1611 lines
2.2 MiB
Plaintext
1611 lines
2.2 MiB
Plaintext
var nZ=Object.defineProperty;var sZ=(t,e,r)=>e in t?nZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var iZ=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var cu=(t,e,r)=>sZ(t,typeof e!="symbol"?e+"":e,r);var h5e=iZ((zIe,Jg)=>{function eB(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var uc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ml(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function z_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return t[n]}})}),r}var lS={exports:{}},$p={};/**
|
||
* @license React
|
||
* react-jsx-runtime.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var iM;function aZ(){if(iM)return $p;iM=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,s,i){var a=null;if(i!==void 0&&(a=""+i),s.key!==void 0&&(a=""+s.key),"key"in s){i={};for(var l in s)l!=="key"&&(i[l]=s[l])}else i=s;return s=i.ref,{$$typeof:t,type:n,key:a,ref:s!==void 0?s:null,props:i}}return $p.Fragment=e,$p.jsx=r,$p.jsxs=r,$p}var aM;function oZ(){return aM||(aM=1,lS.exports=aZ()),lS.exports}var o=oZ(),cS={exports:{}},Nt={};/**
|
||
* @license React
|
||
* react.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var oM;function lZ(){if(oM)return Nt;oM=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.iterator;function m(O){return O===null||typeof O!="object"?null:(O=p&&O[p]||O["@@iterator"],typeof O=="function"?O:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function w(O,H,G){this.props=O,this.context=H,this.refs=x,this.updater=G||g}w.prototype.isReactComponent={},w.prototype.setState=function(O,H){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,H,"setState")},w.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function _(){}_.prototype=w.prototype;function S(O,H,G){this.props=O,this.context=H,this.refs=x,this.updater=G||g}var k=S.prototype=new _;k.constructor=S,y(k,w.prototype),k.isPureReactComponent=!0;var N=Array.isArray,j={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function D(O,H,G,q,J,te){return G=te.ref,{$$typeof:t,type:O,key:H,ref:G!==void 0?G:null,props:te}}function I(O,H){return D(O.type,H,void 0,void 0,void 0,O.props)}function L(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function $(O){var H={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(G){return H[G]})}var Q=/\/+/g;function M(O,H){return typeof O=="object"&&O!==null&&O.key!=null?$(""+O.key):H.toString(36)}function z(){}function R(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(z,z):(O.status="pending",O.then(function(H){O.status==="pending"&&(O.status="fulfilled",O.value=H)},function(H){O.status==="pending"&&(O.status="rejected",O.reason=H)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function B(O,H,G,q,J){var te=typeof O;(te==="undefined"||te==="boolean")&&(O=null);var ve=!1;if(O===null)ve=!0;else switch(te){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(O.$$typeof){case t:case e:ve=!0;break;case f:return ve=O._init,B(ve(O._payload),H,G,q,J)}}if(ve)return J=J(O),ve=q===""?"."+M(O,0):q,N(J)?(G="",ve!=null&&(G=ve.replace(Q,"$&/")+"/"),B(J,H,G,"",function(ke){return ke})):J!=null&&(L(J)&&(J=I(J,G+(J.key==null||O&&O.key===J.key?"":(""+J.key).replace(Q,"$&/")+"/")+ve)),H.push(J)),1;ve=0;var he=q===""?".":q+":";if(N(O))for(var xe=0;xe<O.length;xe++)q=O[xe],te=he+M(q,xe),ve+=B(q,H,G,te,J);else if(xe=m(O),typeof xe=="function")for(O=xe.call(O),xe=0;!(q=O.next()).done;)q=q.value,te=he+M(q,xe++),ve+=B(q,H,G,te,J);else if(te==="object"){if(typeof O.then=="function")return B(R(O),H,G,q,J);throw H=String(O),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return ve}function V(O,H,G){if(O==null)return O;var q=[],J=0;return B(O,q,"","",function(te){return H.call(G,te,J++)}),q}function F(O){if(O._status===-1){var H=O._result;H=H(),H.then(function(G){(O._status===0||O._status===-1)&&(O._status=1,O._result=G)},function(G){(O._status===0||O._status===-1)&&(O._status=2,O._result=G)}),O._status===-1&&(O._status=0,O._result=H)}if(O._status===1)return O._result.default;throw O._result}var K=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)};function Y(){}return Nt.Children={map:V,forEach:function(O,H,G){V(O,function(){H.apply(this,arguments)},G)},count:function(O){var H=0;return V(O,function(){H++}),H},toArray:function(O){return V(O,function(H){return H})||[]},only:function(O){if(!L(O))throw Error("React.Children.only expected to receive a single React element child.");return O}},Nt.Component=w,Nt.Fragment=r,Nt.Profiler=s,Nt.PureComponent=S,Nt.StrictMode=n,Nt.Suspense=c,Nt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Nt.act=function(){throw Error("act(...) is not supported in production builds of React.")},Nt.cache=function(O){return function(){return O.apply(null,arguments)}},Nt.cloneElement=function(O,H,G){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var q=y({},O.props),J=O.key,te=void 0;if(H!=null)for(ve in H.ref!==void 0&&(te=void 0),H.key!==void 0&&(J=""+H.key),H)!T.call(H,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&H.ref===void 0||(q[ve]=H[ve]);var ve=arguments.length-2;if(ve===1)q.children=G;else if(1<ve){for(var he=Array(ve),xe=0;xe<ve;xe++)he[xe]=arguments[xe+2];q.children=he}return D(O.type,J,void 0,void 0,te,q)},Nt.createContext=function(O){return O={$$typeof:a,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:i,_context:O},O},Nt.createElement=function(O,H,G){var q,J={},te=null;if(H!=null)for(q in H.key!==void 0&&(te=""+H.key),H)T.call(H,q)&&q!=="key"&&q!=="__self"&&q!=="__source"&&(J[q]=H[q]);var ve=arguments.length-2;if(ve===1)J.children=G;else if(1<ve){for(var he=Array(ve),xe=0;xe<ve;xe++)he[xe]=arguments[xe+2];J.children=he}if(O&&O.defaultProps)for(q in ve=O.defaultProps,ve)J[q]===void 0&&(J[q]=ve[q]);return D(O,te,void 0,void 0,null,J)},Nt.createRef=function(){return{current:null}},Nt.forwardRef=function(O){return{$$typeof:l,render:O}},Nt.isValidElement=L,Nt.lazy=function(O){return{$$typeof:f,_payload:{_status:-1,_result:O},_init:F}},Nt.memo=function(O,H){return{$$typeof:d,type:O,compare:H===void 0?null:H}},Nt.startTransition=function(O){var H=j.T,G={};j.T=G;try{var q=O(),J=j.S;J!==null&&J(G,q),typeof q=="object"&&q!==null&&typeof q.then=="function"&&q.then(Y,K)}catch(te){K(te)}finally{j.T=H}},Nt.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Nt.use=function(O){return j.H.use(O)},Nt.useActionState=function(O,H,G){return j.H.useActionState(O,H,G)},Nt.useCallback=function(O,H){return j.H.useCallback(O,H)},Nt.useContext=function(O){return j.H.useContext(O)},Nt.useDebugValue=function(){},Nt.useDeferredValue=function(O,H){return j.H.useDeferredValue(O,H)},Nt.useEffect=function(O,H){return j.H.useEffect(O,H)},Nt.useId=function(){return j.H.useId()},Nt.useImperativeHandle=function(O,H,G){return j.H.useImperativeHandle(O,H,G)},Nt.useInsertionEffect=function(O,H){return j.H.useInsertionEffect(O,H)},Nt.useLayoutEffect=function(O,H){return j.H.useLayoutEffect(O,H)},Nt.useMemo=function(O,H){return j.H.useMemo(O,H)},Nt.useOptimistic=function(O,H){return j.H.useOptimistic(O,H)},Nt.useReducer=function(O,H,G){return j.H.useReducer(O,H,G)},Nt.useRef=function(O){return j.H.useRef(O)},Nt.useState=function(O){return j.H.useState(O)},Nt.useSyncExternalStore=function(O,H,G){return j.H.useSyncExternalStore(O,H,G)},Nt.useTransition=function(){return j.H.useTransition()},Nt.version="19.0.0",Nt}var lM;function ff(){return lM||(lM=1,cS.exports=lZ()),cS.exports}var E=ff();const Ss=ml(E),cZ=eB({__proto__:null,default:Ss},[E]);var uS={exports:{}},Bp={},dS={exports:{}},hS={};/**
|
||
* @license React
|
||
* scheduler.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var cM;function uZ(){return cM||(cM=1,function(t){function e(V,F){var K=V.length;V.push(F);e:for(;0<K;){var Y=K-1>>>1,O=V[Y];if(0<s(O,F))V[Y]=F,V[K]=O,K=Y;else break e}}function r(V){return V.length===0?null:V[0]}function n(V){if(V.length===0)return null;var F=V[0],K=V.pop();if(K!==F){V[0]=K;e:for(var Y=0,O=V.length,H=O>>>1;Y<H;){var G=2*(Y+1)-1,q=V[G],J=G+1,te=V[J];if(0>s(q,K))J<O&&0>s(te,q)?(V[Y]=te,V[J]=K,Y=J):(V[Y]=q,V[G]=K,Y=G);else if(J<O&&0>s(te,K))V[Y]=te,V[J]=K,Y=J;else break e}}return F}function s(V,F){var K=V.sortIndex-F.sortIndex;return K!==0?K:V.id-F.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],d=[],f=1,p=null,m=3,g=!1,y=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function k(V){for(var F=r(d);F!==null;){if(F.callback===null)n(d);else if(F.startTime<=V)n(d),F.sortIndex=F.expirationTime,e(c,F);else break;F=r(d)}}function N(V){if(x=!1,k(V),!y)if(r(c)!==null)y=!0,R();else{var F=r(d);F!==null&&B(N,F.startTime-V)}}var j=!1,T=-1,D=5,I=-1;function L(){return!(t.unstable_now()-I<D)}function $(){if(j){var V=t.unstable_now();I=V;var F=!0;try{e:{y=!1,x&&(x=!1,_(T),T=-1),g=!0;var K=m;try{t:{for(k(V),p=r(c);p!==null&&!(p.expirationTime>V&&L());){var Y=p.callback;if(typeof Y=="function"){p.callback=null,m=p.priorityLevel;var O=Y(p.expirationTime<=V);if(V=t.unstable_now(),typeof O=="function"){p.callback=O,k(V),F=!0;break t}p===r(c)&&n(c),k(V)}else n(c);p=r(c)}if(p!==null)F=!0;else{var H=r(d);H!==null&&B(N,H.startTime-V),F=!1}}break e}finally{p=null,m=K,g=!1}F=void 0}}finally{F?Q():j=!1}}}var Q;if(typeof S=="function")Q=function(){S($)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,z=M.port2;M.port1.onmessage=$,Q=function(){z.postMessage(null)}}else Q=function(){w($,0)};function R(){j||(j=!0,Q())}function B(V,F){T=w(function(){V(t.unstable_now())},F)}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(V){V.callback=null},t.unstable_continueExecution=function(){y||g||(y=!0,R())},t.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<V?Math.floor(1e3/V):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(V){switch(m){case 1:case 2:case 3:var F=3;break;default:F=m}var K=m;m=F;try{return V()}finally{m=K}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(V,F){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var K=m;m=V;try{return F()}finally{m=K}},t.unstable_scheduleCallback=function(V,F,K){var Y=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Y+K:Y):K=Y,V){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=K+O,V={id:f++,callback:F,priorityLevel:V,startTime:K,expirationTime:O,sortIndex:-1},K>Y?(V.sortIndex=K,e(d,V),r(c)===null&&V===r(d)&&(x?(_(T),T=-1):x=!0,B(N,K-Y))):(V.sortIndex=O,e(c,V),y||g||(y=!0,R())),V},t.unstable_shouldYield=L,t.unstable_wrapCallback=function(V){var F=m;return function(){var K=m;m=F;try{return V.apply(this,arguments)}finally{m=K}}}}(hS)),hS}var uM;function dZ(){return uM||(uM=1,dS.exports=uZ()),dS.exports}var fS={exports:{}},vs={};/**
|
||
* @license React
|
||
* react-dom.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var dM;function hZ(){if(dM)return vs;dM=1;var t=ff();function e(c){var d="https://react.dev/errors/"+c;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)d+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+c+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(e(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function i(c,d,f){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:c,containerInfo:d,implementation:f}}var a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,d){if(c==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return vs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,vs.createPortal=function(c,d){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return i(c,d,null,f)},vs.flushSync=function(c){var d=a.T,f=n.p;try{if(a.T=null,n.p=2,c)return c()}finally{a.T=d,n.p=f,n.d.f()}},vs.preconnect=function(c,d){typeof c=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(c,d))},vs.prefetchDNS=function(c){typeof c=="string"&&n.d.D(c)},vs.preinit=function(c,d){if(typeof c=="string"&&d&&typeof d.as=="string"){var f=d.as,p=l(f,d.crossOrigin),m=typeof d.integrity=="string"?d.integrity:void 0,g=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;f==="style"?n.d.S(c,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:m,fetchPriority:g}):f==="script"&&n.d.X(c,{crossOrigin:p,integrity:m,fetchPriority:g,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},vs.preinitModule=function(c,d){if(typeof c=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var f=l(d.as,d.crossOrigin);n.d.M(c,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(c)},vs.preload=function(c,d){if(typeof c=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var f=d.as,p=l(f,d.crossOrigin);n.d.L(c,f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},vs.preloadModule=function(c,d){if(typeof c=="string")if(d){var f=l(d.as,d.crossOrigin);n.d.m(c,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(c)},vs.requestFormReset=function(c){n.d.r(c)},vs.unstable_batchedUpdates=function(c,d){return c(d)},vs.useFormState=function(c,d,f){return a.H.useFormState(c,d,f)},vs.useFormStatus=function(){return a.H.useHostTransitionStatus()},vs.version="19.0.0",vs}var hM;function tB(){if(hM)return fS.exports;hM=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),fS.exports=hZ(),fS.exports}/**
|
||
* @license React
|
||
* react-dom-client.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var fM;function fZ(){if(fM)return Bp;fM=1;var t=dZ(),e=ff(),r=tB();function n(u){var h="https://react.dev/errors/"+u;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+u+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}var i=Symbol.for("react.element"),a=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),m=Symbol.for("react.consumer"),g=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),N=Symbol.for("react.memo_cache_sentinel"),j=Symbol.iterator;function T(u){return u===null||typeof u!="object"?null:(u=j&&u[j]||u["@@iterator"],typeof u=="function"?u:null)}var D=Symbol.for("react.client.reference");function I(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===D?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case c:return"Fragment";case l:return"Portal";case f:return"Profiler";case d:return"StrictMode";case x:return"Suspense";case w:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case g:return(u.displayName||"Context")+".Provider";case m:return(u._context.displayName||"Context")+".Consumer";case y:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case _:return h=u.displayName||null,h!==null?h:I(u.type)||"Memo";case S:h=u._payload,u=u._init;try{return I(u(h))}catch{}}return null}var L=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.assign,Q,M;function z(u){if(Q===void 0)try{throw Error()}catch(v){var h=v.stack.trim().match(/\n( *(at )?)/);Q=h&&h[1]||"",M=-1<v.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<v.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Q+u+M}var R=!1;function B(u,h){if(!u||R)return"";R=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(h){var Fe=function(){throw Error()};if(Object.defineProperty(Fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Fe,[])}catch(Ee){var _e=Ee}Reflect.construct(u,[],Fe)}else{try{Fe.call()}catch(Ee){_e=Ee}u.call(Fe.prototype)}}else{try{throw Error()}catch(Ee){_e=Ee}(Fe=u())&&typeof Fe.catch=="function"&&Fe.catch(function(){})}}catch(Ee){if(Ee&&_e&&typeof Ee.stack=="string")return[Ee.stack,_e.stack]}return[null,null]}};b.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(b.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(b.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var A=b.DetermineComponentFrameRoot(),U=A[0],ee=A[1];if(U&&ee){var se=U.split(`
|
||
`),de=ee.split(`
|
||
`);for(C=b=0;b<se.length&&!se[b].includes("DetermineComponentFrameRoot");)b++;for(;C<de.length&&!de[C].includes("DetermineComponentFrameRoot");)C++;if(b===se.length||C===de.length)for(b=se.length-1,C=de.length-1;1<=b&&0<=C&&se[b]!==de[C];)C--;for(;1<=b&&0<=C;b--,C--)if(se[b]!==de[C]){if(b!==1||C!==1)do if(b--,C--,0>C||se[b]!==de[C]){var Te=`
|
||
`+se[b].replace(" at new "," at ");return u.displayName&&Te.includes("<anonymous>")&&(Te=Te.replace("<anonymous>",u.displayName)),Te}while(1<=b&&0<=C);break}}}finally{R=!1,Error.prepareStackTrace=v}return(v=u?u.displayName||u.name:"")?z(v):""}function V(u){switch(u.tag){case 26:case 27:case 5:return z(u.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 15:return u=B(u.type,!1),u;case 11:return u=B(u.type.render,!1),u;case 1:return u=B(u.type,!0),u;default:return""}}function F(u){try{var h="";do h+=V(u),u=u.return;while(u);return h}catch(v){return`
|
||
Error generating stack: `+v.message+`
|
||
`+v.stack}}function K(u){var h=u,v=u;if(u.alternate)for(;h.return;)h=h.return;else{u=h;do h=u,(h.flags&4098)!==0&&(v=h.return),u=h.return;while(u)}return h.tag===3?v:null}function Y(u){if(u.tag===13){var h=u.memoizedState;if(h===null&&(u=u.alternate,u!==null&&(h=u.memoizedState)),h!==null)return h.dehydrated}return null}function O(u){if(K(u)!==u)throw Error(n(188))}function H(u){var h=u.alternate;if(!h){if(h=K(u),h===null)throw Error(n(188));return h!==u?null:u}for(var v=u,b=h;;){var C=v.return;if(C===null)break;var A=C.alternate;if(A===null){if(b=C.return,b!==null){v=b;continue}break}if(C.child===A.child){for(A=C.child;A;){if(A===v)return O(C),u;if(A===b)return O(C),h;A=A.sibling}throw Error(n(188))}if(v.return!==b.return)v=C,b=A;else{for(var U=!1,ee=C.child;ee;){if(ee===v){U=!0,v=C,b=A;break}if(ee===b){U=!0,b=C,v=A;break}ee=ee.sibling}if(!U){for(ee=A.child;ee;){if(ee===v){U=!0,v=A,b=C;break}if(ee===b){U=!0,b=A,v=C;break}ee=ee.sibling}if(!U)throw Error(n(189))}}if(v.alternate!==b)throw Error(n(190))}if(v.tag!==3)throw Error(n(188));return v.stateNode.current===v?u:h}function G(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u;for(u=u.child;u!==null;){if(h=G(u),h!==null)return h;u=u.sibling}return null}var q=Array.isArray,J=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ve=[],he=-1;function xe(u){return{current:u}}function ke(u){0>he||(u.current=ve[he],ve[he]=null,he--)}function Oe(u,h){he++,ve[he]=u.current,u.current=h}var He=xe(null),Ye=xe(null),lt=xe(null),P=xe(null);function ne(u,h){switch(Oe(lt,h),Oe(Ye,u),Oe(He,null),u=h.nodeType,u){case 9:case 11:h=(h=h.documentElement)&&(h=h.namespaceURI)?PP(h):0;break;default:if(u=u===8?h.parentNode:h,h=u.tagName,u=u.namespaceURI)u=PP(u),h=MP(u,h);else switch(h){case"svg":h=1;break;case"math":h=2;break;default:h=0}}ke(He),Oe(He,h)}function X(){ke(He),ke(Ye),ke(lt)}function W(u){u.memoizedState!==null&&Oe(P,u);var h=He.current,v=MP(h,u.type);h!==v&&(Oe(Ye,u),Oe(He,v))}function Z(u){Ye.current===u&&(ke(He),ke(Ye)),P.current===u&&(ke(P),Op._currentValue=te)}var re=Object.prototype.hasOwnProperty,ae=t.unstable_scheduleCallback,fe=t.unstable_cancelCallback,oe=t.unstable_shouldYield,Ae=t.unstable_requestPaint,Ne=t.unstable_now,Le=t.unstable_getCurrentPriorityLevel,pe=t.unstable_ImmediatePriority,De=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,mt=t.unstable_LowPriority,Ot=t.unstable_IdlePriority,wr=t.log,Xn=t.unstable_setDisableYieldValue,Tt=null,Sr=null;function si(u){if(Sr&&typeof Sr.onCommitFiberRoot=="function")try{Sr.onCommitFiberRoot(Tt,u,void 0,(u.current.flags&128)===128)}catch{}}function qt(u){if(typeof wr=="function"&&Xn(u),Sr&&typeof Sr.setStrictMode=="function")try{Sr.setStrictMode(Tt,u)}catch{}}var jr=Math.clz32?Math.clz32:Vf,As=Math.log,Uf=Math.LN2;function Vf(u){return u>>>=0,u===0?32:31-(As(u)/Uf|0)|0}var Eo=128,bi=4194304;function Ws(u){var h=u&42;if(h!==0)return h;switch(u&-u){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:return 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 u&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function md(u,h){var v=u.pendingLanes;if(v===0)return 0;var b=0,C=u.suspendedLanes,A=u.pingedLanes,U=u.warmLanes;u=u.finishedLanes!==0;var ee=v&134217727;return ee!==0?(v=ee&~C,v!==0?b=Ws(v):(A&=ee,A!==0?b=Ws(A):u||(U=ee&~U,U!==0&&(b=Ws(U))))):(ee=v&~C,ee!==0?b=Ws(ee):A!==0?b=Ws(A):u||(U=v&~U,U!==0&&(b=Ws(U)))),b===0?0:h!==0&&h!==b&&(h&C)===0&&(C=b&-b,U=h&-h,C>=U||C===32&&(U&4194176)!==0)?h:b}function zc(u,h){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&h)===0}function tw(u,h){switch(u){case 1:case 2:case 4:case 8:return h+250;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 h+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ov(){var u=Eo;return Eo<<=1,(Eo&4194176)===0&&(Eo=128),u}function Pv(){var u=bi;return bi<<=1,(bi&62914560)===0&&(bi=4194304),u}function Hf(u){for(var h=[],v=0;31>v;v++)h.push(u);return h}function Uc(u,h){u.pendingLanes|=h,h!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function rw(u,h,v,b,C,A){var U=u.pendingLanes;u.pendingLanes=v,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=v,u.entangledLanes&=v,u.errorRecoveryDisabledLanes&=v,u.shellSuspendCounter=0;var ee=u.entanglements,se=u.expirationTimes,de=u.hiddenUpdates;for(v=U&~v;0<v;){var Te=31-jr(v),Fe=1<<Te;ee[Te]=0,se[Te]=-1;var _e=de[Te];if(_e!==null)for(de[Te]=null,Te=0;Te<_e.length;Te++){var Ee=_e[Te];Ee!==null&&(Ee.lane&=-536870913)}v&=~Fe}b!==0&&Mv(u,b,0),A!==0&&C===0&&u.tag!==0&&(u.suspendedLanes|=A&~(U&~h))}function Mv(u,h,v){u.pendingLanes|=h,u.suspendedLanes&=~h;var b=31-jr(h);u.entangledLanes|=h,u.entanglements[b]=u.entanglements[b]|1073741824|v&4194218}function Iv(u,h){var v=u.entangledLanes|=h;for(u=u.entanglements;v;){var b=31-jr(v),C=1<<b;C&h|u[b]&h&&(u[b]|=h),v&=~C}}function Lv(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function $v(){var u=J.p;return u!==0?u:(u=window.event,u===void 0?32:JP(u.type))}function nw(u,h){var v=J.p;try{return J.p=u,h()}finally{J.p=v}}var Fa=Math.random().toString(36).slice(2),Mn="__reactFiber$"+Fa,ps="__reactProps$"+Fa,kl="__reactContainer$"+Fa,qf="__reactEvents$"+Fa,sw="__reactListeners$"+Fa,iw="__reactHandles$"+Fa,Bv="__reactResources$"+Fa,Vc="__reactMarker$"+Fa;function Wf(u){delete u[Mn],delete u[ps],delete u[qf],delete u[sw],delete u[iw]}function Co(u){var h=u[Mn];if(h)return h;for(var v=u.parentNode;v;){if(h=v[kl]||v[Mn]){if(v=h.alternate,h.child!==null||v!==null&&v.child!==null)for(u=$P(u);u!==null;){if(v=u[Mn])return v;u=$P(u)}return h}u=v,v=u.parentNode}return null}function je(u){if(u=u[Mn]||u[kl]){var h=u.tag;if(h===5||h===6||h===13||h===26||h===27||h===3)return u}return null}function be(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u.stateNode;throw Error(n(33))}function Ue(u){var h=u[Bv];return h||(h=u[Bv]={hoistableStyles:new Map,hoistableScripts:new Map}),h}function Qe(u){u[Vc]=!0}var sr=new Set,dn={};function ms(u,h){gd(u,h),gd(u+"Capture",h)}function gd(u,h){for(dn[u]=h,u=0;u<h.length;u++)sr.add(h[u])}var No=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),QY=RegExp("^[: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]*$"),MR={},IR={};function XY(u){return re.call(IR,u)?!0:re.call(MR,u)?!1:QY.test(u)?IR[u]=!0:(MR[u]=!0,!1)}function Fv(u,h,v){if(XY(h))if(v===null)u.removeAttribute(h);else{switch(typeof v){case"undefined":case"function":case"symbol":u.removeAttribute(h);return;case"boolean":var b=h.toLowerCase().slice(0,5);if(b!=="data-"&&b!=="aria-"){u.removeAttribute(h);return}}u.setAttribute(h,""+v)}}function zv(u,h,v){if(v===null)u.removeAttribute(h);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(h);return}u.setAttribute(h,""+v)}}function jo(u,h,v,b){if(b===null)u.removeAttribute(v);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(v);return}u.setAttributeNS(h,v,""+b)}}function wi(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function LR(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function ZY(u){var h=LR(u)?"checked":"value",v=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),b=""+u[h];if(!u.hasOwnProperty(h)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var C=v.get,A=v.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return C.call(this)},set:function(U){b=""+U,A.call(this,U)}}),Object.defineProperty(u,h,{enumerable:v.enumerable}),{getValue:function(){return b},setValue:function(U){b=""+U},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Uv(u){u._valueTracker||(u._valueTracker=ZY(u))}function $R(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var v=h.getValue(),b="";return u&&(b=LR(u)?u.checked?"true":"false":u.value),u=b,u!==v?(h.setValue(u),!0):!1}function Vv(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var JY=/[\n"\\]/g;function Si(u){return u.replace(JY,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function aw(u,h,v,b,C,A,U,ee){u.name="",U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"?u.type=U:u.removeAttribute("type"),h!=null?U==="number"?(h===0&&u.value===""||u.value!=h)&&(u.value=""+wi(h)):u.value!==""+wi(h)&&(u.value=""+wi(h)):U!=="submit"&&U!=="reset"||u.removeAttribute("value"),h!=null?ow(u,U,wi(h)):v!=null?ow(u,U,wi(v)):b!=null&&u.removeAttribute("value"),C==null&&A!=null&&(u.defaultChecked=!!A),C!=null&&(u.checked=C&&typeof C!="function"&&typeof C!="symbol"),ee!=null&&typeof ee!="function"&&typeof ee!="symbol"&&typeof ee!="boolean"?u.name=""+wi(ee):u.removeAttribute("name")}function BR(u,h,v,b,C,A,U,ee){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(u.type=A),h!=null||v!=null){if(!(A!=="submit"&&A!=="reset"||h!=null))return;v=v!=null?""+wi(v):"",h=h!=null?""+wi(h):v,ee||h===u.value||(u.value=h),u.defaultValue=h}b=b??C,b=typeof b!="function"&&typeof b!="symbol"&&!!b,u.checked=ee?u.checked:!!b,u.defaultChecked=!!b,U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"&&(u.name=U)}function ow(u,h,v){h==="number"&&Vv(u.ownerDocument)===u||u.defaultValue===""+v||(u.defaultValue=""+v)}function vd(u,h,v,b){if(u=u.options,h){h={};for(var C=0;C<v.length;C++)h["$"+v[C]]=!0;for(v=0;v<u.length;v++)C=h.hasOwnProperty("$"+u[v].value),u[v].selected!==C&&(u[v].selected=C),C&&b&&(u[v].defaultSelected=!0)}else{for(v=""+wi(v),h=null,C=0;C<u.length;C++){if(u[C].value===v){u[C].selected=!0,b&&(u[C].defaultSelected=!0);return}h!==null||u[C].disabled||(h=u[C])}h!==null&&(h.selected=!0)}}function FR(u,h,v){if(h!=null&&(h=""+wi(h),h!==u.value&&(u.value=h),v==null)){u.defaultValue!==h&&(u.defaultValue=h);return}u.defaultValue=v!=null?""+wi(v):""}function zR(u,h,v,b){if(h==null){if(b!=null){if(v!=null)throw Error(n(92));if(q(b)){if(1<b.length)throw Error(n(93));b=b[0]}v=b}v==null&&(v=""),h=v}v=wi(h),u.defaultValue=v,b=u.textContent,b===v&&b!==""&&b!==null&&(u.value=b)}function yd(u,h){if(h){var v=u.firstChild;if(v&&v===u.lastChild&&v.nodeType===3){v.nodeValue=h;return}}u.textContent=h}var eQ=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function UR(u,h,v){var b=h.indexOf("--")===0;v==null||typeof v=="boolean"||v===""?b?u.setProperty(h,""):h==="float"?u.cssFloat="":u[h]="":b?u.setProperty(h,v):typeof v!="number"||v===0||eQ.has(h)?h==="float"?u.cssFloat=v:u[h]=(""+v).trim():u[h]=v+"px"}function VR(u,h,v){if(h!=null&&typeof h!="object")throw Error(n(62));if(u=u.style,v!=null){for(var b in v)!v.hasOwnProperty(b)||h!=null&&h.hasOwnProperty(b)||(b.indexOf("--")===0?u.setProperty(b,""):b==="float"?u.cssFloat="":u[b]="");for(var C in h)b=h[C],h.hasOwnProperty(C)&&v[C]!==b&&UR(u,C,b)}else for(var A in h)h.hasOwnProperty(A)&&UR(u,A,h[A])}function lw(u){if(u.indexOf("-")===-1)return!1;switch(u){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 tQ=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),rQ=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Hv(u){return rQ.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}var cw=null;function uw(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var xd=null,_d=null;function HR(u){var h=je(u);if(h&&(u=h.stateNode)){var v=u[ps]||null;e:switch(u=h.stateNode,h.type){case"input":if(aw(u,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name),h=v.name,v.type==="radio"&&h!=null){for(v=u;v.parentNode;)v=v.parentNode;for(v=v.querySelectorAll('input[name="'+Si(""+h)+'"][type="radio"]'),h=0;h<v.length;h++){var b=v[h];if(b!==u&&b.form===u.form){var C=b[ps]||null;if(!C)throw Error(n(90));aw(b,C.value,C.defaultValue,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name)}}for(h=0;h<v.length;h++)b=v[h],b.form===u.form&&$R(b)}break e;case"textarea":FR(u,v.value,v.defaultValue);break e;case"select":h=v.value,h!=null&&vd(u,!!v.multiple,h,!1)}}}var dw=!1;function qR(u,h,v){if(dw)return u(h,v);dw=!0;try{var b=u(h);return b}finally{if(dw=!1,(xd!==null||_d!==null)&&(Ny(),xd&&(h=xd,u=_d,_d=xd=null,HR(h),u)))for(h=0;h<u.length;h++)HR(u[h])}}function Gf(u,h){var v=u.stateNode;if(v===null)return null;var b=v[ps]||null;if(b===null)return null;v=b[h];e:switch(h){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(u=u.type,b=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!b;break e;default:u=!1}if(u)return null;if(v&&typeof v!="function")throw Error(n(231,h,typeof v));return v}var hw=!1;if(No)try{var Kf={};Object.defineProperty(Kf,"passive",{get:function(){hw=!0}}),window.addEventListener("test",Kf,Kf),window.removeEventListener("test",Kf,Kf)}catch{hw=!1}var El=null,fw=null,qv=null;function WR(){if(qv)return qv;var u,h=fw,v=h.length,b,C="value"in El?El.value:El.textContent,A=C.length;for(u=0;u<v&&h[u]===C[u];u++);var U=v-u;for(b=1;b<=U&&h[v-b]===C[A-b];b++);return qv=C.slice(u,1<b?1-b:void 0)}function Wv(u){var h=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&h===13&&(u=13)):u=h,u===10&&(u=13),32<=u||u===13?u:0}function Gv(){return!0}function GR(){return!1}function Gs(u){function h(v,b,C,A,U){this._reactName=v,this._targetInst=C,this.type=b,this.nativeEvent=A,this.target=U,this.currentTarget=null;for(var ee in u)u.hasOwnProperty(ee)&&(v=u[ee],this[ee]=v?v(A):A[ee]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?Gv:GR,this.isPropagationStopped=GR,this}return $(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var v=this.nativeEvent;v&&(v.preventDefault?v.preventDefault():typeof v.returnValue!="unknown"&&(v.returnValue=!1),this.isDefaultPrevented=Gv)},stopPropagation:function(){var v=this.nativeEvent;v&&(v.stopPropagation?v.stopPropagation():typeof v.cancelBubble!="unknown"&&(v.cancelBubble=!0),this.isPropagationStopped=Gv)},persist:function(){},isPersistent:Gv}),h}var Hc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kv=Gs(Hc),Yf=$({},Hc,{view:0,detail:0}),nQ=Gs(Yf),pw,mw,Qf,Yv=$({},Yf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vw,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==Qf&&(Qf&&u.type==="mousemove"?(pw=u.screenX-Qf.screenX,mw=u.screenY-Qf.screenY):mw=pw=0,Qf=u),pw)},movementY:function(u){return"movementY"in u?u.movementY:mw}}),KR=Gs(Yv),sQ=$({},Yv,{dataTransfer:0}),iQ=Gs(sQ),aQ=$({},Yf,{relatedTarget:0}),gw=Gs(aQ),oQ=$({},Hc,{animationName:0,elapsedTime:0,pseudoElement:0}),lQ=Gs(oQ),cQ=$({},Hc,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),uQ=Gs(cQ),dQ=$({},Hc,{data:0}),YR=Gs(dQ),hQ={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fQ={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"},pQ={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mQ(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=pQ[u])?!!h[u]:!1}function vw(){return mQ}var gQ=$({},Yf,{key:function(u){if(u.key){var h=hQ[u.key]||u.key;if(h!=="Unidentified")return h}return u.type==="keypress"?(u=Wv(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?fQ[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vw,charCode:function(u){return u.type==="keypress"?Wv(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?Wv(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),vQ=Gs(gQ),yQ=$({},Yv,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),QR=Gs(yQ),xQ=$({},Yf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vw}),_Q=Gs(xQ),bQ=$({},Hc,{propertyName:0,elapsedTime:0,pseudoElement:0}),wQ=Gs(bQ),SQ=$({},Yv,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),kQ=Gs(SQ),EQ=$({},Hc,{newState:0,oldState:0}),CQ=Gs(EQ),NQ=[9,13,27,32],yw=No&&"CompositionEvent"in window,Xf=null;No&&"documentMode"in document&&(Xf=document.documentMode);var jQ=No&&"TextEvent"in window&&!Xf,XR=No&&(!yw||Xf&&8<Xf&&11>=Xf),ZR=" ",JR=!1;function eD(u,h){switch(u){case"keyup":return NQ.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tD(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var bd=!1;function TQ(u,h){switch(u){case"compositionend":return tD(h);case"keypress":return h.which!==32?null:(JR=!0,ZR);case"textInput":return u=h.data,u===ZR&&JR?null:u;default:return null}}function AQ(u,h){if(bd)return u==="compositionend"||!yw&&eD(u,h)?(u=WR(),qv=fw=El=null,bd=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1<h.char.length)return h.char;if(h.which)return String.fromCharCode(h.which)}return null;case"compositionend":return XR&&h.locale!=="ko"?null:h.data;default:return null}}var RQ={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 rD(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!RQ[u.type]:h==="textarea"}function nD(u,h,v,b){xd?_d?_d.push(b):_d=[b]:xd=b,h=Dy(h,"onChange"),0<h.length&&(v=new Kv("onChange","change",null,v,b),u.push({event:v,listeners:h}))}var Zf=null,Jf=null;function DQ(u){TP(u,0)}function Qv(u){var h=be(u);if($R(h))return u}function sD(u,h){if(u==="change")return h}var iD=!1;if(No){var xw;if(No){var _w="oninput"in document;if(!_w){var aD=document.createElement("div");aD.setAttribute("oninput","return;"),_w=typeof aD.oninput=="function"}xw=_w}else xw=!1;iD=xw&&(!document.documentMode||9<document.documentMode)}function oD(){Zf&&(Zf.detachEvent("onpropertychange",lD),Jf=Zf=null)}function lD(u){if(u.propertyName==="value"&&Qv(Jf)){var h=[];nD(h,Jf,u,uw(u)),qR(DQ,h)}}function OQ(u,h,v){u==="focusin"?(oD(),Zf=h,Jf=v,Zf.attachEvent("onpropertychange",lD)):u==="focusout"&&oD()}function PQ(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Qv(Jf)}function MQ(u,h){if(u==="click")return Qv(h)}function IQ(u,h){if(u==="input"||u==="change")return Qv(h)}function LQ(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var ii=typeof Object.is=="function"?Object.is:LQ;function ep(u,h){if(ii(u,h))return!0;if(typeof u!="object"||u===null||typeof h!="object"||h===null)return!1;var v=Object.keys(u),b=Object.keys(h);if(v.length!==b.length)return!1;for(b=0;b<v.length;b++){var C=v[b];if(!re.call(h,C)||!ii(u[C],h[C]))return!1}return!0}function cD(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function uD(u,h){var v=cD(u);u=0;for(var b;v;){if(v.nodeType===3){if(b=u+v.textContent.length,u<=h&&b>=h)return{node:v,offset:h-u};u=b}e:{for(;v;){if(v.nextSibling){v=v.nextSibling;break e}v=v.parentNode}v=void 0}v=cD(v)}}function dD(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?dD(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function hD(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var h=Vv(u.document);h instanceof u.HTMLIFrameElement;){try{var v=typeof h.contentWindow.location.href=="string"}catch{v=!1}if(v)u=h.contentWindow;else break;h=Vv(u.document)}return h}function bw(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h&&(h==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||h==="textarea"||u.contentEditable==="true")}function $Q(u,h){var v=hD(h);h=u.focusedElem;var b=u.selectionRange;if(v!==h&&h&&h.ownerDocument&&dD(h.ownerDocument.documentElement,h)){if(b!==null&&bw(h)){if(u=b.start,v=b.end,v===void 0&&(v=u),"selectionStart"in h)h.selectionStart=u,h.selectionEnd=Math.min(v,h.value.length);else if(v=(u=h.ownerDocument||document)&&u.defaultView||window,v.getSelection){v=v.getSelection();var C=h.textContent.length,A=Math.min(b.start,C);b=b.end===void 0?A:Math.min(b.end,C),!v.extend&&A>b&&(C=b,b=A,A=C),C=uD(h,A);var U=uD(h,b);C&&U&&(v.rangeCount!==1||v.anchorNode!==C.node||v.anchorOffset!==C.offset||v.focusNode!==U.node||v.focusOffset!==U.offset)&&(u=u.createRange(),u.setStart(C.node,C.offset),v.removeAllRanges(),A>b?(v.addRange(u),v.extend(U.node,U.offset)):(u.setEnd(U.node,U.offset),v.addRange(u)))}}for(u=[],v=h;v=v.parentNode;)v.nodeType===1&&u.push({element:v,left:v.scrollLeft,top:v.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<u.length;h++)v=u[h],v.element.scrollLeft=v.left,v.element.scrollTop=v.top}}var BQ=No&&"documentMode"in document&&11>=document.documentMode,wd=null,ww=null,tp=null,Sw=!1;function fD(u,h,v){var b=v.window===v?v.document:v.nodeType===9?v:v.ownerDocument;Sw||wd==null||wd!==Vv(b)||(b=wd,"selectionStart"in b&&bw(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),tp&&ep(tp,b)||(tp=b,b=Dy(ww,"onSelect"),0<b.length&&(h=new Kv("onSelect","select",null,h,v),u.push({event:h,listeners:b}),h.target=wd)))}function qc(u,h){var v={};return v[u.toLowerCase()]=h.toLowerCase(),v["Webkit"+u]="webkit"+h,v["Moz"+u]="moz"+h,v}var Sd={animationend:qc("Animation","AnimationEnd"),animationiteration:qc("Animation","AnimationIteration"),animationstart:qc("Animation","AnimationStart"),transitionrun:qc("Transition","TransitionRun"),transitionstart:qc("Transition","TransitionStart"),transitioncancel:qc("Transition","TransitionCancel"),transitionend:qc("Transition","TransitionEnd")},kw={},pD={};No&&(pD=document.createElement("div").style,"AnimationEvent"in window||(delete Sd.animationend.animation,delete Sd.animationiteration.animation,delete Sd.animationstart.animation),"TransitionEvent"in window||delete Sd.transitionend.transition);function Wc(u){if(kw[u])return kw[u];if(!Sd[u])return u;var h=Sd[u],v;for(v in h)if(h.hasOwnProperty(v)&&v in pD)return kw[u]=h[v];return u}var mD=Wc("animationend"),gD=Wc("animationiteration"),vD=Wc("animationstart"),FQ=Wc("transitionrun"),zQ=Wc("transitionstart"),UQ=Wc("transitioncancel"),yD=Wc("transitionend"),xD=new Map,_D="abort auxClick beforeToggle 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 scrollEnd toggle touchMove waiting wheel".split(" ");function Xi(u,h){xD.set(u,h),ms(h,[u])}var ki=[],kd=0,Ew=0;function Xv(){for(var u=kd,h=Ew=kd=0;h<u;){var v=ki[h];ki[h++]=null;var b=ki[h];ki[h++]=null;var C=ki[h];ki[h++]=null;var A=ki[h];if(ki[h++]=null,b!==null&&C!==null){var U=b.pending;U===null?C.next=C:(C.next=U.next,U.next=C),b.pending=C}A!==0&&bD(v,C,A)}}function Zv(u,h,v,b){ki[kd++]=u,ki[kd++]=h,ki[kd++]=v,ki[kd++]=b,Ew|=b,u.lanes|=b,u=u.alternate,u!==null&&(u.lanes|=b)}function Cw(u,h,v,b){return Zv(u,h,v,b),Jv(u)}function Cl(u,h){return Zv(u,null,null,h),Jv(u)}function bD(u,h,v){u.lanes|=v;var b=u.alternate;b!==null&&(b.lanes|=v);for(var C=!1,A=u.return;A!==null;)A.childLanes|=v,b=A.alternate,b!==null&&(b.childLanes|=v),A.tag===22&&(u=A.stateNode,u===null||u._visibility&1||(C=!0)),u=A,A=A.return;C&&h!==null&&u.tag===3&&(A=u.stateNode,C=31-jr(v),A=A.hiddenUpdates,u=A[C],u===null?A[C]=[h]:u.push(h),h.lane=v|536870912)}function Jv(u){if(50<Cp)throw Cp=0,D1=null,Error(n(185));for(var h=u.return;h!==null;)u=h,h=u.return;return u.tag===3?u.stateNode:null}var Ed={},wD=new WeakMap;function Ei(u,h){if(typeof u=="object"&&u!==null){var v=wD.get(u);return v!==void 0?v:(h={value:u,source:h,stack:F(h)},wD.set(u,h),h)}return{value:u,source:h,stack:F(h)}}var Cd=[],Nd=0,ey=null,ty=0,Ci=[],Ni=0,Gc=null,To=1,Ao="";function Kc(u,h){Cd[Nd++]=ty,Cd[Nd++]=ey,ey=u,ty=h}function SD(u,h,v){Ci[Ni++]=To,Ci[Ni++]=Ao,Ci[Ni++]=Gc,Gc=u;var b=To;u=Ao;var C=32-jr(b)-1;b&=~(1<<C),v+=1;var A=32-jr(h)+C;if(30<A){var U=C-C%5;A=(b&(1<<U)-1).toString(32),b>>=U,C-=U,To=1<<32-jr(h)+C|v<<C|b,Ao=A+u}else To=1<<A|v<<C|b,Ao=u}function Nw(u){u.return!==null&&(Kc(u,1),SD(u,1,0))}function jw(u){for(;u===ey;)ey=Cd[--Nd],Cd[Nd]=null,ty=Cd[--Nd],Cd[Nd]=null;for(;u===Gc;)Gc=Ci[--Ni],Ci[Ni]=null,Ao=Ci[--Ni],Ci[Ni]=null,To=Ci[--Ni],Ci[Ni]=null}var Rs=null,Zn=null,Zt=!1,Zi=null,za=!1,Tw=Error(n(519));function Yc(u){var h=Error(n(418,""));throw sp(Ei(h,u)),Tw}function kD(u){var h=u.stateNode,v=u.type,b=u.memoizedProps;switch(h[Mn]=u,h[ps]=b,v){case"dialog":Ut("cancel",h),Ut("close",h);break;case"iframe":case"object":case"embed":Ut("load",h);break;case"video":case"audio":for(v=0;v<jp.length;v++)Ut(jp[v],h);break;case"source":Ut("error",h);break;case"img":case"image":case"link":Ut("error",h),Ut("load",h);break;case"details":Ut("toggle",h);break;case"input":Ut("invalid",h),BR(h,b.value,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name,!0),Uv(h);break;case"select":Ut("invalid",h);break;case"textarea":Ut("invalid",h),zR(h,b.value,b.defaultValue,b.children),Uv(h)}v=b.children,typeof v!="string"&&typeof v!="number"&&typeof v!="bigint"||h.textContent===""+v||b.suppressHydrationWarning===!0||OP(h.textContent,v)?(b.popover!=null&&(Ut("beforetoggle",h),Ut("toggle",h)),b.onScroll!=null&&Ut("scroll",h),b.onScrollEnd!=null&&Ut("scrollend",h),b.onClick!=null&&(h.onclick=Oy),h=!0):h=!1,h||Yc(u)}function ED(u){for(Rs=u.return;Rs;)switch(Rs.tag){case 3:case 27:za=!0;return;case 5:case 13:za=!1;return;default:Rs=Rs.return}}function rp(u){if(u!==Rs)return!1;if(!Zt)return ED(u),Zt=!0,!1;var h=!1,v;if((v=u.tag!==3&&u.tag!==27)&&((v=u.tag===5)&&(v=u.type,v=!(v!=="form"&&v!=="button")||Y1(u.type,u.memoizedProps)),v=!v),v&&(h=!0),h&&Zn&&Yc(u),ED(u),u.tag===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(n(317));e:{for(u=u.nextSibling,h=0;u;){if(u.nodeType===8)if(v=u.data,v==="/$"){if(h===0){Zn=ea(u.nextSibling);break e}h--}else v!=="$"&&v!=="$!"&&v!=="$?"||h++;u=u.nextSibling}Zn=null}}else Zn=Rs?ea(u.stateNode.nextSibling):null;return!0}function np(){Zn=Rs=null,Zt=!1}function sp(u){Zi===null?Zi=[u]:Zi.push(u)}var ip=Error(n(460)),CD=Error(n(474)),Aw={then:function(){}};function ND(u){return u=u.status,u==="fulfilled"||u==="rejected"}function ry(){}function jD(u,h,v){switch(v=u[v],v===void 0?u.push(h):v!==h&&(h.then(ry,ry),h=v),h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,u===ip?Error(n(483)):u;default:if(typeof h.status=="string")h.then(ry,ry);else{if(u=kr,u!==null&&100<u.shellSuspendCounter)throw Error(n(482));u=h,u.status="pending",u.then(function(b){if(h.status==="pending"){var C=h;C.status="fulfilled",C.value=b}},function(b){if(h.status==="pending"){var C=h;C.status="rejected",C.reason=b}})}switch(h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,u===ip?Error(n(483)):u}throw ap=h,ip}}var ap=null;function TD(){if(ap===null)throw Error(n(459));var u=ap;return ap=null,u}var jd=null,op=0;function ny(u){var h=op;return op+=1,jd===null&&(jd=[]),jD(jd,u,h)}function lp(u,h){h=h.props.ref,u.ref=h!==void 0?h:null}function sy(u,h){throw h.$$typeof===i?Error(n(525)):(u=Object.prototype.toString.call(h),Error(n(31,u==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":u)))}function AD(u){var h=u._init;return h(u._payload)}function RD(u){function h(ge,ce){if(u){var ye=ge.deletions;ye===null?(ge.deletions=[ce],ge.flags|=16):ye.push(ce)}}function v(ge,ce){if(!u)return null;for(;ce!==null;)h(ge,ce),ce=ce.sibling;return null}function b(ge){for(var ce=new Map;ge!==null;)ge.key!==null?ce.set(ge.key,ge):ce.set(ge.index,ge),ge=ge.sibling;return ce}function C(ge,ce){return ge=$l(ge,ce),ge.index=0,ge.sibling=null,ge}function A(ge,ce,ye){return ge.index=ye,u?(ye=ge.alternate,ye!==null?(ye=ye.index,ye<ce?(ge.flags|=33554434,ce):ye):(ge.flags|=33554434,ce)):(ge.flags|=1048576,ce)}function U(ge){return u&&ge.alternate===null&&(ge.flags|=33554434),ge}function ee(ge,ce,ye,Pe){return ce===null||ce.tag!==6?(ce=k1(ye,ge.mode,Pe),ce.return=ge,ce):(ce=C(ce,ye),ce.return=ge,ce)}function se(ge,ce,ye,Pe){var nt=ye.type;return nt===c?Te(ge,ce,ye.props.children,Pe,ye.key):ce!==null&&(ce.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===S&&AD(nt)===ce.type)?(ce=C(ce,ye.props),lp(ce,ye),ce.return=ge,ce):(ce=wy(ye.type,ye.key,ye.props,null,ge.mode,Pe),lp(ce,ye),ce.return=ge,ce)}function de(ge,ce,ye,Pe){return ce===null||ce.tag!==4||ce.stateNode.containerInfo!==ye.containerInfo||ce.stateNode.implementation!==ye.implementation?(ce=E1(ye,ge.mode,Pe),ce.return=ge,ce):(ce=C(ce,ye.children||[]),ce.return=ge,ce)}function Te(ge,ce,ye,Pe,nt){return ce===null||ce.tag!==7?(ce=iu(ye,ge.mode,Pe,nt),ce.return=ge,ce):(ce=C(ce,ye),ce.return=ge,ce)}function Fe(ge,ce,ye){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return ce=k1(""+ce,ge.mode,ye),ce.return=ge,ce;if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case a:return ye=wy(ce.type,ce.key,ce.props,null,ge.mode,ye),lp(ye,ce),ye.return=ge,ye;case l:return ce=E1(ce,ge.mode,ye),ce.return=ge,ce;case S:var Pe=ce._init;return ce=Pe(ce._payload),Fe(ge,ce,ye)}if(q(ce)||T(ce))return ce=iu(ce,ge.mode,ye,null),ce.return=ge,ce;if(typeof ce.then=="function")return Fe(ge,ny(ce),ye);if(ce.$$typeof===g)return Fe(ge,xy(ge,ce),ye);sy(ge,ce)}return null}function _e(ge,ce,ye,Pe){var nt=ce!==null?ce.key:null;if(typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint")return nt!==null?null:ee(ge,ce,""+ye,Pe);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case a:return ye.key===nt?se(ge,ce,ye,Pe):null;case l:return ye.key===nt?de(ge,ce,ye,Pe):null;case S:return nt=ye._init,ye=nt(ye._payload),_e(ge,ce,ye,Pe)}if(q(ye)||T(ye))return nt!==null?null:Te(ge,ce,ye,Pe,null);if(typeof ye.then=="function")return _e(ge,ce,ny(ye),Pe);if(ye.$$typeof===g)return _e(ge,ce,xy(ge,ye),Pe);sy(ge,ye)}return null}function Ee(ge,ce,ye,Pe,nt){if(typeof Pe=="string"&&Pe!==""||typeof Pe=="number"||typeof Pe=="bigint")return ge=ge.get(ye)||null,ee(ce,ge,""+Pe,nt);if(typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case a:return ge=ge.get(Pe.key===null?ye:Pe.key)||null,se(ce,ge,Pe,nt);case l:return ge=ge.get(Pe.key===null?ye:Pe.key)||null,de(ce,ge,Pe,nt);case S:var Pt=Pe._init;return Pe=Pt(Pe._payload),Ee(ge,ce,ye,Pe,nt)}if(q(Pe)||T(Pe))return ge=ge.get(ye)||null,Te(ce,ge,Pe,nt,null);if(typeof Pe.then=="function")return Ee(ge,ce,ye,ny(Pe),nt);if(Pe.$$typeof===g)return Ee(ge,ce,ye,xy(ce,Pe),nt);sy(ce,Pe)}return null}function ct(ge,ce,ye,Pe){for(var nt=null,Pt=null,ft=ce,yt=ce=0,$n=null;ft!==null&&yt<ye.length;yt++){ft.index>yt?($n=ft,ft=null):$n=ft.sibling;var Jt=_e(ge,ft,ye[yt],Pe);if(Jt===null){ft===null&&(ft=$n);break}u&&ft&&Jt.alternate===null&&h(ge,ft),ce=A(Jt,ce,yt),Pt===null?nt=Jt:Pt.sibling=Jt,Pt=Jt,ft=$n}if(yt===ye.length)return v(ge,ft),Zt&&Kc(ge,yt),nt;if(ft===null){for(;yt<ye.length;yt++)ft=Fe(ge,ye[yt],Pe),ft!==null&&(ce=A(ft,ce,yt),Pt===null?nt=ft:Pt.sibling=ft,Pt=ft);return Zt&&Kc(ge,yt),nt}for(ft=b(ft);yt<ye.length;yt++)$n=Ee(ft,ge,yt,ye[yt],Pe),$n!==null&&(u&&$n.alternate!==null&&ft.delete($n.key===null?yt:$n.key),ce=A($n,ce,yt),Pt===null?nt=$n:Pt.sibling=$n,Pt=$n);return u&&ft.forEach(function(ql){return h(ge,ql)}),Zt&&Kc(ge,yt),nt}function wt(ge,ce,ye,Pe){if(ye==null)throw Error(n(151));for(var nt=null,Pt=null,ft=ce,yt=ce=0,$n=null,Jt=ye.next();ft!==null&&!Jt.done;yt++,Jt=ye.next()){ft.index>yt?($n=ft,ft=null):$n=ft.sibling;var ql=_e(ge,ft,Jt.value,Pe);if(ql===null){ft===null&&(ft=$n);break}u&&ft&&ql.alternate===null&&h(ge,ft),ce=A(ql,ce,yt),Pt===null?nt=ql:Pt.sibling=ql,Pt=ql,ft=$n}if(Jt.done)return v(ge,ft),Zt&&Kc(ge,yt),nt;if(ft===null){for(;!Jt.done;yt++,Jt=ye.next())Jt=Fe(ge,Jt.value,Pe),Jt!==null&&(ce=A(Jt,ce,yt),Pt===null?nt=Jt:Pt.sibling=Jt,Pt=Jt);return Zt&&Kc(ge,yt),nt}for(ft=b(ft);!Jt.done;yt++,Jt=ye.next())Jt=Ee(ft,ge,yt,Jt.value,Pe),Jt!==null&&(u&&Jt.alternate!==null&&ft.delete(Jt.key===null?yt:Jt.key),ce=A(Jt,ce,yt),Pt===null?nt=Jt:Pt.sibling=Jt,Pt=Jt);return u&&ft.forEach(function(rZ){return h(ge,rZ)}),Zt&&Kc(ge,yt),nt}function Xr(ge,ce,ye,Pe){if(typeof ye=="object"&&ye!==null&&ye.type===c&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case a:e:{for(var nt=ye.key;ce!==null;){if(ce.key===nt){if(nt=ye.type,nt===c){if(ce.tag===7){v(ge,ce.sibling),Pe=C(ce,ye.props.children),Pe.return=ge,ge=Pe;break e}}else if(ce.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===S&&AD(nt)===ce.type){v(ge,ce.sibling),Pe=C(ce,ye.props),lp(Pe,ye),Pe.return=ge,ge=Pe;break e}v(ge,ce);break}else h(ge,ce);ce=ce.sibling}ye.type===c?(Pe=iu(ye.props.children,ge.mode,Pe,ye.key),Pe.return=ge,ge=Pe):(Pe=wy(ye.type,ye.key,ye.props,null,ge.mode,Pe),lp(Pe,ye),Pe.return=ge,ge=Pe)}return U(ge);case l:e:{for(nt=ye.key;ce!==null;){if(ce.key===nt)if(ce.tag===4&&ce.stateNode.containerInfo===ye.containerInfo&&ce.stateNode.implementation===ye.implementation){v(ge,ce.sibling),Pe=C(ce,ye.children||[]),Pe.return=ge,ge=Pe;break e}else{v(ge,ce);break}else h(ge,ce);ce=ce.sibling}Pe=E1(ye,ge.mode,Pe),Pe.return=ge,ge=Pe}return U(ge);case S:return nt=ye._init,ye=nt(ye._payload),Xr(ge,ce,ye,Pe)}if(q(ye))return ct(ge,ce,ye,Pe);if(T(ye)){if(nt=T(ye),typeof nt!="function")throw Error(n(150));return ye=nt.call(ye),wt(ge,ce,ye,Pe)}if(typeof ye.then=="function")return Xr(ge,ce,ny(ye),Pe);if(ye.$$typeof===g)return Xr(ge,ce,xy(ge,ye),Pe);sy(ge,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint"?(ye=""+ye,ce!==null&&ce.tag===6?(v(ge,ce.sibling),Pe=C(ce,ye),Pe.return=ge,ge=Pe):(v(ge,ce),Pe=k1(ye,ge.mode,Pe),Pe.return=ge,ge=Pe),U(ge)):v(ge,ce)}return function(ge,ce,ye,Pe){try{op=0;var nt=Xr(ge,ce,ye,Pe);return jd=null,nt}catch(ft){if(ft===ip)throw ft;var Pt=Ri(29,ft,null,ge.mode);return Pt.lanes=Pe,Pt.return=ge,Pt}finally{}}}var Qc=RD(!0),DD=RD(!1),Td=xe(null),iy=xe(0);function OD(u,h){u=zo,Oe(iy,u),Oe(Td,h),zo=u|h.baseLanes}function Rw(){Oe(iy,zo),Oe(Td,Td.current)}function Dw(){zo=iy.current,ke(Td),ke(iy)}var ji=xe(null),Ua=null;function Nl(u){var h=u.alternate;Oe(Sn,Sn.current&1),Oe(ji,u),Ua===null&&(h===null||Td.current!==null||h.memoizedState!==null)&&(Ua=u)}function PD(u){if(u.tag===22){if(Oe(Sn,Sn.current),Oe(ji,u),Ua===null){var h=u.alternate;h!==null&&h.memoizedState!==null&&(Ua=u)}}else jl()}function jl(){Oe(Sn,Sn.current),Oe(ji,ji.current)}function Ro(u){ke(ji),Ua===u&&(Ua=null),ke(Sn)}var Sn=xe(0);function ay(u){for(var h=u;h!==null;){if(h.tag===13){var v=h.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||v.data==="$?"||v.data==="$!"))return h}else if(h.tag===19&&h.memoizedProps.revealOrder!==void 0){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}var VQ=typeof AbortController<"u"?AbortController:function(){var u=[],h=this.signal={aborted:!1,addEventListener:function(v,b){u.push(b)}};this.abort=function(){h.aborted=!0,u.forEach(function(v){return v()})}},HQ=t.unstable_scheduleCallback,qQ=t.unstable_NormalPriority,kn={$$typeof:g,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ow(){return{controller:new VQ,data:new Map,refCount:0}}function cp(u){u.refCount--,u.refCount===0&&HQ(qQ,function(){u.controller.abort()})}var up=null,Pw=0,Ad=0,Rd=null;function WQ(u,h){if(up===null){var v=up=[];Pw=0,Ad=F1(),Rd={status:"pending",value:void 0,then:function(b){v.push(b)}}}return Pw++,h.then(MD,MD),h}function MD(){if(--Pw===0&&up!==null){Rd!==null&&(Rd.status="fulfilled");var u=up;up=null,Ad=0,Rd=null;for(var h=0;h<u.length;h++)(0,u[h])()}}function GQ(u,h){var v=[],b={status:"pending",value:null,reason:null,then:function(C){v.push(C)}};return u.then(function(){b.status="fulfilled",b.value=h;for(var C=0;C<v.length;C++)(0,v[C])(h)},function(C){for(b.status="rejected",b.reason=C,C=0;C<v.length;C++)(0,v[C])(void 0)}),b}var ID=L.S;L.S=function(u,h){typeof h=="object"&&h!==null&&typeof h.then=="function"&&WQ(u,h),ID!==null&&ID(u,h)};var Xc=xe(null);function Mw(){var u=Xc.current;return u!==null?u:kr.pooledCache}function oy(u,h){h===null?Oe(Xc,Xc.current):Oe(Xc,h.pool)}function LD(){var u=Mw();return u===null?null:{parent:kn._currentValue,pool:u}}var Tl=0,At=null,ur=null,hn=null,ly=!1,Dd=!1,Zc=!1,cy=0,dp=0,Od=null,KQ=0;function sn(){throw Error(n(321))}function Iw(u,h){if(h===null)return!1;for(var v=0;v<h.length&&v<u.length;v++)if(!ii(u[v],h[v]))return!1;return!0}function Lw(u,h,v,b,C,A){return Tl=A,At=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,L.H=u===null||u.memoizedState===null?Jc:Al,Zc=!1,A=v(b,C),Zc=!1,Dd&&(A=BD(h,v,b,C)),$D(u),A}function $D(u){L.H=Va;var h=ur!==null&&ur.next!==null;if(Tl=0,hn=ur=At=null,ly=!1,dp=0,Od=null,h)throw Error(n(300));u===null||In||(u=u.dependencies,u!==null&&yy(u)&&(In=!0))}function BD(u,h,v,b){At=u;var C=0;do{if(Dd&&(Od=null),dp=0,Dd=!1,25<=C)throw Error(n(301));if(C+=1,hn=ur=null,u.updateQueue!=null){var A=u.updateQueue;A.lastEffect=null,A.events=null,A.stores=null,A.memoCache!=null&&(A.memoCache.index=0)}L.H=eu,A=h(v,b)}while(Dd);return A}function YQ(){var u=L.H,h=u.useState()[0];return h=typeof h.then=="function"?hp(h):h,u=u.useState()[0],(ur!==null?ur.memoizedState:null)!==u&&(At.flags|=1024),h}function $w(){var u=cy!==0;return cy=0,u}function Bw(u,h,v){h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~v}function Fw(u){if(ly){for(u=u.memoizedState;u!==null;){var h=u.queue;h!==null&&(h.pending=null),u=u.next}ly=!1}Tl=0,hn=ur=At=null,Dd=!1,dp=cy=0,Od=null}function Ks(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hn===null?At.memoizedState=hn=u:hn=hn.next=u,hn}function fn(){if(ur===null){var u=At.alternate;u=u!==null?u.memoizedState:null}else u=ur.next;var h=hn===null?At.memoizedState:hn.next;if(h!==null)hn=h,ur=u;else{if(u===null)throw At.alternate===null?Error(n(467)):Error(n(310));ur=u,u={memoizedState:ur.memoizedState,baseState:ur.baseState,baseQueue:ur.baseQueue,queue:ur.queue,next:null},hn===null?At.memoizedState=hn=u:hn=hn.next=u}return hn}var uy;uy=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}};function hp(u){var h=dp;return dp+=1,Od===null&&(Od=[]),u=jD(Od,u,h),h=At,(hn===null?h.memoizedState:hn.next)===null&&(h=h.alternate,L.H=h===null||h.memoizedState===null?Jc:Al),u}function dy(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return hp(u);if(u.$$typeof===g)return gs(u)}throw Error(n(438,String(u)))}function zw(u){var h=null,v=At.updateQueue;if(v!==null&&(h=v.memoCache),h==null){var b=At.alternate;b!==null&&(b=b.updateQueue,b!==null&&(b=b.memoCache,b!=null&&(h={data:b.data.map(function(C){return C.slice()}),index:0})))}if(h==null&&(h={data:[],index:0}),v===null&&(v=uy(),At.updateQueue=v),v.memoCache=h,v=h.data[h.index],v===void 0)for(v=h.data[h.index]=Array(u),b=0;b<u;b++)v[b]=N;return h.index++,v}function Do(u,h){return typeof h=="function"?h(u):h}function hy(u){var h=fn();return Uw(h,ur,u)}function Uw(u,h,v){var b=u.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=v;var C=u.baseQueue,A=b.pending;if(A!==null){if(C!==null){var U=C.next;C.next=A.next,A.next=U}h.baseQueue=C=A,b.pending=null}if(A=u.baseState,C===null)u.memoizedState=A;else{h=C.next;var ee=U=null,se=null,de=h,Te=!1;do{var Fe=de.lane&-536870913;if(Fe!==de.lane?(Wt&Fe)===Fe:(Tl&Fe)===Fe){var _e=de.revertLane;if(_e===0)se!==null&&(se=se.next={lane:0,revertLane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),Fe===Ad&&(Te=!0);else if((Tl&_e)===_e){de=de.next,_e===Ad&&(Te=!0);continue}else Fe={lane:0,revertLane:de.revertLane,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},se===null?(ee=se=Fe,U=A):se=se.next=Fe,At.lanes|=_e,Bl|=_e;Fe=de.action,Zc&&v(A,Fe),A=de.hasEagerState?de.eagerState:v(A,Fe)}else _e={lane:Fe,revertLane:de.revertLane,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},se===null?(ee=se=_e,U=A):se=se.next=_e,At.lanes|=Fe,Bl|=Fe;de=de.next}while(de!==null&&de!==h);if(se===null?U=A:se.next=ee,!ii(A,u.memoizedState)&&(In=!0,Te&&(v=Rd,v!==null)))throw v;u.memoizedState=A,u.baseState=U,u.baseQueue=se,b.lastRenderedState=A}return C===null&&(b.lanes=0),[u.memoizedState,b.dispatch]}function Vw(u){var h=fn(),v=h.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=u;var b=v.dispatch,C=v.pending,A=h.memoizedState;if(C!==null){v.pending=null;var U=C=C.next;do A=u(A,U.action),U=U.next;while(U!==C);ii(A,h.memoizedState)||(In=!0),h.memoizedState=A,h.baseQueue===null&&(h.baseState=A),v.lastRenderedState=A}return[A,b]}function FD(u,h,v){var b=At,C=fn(),A=Zt;if(A){if(v===void 0)throw Error(n(407));v=v()}else v=h();var U=!ii((ur||C).memoizedState,v);if(U&&(C.memoizedState=v,In=!0),C=C.queue,Ww(VD.bind(null,b,C,u),[u]),C.getSnapshot!==h||U||hn!==null&&hn.memoizedState.tag&1){if(b.flags|=2048,Pd(9,UD.bind(null,b,C,v,h),{destroy:void 0},null),kr===null)throw Error(n(349));A||(Tl&60)!==0||zD(b,h,v)}return v}function zD(u,h,v){u.flags|=16384,u={getSnapshot:h,value:v},h=At.updateQueue,h===null?(h=uy(),At.updateQueue=h,h.stores=[u]):(v=h.stores,v===null?h.stores=[u]:v.push(u))}function UD(u,h,v,b){h.value=v,h.getSnapshot=b,HD(h)&&qD(u)}function VD(u,h,v){return v(function(){HD(h)&&qD(u)})}function HD(u){var h=u.getSnapshot;u=u.value;try{var v=h();return!ii(u,v)}catch{return!0}}function qD(u){var h=Cl(u,2);h!==null&&Ds(h,u,2)}function Hw(u){var h=Ks();if(typeof u=="function"){var v=u;if(u=v(),Zc){qt(!0);try{v()}finally{qt(!1)}}}return h.memoizedState=h.baseState=u,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:u},h}function WD(u,h,v,b){return u.baseState=v,Uw(u,ur,typeof b=="function"?b:Do)}function QQ(u,h,v,b,C){if(my(u))throw Error(n(485));if(u=h.action,u!==null){var A={payload:C,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(U){A.listeners.push(U)}};L.T!==null?v(!0):A.isTransition=!1,b(A),v=h.pending,v===null?(A.next=h.pending=A,GD(h,A)):(A.next=v.next,h.pending=v.next=A)}}function GD(u,h){var v=h.action,b=h.payload,C=u.state;if(h.isTransition){var A=L.T,U={};L.T=U;try{var ee=v(C,b),se=L.S;se!==null&&se(U,ee),KD(u,h,ee)}catch(de){qw(u,h,de)}finally{L.T=A}}else try{A=v(C,b),KD(u,h,A)}catch(de){qw(u,h,de)}}function KD(u,h,v){v!==null&&typeof v=="object"&&typeof v.then=="function"?v.then(function(b){YD(u,h,b)},function(b){return qw(u,h,b)}):YD(u,h,v)}function YD(u,h,v){h.status="fulfilled",h.value=v,QD(h),u.state=v,h=u.pending,h!==null&&(v=h.next,v===h?u.pending=null:(v=v.next,h.next=v,GD(u,v)))}function qw(u,h,v){var b=u.pending;if(u.pending=null,b!==null){b=b.next;do h.status="rejected",h.reason=v,QD(h),h=h.next;while(h!==b)}u.action=null}function QD(u){u=u.listeners;for(var h=0;h<u.length;h++)(0,u[h])()}function XD(u,h){return h}function ZD(u,h){if(Zt){var v=kr.formState;if(v!==null){e:{var b=At;if(Zt){if(Zn){t:{for(var C=Zn,A=za;C.nodeType!==8;){if(!A){C=null;break t}if(C=ea(C.nextSibling),C===null){C=null;break t}}A=C.data,C=A==="F!"||A==="F"?C:null}if(C){Zn=ea(C.nextSibling),b=C.data==="F!";break e}}Yc(b)}b=!1}b&&(h=v[0])}}return v=Ks(),v.memoizedState=v.baseState=h,b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:XD,lastRenderedState:h},v.queue=b,v=gO.bind(null,At,b),b.dispatch=v,b=Hw(!1),A=Xw.bind(null,At,!1,b.queue),b=Ks(),C={state:h,dispatch:null,action:u,pending:null},b.queue=C,v=QQ.bind(null,At,C,A,v),C.dispatch=v,b.memoizedState=u,[h,v,!1]}function JD(u){var h=fn();return eO(h,ur,u)}function eO(u,h,v){h=Uw(u,h,XD)[0],u=hy(Do)[0],h=typeof h=="object"&&h!==null&&typeof h.then=="function"?hp(h):h;var b=fn(),C=b.queue,A=C.dispatch;return v!==b.memoizedState&&(At.flags|=2048,Pd(9,XQ.bind(null,C,v),{destroy:void 0},null)),[h,A,u]}function XQ(u,h){u.action=h}function tO(u){var h=fn(),v=ur;if(v!==null)return eO(h,v,u);fn(),h=h.memoizedState,v=fn();var b=v.queue.dispatch;return v.memoizedState=u,[h,b,!1]}function Pd(u,h,v,b){return u={tag:u,create:h,inst:v,deps:b,next:null},h=At.updateQueue,h===null&&(h=uy(),At.updateQueue=h),v=h.lastEffect,v===null?h.lastEffect=u.next=u:(b=v.next,v.next=u,u.next=b,h.lastEffect=u),u}function rO(){return fn().memoizedState}function fy(u,h,v,b){var C=Ks();At.flags|=u,C.memoizedState=Pd(1|h,v,{destroy:void 0},b===void 0?null:b)}function py(u,h,v,b){var C=fn();b=b===void 0?null:b;var A=C.memoizedState.inst;ur!==null&&b!==null&&Iw(b,ur.memoizedState.deps)?C.memoizedState=Pd(h,v,A,b):(At.flags|=u,C.memoizedState=Pd(1|h,v,A,b))}function nO(u,h){fy(8390656,8,u,h)}function Ww(u,h){py(2048,8,u,h)}function sO(u,h){return py(4,2,u,h)}function iO(u,h){return py(4,4,u,h)}function aO(u,h){if(typeof h=="function"){u=u();var v=h(u);return function(){typeof v=="function"?v():h(null)}}if(h!=null)return u=u(),h.current=u,function(){h.current=null}}function oO(u,h,v){v=v!=null?v.concat([u]):null,py(4,4,aO.bind(null,h,u),v)}function Gw(){}function lO(u,h){var v=fn();h=h===void 0?null:h;var b=v.memoizedState;return h!==null&&Iw(h,b[1])?b[0]:(v.memoizedState=[u,h],u)}function cO(u,h){var v=fn();h=h===void 0?null:h;var b=v.memoizedState;if(h!==null&&Iw(h,b[1]))return b[0];if(b=u(),Zc){qt(!0);try{u()}finally{qt(!1)}}return v.memoizedState=[b,h],b}function Kw(u,h,v){return v===void 0||(Tl&1073741824)!==0?u.memoizedState=h:(u.memoizedState=v,u=dP(),At.lanes|=u,Bl|=u,v)}function uO(u,h,v,b){return ii(v,h)?v:Td.current!==null?(u=Kw(u,v,b),ii(u,h)||(In=!0),u):(Tl&42)===0?(In=!0,u.memoizedState=v):(u=dP(),At.lanes|=u,Bl|=u,h)}function dO(u,h,v,b,C){var A=J.p;J.p=A!==0&&8>A?A:8;var U=L.T,ee={};L.T=ee,Xw(u,!1,h,v);try{var se=C(),de=L.S;if(de!==null&&de(ee,se),se!==null&&typeof se=="object"&&typeof se.then=="function"){var Te=GQ(se,b);fp(u,h,Te,ci(u))}else fp(u,h,b,ci(u))}catch(Fe){fp(u,h,{then:function(){},status:"rejected",reason:Fe},ci())}finally{J.p=A,L.T=U}}function ZQ(){}function Yw(u,h,v,b){if(u.tag!==5)throw Error(n(476));var C=hO(u).queue;dO(u,C,h,te,v===null?ZQ:function(){return fO(u),v(b)})}function hO(u){var h=u.memoizedState;if(h!==null)return h;h={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:te},next:null};var v={};return h.next={memoizedState:v,baseState:v,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:v},next:null},u.memoizedState=h,u=u.alternate,u!==null&&(u.memoizedState=h),h}function fO(u){var h=hO(u).next.queue;fp(u,h,{},ci())}function Qw(){return gs(Op)}function pO(){return fn().memoizedState}function mO(){return fn().memoizedState}function JQ(u){for(var h=u.return;h!==null;){switch(h.tag){case 24:case 3:var v=ci();u=Ol(v);var b=Pl(h,u,v);b!==null&&(Ds(b,h,v),gp(b,h,v)),h={cache:Ow()},u.payload=h;return}h=h.return}}function eX(u,h,v){var b=ci();v={lane:b,revertLane:0,action:v,hasEagerState:!1,eagerState:null,next:null},my(u)?vO(h,v):(v=Cw(u,h,v,b),v!==null&&(Ds(v,u,b),yO(v,h,b)))}function gO(u,h,v){var b=ci();fp(u,h,v,b)}function fp(u,h,v,b){var C={lane:b,revertLane:0,action:v,hasEagerState:!1,eagerState:null,next:null};if(my(u))vO(h,C);else{var A=u.alternate;if(u.lanes===0&&(A===null||A.lanes===0)&&(A=h.lastRenderedReducer,A!==null))try{var U=h.lastRenderedState,ee=A(U,v);if(C.hasEagerState=!0,C.eagerState=ee,ii(ee,U))return Zv(u,h,C,0),kr===null&&Xv(),!1}catch{}finally{}if(v=Cw(u,h,C,b),v!==null)return Ds(v,u,b),yO(v,h,b),!0}return!1}function Xw(u,h,v,b){if(b={lane:2,revertLane:F1(),action:b,hasEagerState:!1,eagerState:null,next:null},my(u)){if(h)throw Error(n(479))}else h=Cw(u,v,b,2),h!==null&&Ds(h,u,2)}function my(u){var h=u.alternate;return u===At||h!==null&&h===At}function vO(u,h){Dd=ly=!0;var v=u.pending;v===null?h.next=h:(h.next=v.next,v.next=h),u.pending=h}function yO(u,h,v){if((v&4194176)!==0){var b=h.lanes;b&=u.pendingLanes,v|=b,h.lanes=v,Iv(u,v)}}var Va={readContext:gs,use:dy,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useLayoutEffect:sn,useInsertionEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useSyncExternalStore:sn,useId:sn};Va.useCacheRefresh=sn,Va.useMemoCache=sn,Va.useHostTransitionStatus=sn,Va.useFormState=sn,Va.useActionState=sn,Va.useOptimistic=sn;var Jc={readContext:gs,use:dy,useCallback:function(u,h){return Ks().memoizedState=[u,h===void 0?null:h],u},useContext:gs,useEffect:nO,useImperativeHandle:function(u,h,v){v=v!=null?v.concat([u]):null,fy(4194308,4,aO.bind(null,h,u),v)},useLayoutEffect:function(u,h){return fy(4194308,4,u,h)},useInsertionEffect:function(u,h){fy(4,2,u,h)},useMemo:function(u,h){var v=Ks();h=h===void 0?null:h;var b=u();if(Zc){qt(!0);try{u()}finally{qt(!1)}}return v.memoizedState=[b,h],b},useReducer:function(u,h,v){var b=Ks();if(v!==void 0){var C=v(h);if(Zc){qt(!0);try{v(h)}finally{qt(!1)}}}else C=h;return b.memoizedState=b.baseState=C,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:C},b.queue=u,u=u.dispatch=eX.bind(null,At,u),[b.memoizedState,u]},useRef:function(u){var h=Ks();return u={current:u},h.memoizedState=u},useState:function(u){u=Hw(u);var h=u.queue,v=gO.bind(null,At,h);return h.dispatch=v,[u.memoizedState,v]},useDebugValue:Gw,useDeferredValue:function(u,h){var v=Ks();return Kw(v,u,h)},useTransition:function(){var u=Hw(!1);return u=dO.bind(null,At,u.queue,!0,!1),Ks().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,h,v){var b=At,C=Ks();if(Zt){if(v===void 0)throw Error(n(407));v=v()}else{if(v=h(),kr===null)throw Error(n(349));(Wt&60)!==0||zD(b,h,v)}C.memoizedState=v;var A={value:v,getSnapshot:h};return C.queue=A,nO(VD.bind(null,b,A,u),[u]),b.flags|=2048,Pd(9,UD.bind(null,b,A,v,h),{destroy:void 0},null),v},useId:function(){var u=Ks(),h=kr.identifierPrefix;if(Zt){var v=Ao,b=To;v=(b&~(1<<32-jr(b)-1)).toString(32)+v,h=":"+h+"R"+v,v=cy++,0<v&&(h+="H"+v.toString(32)),h+=":"}else v=KQ++,h=":"+h+"r"+v.toString(32)+":";return u.memoizedState=h},useCacheRefresh:function(){return Ks().memoizedState=JQ.bind(null,At)}};Jc.useMemoCache=zw,Jc.useHostTransitionStatus=Qw,Jc.useFormState=ZD,Jc.useActionState=ZD,Jc.useOptimistic=function(u){var h=Ks();h.memoizedState=h.baseState=u;var v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=v,h=Xw.bind(null,At,!0,v),v.dispatch=h,[u,h]};var Al={readContext:gs,use:dy,useCallback:lO,useContext:gs,useEffect:Ww,useImperativeHandle:oO,useInsertionEffect:sO,useLayoutEffect:iO,useMemo:cO,useReducer:hy,useRef:rO,useState:function(){return hy(Do)},useDebugValue:Gw,useDeferredValue:function(u,h){var v=fn();return uO(v,ur.memoizedState,u,h)},useTransition:function(){var u=hy(Do)[0],h=fn().memoizedState;return[typeof u=="boolean"?u:hp(u),h]},useSyncExternalStore:FD,useId:pO};Al.useCacheRefresh=mO,Al.useMemoCache=zw,Al.useHostTransitionStatus=Qw,Al.useFormState=JD,Al.useActionState=JD,Al.useOptimistic=function(u,h){var v=fn();return WD(v,ur,u,h)};var eu={readContext:gs,use:dy,useCallback:lO,useContext:gs,useEffect:Ww,useImperativeHandle:oO,useInsertionEffect:sO,useLayoutEffect:iO,useMemo:cO,useReducer:Vw,useRef:rO,useState:function(){return Vw(Do)},useDebugValue:Gw,useDeferredValue:function(u,h){var v=fn();return ur===null?Kw(v,u,h):uO(v,ur.memoizedState,u,h)},useTransition:function(){var u=Vw(Do)[0],h=fn().memoizedState;return[typeof u=="boolean"?u:hp(u),h]},useSyncExternalStore:FD,useId:pO};eu.useCacheRefresh=mO,eu.useMemoCache=zw,eu.useHostTransitionStatus=Qw,eu.useFormState=tO,eu.useActionState=tO,eu.useOptimistic=function(u,h){var v=fn();return ur!==null?WD(v,ur,u,h):(v.baseState=u,[u,v.queue.dispatch])};function Zw(u,h,v,b){h=u.memoizedState,v=v(b,h),v=v==null?h:$({},h,v),u.memoizedState=v,u.lanes===0&&(u.updateQueue.baseState=v)}var Jw={isMounted:function(u){return(u=u._reactInternals)?K(u)===u:!1},enqueueSetState:function(u,h,v){u=u._reactInternals;var b=ci(),C=Ol(b);C.payload=h,v!=null&&(C.callback=v),h=Pl(u,C,b),h!==null&&(Ds(h,u,b),gp(h,u,b))},enqueueReplaceState:function(u,h,v){u=u._reactInternals;var b=ci(),C=Ol(b);C.tag=1,C.payload=h,v!=null&&(C.callback=v),h=Pl(u,C,b),h!==null&&(Ds(h,u,b),gp(h,u,b))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var v=ci(),b=Ol(v);b.tag=2,h!=null&&(b.callback=h),h=Pl(u,b,v),h!==null&&(Ds(h,u,v),gp(h,u,v))}};function xO(u,h,v,b,C,A,U){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(b,A,U):h.prototype&&h.prototype.isPureReactComponent?!ep(v,b)||!ep(C,A):!0}function _O(u,h,v,b){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(v,b),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(v,b),h.state!==u&&Jw.enqueueReplaceState(h,h.state,null)}function tu(u,h){var v=h;if("ref"in h){v={};for(var b in h)b!=="ref"&&(v[b]=h[b])}if(u=u.defaultProps){v===h&&(v=$({},v));for(var C in u)v[C]===void 0&&(v[C]=u[C])}return v}var gy=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var h=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(h))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)};function bO(u){gy(u)}function wO(u){console.error(u)}function SO(u){gy(u)}function vy(u,h){try{var v=u.onUncaughtError;v(h.value,{componentStack:h.stack})}catch(b){setTimeout(function(){throw b})}}function kO(u,h,v){try{var b=u.onCaughtError;b(v.value,{componentStack:v.stack,errorBoundary:h.tag===1?h.stateNode:null})}catch(C){setTimeout(function(){throw C})}}function e1(u,h,v){return v=Ol(v),v.tag=3,v.payload={element:null},v.callback=function(){vy(u,h)},v}function EO(u){return u=Ol(u),u.tag=3,u}function CO(u,h,v,b){var C=v.type.getDerivedStateFromError;if(typeof C=="function"){var A=b.value;u.payload=function(){return C(A)},u.callback=function(){kO(h,v,b)}}var U=v.stateNode;U!==null&&typeof U.componentDidCatch=="function"&&(u.callback=function(){kO(h,v,b),typeof C!="function"&&(Fl===null?Fl=new Set([this]):Fl.add(this));var ee=b.stack;this.componentDidCatch(b.value,{componentStack:ee!==null?ee:""})})}function tX(u,h,v,b,C){if(v.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){if(h=v.alternate,h!==null&&mp(h,v,C,!0),v=ji.current,v!==null){switch(v.tag){case 13:return Ua===null?M1():v.alternate===null&&Qr===0&&(Qr=3),v.flags&=-257,v.flags|=65536,v.lanes=C,b===Aw?v.flags|=16384:(h=v.updateQueue,h===null?v.updateQueue=new Set([b]):h.add(b),L1(u,b,C)),!1;case 22:return v.flags|=65536,b===Aw?v.flags|=16384:(h=v.updateQueue,h===null?(h={transitions:null,markerInstances:null,retryQueue:new Set([b])},v.updateQueue=h):(v=h.retryQueue,v===null?h.retryQueue=new Set([b]):v.add(b)),L1(u,b,C)),!1}throw Error(n(435,v.tag))}return L1(u,b,C),M1(),!1}if(Zt)return h=ji.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=C,b!==Tw&&(u=Error(n(422),{cause:b}),sp(Ei(u,v)))):(b!==Tw&&(h=Error(n(423),{cause:b}),sp(Ei(h,v))),u=u.current.alternate,u.flags|=65536,C&=-C,u.lanes|=C,b=Ei(b,v),C=e1(u.stateNode,b,C),m1(u,C),Qr!==4&&(Qr=2)),!1;var A=Error(n(520),{cause:b});if(A=Ei(A,v),kp===null?kp=[A]:kp.push(A),Qr!==4&&(Qr=2),h===null)return!0;b=Ei(b,v),v=h;do{switch(v.tag){case 3:return v.flags|=65536,u=C&-C,v.lanes|=u,u=e1(v.stateNode,b,u),m1(v,u),!1;case 1:if(h=v.type,A=v.stateNode,(v.flags&128)===0&&(typeof h.getDerivedStateFromError=="function"||A!==null&&typeof A.componentDidCatch=="function"&&(Fl===null||!Fl.has(A))))return v.flags|=65536,C&=-C,v.lanes|=C,C=EO(C),CO(C,u,v,b),m1(v,C),!1}v=v.return}while(v!==null);return!1}var NO=Error(n(461)),In=!1;function Jn(u,h,v,b){h.child=u===null?DD(h,null,v,b):Qc(h,u.child,v,b)}function jO(u,h,v,b,C){v=v.render;var A=h.ref;if("ref"in b){var U={};for(var ee in b)ee!=="ref"&&(U[ee]=b[ee])}else U=b;return nu(h),b=Lw(u,h,v,U,A,C),ee=$w(),u!==null&&!In?(Bw(u,h,C),Oo(u,h,C)):(Zt&&ee&&Nw(h),h.flags|=1,Jn(u,h,b,C),h.child)}function TO(u,h,v,b,C){if(u===null){var A=v.type;return typeof A=="function"&&!S1(A)&&A.defaultProps===void 0&&v.compare===null?(h.tag=15,h.type=A,AO(u,h,A,b,C)):(u=wy(v.type,null,b,h,h.mode,C),u.ref=h.ref,u.return=h,h.child=u)}if(A=u.child,!c1(u,C)){var U=A.memoizedProps;if(v=v.compare,v=v!==null?v:ep,v(U,b)&&u.ref===h.ref)return Oo(u,h,C)}return h.flags|=1,u=$l(A,b),u.ref=h.ref,u.return=h,h.child=u}function AO(u,h,v,b,C){if(u!==null){var A=u.memoizedProps;if(ep(A,b)&&u.ref===h.ref)if(In=!1,h.pendingProps=b=A,c1(u,C))(u.flags&131072)!==0&&(In=!0);else return h.lanes=u.lanes,Oo(u,h,C)}return t1(u,h,v,b,C)}function RO(u,h,v){var b=h.pendingProps,C=b.children,A=(h.stateNode._pendingVisibility&2)!==0,U=u!==null?u.memoizedState:null;if(pp(u,h),b.mode==="hidden"||A){if((h.flags&128)!==0){if(b=U!==null?U.baseLanes|v:v,u!==null){for(C=h.child=u.child,A=0;C!==null;)A=A|C.lanes|C.childLanes,C=C.sibling;h.childLanes=A&~b}else h.childLanes=0,h.child=null;return DO(u,h,b,v)}if((v&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},u!==null&&oy(h,U!==null?U.cachePool:null),U!==null?OD(h,U):Rw(),PD(h);else return h.lanes=h.childLanes=536870912,DO(u,h,U!==null?U.baseLanes|v:v,v)}else U!==null?(oy(h,U.cachePool),OD(h,U),jl(),h.memoizedState=null):(u!==null&&oy(h,null),Rw(),jl());return Jn(u,h,C,v),h.child}function DO(u,h,v,b){var C=Mw();return C=C===null?null:{parent:kn._currentValue,pool:C},h.memoizedState={baseLanes:v,cachePool:C},u!==null&&oy(h,null),Rw(),PD(h),u!==null&&mp(u,h,b,!0),null}function pp(u,h){var v=h.ref;if(v===null)u!==null&&u.ref!==null&&(h.flags|=2097664);else{if(typeof v!="function"&&typeof v!="object")throw Error(n(284));(u===null||u.ref!==v)&&(h.flags|=2097664)}}function t1(u,h,v,b,C){return nu(h),v=Lw(u,h,v,b,void 0,C),b=$w(),u!==null&&!In?(Bw(u,h,C),Oo(u,h,C)):(Zt&&b&&Nw(h),h.flags|=1,Jn(u,h,v,C),h.child)}function OO(u,h,v,b,C,A){return nu(h),h.updateQueue=null,v=BD(h,b,v,C),$D(u),b=$w(),u!==null&&!In?(Bw(u,h,A),Oo(u,h,A)):(Zt&&b&&Nw(h),h.flags|=1,Jn(u,h,v,A),h.child)}function PO(u,h,v,b,C){if(nu(h),h.stateNode===null){var A=Ed,U=v.contextType;typeof U=="object"&&U!==null&&(A=gs(U)),A=new v(b,A),h.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,A.updater=Jw,h.stateNode=A,A._reactInternals=h,A=h.stateNode,A.props=b,A.state=h.memoizedState,A.refs={},f1(h),U=v.contextType,A.context=typeof U=="object"&&U!==null?gs(U):Ed,A.state=h.memoizedState,U=v.getDerivedStateFromProps,typeof U=="function"&&(Zw(h,v,U,b),A.state=h.memoizedState),typeof v.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(U=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),U!==A.state&&Jw.enqueueReplaceState(A,A.state,null),yp(h,b,A,C),vp(),A.state=h.memoizedState),typeof A.componentDidMount=="function"&&(h.flags|=4194308),b=!0}else if(u===null){A=h.stateNode;var ee=h.memoizedProps,se=tu(v,ee);A.props=se;var de=A.context,Te=v.contextType;U=Ed,typeof Te=="object"&&Te!==null&&(U=gs(Te));var Fe=v.getDerivedStateFromProps;Te=typeof Fe=="function"||typeof A.getSnapshotBeforeUpdate=="function",ee=h.pendingProps!==ee,Te||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(ee||de!==U)&&_O(h,A,b,U),Dl=!1;var _e=h.memoizedState;A.state=_e,yp(h,b,A,C),vp(),de=h.memoizedState,ee||_e!==de||Dl?(typeof Fe=="function"&&(Zw(h,v,Fe,b),de=h.memoizedState),(se=Dl||xO(h,v,se,b,_e,de,U))?(Te||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"&&(h.flags|=4194308)):(typeof A.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=b,h.memoizedState=de),A.props=b,A.state=de,A.context=U,b=se):(typeof A.componentDidMount=="function"&&(h.flags|=4194308),b=!1)}else{A=h.stateNode,p1(u,h),U=h.memoizedProps,Te=tu(v,U),A.props=Te,Fe=h.pendingProps,_e=A.context,de=v.contextType,se=Ed,typeof de=="object"&&de!==null&&(se=gs(de)),ee=v.getDerivedStateFromProps,(de=typeof ee=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(U!==Fe||_e!==se)&&_O(h,A,b,se),Dl=!1,_e=h.memoizedState,A.state=_e,yp(h,b,A,C),vp();var Ee=h.memoizedState;U!==Fe||_e!==Ee||Dl||u!==null&&u.dependencies!==null&&yy(u.dependencies)?(typeof ee=="function"&&(Zw(h,v,ee,b),Ee=h.memoizedState),(Te=Dl||xO(h,v,Te,b,_e,Ee,se)||u!==null&&u.dependencies!==null&&yy(u.dependencies))?(de||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(b,Ee,se),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(b,Ee,se)),typeof A.componentDidUpdate=="function"&&(h.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof A.componentDidUpdate!="function"||U===u.memoizedProps&&_e===u.memoizedState||(h.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||U===u.memoizedProps&&_e===u.memoizedState||(h.flags|=1024),h.memoizedProps=b,h.memoizedState=Ee),A.props=b,A.state=Ee,A.context=se,b=Te):(typeof A.componentDidUpdate!="function"||U===u.memoizedProps&&_e===u.memoizedState||(h.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||U===u.memoizedProps&&_e===u.memoizedState||(h.flags|=1024),b=!1)}return A=b,pp(u,h),b=(h.flags&128)!==0,A||b?(A=h.stateNode,v=b&&typeof v.getDerivedStateFromError!="function"?null:A.render(),h.flags|=1,u!==null&&b?(h.child=Qc(h,u.child,null,C),h.child=Qc(h,null,v,C)):Jn(u,h,v,C),h.memoizedState=A.state,u=h.child):u=Oo(u,h,C),u}function MO(u,h,v,b){return np(),h.flags|=256,Jn(u,h,v,b),h.child}var r1={dehydrated:null,treeContext:null,retryLane:0};function n1(u){return{baseLanes:u,cachePool:LD()}}function s1(u,h,v){return u=u!==null?u.childLanes&~v:0,h&&(u|=Di),u}function IO(u,h,v){var b=h.pendingProps,C=!1,A=(h.flags&128)!==0,U;if((U=A)||(U=u!==null&&u.memoizedState===null?!1:(Sn.current&2)!==0),U&&(C=!0,h.flags&=-129),U=(h.flags&32)!==0,h.flags&=-33,u===null){if(Zt){if(C?Nl(h):jl(),Zt){var ee=Zn,se;if(se=ee){e:{for(se=ee,ee=za;se.nodeType!==8;){if(!ee){ee=null;break e}if(se=ea(se.nextSibling),se===null){ee=null;break e}}ee=se}ee!==null?(h.memoizedState={dehydrated:ee,treeContext:Gc!==null?{id:To,overflow:Ao}:null,retryLane:536870912},se=Ri(18,null,null,0),se.stateNode=ee,se.return=h,h.child=se,Rs=h,Zn=null,se=!0):se=!1}se||Yc(h)}if(ee=h.memoizedState,ee!==null&&(ee=ee.dehydrated,ee!==null))return ee.data==="$!"?h.lanes=16:h.lanes=536870912,null;Ro(h)}return ee=b.children,b=b.fallback,C?(jl(),C=h.mode,ee=a1({mode:"hidden",children:ee},C),b=iu(b,C,v,null),ee.return=h,b.return=h,ee.sibling=b,h.child=ee,C=h.child,C.memoizedState=n1(v),C.childLanes=s1(u,U,v),h.memoizedState=r1,b):(Nl(h),i1(h,ee))}if(se=u.memoizedState,se!==null&&(ee=se.dehydrated,ee!==null)){if(A)h.flags&256?(Nl(h),h.flags&=-257,h=o1(u,h,v)):h.memoizedState!==null?(jl(),h.child=u.child,h.flags|=128,h=null):(jl(),C=b.fallback,ee=h.mode,b=a1({mode:"visible",children:b.children},ee),C=iu(C,ee,v,null),C.flags|=2,b.return=h,C.return=h,b.sibling=C,h.child=b,Qc(h,u.child,null,v),b=h.child,b.memoizedState=n1(v),b.childLanes=s1(u,U,v),h.memoizedState=r1,h=C);else if(Nl(h),ee.data==="$!"){if(U=ee.nextSibling&&ee.nextSibling.dataset,U)var de=U.dgst;U=de,b=Error(n(419)),b.stack="",b.digest=U,sp({value:b,source:null,stack:null}),h=o1(u,h,v)}else if(In||mp(u,h,v,!1),U=(v&u.childLanes)!==0,In||U){if(U=kr,U!==null){if(b=v&-v,(b&42)!==0)b=1;else switch(b){case 2:b=1;break;case 8:b=4;break;case 32:b=16;break;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:b=64;break;case 268435456:b=134217728;break;default:b=0}if(b=(b&(U.suspendedLanes|v))!==0?0:b,b!==0&&b!==se.retryLane)throw se.retryLane=b,Cl(u,b),Ds(U,u,b),NO}ee.data==="$?"||M1(),h=o1(u,h,v)}else ee.data==="$?"?(h.flags|=128,h.child=u.child,h=gX.bind(null,u),ee._reactRetry=h,h=null):(u=se.treeContext,Zn=ea(ee.nextSibling),Rs=h,Zt=!0,Zi=null,za=!1,u!==null&&(Ci[Ni++]=To,Ci[Ni++]=Ao,Ci[Ni++]=Gc,To=u.id,Ao=u.overflow,Gc=h),h=i1(h,b.children),h.flags|=4096);return h}return C?(jl(),C=b.fallback,ee=h.mode,se=u.child,de=se.sibling,b=$l(se,{mode:"hidden",children:b.children}),b.subtreeFlags=se.subtreeFlags&31457280,de!==null?C=$l(de,C):(C=iu(C,ee,v,null),C.flags|=2),C.return=h,b.return=h,b.sibling=C,h.child=b,b=C,C=h.child,ee=u.child.memoizedState,ee===null?ee=n1(v):(se=ee.cachePool,se!==null?(de=kn._currentValue,se=se.parent!==de?{parent:de,pool:de}:se):se=LD(),ee={baseLanes:ee.baseLanes|v,cachePool:se}),C.memoizedState=ee,C.childLanes=s1(u,U,v),h.memoizedState=r1,b):(Nl(h),v=u.child,u=v.sibling,v=$l(v,{mode:"visible",children:b.children}),v.return=h,v.sibling=null,u!==null&&(U=h.deletions,U===null?(h.deletions=[u],h.flags|=16):U.push(u)),h.child=v,h.memoizedState=null,v)}function i1(u,h){return h=a1({mode:"visible",children:h},u.mode),h.return=u,u.child=h}function a1(u,h){return lP(u,h,0,null)}function o1(u,h,v){return Qc(h,u.child,null,v),u=i1(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function LO(u,h,v){u.lanes|=h;var b=u.alternate;b!==null&&(b.lanes|=h),d1(u.return,h,v)}function l1(u,h,v,b,C){var A=u.memoizedState;A===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:b,tail:v,tailMode:C}:(A.isBackwards=h,A.rendering=null,A.renderingStartTime=0,A.last=b,A.tail=v,A.tailMode=C)}function $O(u,h,v){var b=h.pendingProps,C=b.revealOrder,A=b.tail;if(Jn(u,h,b.children,v),b=Sn.current,(b&2)!==0)b=b&1|2,h.flags|=128;else{if(u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&LO(u,v,h);else if(u.tag===19)LO(u,v,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}b&=1}switch(Oe(Sn,b),C){case"forwards":for(v=h.child,C=null;v!==null;)u=v.alternate,u!==null&&ay(u)===null&&(C=v),v=v.sibling;v=C,v===null?(C=h.child,h.child=null):(C=v.sibling,v.sibling=null),l1(h,!1,C,v,A);break;case"backwards":for(v=null,C=h.child,h.child=null;C!==null;){if(u=C.alternate,u!==null&&ay(u)===null){h.child=C;break}u=C.sibling,C.sibling=v,v=C,C=u}l1(h,!0,v,null,A);break;case"together":l1(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Oo(u,h,v){if(u!==null&&(h.dependencies=u.dependencies),Bl|=h.lanes,(v&h.childLanes)===0)if(u!==null){if(mp(u,h,v,!1),(v&h.childLanes)===0)return null}else return null;if(u!==null&&h.child!==u.child)throw Error(n(153));if(h.child!==null){for(u=h.child,v=$l(u,u.pendingProps),h.child=v,v.return=h;u.sibling!==null;)u=u.sibling,v=v.sibling=$l(u,u.pendingProps),v.return=h;v.sibling=null}return h.child}function c1(u,h){return(u.lanes&h)!==0?!0:(u=u.dependencies,!!(u!==null&&yy(u)))}function rX(u,h,v){switch(h.tag){case 3:ne(h,h.stateNode.containerInfo),Rl(h,kn,u.memoizedState.cache),np();break;case 27:case 5:W(h);break;case 4:ne(h,h.stateNode.containerInfo);break;case 10:Rl(h,h.type,h.memoizedProps.value);break;case 13:var b=h.memoizedState;if(b!==null)return b.dehydrated!==null?(Nl(h),h.flags|=128,null):(v&h.child.childLanes)!==0?IO(u,h,v):(Nl(h),u=Oo(u,h,v),u!==null?u.sibling:null);Nl(h);break;case 19:var C=(u.flags&128)!==0;if(b=(v&h.childLanes)!==0,b||(mp(u,h,v,!1),b=(v&h.childLanes)!==0),C){if(b)return $O(u,h,v);h.flags|=128}if(C=h.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),Oe(Sn,Sn.current),b)break;return null;case 22:case 23:return h.lanes=0,RO(u,h,v);case 24:Rl(h,kn,u.memoizedState.cache)}return Oo(u,h,v)}function BO(u,h,v){if(u!==null)if(u.memoizedProps!==h.pendingProps)In=!0;else{if(!c1(u,v)&&(h.flags&128)===0)return In=!1,rX(u,h,v);In=(u.flags&131072)!==0}else In=!1,Zt&&(h.flags&1048576)!==0&&SD(h,ty,h.index);switch(h.lanes=0,h.tag){case 16:e:{u=h.pendingProps;var b=h.elementType,C=b._init;if(b=C(b._payload),h.type=b,typeof b=="function")S1(b)?(u=tu(b,u),h.tag=1,h=PO(null,h,b,u,v)):(h.tag=0,h=t1(null,h,b,u,v));else{if(b!=null){if(C=b.$$typeof,C===y){h.tag=11,h=jO(null,h,b,u,v);break e}else if(C===_){h.tag=14,h=TO(null,h,b,u,v);break e}}throw h=I(b)||b,Error(n(306,h,""))}}return h;case 0:return t1(u,h,h.type,h.pendingProps,v);case 1:return b=h.type,C=tu(b,h.pendingProps),PO(u,h,b,C,v);case 3:e:{if(ne(h,h.stateNode.containerInfo),u===null)throw Error(n(387));var A=h.pendingProps;C=h.memoizedState,b=C.element,p1(u,h),yp(h,A,null,v);var U=h.memoizedState;if(A=U.cache,Rl(h,kn,A),A!==C.cache&&h1(h,[kn],v,!0),vp(),A=U.element,C.isDehydrated)if(C={element:A,isDehydrated:!1,cache:U.cache},h.updateQueue.baseState=C,h.memoizedState=C,h.flags&256){h=MO(u,h,A,v);break e}else if(A!==b){b=Ei(Error(n(424)),h),sp(b),h=MO(u,h,A,v);break e}else for(Zn=ea(h.stateNode.containerInfo.firstChild),Rs=h,Zt=!0,Zi=null,za=!0,v=DD(h,null,A,v),h.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(np(),A===b){h=Oo(u,h,v);break e}Jn(u,h,A,v)}h=h.child}return h;case 26:return pp(u,h),u===null?(v=UP(h.type,null,h.pendingProps,null))?h.memoizedState=v:Zt||(v=h.type,u=h.pendingProps,b=Py(lt.current).createElement(v),b[Mn]=h,b[ps]=u,es(b,v,u),Qe(b),h.stateNode=b):h.memoizedState=UP(h.type,u.memoizedProps,h.pendingProps,u.memoizedState),null;case 27:return W(h),u===null&&Zt&&(b=h.stateNode=BP(h.type,h.pendingProps,lt.current),Rs=h,za=!0,Zn=ea(b.firstChild)),b=h.pendingProps.children,u!==null||Zt?Jn(u,h,b,v):h.child=Qc(h,null,b,v),pp(u,h),h.child;case 5:return u===null&&Zt&&((C=b=Zn)&&(b=DX(b,h.type,h.pendingProps,za),b!==null?(h.stateNode=b,Rs=h,Zn=ea(b.firstChild),za=!1,C=!0):C=!1),C||Yc(h)),W(h),C=h.type,A=h.pendingProps,U=u!==null?u.memoizedProps:null,b=A.children,Y1(C,A)?b=null:U!==null&&Y1(C,U)&&(h.flags|=32),h.memoizedState!==null&&(C=Lw(u,h,YQ,null,null,v),Op._currentValue=C),pp(u,h),Jn(u,h,b,v),h.child;case 6:return u===null&&Zt&&((u=v=Zn)&&(v=OX(v,h.pendingProps,za),v!==null?(h.stateNode=v,Rs=h,Zn=null,u=!0):u=!1),u||Yc(h)),null;case 13:return IO(u,h,v);case 4:return ne(h,h.stateNode.containerInfo),b=h.pendingProps,u===null?h.child=Qc(h,null,b,v):Jn(u,h,b,v),h.child;case 11:return jO(u,h,h.type,h.pendingProps,v);case 7:return Jn(u,h,h.pendingProps,v),h.child;case 8:return Jn(u,h,h.pendingProps.children,v),h.child;case 12:return Jn(u,h,h.pendingProps.children,v),h.child;case 10:return b=h.pendingProps,Rl(h,h.type,b.value),Jn(u,h,b.children,v),h.child;case 9:return C=h.type._context,b=h.pendingProps.children,nu(h),C=gs(C),b=b(C),h.flags|=1,Jn(u,h,b,v),h.child;case 14:return TO(u,h,h.type,h.pendingProps,v);case 15:return AO(u,h,h.type,h.pendingProps,v);case 19:return $O(u,h,v);case 22:return RO(u,h,v);case 24:return nu(h),b=gs(kn),u===null?(C=Mw(),C===null&&(C=kr,A=Ow(),C.pooledCache=A,A.refCount++,A!==null&&(C.pooledCacheLanes|=v),C=A),h.memoizedState={parent:b,cache:C},f1(h),Rl(h,kn,C)):((u.lanes&v)!==0&&(p1(u,h),yp(h,null,null,v),vp()),C=u.memoizedState,A=h.memoizedState,C.parent!==b?(C={parent:b,cache:b},h.memoizedState=C,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=C),Rl(h,kn,b)):(b=A.cache,Rl(h,kn,b),b!==C.cache&&h1(h,[kn],v,!0))),Jn(u,h,h.pendingProps.children,v),h.child;case 29:throw h.pendingProps}throw Error(n(156,h.tag))}var u1=xe(null),ru=null,Po=null;function Rl(u,h,v){Oe(u1,h._currentValue),h._currentValue=v}function Mo(u){u._currentValue=u1.current,ke(u1)}function d1(u,h,v){for(;u!==null;){var b=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,b!==null&&(b.childLanes|=h)):b!==null&&(b.childLanes&h)!==h&&(b.childLanes|=h),u===v)break;u=u.return}}function h1(u,h,v,b){var C=u.child;for(C!==null&&(C.return=u);C!==null;){var A=C.dependencies;if(A!==null){var U=C.child;A=A.firstContext;e:for(;A!==null;){var ee=A;A=C;for(var se=0;se<h.length;se++)if(ee.context===h[se]){A.lanes|=v,ee=A.alternate,ee!==null&&(ee.lanes|=v),d1(A.return,v,u),b||(U=null);break e}A=ee.next}}else if(C.tag===18){if(U=C.return,U===null)throw Error(n(341));U.lanes|=v,A=U.alternate,A!==null&&(A.lanes|=v),d1(U,v,u),U=null}else U=C.child;if(U!==null)U.return=C;else for(U=C;U!==null;){if(U===u){U=null;break}if(C=U.sibling,C!==null){C.return=U.return,U=C;break}U=U.return}C=U}}function mp(u,h,v,b){u=null;for(var C=h,A=!1;C!==null;){if(!A){if((C.flags&524288)!==0)A=!0;else if((C.flags&262144)!==0)break}if(C.tag===10){var U=C.alternate;if(U===null)throw Error(n(387));if(U=U.memoizedProps,U!==null){var ee=C.type;ii(C.pendingProps.value,U.value)||(u!==null?u.push(ee):u=[ee])}}else if(C===P.current){if(U=C.alternate,U===null)throw Error(n(387));U.memoizedState.memoizedState!==C.memoizedState.memoizedState&&(u!==null?u.push(Op):u=[Op])}C=C.return}u!==null&&h1(h,u,v,b),h.flags|=262144}function yy(u){for(u=u.firstContext;u!==null;){if(!ii(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function nu(u){ru=u,Po=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function gs(u){return FO(ru,u)}function xy(u,h){return ru===null&&nu(u),FO(u,h)}function FO(u,h){var v=h._currentValue;if(h={context:h,memoizedValue:v,next:null},Po===null){if(u===null)throw Error(n(308));Po=h,u.dependencies={lanes:0,firstContext:h},u.flags|=524288}else Po=Po.next=h;return v}var Dl=!1;function f1(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function p1(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function Ol(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Pl(u,h,v){var b=u.updateQueue;if(b===null)return null;if(b=b.shared,(Vr&2)!==0){var C=b.pending;return C===null?h.next=h:(h.next=C.next,C.next=h),b.pending=h,h=Jv(u),bD(u,null,v),h}return Zv(u,b,h,v),Jv(u)}function gp(u,h,v){if(h=h.updateQueue,h!==null&&(h=h.shared,(v&4194176)!==0)){var b=h.lanes;b&=u.pendingLanes,v|=b,h.lanes=v,Iv(u,v)}}function m1(u,h){var v=u.updateQueue,b=u.alternate;if(b!==null&&(b=b.updateQueue,v===b)){var C=null,A=null;if(v=v.firstBaseUpdate,v!==null){do{var U={lane:v.lane,tag:v.tag,payload:v.payload,callback:null,next:null};A===null?C=A=U:A=A.next=U,v=v.next}while(v!==null);A===null?C=A=h:A=A.next=h}else C=A=h;v={baseState:b.baseState,firstBaseUpdate:C,lastBaseUpdate:A,shared:b.shared,callbacks:b.callbacks},u.updateQueue=v;return}u=v.lastBaseUpdate,u===null?v.firstBaseUpdate=h:u.next=h,v.lastBaseUpdate=h}var g1=!1;function vp(){if(g1){var u=Rd;if(u!==null)throw u}}function yp(u,h,v,b){g1=!1;var C=u.updateQueue;Dl=!1;var A=C.firstBaseUpdate,U=C.lastBaseUpdate,ee=C.shared.pending;if(ee!==null){C.shared.pending=null;var se=ee,de=se.next;se.next=null,U===null?A=de:U.next=de,U=se;var Te=u.alternate;Te!==null&&(Te=Te.updateQueue,ee=Te.lastBaseUpdate,ee!==U&&(ee===null?Te.firstBaseUpdate=de:ee.next=de,Te.lastBaseUpdate=se))}if(A!==null){var Fe=C.baseState;U=0,Te=de=se=null,ee=A;do{var _e=ee.lane&-536870913,Ee=_e!==ee.lane;if(Ee?(Wt&_e)===_e:(b&_e)===_e){_e!==0&&_e===Ad&&(g1=!0),Te!==null&&(Te=Te.next={lane:0,tag:ee.tag,payload:ee.payload,callback:null,next:null});e:{var ct=u,wt=ee;_e=h;var Xr=v;switch(wt.tag){case 1:if(ct=wt.payload,typeof ct=="function"){Fe=ct.call(Xr,Fe,_e);break e}Fe=ct;break e;case 3:ct.flags=ct.flags&-65537|128;case 0:if(ct=wt.payload,_e=typeof ct=="function"?ct.call(Xr,Fe,_e):ct,_e==null)break e;Fe=$({},Fe,_e);break e;case 2:Dl=!0}}_e=ee.callback,_e!==null&&(u.flags|=64,Ee&&(u.flags|=8192),Ee=C.callbacks,Ee===null?C.callbacks=[_e]:Ee.push(_e))}else Ee={lane:_e,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},Te===null?(de=Te=Ee,se=Fe):Te=Te.next=Ee,U|=_e;if(ee=ee.next,ee===null){if(ee=C.shared.pending,ee===null)break;Ee=ee,ee=Ee.next,Ee.next=null,C.lastBaseUpdate=Ee,C.shared.pending=null}}while(!0);Te===null&&(se=Fe),C.baseState=se,C.firstBaseUpdate=de,C.lastBaseUpdate=Te,A===null&&(C.shared.lanes=0),Bl|=U,u.lanes=U,u.memoizedState=Fe}}function zO(u,h){if(typeof u!="function")throw Error(n(191,u));u.call(h)}function UO(u,h){var v=u.callbacks;if(v!==null)for(u.callbacks=null,u=0;u<v.length;u++)zO(v[u],h)}function xp(u,h){try{var v=h.updateQueue,b=v!==null?v.lastEffect:null;if(b!==null){var C=b.next;v=C;do{if((v.tag&u)===u){b=void 0;var A=v.create,U=v.inst;b=A(),U.destroy=b}v=v.next}while(v!==C)}}catch(ee){vr(h,h.return,ee)}}function Ml(u,h,v){try{var b=h.updateQueue,C=b!==null?b.lastEffect:null;if(C!==null){var A=C.next;b=A;do{if((b.tag&u)===u){var U=b.inst,ee=U.destroy;if(ee!==void 0){U.destroy=void 0,C=h;var se=v;try{ee()}catch(de){vr(C,se,de)}}}b=b.next}while(b!==A)}}catch(de){vr(h,h.return,de)}}function VO(u){var h=u.updateQueue;if(h!==null){var v=u.stateNode;try{UO(h,v)}catch(b){vr(u,u.return,b)}}}function HO(u,h,v){v.props=tu(u.type,u.memoizedProps),v.state=u.memoizedState;try{v.componentWillUnmount()}catch(b){vr(u,h,b)}}function su(u,h){try{var v=u.ref;if(v!==null){var b=u.stateNode;switch(u.tag){case 26:case 27:case 5:var C=b;break;default:C=b}typeof v=="function"?u.refCleanup=v(C):v.current=C}}catch(A){vr(u,h,A)}}function ai(u,h){var v=u.ref,b=u.refCleanup;if(v!==null)if(typeof b=="function")try{b()}catch(C){vr(u,h,C)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof v=="function")try{v(null)}catch(C){vr(u,h,C)}else v.current=null}function qO(u){var h=u.type,v=u.memoizedProps,b=u.stateNode;try{e:switch(h){case"button":case"input":case"select":case"textarea":v.autoFocus&&b.focus();break e;case"img":v.src?b.src=v.src:v.srcSet&&(b.srcset=v.srcSet)}}catch(C){vr(u,u.return,C)}}function WO(u,h,v){try{var b=u.stateNode;NX(b,u.type,v,h),b[ps]=h}catch(C){vr(u,u.return,C)}}function GO(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27||u.tag===4}function v1(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||GO(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==27&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function y1(u,h,v){var b=u.tag;if(b===5||b===6)u=u.stateNode,h?v.nodeType===8?v.parentNode.insertBefore(u,h):v.insertBefore(u,h):(v.nodeType===8?(h=v.parentNode,h.insertBefore(u,v)):(h=v,h.appendChild(u)),v=v._reactRootContainer,v!=null||h.onclick!==null||(h.onclick=Oy));else if(b!==4&&b!==27&&(u=u.child,u!==null))for(y1(u,h,v),u=u.sibling;u!==null;)y1(u,h,v),u=u.sibling}function _y(u,h,v){var b=u.tag;if(b===5||b===6)u=u.stateNode,h?v.insertBefore(u,h):v.appendChild(u);else if(b!==4&&b!==27&&(u=u.child,u!==null))for(_y(u,h,v),u=u.sibling;u!==null;)_y(u,h,v),u=u.sibling}var Io=!1,Yr=!1,x1=!1,KO=typeof WeakSet=="function"?WeakSet:Set,Ln=null,YO=!1;function nX(u,h){if(u=u.containerInfo,G1=Fy,u=hD(u),bw(u)){if("selectionStart"in u)var v={start:u.selectionStart,end:u.selectionEnd};else e:{v=(v=u.ownerDocument)&&v.defaultView||window;var b=v.getSelection&&v.getSelection();if(b&&b.rangeCount!==0){v=b.anchorNode;var C=b.anchorOffset,A=b.focusNode;b=b.focusOffset;try{v.nodeType,A.nodeType}catch{v=null;break e}var U=0,ee=-1,se=-1,de=0,Te=0,Fe=u,_e=null;t:for(;;){for(var Ee;Fe!==v||C!==0&&Fe.nodeType!==3||(ee=U+C),Fe!==A||b!==0&&Fe.nodeType!==3||(se=U+b),Fe.nodeType===3&&(U+=Fe.nodeValue.length),(Ee=Fe.firstChild)!==null;)_e=Fe,Fe=Ee;for(;;){if(Fe===u)break t;if(_e===v&&++de===C&&(ee=U),_e===A&&++Te===b&&(se=U),(Ee=Fe.nextSibling)!==null)break;Fe=_e,_e=Fe.parentNode}Fe=Ee}v=ee===-1||se===-1?null:{start:ee,end:se}}else v=null}v=v||{start:0,end:0}}else v=null;for(K1={focusedElem:u,selectionRange:v},Fy=!1,Ln=h;Ln!==null;)if(h=Ln,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,Ln=u;else for(;Ln!==null;){switch(h=Ln,A=h.alternate,u=h.flags,h.tag){case 0:break;case 11:case 15:break;case 1:if((u&1024)!==0&&A!==null){u=void 0,v=h,C=A.memoizedProps,A=A.memoizedState,b=v.stateNode;try{var ct=tu(v.type,C,v.elementType===v.type);u=b.getSnapshotBeforeUpdate(ct,A),b.__reactInternalSnapshotBeforeUpdate=u}catch(wt){vr(v,v.return,wt)}}break;case 3:if((u&1024)!==0){if(u=h.stateNode.containerInfo,v=u.nodeType,v===9)Z1(u);else if(v===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":Z1(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((u&1024)!==0)throw Error(n(163))}if(u=h.sibling,u!==null){u.return=h.return,Ln=u;break}Ln=h.return}return ct=YO,YO=!1,ct}function QO(u,h,v){var b=v.flags;switch(v.tag){case 0:case 11:case 15:$o(u,v),b&4&&xp(5,v);break;case 1:if($o(u,v),b&4)if(u=v.stateNode,h===null)try{u.componentDidMount()}catch(ee){vr(v,v.return,ee)}else{var C=tu(v.type,h.memoizedProps);h=h.memoizedState;try{u.componentDidUpdate(C,h,u.__reactInternalSnapshotBeforeUpdate)}catch(ee){vr(v,v.return,ee)}}b&64&&VO(v),b&512&&su(v,v.return);break;case 3:if($o(u,v),b&64&&(b=v.updateQueue,b!==null)){if(u=null,v.child!==null)switch(v.child.tag){case 27:case 5:u=v.child.stateNode;break;case 1:u=v.child.stateNode}try{UO(b,u)}catch(ee){vr(v,v.return,ee)}}break;case 26:$o(u,v),b&512&&su(v,v.return);break;case 27:case 5:$o(u,v),h===null&&b&4&&qO(v),b&512&&su(v,v.return);break;case 12:$o(u,v);break;case 13:$o(u,v),b&4&&JO(u,v);break;case 22:if(C=v.memoizedState!==null||Io,!C){h=h!==null&&h.memoizedState!==null||Yr;var A=Io,U=Yr;Io=C,(Yr=h)&&!U?Il(u,v,(v.subtreeFlags&8772)!==0):$o(u,v),Io=A,Yr=U}b&512&&(v.memoizedProps.mode==="manual"?su(v,v.return):ai(v,v.return));break;default:$o(u,v)}}function XO(u){var h=u.alternate;h!==null&&(u.alternate=null,XO(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&Wf(h)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var pn=null,oi=!1;function Lo(u,h,v){for(v=v.child;v!==null;)ZO(u,h,v),v=v.sibling}function ZO(u,h,v){if(Sr&&typeof Sr.onCommitFiberUnmount=="function")try{Sr.onCommitFiberUnmount(Tt,v)}catch{}switch(v.tag){case 26:Yr||ai(v,h),Lo(u,h,v),v.memoizedState?v.memoizedState.count--:v.stateNode&&(v=v.stateNode,v.parentNode.removeChild(v));break;case 27:Yr||ai(v,h);var b=pn,C=oi;for(pn=v.stateNode,Lo(u,h,v),v=v.stateNode,h=v.attributes;h.length;)v.removeAttributeNode(h[0]);Wf(v),pn=b,oi=C;break;case 5:Yr||ai(v,h);case 6:C=pn;var A=oi;if(pn=null,Lo(u,h,v),pn=C,oi=A,pn!==null)if(oi)try{u=pn,b=v.stateNode,u.nodeType===8?u.parentNode.removeChild(b):u.removeChild(b)}catch(U){vr(v,h,U)}else try{pn.removeChild(v.stateNode)}catch(U){vr(v,h,U)}break;case 18:pn!==null&&(oi?(h=pn,v=v.stateNode,h.nodeType===8?X1(h.parentNode,v):h.nodeType===1&&X1(h,v),Lp(h)):X1(pn,v.stateNode));break;case 4:b=pn,C=oi,pn=v.stateNode.containerInfo,oi=!0,Lo(u,h,v),pn=b,oi=C;break;case 0:case 11:case 14:case 15:Yr||Ml(2,v,h),Yr||Ml(4,v,h),Lo(u,h,v);break;case 1:Yr||(ai(v,h),b=v.stateNode,typeof b.componentWillUnmount=="function"&&HO(v,h,b)),Lo(u,h,v);break;case 21:Lo(u,h,v);break;case 22:Yr||ai(v,h),Yr=(b=Yr)||v.memoizedState!==null,Lo(u,h,v),Yr=b;break;default:Lo(u,h,v)}}function JO(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{Lp(u)}catch(v){vr(h,h.return,v)}}function sX(u){switch(u.tag){case 13:case 19:var h=u.stateNode;return h===null&&(h=u.stateNode=new KO),h;case 22:return u=u.stateNode,h=u._retryCache,h===null&&(h=u._retryCache=new KO),h;default:throw Error(n(435,u.tag))}}function _1(u,h){var v=sX(u);h.forEach(function(b){var C=vX.bind(null,u,b);v.has(b)||(v.add(b),b.then(C,C))})}function Ti(u,h){var v=h.deletions;if(v!==null)for(var b=0;b<v.length;b++){var C=v[b],A=u,U=h,ee=U;e:for(;ee!==null;){switch(ee.tag){case 27:case 5:pn=ee.stateNode,oi=!1;break e;case 3:pn=ee.stateNode.containerInfo,oi=!0;break e;case 4:pn=ee.stateNode.containerInfo,oi=!0;break e}ee=ee.return}if(pn===null)throw Error(n(160));ZO(A,U,C),pn=null,oi=!1,A=C.alternate,A!==null&&(A.return=null),C.return=null}if(h.subtreeFlags&13878)for(h=h.child;h!==null;)eP(h,u),h=h.sibling}var Ji=null;function eP(u,h){var v=u.alternate,b=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Ti(h,u),Ai(u),b&4&&(Ml(3,u,u.return),xp(3,u),Ml(5,u,u.return));break;case 1:Ti(h,u),Ai(u),b&512&&(Yr||v===null||ai(v,v.return)),b&64&&Io&&(u=u.updateQueue,u!==null&&(b=u.callbacks,b!==null&&(v=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=v===null?b:v.concat(b))));break;case 26:var C=Ji;if(Ti(h,u),Ai(u),b&512&&(Yr||v===null||ai(v,v.return)),b&4){var A=v!==null?v.memoizedState:null;if(b=u.memoizedState,v===null)if(b===null)if(u.stateNode===null){e:{b=u.type,v=u.memoizedProps,C=C.ownerDocument||C;t:switch(b){case"title":A=C.getElementsByTagName("title")[0],(!A||A[Vc]||A[Mn]||A.namespaceURI==="http://www.w3.org/2000/svg"||A.hasAttribute("itemprop"))&&(A=C.createElement(b),C.head.insertBefore(A,C.querySelector("head > title"))),es(A,b,v),A[Mn]=u,Qe(A),b=A;break e;case"link":var U=qP("link","href",C).get(b+(v.href||""));if(U){for(var ee=0;ee<U.length;ee++)if(A=U[ee],A.getAttribute("href")===(v.href==null?null:v.href)&&A.getAttribute("rel")===(v.rel==null?null:v.rel)&&A.getAttribute("title")===(v.title==null?null:v.title)&&A.getAttribute("crossorigin")===(v.crossOrigin==null?null:v.crossOrigin)){U.splice(ee,1);break t}}A=C.createElement(b),es(A,b,v),C.head.appendChild(A);break;case"meta":if(U=qP("meta","content",C).get(b+(v.content||""))){for(ee=0;ee<U.length;ee++)if(A=U[ee],A.getAttribute("content")===(v.content==null?null:""+v.content)&&A.getAttribute("name")===(v.name==null?null:v.name)&&A.getAttribute("property")===(v.property==null?null:v.property)&&A.getAttribute("http-equiv")===(v.httpEquiv==null?null:v.httpEquiv)&&A.getAttribute("charset")===(v.charSet==null?null:v.charSet)){U.splice(ee,1);break t}}A=C.createElement(b),es(A,b,v),C.head.appendChild(A);break;default:throw Error(n(468,b))}A[Mn]=u,Qe(A),b=A}u.stateNode=b}else WP(C,u.type,u.stateNode);else u.stateNode=HP(C,b,u.memoizedProps);else A!==b?(A===null?v.stateNode!==null&&(v=v.stateNode,v.parentNode.removeChild(v)):A.count--,b===null?WP(C,u.type,u.stateNode):HP(C,b,u.memoizedProps)):b===null&&u.stateNode!==null&&WO(u,u.memoizedProps,v.memoizedProps)}break;case 27:if(b&4&&u.alternate===null){C=u.stateNode,A=u.memoizedProps;try{for(var se=C.firstChild;se;){var de=se.nextSibling,Te=se.nodeName;se[Vc]||Te==="HEAD"||Te==="BODY"||Te==="SCRIPT"||Te==="STYLE"||Te==="LINK"&&se.rel.toLowerCase()==="stylesheet"||C.removeChild(se),se=de}for(var Fe=u.type,_e=C.attributes;_e.length;)C.removeAttributeNode(_e[0]);es(C,Fe,A),C[Mn]=u,C[ps]=A}catch(ct){vr(u,u.return,ct)}}case 5:if(Ti(h,u),Ai(u),b&512&&(Yr||v===null||ai(v,v.return)),u.flags&32){C=u.stateNode;try{yd(C,"")}catch(ct){vr(u,u.return,ct)}}b&4&&u.stateNode!=null&&(C=u.memoizedProps,WO(u,C,v!==null?v.memoizedProps:C)),b&1024&&(x1=!0);break;case 6:if(Ti(h,u),Ai(u),b&4){if(u.stateNode===null)throw Error(n(162));b=u.memoizedProps,v=u.stateNode;try{v.nodeValue=b}catch(ct){vr(u,u.return,ct)}}break;case 3:if(Ly=null,C=Ji,Ji=My(h.containerInfo),Ti(h,u),Ji=C,Ai(u),b&4&&v!==null&&v.memoizedState.isDehydrated)try{Lp(h.containerInfo)}catch(ct){vr(u,u.return,ct)}x1&&(x1=!1,tP(u));break;case 4:b=Ji,Ji=My(u.stateNode.containerInfo),Ti(h,u),Ai(u),Ji=b;break;case 12:Ti(h,u),Ai(u);break;case 13:Ti(h,u),Ai(u),u.child.flags&8192&&u.memoizedState!==null!=(v!==null&&v.memoizedState!==null)&&(T1=Ne()),b&4&&(b=u.updateQueue,b!==null&&(u.updateQueue=null,_1(u,b)));break;case 22:if(b&512&&(Yr||v===null||ai(v,v.return)),se=u.memoizedState!==null,de=v!==null&&v.memoizedState!==null,Te=Io,Fe=Yr,Io=Te||se,Yr=Fe||de,Ti(h,u),Yr=Fe,Io=Te,Ai(u),h=u.stateNode,h._current=u,h._visibility&=-3,h._visibility|=h._pendingVisibility&2,b&8192&&(h._visibility=se?h._visibility&-2:h._visibility|1,se&&(h=Io||Yr,v===null||de||h||Md(u)),u.memoizedProps===null||u.memoizedProps.mode!=="manual"))e:for(v=null,h=u;;){if(h.tag===5||h.tag===26||h.tag===27){if(v===null){de=v=h;try{if(C=de.stateNode,se)A=C.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{U=de.stateNode,ee=de.memoizedProps.style;var Ee=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;U.style.display=Ee==null||typeof Ee=="boolean"?"":(""+Ee).trim()}}catch(ct){vr(de,de.return,ct)}}}else if(h.tag===6){if(v===null){de=h;try{de.stateNode.nodeValue=se?"":de.memoizedProps}catch(ct){vr(de,de.return,ct)}}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===u)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break e;for(;h.sibling===null;){if(h.return===null||h.return===u)break e;v===h&&(v=null),h=h.return}v===h&&(v=null),h.sibling.return=h.return,h=h.sibling}b&4&&(b=u.updateQueue,b!==null&&(v=b.retryQueue,v!==null&&(b.retryQueue=null,_1(u,v))));break;case 19:Ti(h,u),Ai(u),b&4&&(b=u.updateQueue,b!==null&&(u.updateQueue=null,_1(u,b)));break;case 21:break;default:Ti(h,u),Ai(u)}}function Ai(u){var h=u.flags;if(h&2){try{if(u.tag!==27){e:{for(var v=u.return;v!==null;){if(GO(v)){var b=v;break e}v=v.return}throw Error(n(160))}switch(b.tag){case 27:var C=b.stateNode,A=v1(u);_y(u,A,C);break;case 5:var U=b.stateNode;b.flags&32&&(yd(U,""),b.flags&=-33);var ee=v1(u);_y(u,ee,U);break;case 3:case 4:var se=b.stateNode.containerInfo,de=v1(u);y1(u,de,se);break;default:throw Error(n(161))}}}catch(Te){vr(u,u.return,Te)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function tP(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var h=u;tP(h),h.tag===5&&h.flags&1024&&h.stateNode.reset(),u=u.sibling}}function $o(u,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)QO(u,h.alternate,h),h=h.sibling}function Md(u){for(u=u.child;u!==null;){var h=u;switch(h.tag){case 0:case 11:case 14:case 15:Ml(4,h,h.return),Md(h);break;case 1:ai(h,h.return);var v=h.stateNode;typeof v.componentWillUnmount=="function"&&HO(h,h.return,v),Md(h);break;case 26:case 27:case 5:ai(h,h.return),Md(h);break;case 22:ai(h,h.return),h.memoizedState===null&&Md(h);break;default:Md(h)}u=u.sibling}}function Il(u,h,v){for(v=v&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var b=h.alternate,C=u,A=h,U=A.flags;switch(A.tag){case 0:case 11:case 15:Il(C,A,v),xp(4,A);break;case 1:if(Il(C,A,v),b=A,C=b.stateNode,typeof C.componentDidMount=="function")try{C.componentDidMount()}catch(de){vr(b,b.return,de)}if(b=A,C=b.updateQueue,C!==null){var ee=b.stateNode;try{var se=C.shared.hiddenCallbacks;if(se!==null)for(C.shared.hiddenCallbacks=null,C=0;C<se.length;C++)zO(se[C],ee)}catch(de){vr(b,b.return,de)}}v&&U&64&&VO(A),su(A,A.return);break;case 26:case 27:case 5:Il(C,A,v),v&&b===null&&U&4&&qO(A),su(A,A.return);break;case 12:Il(C,A,v);break;case 13:Il(C,A,v),v&&U&4&&JO(C,A);break;case 22:A.memoizedState===null&&Il(C,A,v),su(A,A.return);break;default:Il(C,A,v)}h=h.sibling}}function b1(u,h){var v=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),u=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(u=h.memoizedState.cachePool.pool),u!==v&&(u!=null&&u.refCount++,v!=null&&cp(v))}function w1(u,h){u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&cp(u))}function Ll(u,h,v,b){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)rP(u,h,v,b),h=h.sibling}function rP(u,h,v,b){var C=h.flags;switch(h.tag){case 0:case 11:case 15:Ll(u,h,v,b),C&2048&&xp(9,h);break;case 3:Ll(u,h,v,b),C&2048&&(u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&cp(u)));break;case 12:if(C&2048){Ll(u,h,v,b),u=h.stateNode;try{var A=h.memoizedProps,U=A.id,ee=A.onPostCommit;typeof ee=="function"&&ee(U,h.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(se){vr(h,h.return,se)}}else Ll(u,h,v,b);break;case 23:break;case 22:A=h.stateNode,h.memoizedState!==null?A._visibility&4?Ll(u,h,v,b):_p(u,h):A._visibility&4?Ll(u,h,v,b):(A._visibility|=4,Id(u,h,v,b,(h.subtreeFlags&10256)!==0)),C&2048&&b1(h.alternate,h);break;case 24:Ll(u,h,v,b),C&2048&&w1(h.alternate,h);break;default:Ll(u,h,v,b)}}function Id(u,h,v,b,C){for(C=C&&(h.subtreeFlags&10256)!==0,h=h.child;h!==null;){var A=u,U=h,ee=v,se=b,de=U.flags;switch(U.tag){case 0:case 11:case 15:Id(A,U,ee,se,C),xp(8,U);break;case 23:break;case 22:var Te=U.stateNode;U.memoizedState!==null?Te._visibility&4?Id(A,U,ee,se,C):_p(A,U):(Te._visibility|=4,Id(A,U,ee,se,C)),C&&de&2048&&b1(U.alternate,U);break;case 24:Id(A,U,ee,se,C),C&&de&2048&&w1(U.alternate,U);break;default:Id(A,U,ee,se,C)}h=h.sibling}}function _p(u,h){if(h.subtreeFlags&10256)for(h=h.child;h!==null;){var v=u,b=h,C=b.flags;switch(b.tag){case 22:_p(v,b),C&2048&&b1(b.alternate,b);break;case 24:_p(v,b),C&2048&&w1(b.alternate,b);break;default:_p(v,b)}h=h.sibling}}var bp=8192;function Ld(u){if(u.subtreeFlags&bp)for(u=u.child;u!==null;)nP(u),u=u.sibling}function nP(u){switch(u.tag){case 26:Ld(u),u.flags&bp&&u.memoizedState!==null&&WX(Ji,u.memoizedState,u.memoizedProps);break;case 5:Ld(u);break;case 3:case 4:var h=Ji;Ji=My(u.stateNode.containerInfo),Ld(u),Ji=h;break;case 22:u.memoizedState===null&&(h=u.alternate,h!==null&&h.memoizedState!==null?(h=bp,bp=16777216,Ld(u),bp=h):Ld(u));break;default:Ld(u)}}function sP(u){var h=u.alternate;if(h!==null&&(u=h.child,u!==null)){h.child=null;do h=u.sibling,u.sibling=null,u=h;while(u!==null)}}function wp(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var v=0;v<h.length;v++){var b=h[v];Ln=b,aP(b,u)}sP(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)iP(u),u=u.sibling}function iP(u){switch(u.tag){case 0:case 11:case 15:wp(u),u.flags&2048&&Ml(9,u,u.return);break;case 3:wp(u);break;case 12:wp(u);break;case 22:var h=u.stateNode;u.memoizedState!==null&&h._visibility&4&&(u.return===null||u.return.tag!==13)?(h._visibility&=-5,by(u)):wp(u);break;default:wp(u)}}function by(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var v=0;v<h.length;v++){var b=h[v];Ln=b,aP(b,u)}sP(u)}for(u=u.child;u!==null;){switch(h=u,h.tag){case 0:case 11:case 15:Ml(8,h,h.return),by(h);break;case 22:v=h.stateNode,v._visibility&4&&(v._visibility&=-5,by(h));break;default:by(h)}u=u.sibling}}function aP(u,h){for(;Ln!==null;){var v=Ln;switch(v.tag){case 0:case 11:case 15:Ml(8,v,h);break;case 23:case 22:if(v.memoizedState!==null&&v.memoizedState.cachePool!==null){var b=v.memoizedState.cachePool.pool;b!=null&&b.refCount++}break;case 24:cp(v.memoizedState.cache)}if(b=v.child,b!==null)b.return=v,Ln=b;else e:for(v=u;Ln!==null;){b=Ln;var C=b.sibling,A=b.return;if(XO(b),b===v){Ln=null;break e}if(C!==null){C.return=A,Ln=C;break e}Ln=A}}}function iX(u,h,v,b){this.tag=u,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ri(u,h,v,b){return new iX(u,h,v,b)}function S1(u){return u=u.prototype,!(!u||!u.isReactComponent)}function $l(u,h){var v=u.alternate;return v===null?(v=Ri(u.tag,h,u.key,u.mode),v.elementType=u.elementType,v.type=u.type,v.stateNode=u.stateNode,v.alternate=u,u.alternate=v):(v.pendingProps=h,v.type=u.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=u.flags&31457280,v.childLanes=u.childLanes,v.lanes=u.lanes,v.child=u.child,v.memoizedProps=u.memoizedProps,v.memoizedState=u.memoizedState,v.updateQueue=u.updateQueue,h=u.dependencies,v.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},v.sibling=u.sibling,v.index=u.index,v.ref=u.ref,v.refCleanup=u.refCleanup,v}function oP(u,h){u.flags&=31457282;var v=u.alternate;return v===null?(u.childLanes=0,u.lanes=h,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=v.childLanes,u.lanes=v.lanes,u.child=v.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=v.memoizedProps,u.memoizedState=v.memoizedState,u.updateQueue=v.updateQueue,u.type=v.type,h=v.dependencies,u.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),u}function wy(u,h,v,b,C,A){var U=0;if(b=u,typeof u=="function")S1(u)&&(U=1);else if(typeof u=="string")U=HX(u,v,He.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case c:return iu(v.children,C,A,h);case d:U=8,C|=24;break;case f:return u=Ri(12,v,h,C|2),u.elementType=f,u.lanes=A,u;case x:return u=Ri(13,v,h,C),u.elementType=x,u.lanes=A,u;case w:return u=Ri(19,v,h,C),u.elementType=w,u.lanes=A,u;case k:return lP(v,C,A,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case p:case g:U=10;break e;case m:U=9;break e;case y:U=11;break e;case _:U=14;break e;case S:U=16,b=null;break e}U=29,v=Error(n(130,u===null?"null":typeof u,"")),b=null}return h=Ri(U,v,h,C),h.elementType=u,h.type=b,h.lanes=A,h}function iu(u,h,v,b){return u=Ri(7,u,b,h),u.lanes=v,u}function lP(u,h,v,b){u=Ri(22,u,b,h),u.elementType=k,u.lanes=v;var C={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var A=C._current;if(A===null)throw Error(n(456));if((C._pendingVisibility&2)===0){var U=Cl(A,2);U!==null&&(C._pendingVisibility|=2,Ds(U,A,2))}},attach:function(){var A=C._current;if(A===null)throw Error(n(456));if((C._pendingVisibility&2)!==0){var U=Cl(A,2);U!==null&&(C._pendingVisibility&=-3,Ds(U,A,2))}}};return u.stateNode=C,u}function k1(u,h,v){return u=Ri(6,u,null,h),u.lanes=v,u}function E1(u,h,v){return h=Ri(4,u.children!==null?u.children:[],u.key,h),h.lanes=v,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function Bo(u){u.flags|=4}function cP(u,h){if(h.type!=="stylesheet"||(h.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!GP(h)){if(h=ji.current,h!==null&&((Wt&4194176)===Wt?Ua!==null:(Wt&62914560)!==Wt&&(Wt&536870912)===0||h!==Ua))throw ap=Aw,CD;u.flags|=8192}}function Sy(u,h){h!==null&&(u.flags|=4),u.flags&16384&&(h=u.tag!==22?Pv():536870912,u.lanes|=h,Bd|=h)}function Sp(u,h){if(!Zt)switch(u.tailMode){case"hidden":h=u.tail;for(var v=null;h!==null;)h.alternate!==null&&(v=h),h=h.sibling;v===null?u.tail=null:v.sibling=null;break;case"collapsed":v=u.tail;for(var b=null;v!==null;)v.alternate!==null&&(b=v),v=v.sibling;b===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:b.sibling=null}}function Ur(u){var h=u.alternate!==null&&u.alternate.child===u.child,v=0,b=0;if(h)for(var C=u.child;C!==null;)v|=C.lanes|C.childLanes,b|=C.subtreeFlags&31457280,b|=C.flags&31457280,C.return=u,C=C.sibling;else for(C=u.child;C!==null;)v|=C.lanes|C.childLanes,b|=C.subtreeFlags,b|=C.flags,C.return=u,C=C.sibling;return u.subtreeFlags|=b,u.childLanes=v,h}function aX(u,h,v){var b=h.pendingProps;switch(jw(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ur(h),null;case 1:return Ur(h),null;case 3:return v=h.stateNode,b=null,u!==null&&(b=u.memoizedState.cache),h.memoizedState.cache!==b&&(h.flags|=2048),Mo(kn),X(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(u===null||u.child===null)&&(rp(h)?Bo(h):u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Zi!==null&&(O1(Zi),Zi=null))),Ur(h),null;case 26:return v=h.memoizedState,u===null?(Bo(h),v!==null?(Ur(h),cP(h,v)):(Ur(h),h.flags&=-16777217)):v?v!==u.memoizedState?(Bo(h),Ur(h),cP(h,v)):(Ur(h),h.flags&=-16777217):(u.memoizedProps!==b&&Bo(h),Ur(h),h.flags&=-16777217),null;case 27:Z(h),v=lt.current;var C=h.type;if(u!==null&&h.stateNode!=null)u.memoizedProps!==b&&Bo(h);else{if(!b){if(h.stateNode===null)throw Error(n(166));return Ur(h),null}u=He.current,rp(h)?kD(h):(u=BP(C,b,v),h.stateNode=u,Bo(h))}return Ur(h),null;case 5:if(Z(h),v=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==b&&Bo(h);else{if(!b){if(h.stateNode===null)throw Error(n(166));return Ur(h),null}if(u=He.current,rp(h))kD(h);else{switch(C=Py(lt.current),u){case 1:u=C.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:u=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":u=C.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":u=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":u=C.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof b.is=="string"?C.createElement("select",{is:b.is}):C.createElement("select"),b.multiple?u.multiple=!0:b.size&&(u.size=b.size);break;default:u=typeof b.is=="string"?C.createElement(v,{is:b.is}):C.createElement(v)}}u[Mn]=h,u[ps]=b;e:for(C=h.child;C!==null;){if(C.tag===5||C.tag===6)u.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===h)break e;for(;C.sibling===null;){if(C.return===null||C.return===h)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}h.stateNode=u;e:switch(es(u,v,b),v){case"button":case"input":case"select":case"textarea":u=!!b.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Bo(h)}}return Ur(h),h.flags&=-16777217,null;case 6:if(u&&h.stateNode!=null)u.memoizedProps!==b&&Bo(h);else{if(typeof b!="string"&&h.stateNode===null)throw Error(n(166));if(u=lt.current,rp(h)){if(u=h.stateNode,v=h.memoizedProps,b=null,C=Rs,C!==null)switch(C.tag){case 27:case 5:b=C.memoizedProps}u[Mn]=h,u=!!(u.nodeValue===v||b!==null&&b.suppressHydrationWarning===!0||OP(u.nodeValue,v)),u||Yc(h)}else u=Py(u).createTextNode(b),u[Mn]=h,h.stateNode=u}return Ur(h),null;case 13:if(b=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(C=rp(h),b!==null&&b.dehydrated!==null){if(u===null){if(!C)throw Error(n(318));if(C=h.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[Mn]=h}else np(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Ur(h),C=!1}else Zi!==null&&(O1(Zi),Zi=null),C=!0;if(!C)return h.flags&256?(Ro(h),h):(Ro(h),null)}if(Ro(h),(h.flags&128)!==0)return h.lanes=v,h;if(v=b!==null,u=u!==null&&u.memoizedState!==null,v){b=h.child,C=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(C=b.alternate.memoizedState.cachePool.pool);var A=null;b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(A=b.memoizedState.cachePool.pool),A!==C&&(b.flags|=2048)}return v!==u&&v&&(h.child.flags|=8192),Sy(h,h.updateQueue),Ur(h),null;case 4:return X(),u===null&&H1(h.stateNode.containerInfo),Ur(h),null;case 10:return Mo(h.type),Ur(h),null;case 19:if(ke(Sn),C=h.memoizedState,C===null)return Ur(h),null;if(b=(h.flags&128)!==0,A=C.rendering,A===null)if(b)Sp(C,!1);else{if(Qr!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if(A=ay(u),A!==null){for(h.flags|=128,Sp(C,!1),u=A.updateQueue,h.updateQueue=u,Sy(h,u),h.subtreeFlags=0,u=v,v=h.child;v!==null;)oP(v,u),v=v.sibling;return Oe(Sn,Sn.current&1|2),h.child}u=u.sibling}C.tail!==null&&Ne()>ky&&(h.flags|=128,b=!0,Sp(C,!1),h.lanes=4194304)}else{if(!b)if(u=ay(A),u!==null){if(h.flags|=128,b=!0,u=u.updateQueue,h.updateQueue=u,Sy(h,u),Sp(C,!0),C.tail===null&&C.tailMode==="hidden"&&!A.alternate&&!Zt)return Ur(h),null}else 2*Ne()-C.renderingStartTime>ky&&v!==536870912&&(h.flags|=128,b=!0,Sp(C,!1),h.lanes=4194304);C.isBackwards?(A.sibling=h.child,h.child=A):(u=C.last,u!==null?u.sibling=A:h.child=A,C.last=A)}return C.tail!==null?(h=C.tail,C.rendering=h,C.tail=h.sibling,C.renderingStartTime=Ne(),h.sibling=null,u=Sn.current,Oe(Sn,b?u&1|2:u&1),h):(Ur(h),null);case 22:case 23:return Ro(h),Dw(),b=h.memoizedState!==null,u!==null?u.memoizedState!==null!==b&&(h.flags|=8192):b&&(h.flags|=8192),b?(v&536870912)!==0&&(h.flags&128)===0&&(Ur(h),h.subtreeFlags&6&&(h.flags|=8192)):Ur(h),v=h.updateQueue,v!==null&&Sy(h,v.retryQueue),v=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),b=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(b=h.memoizedState.cachePool.pool),b!==v&&(h.flags|=2048),u!==null&&ke(Xc),null;case 24:return v=null,u!==null&&(v=u.memoizedState.cache),h.memoizedState.cache!==v&&(h.flags|=2048),Mo(kn),Ur(h),null;case 25:return null}throw Error(n(156,h.tag))}function oX(u,h){switch(jw(h),h.tag){case 1:return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return Mo(kn),X(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 26:case 27:case 5:return Z(h),null;case 13:if(Ro(h),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));np()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return ke(Sn),null;case 4:return X(),null;case 10:return Mo(h.type),null;case 22:case 23:return Ro(h),Dw(),u!==null&&ke(Xc),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 24:return Mo(kn),null;case 25:return null;default:return null}}function uP(u,h){switch(jw(h),h.tag){case 3:Mo(kn),X();break;case 26:case 27:case 5:Z(h);break;case 4:X();break;case 13:Ro(h);break;case 19:ke(Sn);break;case 10:Mo(h.type);break;case 22:case 23:Ro(h),Dw(),u!==null&&ke(Xc);break;case 24:Mo(kn)}}var lX={getCacheForType:function(u){var h=gs(kn),v=h.data.get(u);return v===void 0&&(v=u(),h.data.set(u,v)),v}},cX=typeof WeakMap=="function"?WeakMap:Map,Vr=0,kr=null,It=null,Wt=0,Er=0,li=null,Fo=!1,$d=!1,C1=!1,zo=0,Qr=0,Bl=0,au=0,N1=0,Di=0,Bd=0,kp=null,Ha=null,j1=!1,T1=0,ky=1/0,Ey=null,Fl=null,Cy=!1,ou=null,Ep=0,A1=0,R1=null,Cp=0,D1=null;function ci(){if((Vr&2)!==0&&Wt!==0)return Wt&-Wt;if(L.T!==null){var u=Ad;return u!==0?u:F1()}return $v()}function dP(){Di===0&&(Di=(Wt&536870912)===0||Zt?Ov():536870912);var u=ji.current;return u!==null&&(u.flags|=32),Di}function Ds(u,h,v){(u===kr&&Er===2||u.cancelPendingCommit!==null)&&(Fd(u,0),Uo(u,Wt,Di,!1)),Uc(u,v),((Vr&2)===0||u!==kr)&&(u===kr&&((Vr&2)===0&&(au|=v),Qr===4&&Uo(u,Wt,Di,!1)),qa(u))}function hP(u,h,v){if((Vr&6)!==0)throw Error(n(327));var b=!v&&(h&60)===0&&(h&u.expiredLanes)===0||zc(u,h),C=b?hX(u,h):I1(u,h,!0),A=b;do{if(C===0){$d&&!b&&Uo(u,h,0,!1);break}else if(C===6)Uo(u,h,0,!Fo);else{if(v=u.current.alternate,A&&!uX(v)){C=I1(u,h,!1),A=!1;continue}if(C===2){if(A=h,u.errorRecoveryDisabledLanes&A)var U=0;else U=u.pendingLanes&-536870913,U=U!==0?U:U&536870912?536870912:0;if(U!==0){h=U;e:{var ee=u;C=kp;var se=ee.current.memoizedState.isDehydrated;if(se&&(Fd(ee,U).flags|=256),U=I1(ee,U,!1),U!==2){if(C1&&!se){ee.errorRecoveryDisabledLanes|=A,au|=A,C=4;break e}A=Ha,Ha=C,A!==null&&O1(A)}C=U}if(A=!1,C!==2)continue}}if(C===1){Fd(u,0),Uo(u,h,0,!0);break}e:{switch(b=u,C){case 0:case 1:throw Error(n(345));case 4:if((h&4194176)===h){Uo(b,h,Di,!Fo);break e}break;case 2:Ha=null;break;case 3:case 5:break;default:throw Error(n(329))}if(b.finishedWork=v,b.finishedLanes=h,(h&62914560)===h&&(A=T1+300-Ne(),10<A)){if(Uo(b,h,Di,!Fo),md(b,0)!==0)break e;b.timeoutHandle=IP(fP.bind(null,b,v,Ha,Ey,j1,h,Di,au,Bd,Fo,2,-0,0),A);break e}fP(b,v,Ha,Ey,j1,h,Di,au,Bd,Fo,0,-0,0)}}break}while(!0);qa(u)}function O1(u){Ha===null?Ha=u:Ha.push.apply(Ha,u)}function fP(u,h,v,b,C,A,U,ee,se,de,Te,Fe,_e){var Ee=h.subtreeFlags;if((Ee&8192||(Ee&16785408)===16785408)&&(Dp={stylesheets:null,count:0,unsuspend:qX},nP(h),h=GX(),h!==null)){u.cancelPendingCommit=h(_P.bind(null,u,v,b,C,U,ee,se,1,Fe,_e)),Uo(u,A,U,!de);return}_P(u,v,b,C,U,ee,se,Te,Fe,_e)}function uX(u){for(var h=u;;){var v=h.tag;if((v===0||v===11||v===15)&&h.flags&16384&&(v=h.updateQueue,v!==null&&(v=v.stores,v!==null)))for(var b=0;b<v.length;b++){var C=v[b],A=C.getSnapshot;C=C.value;try{if(!ii(A(),C))return!1}catch{return!1}}if(v=h.child,h.subtreeFlags&16384&&v!==null)v.return=h,h=v;else{if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function Uo(u,h,v,b){h&=~N1,h&=~au,u.suspendedLanes|=h,u.pingedLanes&=~h,b&&(u.warmLanes|=h),b=u.expirationTimes;for(var C=h;0<C;){var A=31-jr(C),U=1<<A;b[A]=-1,C&=~U}v!==0&&Mv(u,v,h)}function Ny(){return(Vr&6)===0?(Np(0),!1):!0}function P1(){if(It!==null){if(Er===0)var u=It.return;else u=It,Po=ru=null,Fw(u),jd=null,op=0,u=It;for(;u!==null;)uP(u.alternate,u),u=u.return;It=null}}function Fd(u,h){u.finishedWork=null,u.finishedLanes=0;var v=u.timeoutHandle;v!==-1&&(u.timeoutHandle=-1,TX(v)),v=u.cancelPendingCommit,v!==null&&(u.cancelPendingCommit=null,v()),P1(),kr=u,It=v=$l(u.current,null),Wt=h,Er=0,li=null,Fo=!1,$d=zc(u,h),C1=!1,Bd=Di=N1=au=Bl=Qr=0,Ha=kp=null,j1=!1,(h&8)!==0&&(h|=h&32);var b=u.entangledLanes;if(b!==0)for(u=u.entanglements,b&=h;0<b;){var C=31-jr(b),A=1<<C;h|=u[C],b&=~A}return zo=h,Xv(),v}function pP(u,h){At=null,L.H=Va,h===ip?(h=TD(),Er=3):h===CD?(h=TD(),Er=4):Er=h===NO?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,li=h,It===null&&(Qr=1,vy(u,Ei(h,u.current)))}function mP(){var u=L.H;return L.H=Va,u===null?Va:u}function gP(){var u=L.A;return L.A=lX,u}function M1(){Qr=4,Fo||(Wt&4194176)!==Wt&&ji.current!==null||($d=!0),(Bl&134217727)===0&&(au&134217727)===0||kr===null||Uo(kr,Wt,Di,!1)}function I1(u,h,v){var b=Vr;Vr|=2;var C=mP(),A=gP();(kr!==u||Wt!==h)&&(Ey=null,Fd(u,h)),h=!1;var U=Qr;e:do try{if(Er!==0&&It!==null){var ee=It,se=li;switch(Er){case 8:P1(),U=6;break e;case 3:case 2:case 6:ji.current===null&&(h=!0);var de=Er;if(Er=0,li=null,zd(u,ee,se,de),v&&$d){U=0;break e}break;default:de=Er,Er=0,li=null,zd(u,ee,se,de)}}dX(),U=Qr;break}catch(Te){pP(u,Te)}while(!0);return h&&u.shellSuspendCounter++,Po=ru=null,Vr=b,L.H=C,L.A=A,It===null&&(kr=null,Wt=0,Xv()),U}function dX(){for(;It!==null;)vP(It)}function hX(u,h){var v=Vr;Vr|=2;var b=mP(),C=gP();kr!==u||Wt!==h?(Ey=null,ky=Ne()+500,Fd(u,h)):$d=zc(u,h);e:do try{if(Er!==0&&It!==null){h=It;var A=li;t:switch(Er){case 1:Er=0,li=null,zd(u,h,A,1);break;case 2:if(ND(A)){Er=0,li=null,yP(h);break}h=function(){Er===2&&kr===u&&(Er=7),qa(u)},A.then(h,h);break e;case 3:Er=7;break e;case 4:Er=5;break e;case 7:ND(A)?(Er=0,li=null,yP(h)):(Er=0,li=null,zd(u,h,A,7));break;case 5:var U=null;switch(It.tag){case 26:U=It.memoizedState;case 5:case 27:var ee=It;if(!U||GP(U)){Er=0,li=null;var se=ee.sibling;if(se!==null)It=se;else{var de=ee.return;de!==null?(It=de,jy(de)):It=null}break t}}Er=0,li=null,zd(u,h,A,5);break;case 6:Er=0,li=null,zd(u,h,A,6);break;case 8:P1(),Qr=6;break e;default:throw Error(n(462))}}fX();break}catch(Te){pP(u,Te)}while(!0);return Po=ru=null,L.H=b,L.A=C,Vr=v,It!==null?0:(kr=null,Wt=0,Xv(),Qr)}function fX(){for(;It!==null&&!oe();)vP(It)}function vP(u){var h=BO(u.alternate,u,zo);u.memoizedProps=u.pendingProps,h===null?jy(u):It=h}function yP(u){var h=u,v=h.alternate;switch(h.tag){case 15:case 0:h=OO(v,h,h.pendingProps,h.type,void 0,Wt);break;case 11:h=OO(v,h,h.pendingProps,h.type.render,h.ref,Wt);break;case 5:Fw(h);default:uP(v,h),h=It=oP(h,zo),h=BO(v,h,zo)}u.memoizedProps=u.pendingProps,h===null?jy(u):It=h}function zd(u,h,v,b){Po=ru=null,Fw(h),jd=null,op=0;var C=h.return;try{if(tX(u,C,h,v,Wt)){Qr=1,vy(u,Ei(v,u.current)),It=null;return}}catch(A){if(C!==null)throw It=C,A;Qr=1,vy(u,Ei(v,u.current)),It=null;return}h.flags&32768?(Zt||b===1?u=!0:$d||(Wt&536870912)!==0?u=!1:(Fo=u=!0,(b===2||b===3||b===6)&&(b=ji.current,b!==null&&b.tag===13&&(b.flags|=16384))),xP(h,u)):jy(h)}function jy(u){var h=u;do{if((h.flags&32768)!==0){xP(h,Fo);return}u=h.return;var v=aX(h.alternate,h,zo);if(v!==null){It=v;return}if(h=h.sibling,h!==null){It=h;return}It=h=u}while(h!==null);Qr===0&&(Qr=5)}function xP(u,h){do{var v=oX(u.alternate,u);if(v!==null){v.flags&=32767,It=v;return}if(v=u.return,v!==null&&(v.flags|=32768,v.subtreeFlags=0,v.deletions=null),!h&&(u=u.sibling,u!==null)){It=u;return}It=u=v}while(u!==null);Qr=6,It=null}function _P(u,h,v,b,C,A,U,ee,se,de){var Te=L.T,Fe=J.p;try{J.p=2,L.T=null,pX(u,h,v,b,Fe,C,A,U,ee,se,de)}finally{L.T=Te,J.p=Fe}}function pX(u,h,v,b,C,A,U,ee){do Ud();while(ou!==null);if((Vr&6)!==0)throw Error(n(327));var se=u.finishedWork;if(b=u.finishedLanes,se===null)return null;if(u.finishedWork=null,u.finishedLanes=0,se===u.current)throw Error(n(177));u.callbackNode=null,u.callbackPriority=0,u.cancelPendingCommit=null;var de=se.lanes|se.childLanes;if(de|=Ew,rw(u,b,de,A,U,ee),u===kr&&(It=kr=null,Wt=0),(se.subtreeFlags&10256)===0&&(se.flags&10256)===0||Cy||(Cy=!0,A1=de,R1=v,yX(qe,function(){return Ud(),null})),v=(se.flags&15990)!==0,(se.subtreeFlags&15990)!==0||v?(v=L.T,L.T=null,A=J.p,J.p=2,U=Vr,Vr|=4,nX(u,se),eP(se,u),$Q(K1,u.containerInfo),Fy=!!G1,K1=G1=null,u.current=se,QO(u,se.alternate,se),Ae(),Vr=U,J.p=A,L.T=v):u.current=se,Cy?(Cy=!1,ou=u,Ep=b):bP(u,de),de=u.pendingLanes,de===0&&(Fl=null),si(se.stateNode),qa(u),h!==null)for(C=u.onRecoverableError,se=0;se<h.length;se++)de=h[se],C(de.value,{componentStack:de.stack});return(Ep&3)!==0&&Ud(),de=u.pendingLanes,(b&4194218)!==0&&(de&42)!==0?u===D1?Cp++:(Cp=0,D1=u):Cp=0,Np(0),null}function bP(u,h){(u.pooledCacheLanes&=h)===0&&(h=u.pooledCache,h!=null&&(u.pooledCache=null,cp(h)))}function Ud(){if(ou!==null){var u=ou,h=A1;A1=0;var v=Lv(Ep),b=L.T,C=J.p;try{if(J.p=32>v?32:v,L.T=null,ou===null)var A=!1;else{v=R1,R1=null;var U=ou,ee=Ep;if(ou=null,Ep=0,(Vr&6)!==0)throw Error(n(331));var se=Vr;if(Vr|=4,iP(U.current),rP(U,U.current,ee,v),Vr=se,Np(0,!1),Sr&&typeof Sr.onPostCommitFiberRoot=="function")try{Sr.onPostCommitFiberRoot(Tt,U)}catch{}A=!0}return A}finally{J.p=C,L.T=b,bP(u,h)}}return!1}function wP(u,h,v){h=Ei(v,h),h=e1(u.stateNode,h,2),u=Pl(u,h,2),u!==null&&(Uc(u,2),qa(u))}function vr(u,h,v){if(u.tag===3)wP(u,u,v);else for(;h!==null;){if(h.tag===3){wP(h,u,v);break}else if(h.tag===1){var b=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Fl===null||!Fl.has(b))){u=Ei(v,u),v=EO(2),b=Pl(h,v,2),b!==null&&(CO(v,b,h,u),Uc(b,2),qa(b));break}}h=h.return}}function L1(u,h,v){var b=u.pingCache;if(b===null){b=u.pingCache=new cX;var C=new Set;b.set(h,C)}else C=b.get(h),C===void 0&&(C=new Set,b.set(h,C));C.has(v)||(C1=!0,C.add(v),u=mX.bind(null,u,h,v),h.then(u,u))}function mX(u,h,v){var b=u.pingCache;b!==null&&b.delete(h),u.pingedLanes|=u.suspendedLanes&v,u.warmLanes&=~v,kr===u&&(Wt&v)===v&&(Qr===4||Qr===3&&(Wt&62914560)===Wt&&300>Ne()-T1?(Vr&2)===0&&Fd(u,0):N1|=v,Bd===Wt&&(Bd=0)),qa(u)}function SP(u,h){h===0&&(h=Pv()),u=Cl(u,h),u!==null&&(Uc(u,h),qa(u))}function gX(u){var h=u.memoizedState,v=0;h!==null&&(v=h.retryLane),SP(u,v)}function vX(u,h){var v=0;switch(u.tag){case 13:var b=u.stateNode,C=u.memoizedState;C!==null&&(v=C.retryLane);break;case 19:b=u.stateNode;break;case 22:b=u.stateNode._retryCache;break;default:throw Error(n(314))}b!==null&&b.delete(h),SP(u,v)}function yX(u,h){return ae(u,h)}var Ty=null,Vd=null,$1=!1,Ay=!1,B1=!1,lu=0;function qa(u){u!==Vd&&u.next===null&&(Vd===null?Ty=Vd=u:Vd=Vd.next=u),Ay=!0,$1||($1=!0,_X(xX))}function Np(u,h){if(!B1&&Ay){B1=!0;do for(var v=!1,b=Ty;b!==null;){if(u!==0){var C=b.pendingLanes;if(C===0)var A=0;else{var U=b.suspendedLanes,ee=b.pingedLanes;A=(1<<31-jr(42|u)+1)-1,A&=C&~(U&~ee),A=A&201326677?A&201326677|1:A?A|2:0}A!==0&&(v=!0,CP(b,A))}else A=Wt,A=md(b,b===kr?A:0),(A&3)===0||zc(b,A)||(v=!0,CP(b,A));b=b.next}while(v);B1=!1}}function xX(){Ay=$1=!1;var u=0;lu!==0&&(jX()&&(u=lu),lu=0);for(var h=Ne(),v=null,b=Ty;b!==null;){var C=b.next,A=kP(b,h);A===0?(b.next=null,v===null?Ty=C:v.next=C,C===null&&(Vd=v)):(v=b,(u!==0||(A&3)!==0)&&(Ay=!0)),b=C}Np(u)}function kP(u,h){for(var v=u.suspendedLanes,b=u.pingedLanes,C=u.expirationTimes,A=u.pendingLanes&-62914561;0<A;){var U=31-jr(A),ee=1<<U,se=C[U];se===-1?((ee&v)===0||(ee&b)!==0)&&(C[U]=tw(ee,h)):se<=h&&(u.expiredLanes|=ee),A&=~ee}if(h=kr,v=Wt,v=md(u,u===h?v:0),b=u.callbackNode,v===0||u===h&&Er===2||u.cancelPendingCommit!==null)return b!==null&&b!==null&&fe(b),u.callbackNode=null,u.callbackPriority=0;if((v&3)===0||zc(u,v)){if(h=v&-v,h===u.callbackPriority)return h;switch(b!==null&&fe(b),Lv(v)){case 2:case 8:v=De;break;case 32:v=qe;break;case 268435456:v=Ot;break;default:v=qe}return b=EP.bind(null,u),v=ae(v,b),u.callbackPriority=h,u.callbackNode=v,h}return b!==null&&b!==null&&fe(b),u.callbackPriority=2,u.callbackNode=null,2}function EP(u,h){var v=u.callbackNode;if(Ud()&&u.callbackNode!==v)return null;var b=Wt;return b=md(u,u===kr?b:0),b===0?null:(hP(u,b,h),kP(u,Ne()),u.callbackNode!=null&&u.callbackNode===v?EP.bind(null,u):null)}function CP(u,h){if(Ud())return null;hP(u,h,!0)}function _X(u){AX(function(){(Vr&6)!==0?ae(pe,u):u()})}function F1(){return lu===0&&(lu=Ov()),lu}function NP(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:Hv(""+u)}function jP(u,h){var v=h.ownerDocument.createElement("input");return v.name=h.name,v.value=h.value,u.id&&v.setAttribute("form",u.id),h.parentNode.insertBefore(v,h),u=new FormData(u),v.parentNode.removeChild(v),u}function bX(u,h,v,b,C){if(h==="submit"&&v&&v.stateNode===C){var A=NP((C[ps]||null).action),U=b.submitter;U&&(h=(h=U[ps]||null)?NP(h.formAction):U.getAttribute("formAction"),h!==null&&(A=h,U=null));var ee=new Kv("action","action",null,b,C);u.push({event:ee,listeners:[{instance:null,listener:function(){if(b.defaultPrevented){if(lu!==0){var se=U?jP(C,U):new FormData(C);Yw(v,{pending:!0,data:se,method:C.method,action:A},null,se)}}else typeof A=="function"&&(ee.preventDefault(),se=U?jP(C,U):new FormData(C),Yw(v,{pending:!0,data:se,method:C.method,action:A},A,se))},currentTarget:C}]})}}for(var z1=0;z1<_D.length;z1++){var U1=_D[z1],wX=U1.toLowerCase(),SX=U1[0].toUpperCase()+U1.slice(1);Xi(wX,"on"+SX)}Xi(mD,"onAnimationEnd"),Xi(gD,"onAnimationIteration"),Xi(vD,"onAnimationStart"),Xi("dblclick","onDoubleClick"),Xi("focusin","onFocus"),Xi("focusout","onBlur"),Xi(FQ,"onTransitionRun"),Xi(zQ,"onTransitionStart"),Xi(UQ,"onTransitionCancel"),Xi(yD,"onTransitionEnd"),gd("onMouseEnter",["mouseout","mouseover"]),gd("onMouseLeave",["mouseout","mouseover"]),gd("onPointerEnter",["pointerout","pointerover"]),gd("onPointerLeave",["pointerout","pointerover"]),ms("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ms("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ms("onBeforeInput",["compositionend","keypress","textInput","paste"]),ms("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ms("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ms("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var jp="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(" "),kX=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(jp));function TP(u,h){h=(h&4)!==0;for(var v=0;v<u.length;v++){var b=u[v],C=b.event;b=b.listeners;e:{var A=void 0;if(h)for(var U=b.length-1;0<=U;U--){var ee=b[U],se=ee.instance,de=ee.currentTarget;if(ee=ee.listener,se!==A&&C.isPropagationStopped())break e;A=ee,C.currentTarget=de;try{A(C)}catch(Te){gy(Te)}C.currentTarget=null,A=se}else for(U=0;U<b.length;U++){if(ee=b[U],se=ee.instance,de=ee.currentTarget,ee=ee.listener,se!==A&&C.isPropagationStopped())break e;A=ee,C.currentTarget=de;try{A(C)}catch(Te){gy(Te)}C.currentTarget=null,A=se}}}}function Ut(u,h){var v=h[qf];v===void 0&&(v=h[qf]=new Set);var b=u+"__bubble";v.has(b)||(AP(h,u,2,!1),v.add(b))}function V1(u,h,v){var b=0;h&&(b|=4),AP(v,u,b,h)}var Ry="_reactListening"+Math.random().toString(36).slice(2);function H1(u){if(!u[Ry]){u[Ry]=!0,sr.forEach(function(v){v!=="selectionchange"&&(kX.has(v)||V1(v,!1,u),V1(v,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[Ry]||(h[Ry]=!0,V1("selectionchange",!1,h))}}function AP(u,h,v,b){switch(JP(h)){case 2:var C=QX;break;case 8:C=XX;break;default:C=nS}v=C.bind(null,h,v,u),C=void 0,!hw||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(C=!0),b?C!==void 0?u.addEventListener(h,v,{capture:!0,passive:C}):u.addEventListener(h,v,!0):C!==void 0?u.addEventListener(h,v,{passive:C}):u.addEventListener(h,v,!1)}function q1(u,h,v,b,C){var A=b;if((h&1)===0&&(h&2)===0&&b!==null)e:for(;;){if(b===null)return;var U=b.tag;if(U===3||U===4){var ee=b.stateNode.containerInfo;if(ee===C||ee.nodeType===8&&ee.parentNode===C)break;if(U===4)for(U=b.return;U!==null;){var se=U.tag;if((se===3||se===4)&&(se=U.stateNode.containerInfo,se===C||se.nodeType===8&&se.parentNode===C))return;U=U.return}for(;ee!==null;){if(U=Co(ee),U===null)return;if(se=U.tag,se===5||se===6||se===26||se===27){b=A=U;continue e}ee=ee.parentNode}}b=b.return}qR(function(){var de=A,Te=uw(v),Fe=[];e:{var _e=xD.get(u);if(_e!==void 0){var Ee=Kv,ct=u;switch(u){case"keypress":if(Wv(v)===0)break e;case"keydown":case"keyup":Ee=vQ;break;case"focusin":ct="focus",Ee=gw;break;case"focusout":ct="blur",Ee=gw;break;case"beforeblur":case"afterblur":Ee=gw;break;case"click":if(v.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ee=KR;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ee=iQ;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ee=_Q;break;case mD:case gD:case vD:Ee=lQ;break;case yD:Ee=wQ;break;case"scroll":case"scrollend":Ee=nQ;break;case"wheel":Ee=kQ;break;case"copy":case"cut":case"paste":Ee=uQ;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ee=QR;break;case"toggle":case"beforetoggle":Ee=CQ}var wt=(h&4)!==0,Xr=!wt&&(u==="scroll"||u==="scrollend"),ge=wt?_e!==null?_e+"Capture":null:_e;wt=[];for(var ce=de,ye;ce!==null;){var Pe=ce;if(ye=Pe.stateNode,Pe=Pe.tag,Pe!==5&&Pe!==26&&Pe!==27||ye===null||ge===null||(Pe=Gf(ce,ge),Pe!=null&&wt.push(Tp(ce,Pe,ye))),Xr)break;ce=ce.return}0<wt.length&&(_e=new Ee(_e,ct,null,v,Te),Fe.push({event:_e,listeners:wt}))}}if((h&7)===0){e:{if(_e=u==="mouseover"||u==="pointerover",Ee=u==="mouseout"||u==="pointerout",_e&&v!==cw&&(ct=v.relatedTarget||v.fromElement)&&(Co(ct)||ct[kl]))break e;if((Ee||_e)&&(_e=Te.window===Te?Te:(_e=Te.ownerDocument)?_e.defaultView||_e.parentWindow:window,Ee?(ct=v.relatedTarget||v.toElement,Ee=de,ct=ct?Co(ct):null,ct!==null&&(Xr=K(ct),wt=ct.tag,ct!==Xr||wt!==5&&wt!==27&&wt!==6)&&(ct=null)):(Ee=null,ct=de),Ee!==ct)){if(wt=KR,Pe="onMouseLeave",ge="onMouseEnter",ce="mouse",(u==="pointerout"||u==="pointerover")&&(wt=QR,Pe="onPointerLeave",ge="onPointerEnter",ce="pointer"),Xr=Ee==null?_e:be(Ee),ye=ct==null?_e:be(ct),_e=new wt(Pe,ce+"leave",Ee,v,Te),_e.target=Xr,_e.relatedTarget=ye,Pe=null,Co(Te)===de&&(wt=new wt(ge,ce+"enter",ct,v,Te),wt.target=ye,wt.relatedTarget=Xr,Pe=wt),Xr=Pe,Ee&&ct)t:{for(wt=Ee,ge=ct,ce=0,ye=wt;ye;ye=Hd(ye))ce++;for(ye=0,Pe=ge;Pe;Pe=Hd(Pe))ye++;for(;0<ce-ye;)wt=Hd(wt),ce--;for(;0<ye-ce;)ge=Hd(ge),ye--;for(;ce--;){if(wt===ge||ge!==null&&wt===ge.alternate)break t;wt=Hd(wt),ge=Hd(ge)}wt=null}else wt=null;Ee!==null&&RP(Fe,_e,Ee,wt,!1),ct!==null&&Xr!==null&&RP(Fe,Xr,ct,wt,!0)}}e:{if(_e=de?be(de):window,Ee=_e.nodeName&&_e.nodeName.toLowerCase(),Ee==="select"||Ee==="input"&&_e.type==="file")var nt=sD;else if(rD(_e))if(iD)nt=IQ;else{nt=PQ;var Pt=OQ}else Ee=_e.nodeName,!Ee||Ee.toLowerCase()!=="input"||_e.type!=="checkbox"&&_e.type!=="radio"?de&&lw(de.elementType)&&(nt=sD):nt=MQ;if(nt&&(nt=nt(u,de))){nD(Fe,nt,v,Te);break e}Pt&&Pt(u,_e,de),u==="focusout"&&de&&_e.type==="number"&&de.memoizedProps.value!=null&&ow(_e,"number",_e.value)}switch(Pt=de?be(de):window,u){case"focusin":(rD(Pt)||Pt.contentEditable==="true")&&(wd=Pt,ww=de,tp=null);break;case"focusout":tp=ww=wd=null;break;case"mousedown":Sw=!0;break;case"contextmenu":case"mouseup":case"dragend":Sw=!1,fD(Fe,v,Te);break;case"selectionchange":if(BQ)break;case"keydown":case"keyup":fD(Fe,v,Te)}var ft;if(yw)e:{switch(u){case"compositionstart":var yt="onCompositionStart";break e;case"compositionend":yt="onCompositionEnd";break e;case"compositionupdate":yt="onCompositionUpdate";break e}yt=void 0}else bd?eD(u,v)&&(yt="onCompositionEnd"):u==="keydown"&&v.keyCode===229&&(yt="onCompositionStart");yt&&(XR&&v.locale!=="ko"&&(bd||yt!=="onCompositionStart"?yt==="onCompositionEnd"&&bd&&(ft=WR()):(El=Te,fw="value"in El?El.value:El.textContent,bd=!0)),Pt=Dy(de,yt),0<Pt.length&&(yt=new YR(yt,u,null,v,Te),Fe.push({event:yt,listeners:Pt}),ft?yt.data=ft:(ft=tD(v),ft!==null&&(yt.data=ft)))),(ft=jQ?TQ(u,v):AQ(u,v))&&(yt=Dy(de,"onBeforeInput"),0<yt.length&&(Pt=new YR("onBeforeInput","beforeinput",null,v,Te),Fe.push({event:Pt,listeners:yt}),Pt.data=ft)),bX(Fe,u,de,v,Te)}TP(Fe,h)})}function Tp(u,h,v){return{instance:u,listener:h,currentTarget:v}}function Dy(u,h){for(var v=h+"Capture",b=[];u!==null;){var C=u,A=C.stateNode;C=C.tag,C!==5&&C!==26&&C!==27||A===null||(C=Gf(u,v),C!=null&&b.unshift(Tp(u,C,A)),C=Gf(u,h),C!=null&&b.push(Tp(u,C,A))),u=u.return}return b}function Hd(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function RP(u,h,v,b,C){for(var A=h._reactName,U=[];v!==null&&v!==b;){var ee=v,se=ee.alternate,de=ee.stateNode;if(ee=ee.tag,se!==null&&se===b)break;ee!==5&&ee!==26&&ee!==27||de===null||(se=de,C?(de=Gf(v,A),de!=null&&U.unshift(Tp(v,de,se))):C||(de=Gf(v,A),de!=null&&U.push(Tp(v,de,se)))),v=v.return}U.length!==0&&u.push({event:h,listeners:U})}var EX=/\r\n?/g,CX=/\u0000|\uFFFD/g;function DP(u){return(typeof u=="string"?u:""+u).replace(EX,`
|
||
`).replace(CX,"")}function OP(u,h){return h=DP(h),DP(u)===h}function Oy(){}function dr(u,h,v,b,C,A){switch(v){case"children":typeof b=="string"?h==="body"||h==="textarea"&&b===""||yd(u,b):(typeof b=="number"||typeof b=="bigint")&&h!=="body"&&yd(u,""+b);break;case"className":zv(u,"class",b);break;case"tabIndex":zv(u,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":zv(u,v,b);break;case"style":VR(u,b,A);break;case"data":if(h!=="object"){zv(u,"data",b);break}case"src":case"href":if(b===""&&(h!=="a"||v!=="href")){u.removeAttribute(v);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){u.removeAttribute(v);break}b=Hv(""+b),u.setAttribute(v,b);break;case"action":case"formAction":if(typeof b=="function"){u.setAttribute(v,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof A=="function"&&(v==="formAction"?(h!=="input"&&dr(u,h,"name",C.name,C,null),dr(u,h,"formEncType",C.formEncType,C,null),dr(u,h,"formMethod",C.formMethod,C,null),dr(u,h,"formTarget",C.formTarget,C,null)):(dr(u,h,"encType",C.encType,C,null),dr(u,h,"method",C.method,C,null),dr(u,h,"target",C.target,C,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){u.removeAttribute(v);break}b=Hv(""+b),u.setAttribute(v,b);break;case"onClick":b!=null&&(u.onclick=Oy);break;case"onScroll":b!=null&&Ut("scroll",u);break;case"onScrollEnd":b!=null&&Ut("scrollend",u);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(v=b.__html,v!=null){if(C.children!=null)throw Error(n(60));u.innerHTML=v}}break;case"multiple":u.multiple=b&&typeof b!="function"&&typeof b!="symbol";break;case"muted":u.muted=b&&typeof b!="function"&&typeof b!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(b==null||typeof b=="function"||typeof b=="boolean"||typeof b=="symbol"){u.removeAttribute("xlink:href");break}v=Hv(""+b),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",v);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":b!=null&&typeof b!="function"&&typeof b!="symbol"?u.setAttribute(v,""+b):u.removeAttribute(v);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":b&&typeof b!="function"&&typeof b!="symbol"?u.setAttribute(v,""):u.removeAttribute(v);break;case"capture":case"download":b===!0?u.setAttribute(v,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?u.setAttribute(v,b):u.removeAttribute(v);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?u.setAttribute(v,b):u.removeAttribute(v);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?u.removeAttribute(v):u.setAttribute(v,b);break;case"popover":Ut("beforetoggle",u),Ut("toggle",u),Fv(u,"popover",b);break;case"xlinkActuate":jo(u,"http://www.w3.org/1999/xlink","xlink:actuate",b);break;case"xlinkArcrole":jo(u,"http://www.w3.org/1999/xlink","xlink:arcrole",b);break;case"xlinkRole":jo(u,"http://www.w3.org/1999/xlink","xlink:role",b);break;case"xlinkShow":jo(u,"http://www.w3.org/1999/xlink","xlink:show",b);break;case"xlinkTitle":jo(u,"http://www.w3.org/1999/xlink","xlink:title",b);break;case"xlinkType":jo(u,"http://www.w3.org/1999/xlink","xlink:type",b);break;case"xmlBase":jo(u,"http://www.w3.org/XML/1998/namespace","xml:base",b);break;case"xmlLang":jo(u,"http://www.w3.org/XML/1998/namespace","xml:lang",b);break;case"xmlSpace":jo(u,"http://www.w3.org/XML/1998/namespace","xml:space",b);break;case"is":Fv(u,"is",b);break;case"innerText":case"textContent":break;default:(!(2<v.length)||v[0]!=="o"&&v[0]!=="O"||v[1]!=="n"&&v[1]!=="N")&&(v=tQ.get(v)||v,Fv(u,v,b))}}function W1(u,h,v,b,C,A){switch(v){case"style":VR(u,b,A);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(v=b.__html,v!=null){if(C.children!=null)throw Error(n(60));u.innerHTML=v}}break;case"children":typeof b=="string"?yd(u,b):(typeof b=="number"||typeof b=="bigint")&&yd(u,""+b);break;case"onScroll":b!=null&&Ut("scroll",u);break;case"onScrollEnd":b!=null&&Ut("scrollend",u);break;case"onClick":b!=null&&(u.onclick=Oy);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dn.hasOwnProperty(v))e:{if(v[0]==="o"&&v[1]==="n"&&(C=v.endsWith("Capture"),h=v.slice(2,C?v.length-7:void 0),A=u[ps]||null,A=A!=null?A[v]:null,typeof A=="function"&&u.removeEventListener(h,A,C),typeof b=="function")){typeof A!="function"&&A!==null&&(v in u?u[v]=null:u.hasAttribute(v)&&u.removeAttribute(v)),u.addEventListener(h,b,C);break e}v in u?u[v]=b:b===!0?u.setAttribute(v,""):Fv(u,v,b)}}}function es(u,h,v){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ut("error",u),Ut("load",u);var b=!1,C=!1,A;for(A in v)if(v.hasOwnProperty(A)){var U=v[A];if(U!=null)switch(A){case"src":b=!0;break;case"srcSet":C=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,h));default:dr(u,h,A,U,v,null)}}C&&dr(u,h,"srcSet",v.srcSet,v,null),b&&dr(u,h,"src",v.src,v,null);return;case"input":Ut("invalid",u);var ee=A=U=C=null,se=null,de=null;for(b in v)if(v.hasOwnProperty(b)){var Te=v[b];if(Te!=null)switch(b){case"name":C=Te;break;case"type":U=Te;break;case"checked":se=Te;break;case"defaultChecked":de=Te;break;case"value":A=Te;break;case"defaultValue":ee=Te;break;case"children":case"dangerouslySetInnerHTML":if(Te!=null)throw Error(n(137,h));break;default:dr(u,h,b,Te,v,null)}}BR(u,A,ee,se,de,U,C,!1),Uv(u);return;case"select":Ut("invalid",u),b=U=A=null;for(C in v)if(v.hasOwnProperty(C)&&(ee=v[C],ee!=null))switch(C){case"value":A=ee;break;case"defaultValue":U=ee;break;case"multiple":b=ee;default:dr(u,h,C,ee,v,null)}h=A,v=U,u.multiple=!!b,h!=null?vd(u,!!b,h,!1):v!=null&&vd(u,!!b,v,!0);return;case"textarea":Ut("invalid",u),A=C=b=null;for(U in v)if(v.hasOwnProperty(U)&&(ee=v[U],ee!=null))switch(U){case"value":b=ee;break;case"defaultValue":C=ee;break;case"children":A=ee;break;case"dangerouslySetInnerHTML":if(ee!=null)throw Error(n(91));break;default:dr(u,h,U,ee,v,null)}zR(u,b,C,A),Uv(u);return;case"option":for(se in v)if(v.hasOwnProperty(se)&&(b=v[se],b!=null))switch(se){case"selected":u.selected=b&&typeof b!="function"&&typeof b!="symbol";break;default:dr(u,h,se,b,v,null)}return;case"dialog":Ut("cancel",u),Ut("close",u);break;case"iframe":case"object":Ut("load",u);break;case"video":case"audio":for(b=0;b<jp.length;b++)Ut(jp[b],u);break;case"image":Ut("error",u),Ut("load",u);break;case"details":Ut("toggle",u);break;case"embed":case"source":case"link":Ut("error",u),Ut("load",u);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(de in v)if(v.hasOwnProperty(de)&&(b=v[de],b!=null))switch(de){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,h));default:dr(u,h,de,b,v,null)}return;default:if(lw(h)){for(Te in v)v.hasOwnProperty(Te)&&(b=v[Te],b!==void 0&&W1(u,h,Te,b,v,void 0));return}}for(ee in v)v.hasOwnProperty(ee)&&(b=v[ee],b!=null&&dr(u,h,ee,b,v,null))}function NX(u,h,v,b){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var C=null,A=null,U=null,ee=null,se=null,de=null,Te=null;for(Ee in v){var Fe=v[Ee];if(v.hasOwnProperty(Ee)&&Fe!=null)switch(Ee){case"checked":break;case"value":break;case"defaultValue":se=Fe;default:b.hasOwnProperty(Ee)||dr(u,h,Ee,null,b,Fe)}}for(var _e in b){var Ee=b[_e];if(Fe=v[_e],b.hasOwnProperty(_e)&&(Ee!=null||Fe!=null))switch(_e){case"type":A=Ee;break;case"name":C=Ee;break;case"checked":de=Ee;break;case"defaultChecked":Te=Ee;break;case"value":U=Ee;break;case"defaultValue":ee=Ee;break;case"children":case"dangerouslySetInnerHTML":if(Ee!=null)throw Error(n(137,h));break;default:Ee!==Fe&&dr(u,h,_e,Ee,b,Fe)}}aw(u,U,ee,se,de,Te,A,C);return;case"select":Ee=U=ee=_e=null;for(A in v)if(se=v[A],v.hasOwnProperty(A)&&se!=null)switch(A){case"value":break;case"multiple":Ee=se;default:b.hasOwnProperty(A)||dr(u,h,A,null,b,se)}for(C in b)if(A=b[C],se=v[C],b.hasOwnProperty(C)&&(A!=null||se!=null))switch(C){case"value":_e=A;break;case"defaultValue":ee=A;break;case"multiple":U=A;default:A!==se&&dr(u,h,C,A,b,se)}h=ee,v=U,b=Ee,_e!=null?vd(u,!!v,_e,!1):!!b!=!!v&&(h!=null?vd(u,!!v,h,!0):vd(u,!!v,v?[]:"",!1));return;case"textarea":Ee=_e=null;for(ee in v)if(C=v[ee],v.hasOwnProperty(ee)&&C!=null&&!b.hasOwnProperty(ee))switch(ee){case"value":break;case"children":break;default:dr(u,h,ee,null,b,C)}for(U in b)if(C=b[U],A=v[U],b.hasOwnProperty(U)&&(C!=null||A!=null))switch(U){case"value":_e=C;break;case"defaultValue":Ee=C;break;case"children":break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(n(91));break;default:C!==A&&dr(u,h,U,C,b,A)}FR(u,_e,Ee);return;case"option":for(var ct in v)if(_e=v[ct],v.hasOwnProperty(ct)&&_e!=null&&!b.hasOwnProperty(ct))switch(ct){case"selected":u.selected=!1;break;default:dr(u,h,ct,null,b,_e)}for(se in b)if(_e=b[se],Ee=v[se],b.hasOwnProperty(se)&&_e!==Ee&&(_e!=null||Ee!=null))switch(se){case"selected":u.selected=_e&&typeof _e!="function"&&typeof _e!="symbol";break;default:dr(u,h,se,_e,b,Ee)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var wt in v)_e=v[wt],v.hasOwnProperty(wt)&&_e!=null&&!b.hasOwnProperty(wt)&&dr(u,h,wt,null,b,_e);for(de in b)if(_e=b[de],Ee=v[de],b.hasOwnProperty(de)&&_e!==Ee&&(_e!=null||Ee!=null))switch(de){case"children":case"dangerouslySetInnerHTML":if(_e!=null)throw Error(n(137,h));break;default:dr(u,h,de,_e,b,Ee)}return;default:if(lw(h)){for(var Xr in v)_e=v[Xr],v.hasOwnProperty(Xr)&&_e!==void 0&&!b.hasOwnProperty(Xr)&&W1(u,h,Xr,void 0,b,_e);for(Te in b)_e=b[Te],Ee=v[Te],!b.hasOwnProperty(Te)||_e===Ee||_e===void 0&&Ee===void 0||W1(u,h,Te,_e,b,Ee);return}}for(var ge in v)_e=v[ge],v.hasOwnProperty(ge)&&_e!=null&&!b.hasOwnProperty(ge)&&dr(u,h,ge,null,b,_e);for(Fe in b)_e=b[Fe],Ee=v[Fe],!b.hasOwnProperty(Fe)||_e===Ee||_e==null&&Ee==null||dr(u,h,Fe,_e,b,Ee)}var G1=null,K1=null;function Py(u){return u.nodeType===9?u:u.ownerDocument}function PP(u){switch(u){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function MP(u,h){if(u===0)switch(h){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&h==="foreignObject"?0:u}function Y1(u,h){return u==="textarea"||u==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.children=="bigint"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var Q1=null;function jX(){var u=window.event;return u&&u.type==="popstate"?u===Q1?!1:(Q1=u,!0):(Q1=null,!1)}var IP=typeof setTimeout=="function"?setTimeout:void 0,TX=typeof clearTimeout=="function"?clearTimeout:void 0,LP=typeof Promise=="function"?Promise:void 0,AX=typeof queueMicrotask=="function"?queueMicrotask:typeof LP<"u"?function(u){return LP.resolve(null).then(u).catch(RX)}:IP;function RX(u){setTimeout(function(){throw u})}function X1(u,h){var v=h,b=0;do{var C=v.nextSibling;if(u.removeChild(v),C&&C.nodeType===8)if(v=C.data,v==="/$"){if(b===0){u.removeChild(C),Lp(h);return}b--}else v!=="$"&&v!=="$?"&&v!=="$!"||b++;v=C}while(v);Lp(h)}function Z1(u){var h=u.firstChild;for(h&&h.nodeType===10&&(h=h.nextSibling);h;){var v=h;switch(h=h.nextSibling,v.nodeName){case"HTML":case"HEAD":case"BODY":Z1(v),Wf(v);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(v.rel.toLowerCase()==="stylesheet")continue}u.removeChild(v)}}function DX(u,h,v,b){for(;u.nodeType===1;){var C=v;if(u.nodeName.toLowerCase()!==h.toLowerCase()){if(!b&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(b){if(!u[Vc])switch(h){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(A=u.getAttribute("rel"),A==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(A!==C.rel||u.getAttribute("href")!==(C.href==null?null:C.href)||u.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin)||u.getAttribute("title")!==(C.title==null?null:C.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(A=u.getAttribute("src"),(A!==(C.src==null?null:C.src)||u.getAttribute("type")!==(C.type==null?null:C.type)||u.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin))&&A&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(h==="input"&&u.type==="hidden"){var A=C.name==null?null:""+C.name;if(C.type==="hidden"&&u.getAttribute("name")===A)return u}else return u;if(u=ea(u.nextSibling),u===null)break}return null}function OX(u,h,v){if(h==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!v||(u=ea(u.nextSibling),u===null))return null;return u}function ea(u){for(;u!=null;u=u.nextSibling){var h=u.nodeType;if(h===1||h===3)break;if(h===8){if(h=u.data,h==="$"||h==="$!"||h==="$?"||h==="F!"||h==="F")break;if(h==="/$")return null}}return u}function $P(u){u=u.previousSibling;for(var h=0;u;){if(u.nodeType===8){var v=u.data;if(v==="$"||v==="$!"||v==="$?"){if(h===0)return u;h--}else v==="/$"&&h++}u=u.previousSibling}return null}function BP(u,h,v){switch(h=Py(v),u){case"html":if(u=h.documentElement,!u)throw Error(n(452));return u;case"head":if(u=h.head,!u)throw Error(n(453));return u;case"body":if(u=h.body,!u)throw Error(n(454));return u;default:throw Error(n(451))}}var Oi=new Map,FP=new Set;function My(u){return typeof u.getRootNode=="function"?u.getRootNode():u.ownerDocument}var Vo=J.d;J.d={f:PX,r:MX,D:IX,C:LX,L:$X,m:BX,X:zX,S:FX,M:UX};function PX(){var u=Vo.f(),h=Ny();return u||h}function MX(u){var h=je(u);h!==null&&h.tag===5&&h.type==="form"?fO(h):Vo.r(u)}var qd=typeof document>"u"?null:document;function zP(u,h,v){var b=qd;if(b&&typeof h=="string"&&h){var C=Si(h);C='link[rel="'+u+'"][href="'+C+'"]',typeof v=="string"&&(C+='[crossorigin="'+v+'"]'),FP.has(C)||(FP.add(C),u={rel:u,crossOrigin:v,href:h},b.querySelector(C)===null&&(h=b.createElement("link"),es(h,"link",u),Qe(h),b.head.appendChild(h)))}}function IX(u){Vo.D(u),zP("dns-prefetch",u,null)}function LX(u,h){Vo.C(u,h),zP("preconnect",u,h)}function $X(u,h,v){Vo.L(u,h,v);var b=qd;if(b&&u&&h){var C='link[rel="preload"][as="'+Si(h)+'"]';h==="image"&&v&&v.imageSrcSet?(C+='[imagesrcset="'+Si(v.imageSrcSet)+'"]',typeof v.imageSizes=="string"&&(C+='[imagesizes="'+Si(v.imageSizes)+'"]')):C+='[href="'+Si(u)+'"]';var A=C;switch(h){case"style":A=Wd(u);break;case"script":A=Gd(u)}Oi.has(A)||(u=$({rel:"preload",href:h==="image"&&v&&v.imageSrcSet?void 0:u,as:h},v),Oi.set(A,u),b.querySelector(C)!==null||h==="style"&&b.querySelector(Ap(A))||h==="script"&&b.querySelector(Rp(A))||(h=b.createElement("link"),es(h,"link",u),Qe(h),b.head.appendChild(h)))}}function BX(u,h){Vo.m(u,h);var v=qd;if(v&&u){var b=h&&typeof h.as=="string"?h.as:"script",C='link[rel="modulepreload"][as="'+Si(b)+'"][href="'+Si(u)+'"]',A=C;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=Gd(u)}if(!Oi.has(A)&&(u=$({rel:"modulepreload",href:u},h),Oi.set(A,u),v.querySelector(C)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(v.querySelector(Rp(A)))return}b=v.createElement("link"),es(b,"link",u),Qe(b),v.head.appendChild(b)}}}function FX(u,h,v){Vo.S(u,h,v);var b=qd;if(b&&u){var C=Ue(b).hoistableStyles,A=Wd(u);h=h||"default";var U=C.get(A);if(!U){var ee={loading:0,preload:null};if(U=b.querySelector(Ap(A)))ee.loading=5;else{u=$({rel:"stylesheet",href:u,"data-precedence":h},v),(v=Oi.get(A))&&J1(u,v);var se=U=b.createElement("link");Qe(se),es(se,"link",u),se._p=new Promise(function(de,Te){se.onload=de,se.onerror=Te}),se.addEventListener("load",function(){ee.loading|=1}),se.addEventListener("error",function(){ee.loading|=2}),ee.loading|=4,Iy(U,h,b)}U={type:"stylesheet",instance:U,count:1,state:ee},C.set(A,U)}}}function zX(u,h){Vo.X(u,h);var v=qd;if(v&&u){var b=Ue(v).hoistableScripts,C=Gd(u),A=b.get(C);A||(A=v.querySelector(Rp(C)),A||(u=$({src:u,async:!0},h),(h=Oi.get(C))&&eS(u,h),A=v.createElement("script"),Qe(A),es(A,"link",u),v.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},b.set(C,A))}}function UX(u,h){Vo.M(u,h);var v=qd;if(v&&u){var b=Ue(v).hoistableScripts,C=Gd(u),A=b.get(C);A||(A=v.querySelector(Rp(C)),A||(u=$({src:u,async:!0,type:"module"},h),(h=Oi.get(C))&&eS(u,h),A=v.createElement("script"),Qe(A),es(A,"link",u),v.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},b.set(C,A))}}function UP(u,h,v,b){var C=(C=lt.current)?My(C):null;if(!C)throw Error(n(446));switch(u){case"meta":case"title":return null;case"style":return typeof v.precedence=="string"&&typeof v.href=="string"?(h=Wd(v.href),v=Ue(C).hoistableStyles,b=v.get(h),b||(b={type:"style",instance:null,count:0,state:null},v.set(h,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(v.rel==="stylesheet"&&typeof v.href=="string"&&typeof v.precedence=="string"){u=Wd(v.href);var A=Ue(C).hoistableStyles,U=A.get(u);if(U||(C=C.ownerDocument||C,U={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(u,U),(A=C.querySelector(Ap(u)))&&!A._p&&(U.instance=A,U.state.loading=5),Oi.has(u)||(v={rel:"preload",as:"style",href:v.href,crossOrigin:v.crossOrigin,integrity:v.integrity,media:v.media,hrefLang:v.hrefLang,referrerPolicy:v.referrerPolicy},Oi.set(u,v),A||VX(C,u,v,U.state))),h&&b===null)throw Error(n(528,""));return U}if(h&&b!==null)throw Error(n(529,""));return null;case"script":return h=v.async,v=v.src,typeof v=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=Gd(v),v=Ue(C).hoistableScripts,b=v.get(h),b||(b={type:"script",instance:null,count:0,state:null},v.set(h,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,u))}}function Wd(u){return'href="'+Si(u)+'"'}function Ap(u){return'link[rel="stylesheet"]['+u+"]"}function VP(u){return $({},u,{"data-precedence":u.precedence,precedence:null})}function VX(u,h,v,b){u.querySelector('link[rel="preload"][as="style"]['+h+"]")?b.loading=1:(h=u.createElement("link"),b.preload=h,h.addEventListener("load",function(){return b.loading|=1}),h.addEventListener("error",function(){return b.loading|=2}),es(h,"link",v),Qe(h),u.head.appendChild(h))}function Gd(u){return'[src="'+Si(u)+'"]'}function Rp(u){return"script[async]"+u}function HP(u,h,v){if(h.count++,h.instance===null)switch(h.type){case"style":var b=u.querySelector('style[data-href~="'+Si(v.href)+'"]');if(b)return h.instance=b,Qe(b),b;var C=$({},v,{"data-href":v.href,"data-precedence":v.precedence,href:null,precedence:null});return b=(u.ownerDocument||u).createElement("style"),Qe(b),es(b,"style",C),Iy(b,v.precedence,u),h.instance=b;case"stylesheet":C=Wd(v.href);var A=u.querySelector(Ap(C));if(A)return h.state.loading|=4,h.instance=A,Qe(A),A;b=VP(v),(C=Oi.get(C))&&J1(b,C),A=(u.ownerDocument||u).createElement("link"),Qe(A);var U=A;return U._p=new Promise(function(ee,se){U.onload=ee,U.onerror=se}),es(A,"link",b),h.state.loading|=4,Iy(A,v.precedence,u),h.instance=A;case"script":return A=Gd(v.src),(C=u.querySelector(Rp(A)))?(h.instance=C,Qe(C),C):(b=v,(C=Oi.get(A))&&(b=$({},v),eS(b,C)),u=u.ownerDocument||u,C=u.createElement("script"),Qe(C),es(C,"link",b),u.head.appendChild(C),h.instance=C);case"void":return null;default:throw Error(n(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(b=h.instance,h.state.loading|=4,Iy(b,v.precedence,u));return h.instance}function Iy(u,h,v){for(var b=v.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=b.length?b[b.length-1]:null,A=C,U=0;U<b.length;U++){var ee=b[U];if(ee.dataset.precedence===h)A=ee;else if(A!==C)break}A?A.parentNode.insertBefore(u,A.nextSibling):(h=v.nodeType===9?v.head:v,h.insertBefore(u,h.firstChild))}function J1(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.title==null&&(u.title=h.title)}function eS(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.integrity==null&&(u.integrity=h.integrity)}var Ly=null;function qP(u,h,v){if(Ly===null){var b=new Map,C=Ly=new Map;C.set(v,b)}else C=Ly,b=C.get(v),b||(b=new Map,C.set(v,b));if(b.has(u))return b;for(b.set(u,null),v=v.getElementsByTagName(u),C=0;C<v.length;C++){var A=v[C];if(!(A[Vc]||A[Mn]||u==="link"&&A.getAttribute("rel")==="stylesheet")&&A.namespaceURI!=="http://www.w3.org/2000/svg"){var U=A.getAttribute(h)||"";U=u+U;var ee=b.get(U);ee?ee.push(A):b.set(U,[A])}}return b}function WP(u,h,v){u=u.ownerDocument||u,u.head.insertBefore(v,h==="title"?u.querySelector("head > title"):null)}function HX(u,h,v){if(v===1||h.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof h.precedence!="string"||typeof h.href!="string"||h.href==="")break;return!0;case"link":if(typeof h.rel!="string"||typeof h.href!="string"||h.href===""||h.onLoad||h.onError)break;switch(h.rel){case"stylesheet":return u=h.disabled,typeof h.precedence=="string"&&u==null;default:return!0}case"script":if(h.async&&typeof h.async!="function"&&typeof h.async!="symbol"&&!h.onLoad&&!h.onError&&h.src&&typeof h.src=="string")return!0}return!1}function GP(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}var Dp=null;function qX(){}function WX(u,h,v){if(Dp===null)throw Error(n(475));var b=Dp;if(h.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var C=Wd(v.href),A=u.querySelector(Ap(C));if(A){u=A._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(b.count++,b=$y.bind(b),u.then(b,b)),h.state.loading|=4,h.instance=A,Qe(A);return}A=u.ownerDocument||u,v=VP(v),(C=Oi.get(C))&&J1(v,C),A=A.createElement("link"),Qe(A);var U=A;U._p=new Promise(function(ee,se){U.onload=ee,U.onerror=se}),es(A,"link",v),h.instance=A}b.stylesheets===null&&(b.stylesheets=new Map),b.stylesheets.set(h,u),(u=h.state.preload)&&(h.state.loading&3)===0&&(b.count++,h=$y.bind(b),u.addEventListener("load",h),u.addEventListener("error",h))}}function GX(){if(Dp===null)throw Error(n(475));var u=Dp;return u.stylesheets&&u.count===0&&tS(u,u.stylesheets),0<u.count?function(h){var v=setTimeout(function(){if(u.stylesheets&&tS(u,u.stylesheets),u.unsuspend){var b=u.unsuspend;u.unsuspend=null,b()}},6e4);return u.unsuspend=h,function(){u.unsuspend=null,clearTimeout(v)}}:null}function $y(){if(this.count--,this.count===0){if(this.stylesheets)tS(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var By=null;function tS(u,h){u.stylesheets=null,u.unsuspend!==null&&(u.count++,By=new Map,h.forEach(KX,u),By=null,$y.call(u))}function KX(u,h){if(!(h.state.loading&4)){var v=By.get(u);if(v)var b=v.get(null);else{v=new Map,By.set(u,v);for(var C=u.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A<C.length;A++){var U=C[A];(U.nodeName==="LINK"||U.getAttribute("media")!=="not all")&&(v.set(U.dataset.precedence,U),b=U)}b&&v.set(null,b)}C=h.instance,U=C.getAttribute("data-precedence"),A=v.get(U)||b,A===b&&v.set(null,C),v.set(U,C),this.count++,b=$y.bind(this),C.addEventListener("load",b),C.addEventListener("error",b),A?A.parentNode.insertBefore(C,A.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(C,u.firstChild)),h.state.loading|=4}}var Op={$$typeof:g,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function YX(u,h,v,b,C,A,U,ee){this.tag=1,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Hf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hf(0),this.hiddenUpdates=Hf(null),this.identifierPrefix=b,this.onUncaughtError=C,this.onCaughtError=A,this.onRecoverableError=U,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ee,this.incompleteTransitions=new Map}function KP(u,h,v,b,C,A,U,ee,se,de,Te,Fe){return u=new YX(u,h,v,U,ee,se,de,Fe),h=1,A===!0&&(h|=24),A=Ri(3,null,null,h),u.current=A,A.stateNode=u,h=Ow(),h.refCount++,u.pooledCache=h,h.refCount++,A.memoizedState={element:b,isDehydrated:v,cache:h},f1(A),u}function YP(u){return u?(u=Ed,u):Ed}function QP(u,h,v,b,C,A){C=YP(C),b.context===null?b.context=C:b.pendingContext=C,b=Ol(h),b.payload={element:v},A=A===void 0?null:A,A!==null&&(b.callback=A),v=Pl(u,b,h),v!==null&&(Ds(v,u,h),gp(v,u,h))}function XP(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var v=u.retryLane;u.retryLane=v!==0&&v<h?v:h}}function rS(u,h){XP(u,h),(u=u.alternate)&&XP(u,h)}function ZP(u){if(u.tag===13){var h=Cl(u,67108864);h!==null&&Ds(h,u,67108864),rS(u,67108864)}}var Fy=!0;function QX(u,h,v,b){var C=L.T;L.T=null;var A=J.p;try{J.p=2,nS(u,h,v,b)}finally{J.p=A,L.T=C}}function XX(u,h,v,b){var C=L.T;L.T=null;var A=J.p;try{J.p=8,nS(u,h,v,b)}finally{J.p=A,L.T=C}}function nS(u,h,v,b){if(Fy){var C=sS(b);if(C===null)q1(u,h,b,zy,v),eM(u,b);else if(JX(C,u,h,v,b))b.stopPropagation();else if(eM(u,b),h&4&&-1<ZX.indexOf(u)){for(;C!==null;){var A=je(C);if(A!==null)switch(A.tag){case 3:if(A=A.stateNode,A.current.memoizedState.isDehydrated){var U=Ws(A.pendingLanes);if(U!==0){var ee=A;for(ee.pendingLanes|=2,ee.entangledLanes|=2;U;){var se=1<<31-jr(U);ee.entanglements[1]|=se,U&=~se}qa(A),(Vr&6)===0&&(ky=Ne()+500,Np(0))}}break;case 13:ee=Cl(A,2),ee!==null&&Ds(ee,A,2),Ny(),rS(A,2)}if(A=sS(b),A===null&&q1(u,h,b,zy,v),A===C)break;C=A}C!==null&&b.stopPropagation()}else q1(u,h,b,null,v)}}function sS(u){return u=uw(u),iS(u)}var zy=null;function iS(u){if(zy=null,u=Co(u),u!==null){var h=K(u);if(h===null)u=null;else{var v=h.tag;if(v===13){if(u=Y(h),u!==null)return u;u=null}else if(v===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;u=null}else h!==u&&(u=null)}}return zy=u,null}function JP(u){switch(u){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Le()){case pe:return 2;case De:return 8;case qe:case mt:return 32;case Ot:return 268435456;default:return 32}default:return 32}}var aS=!1,zl=null,Ul=null,Vl=null,Pp=new Map,Mp=new Map,Hl=[],ZX="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".split(" ");function eM(u,h){switch(u){case"focusin":case"focusout":zl=null;break;case"dragenter":case"dragleave":Ul=null;break;case"mouseover":case"mouseout":Vl=null;break;case"pointerover":case"pointerout":Pp.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mp.delete(h.pointerId)}}function Ip(u,h,v,b,C,A){return u===null||u.nativeEvent!==A?(u={blockedOn:h,domEventName:v,eventSystemFlags:b,nativeEvent:A,targetContainers:[C]},h!==null&&(h=je(h),h!==null&&ZP(h)),u):(u.eventSystemFlags|=b,h=u.targetContainers,C!==null&&h.indexOf(C)===-1&&h.push(C),u)}function JX(u,h,v,b,C){switch(h){case"focusin":return zl=Ip(zl,u,h,v,b,C),!0;case"dragenter":return Ul=Ip(Ul,u,h,v,b,C),!0;case"mouseover":return Vl=Ip(Vl,u,h,v,b,C),!0;case"pointerover":var A=C.pointerId;return Pp.set(A,Ip(Pp.get(A)||null,u,h,v,b,C)),!0;case"gotpointercapture":return A=C.pointerId,Mp.set(A,Ip(Mp.get(A)||null,u,h,v,b,C)),!0}return!1}function tM(u){var h=Co(u.target);if(h!==null){var v=K(h);if(v!==null){if(h=v.tag,h===13){if(h=Y(v),h!==null){u.blockedOn=h,nw(u.priority,function(){if(v.tag===13){var b=ci(),C=Cl(v,b);C!==null&&Ds(C,v,b),rS(v,b)}});return}}else if(h===3&&v.stateNode.current.memoizedState.isDehydrated){u.blockedOn=v.tag===3?v.stateNode.containerInfo:null;return}}}u.blockedOn=null}function Uy(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var v=sS(u.nativeEvent);if(v===null){v=u.nativeEvent;var b=new v.constructor(v.type,v);cw=b,v.target.dispatchEvent(b),cw=null}else return h=je(v),h!==null&&ZP(h),u.blockedOn=v,!1;h.shift()}return!0}function rM(u,h,v){Uy(u)&&v.delete(h)}function eZ(){aS=!1,zl!==null&&Uy(zl)&&(zl=null),Ul!==null&&Uy(Ul)&&(Ul=null),Vl!==null&&Uy(Vl)&&(Vl=null),Pp.forEach(rM),Mp.forEach(rM)}function Vy(u,h){u.blockedOn===h&&(u.blockedOn=null,aS||(aS=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,eZ)))}var Hy=null;function nM(u){Hy!==u&&(Hy=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Hy===u&&(Hy=null);for(var h=0;h<u.length;h+=3){var v=u[h],b=u[h+1],C=u[h+2];if(typeof b!="function"){if(iS(b||v)===null)continue;break}var A=je(v);A!==null&&(u.splice(h,3),h-=3,Yw(A,{pending:!0,data:C,method:v.method,action:b},b,C))}}))}function Lp(u){function h(se){return Vy(se,u)}zl!==null&&Vy(zl,u),Ul!==null&&Vy(Ul,u),Vl!==null&&Vy(Vl,u),Pp.forEach(h),Mp.forEach(h);for(var v=0;v<Hl.length;v++){var b=Hl[v];b.blockedOn===u&&(b.blockedOn=null)}for(;0<Hl.length&&(v=Hl[0],v.blockedOn===null);)tM(v),v.blockedOn===null&&Hl.shift();if(v=(u.ownerDocument||u).$$reactFormReplay,v!=null)for(b=0;b<v.length;b+=3){var C=v[b],A=v[b+1],U=C[ps]||null;if(typeof A=="function")U||nM(v);else if(U){var ee=null;if(A&&A.hasAttribute("formAction")){if(C=A,U=A[ps]||null)ee=U.formAction;else if(iS(C)!==null)continue}else ee=U.action;typeof ee=="function"?v[b+1]=ee:(v.splice(b,3),b-=3),nM(v)}}}function oS(u){this._internalRoot=u}qy.prototype.render=oS.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(n(409));var v=h.current,b=ci();QP(v,b,u,h,null,null)},qy.prototype.unmount=oS.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;u.tag===0&&Ud(),QP(u.current,2,null,u,null,null),Ny(),h[kl]=null}};function qy(u){this._internalRoot=u}qy.prototype.unstable_scheduleHydration=function(u){if(u){var h=$v();u={blockedOn:null,target:u,priority:h};for(var v=0;v<Hl.length&&h!==0&&h<Hl[v].priority;v++);Hl.splice(v,0,u),v===0&&tM(u)}};var sM=e.version;if(sM!=="19.0.0")throw Error(n(527,sM,"19.0.0"));J.findDOMNode=function(u){var h=u._reactInternals;if(h===void 0)throw typeof u.render=="function"?Error(n(188)):(u=Object.keys(u).join(","),Error(n(268,u)));return u=H(h),u=u!==null?G(u):null,u=u===null?null:u.stateNode,u};var tZ={bundleType:0,version:"19.0.0",rendererPackageName:"react-dom",currentDispatcherRef:L,findFiberByHostInstance:Co,reconcilerVersion:"19.0.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wy=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wy.isDisabled&&Wy.supportsFiber)try{Tt=Wy.inject(tZ),Sr=Wy}catch{}}return Bp.createRoot=function(u,h){if(!s(u))throw Error(n(299));var v=!1,b="",C=bO,A=wO,U=SO,ee=null;return h!=null&&(h.unstable_strictMode===!0&&(v=!0),h.identifierPrefix!==void 0&&(b=h.identifierPrefix),h.onUncaughtError!==void 0&&(C=h.onUncaughtError),h.onCaughtError!==void 0&&(A=h.onCaughtError),h.onRecoverableError!==void 0&&(U=h.onRecoverableError),h.unstable_transitionCallbacks!==void 0&&(ee=h.unstable_transitionCallbacks)),h=KP(u,1,!1,null,null,v,b,C,A,U,ee,null),u[kl]=h.current,H1(u.nodeType===8?u.parentNode:u),new oS(h)},Bp.hydrateRoot=function(u,h,v){if(!s(u))throw Error(n(299));var b=!1,C="",A=bO,U=wO,ee=SO,se=null,de=null;return v!=null&&(v.unstable_strictMode===!0&&(b=!0),v.identifierPrefix!==void 0&&(C=v.identifierPrefix),v.onUncaughtError!==void 0&&(A=v.onUncaughtError),v.onCaughtError!==void 0&&(U=v.onCaughtError),v.onRecoverableError!==void 0&&(ee=v.onRecoverableError),v.unstable_transitionCallbacks!==void 0&&(se=v.unstable_transitionCallbacks),v.formState!==void 0&&(de=v.formState)),h=KP(u,1,!0,h,v??null,b,C,A,U,ee,se,de),h.context=YP(null),v=h.current,b=ci(),C=Ol(b),C.callback=null,Pl(v,C,b),h.current.lanes=b,Uc(h,b),qa(h),u[kl]=h.current,H1(u),new qy(h)},Bp.version="19.0.0",Bp}var pM;function pZ(){if(pM)return uS.exports;pM=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),uS.exports=fZ(),uS.exports}var mZ=pZ(),Fp={},mM;function gZ(){if(mM)return Fp;mM=1,Object.defineProperty(Fp,"__esModule",{value:!0}),Fp.parse=a,Fp.serialize=d;const t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,e=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,s=Object.prototype.toString,i=(()=>{const m=function(){};return m.prototype=Object.create(null),m})();function a(m,g){const y=new i,x=m.length;if(x<2)return y;const w=(g==null?void 0:g.decode)||f;let _=0;do{const S=m.indexOf("=",_);if(S===-1)break;const k=m.indexOf(";",_),N=k===-1?x:k;if(S>N){_=m.lastIndexOf(";",S-1)+1;continue}const j=l(m,_,S),T=c(m,S,j),D=m.slice(j,T);if(y[D]===void 0){let I=l(m,S+1,N),L=c(m,N,I);const $=w(m.slice(I,L));y[D]=$}_=N+1}while(_<x);return y}function l(m,g,y){do{const x=m.charCodeAt(g);if(x!==32&&x!==9)return g}while(++g<y);return y}function c(m,g,y){for(;g>y;){const x=m.charCodeAt(--g);if(x!==32&&x!==9)return g+1}return y}function d(m,g,y){const x=(y==null?void 0:y.encode)||encodeURIComponent;if(!t.test(m))throw new TypeError(`argument name is invalid: ${m}`);const w=x(g);if(!e.test(w))throw new TypeError(`argument val is invalid: ${g}`);let _=m+"="+w;if(!y)return _;if(y.maxAge!==void 0){if(!Number.isInteger(y.maxAge))throw new TypeError(`option maxAge is invalid: ${y.maxAge}`);_+="; Max-Age="+y.maxAge}if(y.domain){if(!r.test(y.domain))throw new TypeError(`option domain is invalid: ${y.domain}`);_+="; Domain="+y.domain}if(y.path){if(!n.test(y.path))throw new TypeError(`option path is invalid: ${y.path}`);_+="; Path="+y.path}if(y.expires){if(!p(y.expires)||!Number.isFinite(y.expires.valueOf()))throw new TypeError(`option expires is invalid: ${y.expires}`);_+="; Expires="+y.expires.toUTCString()}if(y.httpOnly&&(_+="; HttpOnly"),y.secure&&(_+="; Secure"),y.partitioned&&(_+="; Partitioned"),y.priority)switch(typeof y.priority=="string"?y.priority.toLowerCase():void 0){case"low":_+="; Priority=Low";break;case"medium":_+="; Priority=Medium";break;case"high":_+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${y.priority}`)}if(y.sameSite)switch(typeof y.sameSite=="string"?y.sameSite.toLowerCase():y.sameSite){case!0:case"strict":_+="; SameSite=Strict";break;case"lax":_+="; SameSite=Lax";break;case"none":_+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${y.sameSite}`)}return _}function f(m){if(m.indexOf("%")===-1)return m;try{return decodeURIComponent(m)}catch{return m}}function p(m){return s.call(m)==="[object Date]"}return Fp}gZ();/**
|
||
* react-router v7.3.0
|
||
*
|
||
* Copyright (c) Remix Software Inc.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/var gM="popstate";function vZ(t={}){function e(n,s){let{pathname:i,search:a,hash:l}=n.location;return HE("",{pathname:i,search:a,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(n,s){return typeof s=="string"?s:mg(s)}return xZ(e,r,null,t)}function Br(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function _a(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function yZ(){return Math.random().toString(36).substring(2,10)}function vM(t,e){return{usr:t.state,key:t.key,idx:e}}function HE(t,e,r=null,n){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?pf(e):e,state:r,key:e&&e.key||n||yZ()}}function mg({pathname:t="/",search:e="",hash:r=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function pf(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substring(r),t=t.substring(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substring(n),t=t.substring(0,n)),t&&(e.pathname=t)}return e}function xZ(t,e,r,n={}){let{window:s=document.defaultView,v5Compat:i=!1}=n,a=s.history,l="POP",c=null,d=f();d==null&&(d=0,a.replaceState({...a.state,idx:d},""));function f(){return(a.state||{idx:null}).idx}function p(){l="POP";let w=f(),_=w==null?null:w-d;d=w,c&&c({action:l,location:x.location,delta:_})}function m(w,_){l="PUSH";let S=HE(x.location,w,_);d=f()+1;let k=vM(S,d),N=x.createHref(S);try{a.pushState(k,"",N)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(N)}i&&c&&c({action:l,location:x.location,delta:1})}function g(w,_){l="REPLACE";let S=HE(x.location,w,_);d=f();let k=vM(S,d),N=x.createHref(S);a.replaceState(k,"",N),i&&c&&c({action:l,location:x.location,delta:0})}function y(w){let _=s.location.origin!=="null"?s.location.origin:s.location.href,S=typeof w=="string"?w:mg(w);return S=S.replace(/ $/,"%20"),Br(_,`No window.location.(origin|href) available to create URL for href: ${S}`),new URL(S,_)}let x={get action(){return l},get location(){return t(s,a)},listen(w){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(gM,p),c=w,()=>{s.removeEventListener(gM,p),c=null}},createHref(w){return e(s,w)},createURL:y,encodeLocation(w){let _=y(w);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:m,replace:g,go(w){return a.go(w)}};return x}function rB(t,e,r="/"){return _Z(t,e,r,!1)}function _Z(t,e,r,n){let s=typeof e=="string"?pf(e):e,i=sl(s.pathname||"/",r);if(i==null)return null;let a=nB(t);bZ(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let d=DZ(i);l=AZ(a[c],d,n)}return l}function nB(t,e=[],r=[],n=""){let s=(i,a,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};c.relativePath.startsWith("/")&&(Br(c.relativePath.startsWith(n),`Absolute route path "${c.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(n.length));let d=tl([n,c.relativePath]),f=r.concat(c);i.children&&i.children.length>0&&(Br(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),nB(i.children,e,f,d)),!(i.path==null&&!i.index)&&e.push({path:d,score:jZ(d,i.index),routesMeta:f})};return t.forEach((i,a)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,a);else for(let c of sB(i.path))s(i,a,c)}),e}function sB(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let a=sB(n.join("/")),l=[];return l.push(...a.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...a),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function bZ(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:TZ(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var wZ=/^:[\w-]+$/,SZ=3,kZ=2,EZ=1,CZ=10,NZ=-2,yM=t=>t==="*";function jZ(t,e){let r=t.split("/"),n=r.length;return r.some(yM)&&(n+=NZ),e&&(n+=kZ),r.filter(s=>!yM(s)).reduce((s,i)=>s+(wZ.test(i)?SZ:i===""?EZ:CZ),n)}function TZ(t,e){return t.length===e.length&&t.slice(0,-1).every((n,s)=>n===e[s])?t[t.length-1]-e[e.length-1]:0}function AZ(t,e,r=!1){let{routesMeta:n}=t,s={},i="/",a=[];for(let l=0;l<n.length;++l){let c=n[l],d=l===n.length-1,f=i==="/"?e:e.slice(i.length)||"/",p=M0({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},f),m=c.route;if(!p&&d&&r&&!n[n.length-1].route.index&&(p=M0({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},f)),!p)return null;Object.assign(s,p.params),a.push({params:s,pathname:tl([i,p.pathname]),pathnameBase:IZ(tl([i,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(i=tl([i,p.pathnameBase]))}return a}function M0(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=RZ(t.path,t.caseSensitive,t.end),s=e.match(r);if(!s)return null;let i=s[0],a=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((d,{paramName:f,isOptional:p},m)=>{if(f==="*"){let y=l[m]||"";a=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const g=l[m];return p&&!g?d[f]=void 0:d[f]=(g||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:a,pattern:t}}function RZ(t,e=!1,r=!0){_a(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let n=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),n]}function DZ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return _a(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function sl(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function OZ(t,e="/"){let{pathname:r,search:n="",hash:s=""}=typeof t=="string"?pf(t):t;return{pathname:r?r.startsWith("/")?r:PZ(r,e):e,search:LZ(n),hash:$Z(s)}}function PZ(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function pS(t,e,r,n){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function MZ(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function cj(t){let e=MZ(t);return e.map((r,n)=>n===e.length-1?r.pathname:r.pathnameBase)}function uj(t,e,r,n=!1){let s;typeof t=="string"?s=pf(t):(s={...t},Br(!s.pathname||!s.pathname.includes("?"),pS("?","pathname","search",s)),Br(!s.pathname||!s.pathname.includes("#"),pS("#","pathname","hash",s)),Br(!s.search||!s.search.includes("#"),pS("#","search","hash",s)));let i=t===""||s.pathname==="",a=i?"/":s.pathname,l;if(a==null)l=r;else{let p=e.length-1;if(!n&&a.startsWith("..")){let m=a.split("/");for(;m[0]==="..";)m.shift(),p-=1;s.pathname=m.join("/")}l=p>=0?e[p]:"/"}let c=OZ(s,l),d=a&&a!=="/"&&a.endsWith("/"),f=(i||a===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||f)&&(c.pathname+="/"),c}var tl=t=>t.join("/").replace(/\/\/+/g,"/"),IZ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),LZ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,$Z=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function BZ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var iB=["POST","PUT","PATCH","DELETE"];new Set(iB);var FZ=["GET",...iB];new Set(FZ);var mf=E.createContext(null);mf.displayName="DataRouter";var U_=E.createContext(null);U_.displayName="DataRouterState";var aB=E.createContext({isTransitioning:!1});aB.displayName="ViewTransition";var zZ=E.createContext(new Map);zZ.displayName="Fetchers";var UZ=E.createContext(null);UZ.displayName="Await";var Aa=E.createContext(null);Aa.displayName="Navigation";var ev=E.createContext(null);ev.displayName="Location";var Yi=E.createContext({outlet:null,matches:[],isDataRoute:!1});Yi.displayName="Route";var dj=E.createContext(null);dj.displayName="RouteError";function VZ(t,{relative:e}={}){Br(gf(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=E.useContext(Aa),{hash:s,pathname:i,search:a}=tv(t,{relative:e}),l=i;return r!=="/"&&(l=i==="/"?r:tl([r,i])),n.createHref({pathname:l,search:a,hash:s})}function gf(){return E.useContext(ev)!=null}function Ra(){return Br(gf(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(ev).location}var oB="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function lB(t){E.useContext(Aa).static||E.useLayoutEffect(t)}function Yn(){let{isDataRoute:t}=E.useContext(Yi);return t?sJ():HZ()}function HZ(){Br(gf(),"useNavigate() may be used only in the context of a <Router> component.");let t=E.useContext(mf),{basename:e,navigator:r}=E.useContext(Aa),{matches:n}=E.useContext(Yi),{pathname:s}=Ra(),i=JSON.stringify(cj(n)),a=E.useRef(!1);return lB(()=>{a.current=!0}),E.useCallback((c,d={})=>{if(_a(a.current,oB),!a.current)return;if(typeof c=="number"){r.go(c);return}let f=uj(c,JSON.parse(i),s,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:tl([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,i,s,t])}var qZ=E.createContext(null);function WZ(t){let e=E.useContext(Yi).outlet;return e&&E.createElement(qZ.Provider,{value:t},e)}function Hh(){let{matches:t}=E.useContext(Yi),e=t[t.length-1];return e?e.params:{}}function tv(t,{relative:e}={}){let{matches:r}=E.useContext(Yi),{pathname:n}=Ra(),s=JSON.stringify(cj(r));return E.useMemo(()=>uj(t,JSON.parse(s),n,e==="path"),[t,s,n,e])}function GZ(t,e){return cB(t,e)}function cB(t,e,r,n){var S;Br(gf(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s,static:i}=E.useContext(Aa),{matches:a}=E.useContext(Yi),l=a[a.length-1],c=l?l.params:{},d=l?l.pathname:"/",f=l?l.pathnameBase:"/",p=l&&l.route;{let k=p&&p.path||"";uB(d,!p||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
||
|
||
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let m=Ra(),g;if(e){let k=typeof e=="string"?pf(e):e;Br(f==="/"||((S=k.pathname)==null?void 0:S.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=m;let y=g.pathname||"/",x=y;if(f!=="/"){let k=f.replace(/^\//,"").split("/");x="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=!i&&r&&r.matches&&r.matches.length>0?r.matches:rB(t,{pathname:x});_a(p||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),_a(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=ZZ(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:tl([f,s.encodeLocation?s.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:tl([f,s.encodeLocation?s.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),a,r,n);return e&&_?E.createElement(ev.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...g},navigationType:"POP"}},_):_}function KZ(){let t=nJ(),e=BZ(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,n="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:i},"ErrorBoundary")," or"," ",E.createElement("code",{style:i},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),r?E.createElement("pre",{style:s},r):null,a)}var YZ=E.createElement(KZ,null),QZ=class extends E.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){console.error("React Router caught the following error during render",t,e)}render(){return this.state.error!==void 0?E.createElement(Yi.Provider,{value:this.props.routeContext},E.createElement(dj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function XZ({routeContext:t,match:e,children:r}){let n=E.useContext(mf);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),E.createElement(Yi.Provider,{value:t},r)}function ZZ(t,e=[],r=null,n=null){if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,i=r==null?void 0:r.errors;if(i!=null){let c=s.findIndex(d=>d.route.id&&(i==null?void 0:i[d.route.id])!==void 0);Br(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,l=-1;if(r)for(let c=0;c<s.length;c++){let d=s[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=c),d.route.id){let{loaderData:f,errors:p}=r,m=d.route.loader&&!f.hasOwnProperty(d.route.id)&&(!p||p[d.route.id]===void 0);if(d.route.lazy||m){a=!0,l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}return s.reduceRight((c,d,f)=>{let p,m=!1,g=null,y=null;r&&(p=i&&d.route.id?i[d.route.id]:void 0,g=d.route.errorElement||YZ,a&&(l<0&&f===0?(uB("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,y=null):l===f&&(m=!0,y=d.route.hydrateFallbackElement||null)));let x=e.concat(s.slice(0,f+1)),w=()=>{let _;return p?_=g:m?_=y:d.route.Component?_=E.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,E.createElement(XZ,{match:d,routeContext:{outlet:c,matches:x,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?E.createElement(QZ,{location:r.location,revalidation:r.revalidation,component:g,error:p,children:w(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):w()},null)}function hj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function JZ(t){let e=E.useContext(mf);return Br(e,hj(t)),e}function eJ(t){let e=E.useContext(U_);return Br(e,hj(t)),e}function tJ(t){let e=E.useContext(Yi);return Br(e,hj(t)),e}function fj(t){let e=tJ(t),r=e.matches[e.matches.length-1];return Br(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function rJ(){return fj("useRouteId")}function nJ(){var n;let t=E.useContext(dj),e=eJ("useRouteError"),r=fj("useRouteError");return t!==void 0?t:(n=e.errors)==null?void 0:n[r]}function sJ(){let{router:t}=JZ("useNavigate"),e=fj("useNavigate"),r=E.useRef(!1);return lB(()=>{r.current=!0}),E.useCallback(async(s,i={})=>{_a(r.current,oB),r.current&&(typeof s=="number"?t.navigate(s):await t.navigate(s,{fromRouteId:e,...i}))},[t,e])}var xM={};function uB(t,e,r){!e&&!xM[t]&&(xM[t]=!0,_a(!1,r))}E.memo(iJ);function iJ({routes:t,future:e,state:r}){return cB(t,void 0,r,e)}function pj({to:t,replace:e,state:r,relative:n}){Br(gf(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=E.useContext(Aa);_a(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=E.useContext(Yi),{pathname:a}=Ra(),l=Yn(),c=uj(t,cj(i),a,n==="path"),d=JSON.stringify(c);return E.useEffect(()=>{l(JSON.parse(d),{replace:e,state:r,relative:n})},[l,d,n,e,r]),null}function aJ(t){return WZ(t.context)}function Qt(t){Br(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function oJ({basename:t="/",children:e=null,location:r,navigationType:n="POP",navigator:s,static:i=!1}){Br(!gf(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=E.useMemo(()=>({basename:a,navigator:s,static:i,future:{}}),[a,s,i]);typeof r=="string"&&(r=pf(r));let{pathname:c="/",search:d="",hash:f="",state:p=null,key:m="default"}=r,g=E.useMemo(()=>{let y=sl(c,a);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:m},navigationType:n}},[a,c,d,f,p,m,n]);return _a(g!=null,`<Router basename="${a}"> is not able to match the URL "${c}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:E.createElement(Aa.Provider,{value:l},E.createElement(ev.Provider,{children:e,value:g}))}function dB({children:t,location:e}){return GZ(qE(t),e)}function qE(t,e=[]){let r=[];return E.Children.forEach(t,(n,s)=>{if(!E.isValidElement(n))return;let i=[...e,s];if(n.type===E.Fragment){r.push.apply(r,qE(n.props.children,i));return}Br(n.type===Qt,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Br(!n.props.index||!n.props.children,"An index route cannot have child routes.");let a={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=qE(n.props.children,i)),r.push(a)}),r}var Kx="get",Yx="application/x-www-form-urlencoded";function V_(t){return t!=null&&typeof t.tagName=="string"}function lJ(t){return V_(t)&&t.tagName.toLowerCase()==="button"}function cJ(t){return V_(t)&&t.tagName.toLowerCase()==="form"}function uJ(t){return V_(t)&&t.tagName.toLowerCase()==="input"}function dJ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function hJ(t,e){return t.button===0&&(!e||e==="_self")&&!dJ(t)}var Gy=null;function fJ(){if(Gy===null)try{new FormData(document.createElement("form"),0),Gy=!1}catch{Gy=!0}return Gy}var pJ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function mS(t){return t!=null&&!pJ.has(t)?(_a(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Yx}"`),null):t}function mJ(t,e){let r,n,s,i,a;if(cJ(t)){let l=t.getAttribute("action");n=l?sl(l,e):null,r=t.getAttribute("method")||Kx,s=mS(t.getAttribute("enctype"))||Yx,i=new FormData(t)}else if(lJ(t)||uJ(t)&&(t.type==="submit"||t.type==="image")){let l=t.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=t.getAttribute("formaction")||l.getAttribute("action");if(n=c?sl(c,e):null,r=t.getAttribute("formmethod")||l.getAttribute("method")||Kx,s=mS(t.getAttribute("formenctype"))||mS(l.getAttribute("enctype"))||Yx,i=new FormData(l,t),!fJ()){let{name:d,type:f,value:p}=t;if(f==="image"){let m=d?`${d}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else d&&i.append(d,p)}}else{if(V_(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Kx,n=null,s=Yx,a=t}return i&&s==="text/plain"&&(a=i,i=void 0),{action:n,method:r.toLowerCase(),encType:s,formData:i,body:a}}function mj(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}async function gJ(t,e){if(t.id in e)return e[t.id];try{let r=await import(t.module);return e[t.id]=r,r}catch(r){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function vJ(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function yJ(t,e,r){let n=await Promise.all(t.map(async s=>{let i=e.routes[s.route.id];if(i){let a=await gJ(i,r);return a.links?a.links():[]}return[]}));return wJ(n.flat(1).filter(vJ).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function _M(t,e,r,n,s,i){let a=(c,d)=>r[d]?c.route.id!==r[d].route.id:!0,l=(c,d)=>{var f;return r[d].pathname!==c.pathname||((f=r[d].route.path)==null?void 0:f.endsWith("*"))&&r[d].params["*"]!==c.params["*"]};return i==="assets"?e.filter((c,d)=>a(c,d)||l(c,d)):i==="data"?e.filter((c,d)=>{var p;let f=n.routes[c.route.id];if(!f||!f.hasLoader)return!1;if(a(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let m=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=r[0])==null?void 0:p.params)||{},nextUrl:new URL(t,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function xJ(t,e,{includeHydrateFallback:r}={}){return _J(t.map(n=>{let s=e.routes[n.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function _J(t){return[...new Set(t)]}function bJ(t){let e={},r=Object.keys(t).sort();for(let n of r)e[n]=t[n];return e}function wJ(t,e){let r=new Set;return new Set(e),t.reduce((n,s)=>{let i=JSON.stringify(bJ(s));return r.has(i)||(r.add(i),n.push({key:i,link:s})),n},[])}function SJ(t,e){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r.pathname==="/"?r.pathname="_root.data":e&&sl(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}function hB(){let t=E.useContext(mf);return mj(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function kJ(){let t=E.useContext(U_);return mj(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var gj=E.createContext(void 0);gj.displayName="FrameworkContext";function fB(){let t=E.useContext(gj);return mj(t,"You must render this element inside a <HydratedRouter> element"),t}function EJ(t,e){let r=E.useContext(gj),[n,s]=E.useState(!1),[i,a]=E.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:f,onTouchStart:p}=e,m=E.useRef(null);E.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let x=_=>{_.forEach(S=>{a(S.isIntersecting)})},w=new IntersectionObserver(x,{threshold:.5});return m.current&&w.observe(m.current),()=>{w.disconnect()}}},[t]),E.useEffect(()=>{if(n){let x=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(x)}}},[n]);let g=()=>{s(!0)},y=()=>{s(!1),a(!1)};return r?t!=="intent"?[i,m,{}]:[i,m,{onFocus:zp(l,g),onBlur:zp(c,y),onMouseEnter:zp(d,g),onMouseLeave:zp(f,y),onTouchStart:zp(p,g)}]:[!1,m,{}]}function zp(t,e){return r=>{t&&t(r),r.defaultPrevented||e(r)}}function CJ({page:t,...e}){let{router:r}=hB(),n=E.useMemo(()=>rB(r.routes,t,r.basename),[r.routes,t,r.basename]);return n?E.createElement(jJ,{page:t,matches:n,...e}):null}function NJ(t){let{manifest:e,routeModules:r}=fB(),[n,s]=E.useState([]);return E.useEffect(()=>{let i=!1;return yJ(t,e,r).then(a=>{i||s(a)}),()=>{i=!0}},[t,e,r]),n}function jJ({page:t,matches:e,...r}){let n=Ra(),{manifest:s,routeModules:i}=fB(),{basename:a}=hB(),{loaderData:l,matches:c}=kJ(),d=E.useMemo(()=>_M(t,e,c,s,n,"data"),[t,e,c,s,n]),f=E.useMemo(()=>_M(t,e,c,s,n,"assets"),[t,e,c,s,n]),p=E.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let y=new Set,x=!1;if(e.forEach(_=>{var k;let S=s.routes[_.route.id];!S||!S.hasLoader||(!d.some(N=>N.route.id===_.route.id)&&_.route.id in l&&((k=i[_.route.id])!=null&&k.shouldRevalidate)||S.hasClientLoader?x=!0:y.add(_.route.id))}),y.size===0)return[];let w=SJ(t,a);return x&&y.size>0&&w.searchParams.set("_routes",e.filter(_=>y.has(_.route.id)).map(_=>_.route.id).join(",")),[w.pathname+w.search]},[a,l,n,s,d,e,t,i]),m=E.useMemo(()=>xJ(f,s),[f,s]),g=NJ(f);return E.createElement(E.Fragment,null,p.map(y=>E.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...r})),m.map(y=>E.createElement("link",{key:y,rel:"modulepreload",href:y,...r})),g.map(({key:y,link:x})=>E.createElement("link",{key:y,...x})))}function TJ(...t){return e=>{t.forEach(r=>{typeof r=="function"?r(e):r!=null&&(r.current=e)})}}var pB=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{pB&&(window.__reactRouterVersion="7.3.0")}catch{}function AJ({basename:t,children:e,window:r}){let n=E.useRef();n.current==null&&(n.current=vZ({window:r,v5Compat:!0}));let s=n.current,[i,a]=E.useState({action:s.action,location:s.location}),l=E.useCallback(c=>{E.startTransition(()=>a(c))},[a]);return E.useLayoutEffect(()=>s.listen(l),[s,l]),E.createElement(oJ,{basename:t,children:e,location:i.location,navigationType:i.action,navigator:s})}var mB=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ba=E.forwardRef(function({onClick:e,discover:r="render",prefetch:n="none",relative:s,reloadDocument:i,replace:a,state:l,target:c,to:d,preventScrollReset:f,viewTransition:p,...m},g){let{basename:y}=E.useContext(Aa),x=typeof d=="string"&&mB.test(d),w,_=!1;if(typeof d=="string"&&x&&(w=d,pB))try{let L=new URL(window.location.href),$=d.startsWith("//")?new URL(L.protocol+d):new URL(d),Q=sl($.pathname,y);$.origin===L.origin&&Q!=null?d=Q+$.search+$.hash:_=!0}catch{_a(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let S=VZ(d,{relative:s}),[k,N,j]=EJ(n,m),T=PJ(d,{replace:a,state:l,target:c,preventScrollReset:f,relative:s,viewTransition:p});function D(L){e&&e(L),L.defaultPrevented||T(L)}let I=E.createElement("a",{...m,...j,href:w||S,onClick:_||i?e:D,ref:TJ(g,N),target:c,"data-discover":!x&&r==="render"?"true":void 0});return k&&!x?E.createElement(E.Fragment,null,I,E.createElement(CJ,{page:S})):I});ba.displayName="Link";var RJ=E.forwardRef(function({"aria-current":e="page",caseSensitive:r=!1,className:n="",end:s=!1,style:i,to:a,viewTransition:l,children:c,...d},f){let p=tv(a,{relative:d.relative}),m=Ra(),g=E.useContext(U_),{navigator:y,basename:x}=E.useContext(Aa),w=g!=null&&BJ(p)&&l===!0,_=y.encodeLocation?y.encodeLocation(p).pathname:p.pathname,S=m.pathname,k=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;r||(S=S.toLowerCase(),k=k?k.toLowerCase():null,_=_.toLowerCase()),k&&x&&(k=sl(k,x)||k);const N=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let j=S===_||!s&&S.startsWith(_)&&S.charAt(N)==="/",T=k!=null&&(k===_||!s&&k.startsWith(_)&&k.charAt(_.length)==="/"),D={isActive:j,isPending:T,isTransitioning:w},I=j?e:void 0,L;typeof n=="function"?L=n(D):L=[n,j?"active":null,T?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let $=typeof i=="function"?i(D):i;return E.createElement(ba,{...d,"aria-current":I,className:L,ref:f,style:$,to:a,viewTransition:l},typeof c=="function"?c(D):c)});RJ.displayName="NavLink";var DJ=E.forwardRef(({discover:t="render",fetcherKey:e,navigate:r,reloadDocument:n,replace:s,state:i,method:a=Kx,action:l,onSubmit:c,relative:d,preventScrollReset:f,viewTransition:p,...m},g)=>{let y=LJ(),x=$J(l,{relative:d}),w=a.toLowerCase()==="get"?"get":"post",_=typeof l=="string"&&mB.test(l),S=k=>{if(c&&c(k),k.defaultPrevented)return;k.preventDefault();let N=k.nativeEvent.submitter,j=(N==null?void 0:N.getAttribute("formmethod"))||a;y(N||k.currentTarget,{fetcherKey:e,method:j,navigate:r,replace:s,state:i,relative:d,preventScrollReset:f,viewTransition:p})};return E.createElement("form",{ref:g,method:w,action:x,onSubmit:n?c:S,...m,"data-discover":!_&&t==="render"?"true":void 0})});DJ.displayName="Form";function OJ(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gB(t){let e=E.useContext(mf);return Br(e,OJ(t)),e}function PJ(t,{target:e,replace:r,state:n,preventScrollReset:s,relative:i,viewTransition:a}={}){let l=Yn(),c=Ra(),d=tv(t,{relative:i});return E.useCallback(f=>{if(hJ(f,e)){f.preventDefault();let p=r!==void 0?r:mg(c)===mg(d);l(t,{replace:p,state:n,preventScrollReset:s,relative:i,viewTransition:a})}},[c,l,d,r,n,e,t,s,i,a])}var MJ=0,IJ=()=>`__${String(++MJ)}__`;function LJ(){let{router:t}=gB("useSubmit"),{basename:e}=E.useContext(Aa),r=rJ();return E.useCallback(async(n,s={})=>{let{action:i,method:a,encType:l,formData:c,body:d}=mJ(n,e);if(s.navigate===!1){let f=s.fetcherKey||IJ();await t.fetch(f,r,s.action||i,{preventScrollReset:s.preventScrollReset,formData:c,body:d,formMethod:s.method||a,formEncType:s.encType||l,flushSync:s.flushSync})}else await t.navigate(s.action||i,{preventScrollReset:s.preventScrollReset,formData:c,body:d,formMethod:s.method||a,formEncType:s.encType||l,replace:s.replace,state:s.state,fromRouteId:r,flushSync:s.flushSync,viewTransition:s.viewTransition})},[t,e,r])}function $J(t,{relative:e}={}){let{basename:r}=E.useContext(Aa),n=E.useContext(Yi);Br(n,"useFormAction must be used inside a RouteContext");let[s]=n.matches.slice(-1),i={...tv(t||".",{relative:e})},a=Ra();if(t==null){i.search=a.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(f=>f==="")){l.delete("index"),c.filter(p=>p).forEach(p=>l.append("index",p));let f=l.toString();i.search=f?`?${f}`:""}}return(!t||t===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:tl([r,i.pathname])),mg(i)}function BJ(t,e={}){let r=E.useContext(aB);Br(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=gB("useViewTransitionState"),s=tv(t,{relative:e.relative});if(!r.isTransitioning)return!1;let i=sl(r.currentLocation.pathname,n)||r.currentLocation.pathname,a=sl(r.nextLocation.pathname,n)||r.nextLocation.pathname;return M0(s.pathname,a)!=null||M0(s.pathname,i)!=null}new TextEncoder;var vf=tB();const FJ=ml(vf),zJ=1,UJ=1e6;let gS=0;function VJ(){return gS=(gS+1)%Number.MAX_SAFE_INTEGER,gS.toString()}const vS=new Map,bM=t=>{if(vS.has(t))return;const e=setTimeout(()=>{vS.delete(t),zm({type:"REMOVE_TOAST",toastId:t})},UJ);vS.set(t,e)},HJ=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,zJ)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;return r?bM(r):t.toasts.forEach(n=>{bM(n.id)}),{...t,toasts:t.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},Qx=[];let Xx={toasts:[]};function zm(t){Xx=HJ(Xx,t),Qx.forEach(e=>{e(Xx)})}function qJ({...t}){const e=VJ(),r=s=>zm({type:"UPDATE_TOAST",toast:{...s,id:e}}),n=()=>zm({type:"DISMISS_TOAST",toastId:e});return zm({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||n()}}}),{id:e,dismiss:n,update:r}}function br(){const[t,e]=E.useState(Xx);return E.useEffect(()=>(Qx.push(e),()=>{const r=Qx.indexOf(e);r>-1&&Qx.splice(r,1)}),[t]),{...t,toast:qJ,dismiss:r=>zm({type:"DISMISS_TOAST",toastId:r})}}function Ge(t,e,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t==null||t(s),r===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function wM(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _o(...t){return e=>{let r=!1;const n=t.map(s=>{const i=wM(s,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let s=0;s<n.length;s++){const i=n[s];typeof i=="function"?i():wM(t[s],null)}}}}function Ht(...t){return E.useCallback(_o(...t),t)}function WJ(t,e){const r=E.createContext(e),n=i=>{const{children:a,...l}=i,c=E.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:a})};n.displayName=t+"Provider";function s(i){const a=E.useContext(r);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[n,s]}function Us(t,e=[]){let r=[];function n(i,a){const l=E.createContext(a),c=r.length;r=[...r,a];const d=p=>{var _;const{scope:m,children:g,...y}=p,x=((_=m==null?void 0:m[t])==null?void 0:_[c])||l,w=E.useMemo(()=>y,Object.values(y));return o.jsx(x.Provider,{value:w,children:g})};d.displayName=i+"Provider";function f(p,m){var x;const g=((x=m==null?void 0:m[t])==null?void 0:x[c])||l,y=E.useContext(g);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[d,f]}const s=()=>{const i=r.map(a=>E.createContext(a));return function(l){const c=(l==null?void 0:l[t])||i;return E.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[n,GJ(s,...e)]}function GJ(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=n.reduce((l,{useScope:c,scopeName:d})=>{const p=c(i)[`__scope${d}`];return{...l,...p}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var WE=E.forwardRef((t,e)=>{const{children:r,...n}=t,s=E.Children.toArray(r),i=s.find(YJ);if(i){const a=i.props.children,l=s.map(c=>c===i?E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null:c);return o.jsx(GE,{...n,ref:e,children:E.isValidElement(a)?E.cloneElement(a,void 0,l):null})}return o.jsx(GE,{...n,ref:e,children:r})});WE.displayName="Slot";var GE=E.forwardRef((t,e)=>{const{children:r,...n}=t;if(E.isValidElement(r)){const s=XJ(r),i=QJ(n,r.props);return r.type!==E.Fragment&&(i.ref=e?_o(e,s):s),E.cloneElement(r,i)}return E.Children.count(r)>1?E.Children.only(null):null});GE.displayName="SlotClone";var KJ=({children:t})=>o.jsx(o.Fragment,{children:t});function YJ(t){return E.isValidElement(t)&&t.type===KJ}function QJ(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{i(...l),s(...l)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function XJ(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function H_(t){const e=t+"CollectionProvider",[r,n]=Us(e),[s,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:y,children:x}=g,w=Ss.useRef(null),_=Ss.useRef(new Map).current;return o.jsx(s,{scope:y,itemMap:_,collectionRef:w,children:x})};a.displayName=e;const l=t+"CollectionSlot",c=Ss.forwardRef((g,y)=>{const{scope:x,children:w}=g,_=i(l,x),S=Ht(y,_.collectionRef);return o.jsx(WE,{ref:S,children:w})});c.displayName=l;const d=t+"CollectionItemSlot",f="data-radix-collection-item",p=Ss.forwardRef((g,y)=>{const{scope:x,children:w,..._}=g,S=Ss.useRef(null),k=Ht(y,S),N=i(d,x);return Ss.useEffect(()=>(N.itemMap.set(S,{ref:S,..._}),()=>void N.itemMap.delete(S))),o.jsx(WE,{[f]:"",ref:k,children:w})});p.displayName=d;function m(g){const y=i(t+"CollectionConsumer",g);return Ss.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const _=Array.from(w.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((N,j)=>_.indexOf(N.ref.current)-_.indexOf(j.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:c,ItemSlot:p},m,n]}var vB=E.forwardRef((t,e)=>{const{children:r,...n}=t,s=E.Children.toArray(r),i=s.find(JJ);if(i){const a=i.props.children,l=s.map(c=>c===i?E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null:c);return o.jsx(KE,{...n,ref:e,children:E.isValidElement(a)?E.cloneElement(a,void 0,l):null})}return o.jsx(KE,{...n,ref:e,children:r})});vB.displayName="Slot";var KE=E.forwardRef((t,e)=>{const{children:r,...n}=t;if(E.isValidElement(r)){const s=tee(r),i=eee(n,r.props);return r.type!==E.Fragment&&(i.ref=e?_o(e,s):s),E.cloneElement(r,i)}return E.Children.count(r)>1?E.Children.only(null):null});KE.displayName="SlotClone";var ZJ=({children:t})=>o.jsx(o.Fragment,{children:t});function JJ(t){return E.isValidElement(t)&&t.type===ZJ}function eee(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{i(...l),s(...l)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function tee(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var ree=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],pt=ree.reduce((t,e)=>{const r=E.forwardRef((n,s)=>{const{asChild:i,...a}=n,l=i?vB:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function vj(t,e){t&&vf.flushSync(()=>t.dispatchEvent(e))}function us(t){const e=E.useRef(t);return E.useEffect(()=>{e.current=t}),E.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function nee(t,e=globalThis==null?void 0:globalThis.document){const r=us(t);E.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var see="DismissableLayer",YE="dismissableLayer.update",iee="dismissableLayer.pointerDownOutside",aee="dismissableLayer.focusOutside",SM,yB=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yf=E.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...c}=t,d=E.useContext(yB),[f,p]=E.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=E.useState({}),y=Ht(e,D=>p(D)),x=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),_=x.indexOf(w),S=f?x.indexOf(f):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,N=S>=_,j=lee(D=>{const I=D.target,L=[...d.branches].some($=>$.contains(I));!N||L||(s==null||s(D),a==null||a(D),D.defaultPrevented||l==null||l())},m),T=cee(D=>{const I=D.target;[...d.branches].some($=>$.contains(I))||(i==null||i(D),a==null||a(D),D.defaultPrevented||l==null||l())},m);return nee(D=>{S===d.layers.size-1&&(n==null||n(D),!D.defaultPrevented&&l&&(D.preventDefault(),l()))},m),E.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(SM=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),kM(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=SM)}},[f,m,r,d]),E.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),kM())},[f,d]),E.useEffect(()=>{const D=()=>g({});return document.addEventListener(YE,D),()=>document.removeEventListener(YE,D)},[]),o.jsx(pt.div,{...c,ref:y,style:{pointerEvents:k?N?"auto":"none":void 0,...t.style},onFocusCapture:Ge(t.onFocusCapture,T.onFocusCapture),onBlurCapture:Ge(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ge(t.onPointerDownCapture,j.onPointerDownCapture)})});yf.displayName=see;var oee="DismissableLayerBranch",xB=E.forwardRef((t,e)=>{const r=E.useContext(yB),n=E.useRef(null),s=Ht(e,n);return E.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),o.jsx(pt.div,{...t,ref:s})});xB.displayName=oee;function lee(t,e=globalThis==null?void 0:globalThis.document){const r=us(t),n=E.useRef(!1),s=E.useRef(()=>{});return E.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){_B(iee,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function cee(t,e=globalThis==null?void 0:globalThis.document){const r=us(t),n=E.useRef(!1);return E.useEffect(()=>{const s=i=>{i.target&&!n.current&&_B(aee,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function kM(){const t=new CustomEvent(YE);document.dispatchEvent(t)}function _B(t,e,r,{discrete:n}){const s=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?vj(s,i):s.dispatchEvent(i)}var uee=yf,dee=xB,Kn=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},hee="Portal",xf=E.forwardRef((t,e)=>{var l;const{container:r,...n}=t,[s,i]=E.useState(!1);Kn(()=>i(!0),[]);const a=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?FJ.createPortal(o.jsx(pt.div,{...n,ref:e}),a):null});xf.displayName=hee;function fee(t,e){return E.useReducer((r,n)=>e[r][n]??r,t)}var _i=t=>{const{present:e,children:r}=t,n=pee(e),s=typeof r=="function"?r({present:n.isPresent}):E.Children.only(r),i=Ht(n.ref,mee(s));return typeof r=="function"||n.isPresent?E.cloneElement(s,{ref:i}):null};_i.displayName="Presence";function pee(t){const[e,r]=E.useState(),n=E.useRef({}),s=E.useRef(t),i=E.useRef("none"),a=t?"mounted":"unmounted",[l,c]=fee(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const d=Ky(n.current);i.current=l==="mounted"?d:"none"},[l]),Kn(()=>{const d=n.current,f=s.current;if(f!==t){const m=i.current,g=Ky(d);t?c("MOUNT"):g==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),Kn(()=>{if(e){let d;const f=e.ownerDocument.defaultView??window,p=g=>{const x=Ky(n.current).includes(g.animationName);if(g.target===e&&x&&(c("ANIMATION_END"),!s.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",d=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},m=g=>{g.target===e&&(i.current=Ky(n.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",p),e.addEventListener("animationend",p),()=>{f.clearTimeout(d),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",p),e.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:E.useCallback(d=>{d&&(n.current=getComputedStyle(d)),r(d)},[])}}function Ky(t){return(t==null?void 0:t.animationName)||"none"}function mee(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function po({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,s]=gee({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,l=us(r),c=E.useCallback(d=>{if(i){const p=typeof d=="function"?d(t):d;p!==t&&l(p)}else s(d)},[i,t,s,l]);return[a,c]}function gee({defaultProp:t,onChange:e}){const r=E.useState(t),[n]=r,s=E.useRef(n),i=us(e);return E.useEffect(()=>{s.current!==n&&(i(n),s.current=n)},[n,s,i]),r}var vee="VisuallyHidden",rv=E.forwardRef((t,e)=>o.jsx(pt.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));rv.displayName=vee;var yee=rv,yj="ToastProvider",[xj,xee,_ee]=H_("Toast"),[bB,p5e]=Us("Toast",[_ee]),[bee,q_]=bB(yj),wB=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[l,c]=E.useState(null),[d,f]=E.useState(0),p=E.useRef(!1),m=E.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${yj}\`. Expected non-empty \`string\`.`),o.jsx(xj.Provider,{scope:e,children:o.jsx(bee,{scope:e,label:r,duration:n,swipeDirection:s,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:E.useCallback(()=>f(g=>g+1),[]),onToastRemove:E.useCallback(()=>f(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:m,children:a})})};wB.displayName=yj;var SB="ToastViewport",wee=["F8"],QE="toast.viewportPause",XE="toast.viewportResume",kB=E.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=wee,label:s="Notifications ({hotkey})",...i}=t,a=q_(SB,r),l=xee(r),c=E.useRef(null),d=E.useRef(null),f=E.useRef(null),p=E.useRef(null),m=Ht(e,p,a.onViewportChange),g=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;E.useEffect(()=>{const w=_=>{var k;n.length!==0&&n.every(N=>_[N]||_.code===N)&&((k=p.current)==null||k.focus())};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[n]),E.useEffect(()=>{const w=c.current,_=p.current;if(y&&w&&_){const S=()=>{if(!a.isClosePausedRef.current){const T=new CustomEvent(QE);_.dispatchEvent(T),a.isClosePausedRef.current=!0}},k=()=>{if(a.isClosePausedRef.current){const T=new CustomEvent(XE);_.dispatchEvent(T),a.isClosePausedRef.current=!1}},N=T=>{!w.contains(T.relatedTarget)&&k()},j=()=>{w.contains(document.activeElement)||k()};return w.addEventListener("focusin",S),w.addEventListener("focusout",N),w.addEventListener("pointermove",S),w.addEventListener("pointerleave",j),window.addEventListener("blur",S),window.addEventListener("focus",k),()=>{w.removeEventListener("focusin",S),w.removeEventListener("focusout",N),w.removeEventListener("pointermove",S),w.removeEventListener("pointerleave",j),window.removeEventListener("blur",S),window.removeEventListener("focus",k)}}},[y,a.isClosePausedRef]);const x=E.useCallback(({tabbingDirection:w})=>{const S=l().map(k=>{const N=k.ref.current,j=[N,...Mee(N)];return w==="forwards"?j:j.reverse()});return(w==="forwards"?S.reverse():S).flat()},[l]);return E.useEffect(()=>{const w=p.current;if(w){const _=S=>{var j,T,D;const k=S.altKey||S.ctrlKey||S.metaKey;if(S.key==="Tab"&&!k){const I=document.activeElement,L=S.shiftKey;if(S.target===w&&L){(j=d.current)==null||j.focus();return}const M=x({tabbingDirection:L?"backwards":"forwards"}),z=M.findIndex(R=>R===I);yS(M.slice(z+1))?S.preventDefault():L?(T=d.current)==null||T.focus():(D=f.current)==null||D.focus()}};return w.addEventListener("keydown",_),()=>w.removeEventListener("keydown",_)}},[l,x]),o.jsxs(dee,{ref:c,role:"region","aria-label":s.replace("{hotkey}",g),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(ZE,{ref:d,onFocusFromOutsideViewport:()=>{const w=x({tabbingDirection:"forwards"});yS(w)}}),o.jsx(xj.Slot,{scope:r,children:o.jsx(pt.ol,{tabIndex:-1,...i,ref:m})}),y&&o.jsx(ZE,{ref:f,onFocusFromOutsideViewport:()=>{const w=x({tabbingDirection:"backwards"});yS(w)}})]})});kB.displayName=SB;var EB="ToastFocusProxy",ZE=E.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=t,i=q_(EB,r);return o.jsx(rv,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{var d;const l=a.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&n()}})});ZE.displayName=EB;var W_="Toast",See="toast.swipeStart",kee="toast.swipeMove",Eee="toast.swipeCancel",Cee="toast.swipeEnd",CB=E.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...a}=t,[l=!0,c]=po({prop:n,defaultProp:s,onChange:i});return o.jsx(_i,{present:r||l,children:o.jsx(Tee,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:us(t.onPause),onResume:us(t.onResume),onSwipeStart:Ge(t.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ge(t.onSwipeMove,d=>{const{x:f,y:p}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:Ge(t.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ge(t.onSwipeEnd,d=>{const{x:f,y:p}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),c(!1)})})})});CB.displayName=W_;var[Nee,jee]=bB(W_,{onClose(){}}),Tee=E.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:f,onSwipeMove:p,onSwipeCancel:m,onSwipeEnd:g,...y}=t,x=q_(W_,r),[w,_]=E.useState(null),S=Ht(e,R=>_(R)),k=E.useRef(null),N=E.useRef(null),j=s||x.duration,T=E.useRef(0),D=E.useRef(j),I=E.useRef(0),{onToastAdd:L,onToastRemove:$}=x,Q=us(()=>{var B;(w==null?void 0:w.contains(document.activeElement))&&((B=x.viewport)==null||B.focus()),a()}),M=E.useCallback(R=>{!R||R===1/0||(window.clearTimeout(I.current),T.current=new Date().getTime(),I.current=window.setTimeout(Q,R))},[Q]);E.useEffect(()=>{const R=x.viewport;if(R){const B=()=>{M(D.current),d==null||d()},V=()=>{const F=new Date().getTime()-T.current;D.current=D.current-F,window.clearTimeout(I.current),c==null||c()};return R.addEventListener(QE,V),R.addEventListener(XE,B),()=>{R.removeEventListener(QE,V),R.removeEventListener(XE,B)}}},[x.viewport,j,c,d,M]),E.useEffect(()=>{i&&!x.isClosePausedRef.current&&M(j)},[i,j,x.isClosePausedRef,M]),E.useEffect(()=>(L(),()=>$()),[L,$]);const z=E.useMemo(()=>w?OB(w):null,[w]);return x.viewport?o.jsxs(o.Fragment,{children:[z&&o.jsx(Aee,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:z}),o.jsx(Nee,{scope:r,onClose:Q,children:vf.createPortal(o.jsx(xj.ItemSlot,{scope:r,children:o.jsx(uee,{asChild:!0,onEscapeKeyDown:Ge(l,()=>{x.isFocusedToastEscapeKeyDownRef.current||Q(),x.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(pt.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":x.swipeDirection,...y,ref:S,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ge(t.onKeyDown,R=>{R.key==="Escape"&&(l==null||l(R.nativeEvent),R.nativeEvent.defaultPrevented||(x.isFocusedToastEscapeKeyDownRef.current=!0,Q()))}),onPointerDown:Ge(t.onPointerDown,R=>{R.button===0&&(k.current={x:R.clientX,y:R.clientY})}),onPointerMove:Ge(t.onPointerMove,R=>{if(!k.current)return;const B=R.clientX-k.current.x,V=R.clientY-k.current.y,F=!!N.current,K=["left","right"].includes(x.swipeDirection),Y=["left","up"].includes(x.swipeDirection)?Math.min:Math.max,O=K?Y(0,B):0,H=K?0:Y(0,V),G=R.pointerType==="touch"?10:2,q={x:O,y:H},J={originalEvent:R,delta:q};F?(N.current=q,Yy(kee,p,J,{discrete:!1})):EM(q,x.swipeDirection,G)?(N.current=q,Yy(See,f,J,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(B)>G||Math.abs(V)>G)&&(k.current=null)}),onPointerUp:Ge(t.onPointerUp,R=>{const B=N.current,V=R.target;if(V.hasPointerCapture(R.pointerId)&&V.releasePointerCapture(R.pointerId),N.current=null,k.current=null,B){const F=R.currentTarget,K={originalEvent:R,delta:B};EM(B,x.swipeDirection,x.swipeThreshold)?Yy(Cee,g,K,{discrete:!0}):Yy(Eee,m,K,{discrete:!0}),F.addEventListener("click",Y=>Y.preventDefault(),{once:!0})}})})})}),x.viewport)})]}):null}),Aee=t=>{const{__scopeToast:e,children:r,...n}=t,s=q_(W_,e),[i,a]=E.useState(!1),[l,c]=E.useState(!1);return Oee(()=>a(!0)),E.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:o.jsx(xf,{asChild:!0,children:o.jsx(rv,{...n,children:i&&o.jsxs(o.Fragment,{children:[s.label," ",r]})})})},Ree="ToastTitle",NB=E.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return o.jsx(pt.div,{...n,ref:e})});NB.displayName=Ree;var Dee="ToastDescription",jB=E.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return o.jsx(pt.div,{...n,ref:e})});jB.displayName=Dee;var TB="ToastAction",AB=E.forwardRef((t,e)=>{const{altText:r,...n}=t;return r.trim()?o.jsx(DB,{altText:r,asChild:!0,children:o.jsx(_j,{...n,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${TB}\`. Expected non-empty \`string\`.`),null)});AB.displayName=TB;var RB="ToastClose",_j=E.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,s=jee(RB,r);return o.jsx(DB,{asChild:!0,children:o.jsx(pt.button,{type:"button",...n,ref:e,onClick:Ge(t.onClick,s.onClose)})})});_j.displayName=RB;var DB=E.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...s}=t;return o.jsx(pt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:e})});function OB(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),Pee(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",i=n.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=n.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...OB(n))}}),e}function Yy(t,e,r,{discrete:n}){const s=r.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?vj(s,i):s.dispatchEvent(i)}var EM=(t,e,r=0)=>{const n=Math.abs(t.x),s=Math.abs(t.y),i=n>s;return e==="left"||e==="right"?i&&n>r:!i&&s>r};function Oee(t=()=>{}){const e=us(t);Kn(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function Pee(t){return t.nodeType===t.ELEMENT_NODE}function Mee(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function yS(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var Iee=wB,PB=kB,MB=CB,IB=NB,LB=jB,$B=AB,BB=_j;function FB(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=FB(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function zB(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=FB(t))&&(n&&(n+=" "),n+=e);return n}const CM=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,NM=zB,_f=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return NM(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(d=>{const f=r==null?void 0:r[d],p=i==null?void 0:i[d];if(f===null)return null;const m=CM(f)||CM(p);return s[d][m]}),l=r&&Object.entries(r).reduce((d,f)=>{let[p,m]=f;return m===void 0||(d[p]=m),d},{}),c=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((d,f)=>{let{class:p,className:m,...g}=f;return Object.entries(g).every(y=>{let[x,w]=y;return Array.isArray(w)?w.includes({...i,...l}[x]):{...i,...l}[x]===w})?[...d,p,m]:d},[]);return NM(t,a,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Lee=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),UB=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/var $ee={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Bee=E.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:a,...l},c)=>E.createElement("svg",{ref:c,...$ee,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:UB("lucide",s),...l},[...a.map(([d,f])=>E.createElement(d,f)),...Array.isArray(i)?i:[i]]));/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ie=(t,e)=>{const r=E.forwardRef(({className:n,...s},i)=>E.createElement(Bee,{ref:i,iconNode:e,className:UB(`lucide-${Lee(t)}`,n),...s}));return r.displayName=`${t}`,r};/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Fee=[["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"}]],VB=Ie("Activity",Fee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const zee=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],HB=Ie("AppWindow",zee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Uee=[["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"}]],Au=Ie("Archive",Uee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Vee=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],mo=Ie("ArrowLeft",Vee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Hee=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ei=Ie("ArrowRight",Hee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const qee=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Wee=Ie("BadgeCheck",qee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Gee=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 9.5 2 2 4-4",key:"1dth82"}]],Kee=Ie("BookCheck",Gee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Yee=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],jM=Ie("BookOpen",Yee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Qee=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]],TM=Ie("BookText",Qee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Xee=[["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"}]],I0=Ie("Bot",Xee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Zee=[["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"}]],nv=Ie("Box",Zee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Jee=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],qB=Ie("Boxes",Jee);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ete=[["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"}]],tte=Ie("Brain",ete);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const rte=[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]],WB=Ie("Cable",rte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const nte=[["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"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],ste=Ie("CalendarDays",nte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ite=[["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"}]],bj=Ie("Calendar",ite);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ate=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lr=Ie("Check",ate);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ote=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],G_=Ie("ChevronDown",ote);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const lte=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Qa=Ie("ChevronLeft",lte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const cte=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_s=Ie("ChevronRight",cte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ute=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],wj=Ie("ChevronUp",ute);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const dte=[["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"}]],os=Ie("CircleAlert",dte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const hte=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],is=Ie("CircleCheckBig",hte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const fte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Sj=Ie("CircleCheck",fte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const pte=[["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"}]],GB=Ie("CircleHelp",pte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const mte=[["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"}]],AM=Ie("CircleUser",mte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const gte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],vte=Ie("Circle",gte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const yte=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["path",{d:"M16 21.16a10 10 0 1 1 5-13.516",key:"cxo92l"}],["path",{d:"M20 11.5v6",key:"2ei3xq"}],["path",{d:"M20 21.5h.01",key:"1r2dzp"}]],xte=Ie("ClockAlert",yte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const _te=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Vu=Ie("Clock",_te);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const bte=[["circle",{cx:"12",cy:"17",r:"3",key:"1spfwm"}],["path",{d:"M4.2 15.1A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"zaobp"}],["path",{d:"m15.7 18.4-.9-.3",key:"4qxpbn"}],["path",{d:"m9.2 15.9-.9-.3",key:"17q7o2"}],["path",{d:"m10.6 20.7.3-.9",key:"1pf4s2"}],["path",{d:"m13.1 14.2.3-.9",key:"1mnuqm"}],["path",{d:"m13.6 20.7-.4-1",key:"1jpd1m"}],["path",{d:"m10.8 14.3-.4-1",key:"17ugyy"}],["path",{d:"m8.3 18.6 1-.4",key:"s42vdx"}],["path",{d:"m14.7 15.8 1-.4",key:"2wizun"}]],wte=Ie("CloudCog",bte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ste=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],xS=Ie("CloudUpload",Ste);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const kte=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Hu=Ie("Cloud",kte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ete=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],JE=Ie("Code",Ete);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Cte=[["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"}]],cn=Ie("Copy",Cte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Nte=[["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"}]],il=Ie("Cpu",Nte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const jte=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],KB=Ie("CreditCard",jte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Tte=[["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"}]],RM=Ie("Crown",Tte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ate=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Zs=Ie("Database",Ate);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Rte=[["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"}]],al=Ie("ExternalLink",Rte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Dte=[["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"}]],ol=Ie("EyeOff",Dte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ote=[["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"}]],ll=Ie("Eye",Ote);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Pte=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],qh=Ie("FileCode",Pte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Mte=[["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"}]],Ite=Ie("FileText",Mte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Lte=[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]],DM=Ie("Filter",Lte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const $te=[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],L0=Ie("FolderGit2",$te);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Bte=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],eC=Ie("FolderOpen",Bte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Fte=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],zte=Ie("Folder",Fte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ute=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Vte=Ie("Gauge",Ute);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Hte=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],K_=Ie("GitBranch",Hte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const qte=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Zx=Ie("Github",qte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Wte=[["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"}]],An=Ie("Globe",Wte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Gte=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Kte=Ie("Grid3x3",Gte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Yte=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],Es=Ie("HardDrive",Yte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Qte=[["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"}]],Jx=Ie("Image",Qte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Xte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Bi=Ie("Info",Xte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Zte=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],gi=Ie("KeyRound",Zte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Jte=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],gg=Ie("Key",Jte);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ere=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Wh=Ie("Layers",ere);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const tre=[["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"}]],rre=Ie("LayoutDashboard",tre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const nre=[["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"}]],YB=Ie("LayoutGrid",nre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const sre=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],kj=Ie("List",sre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ire=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kt=Ie("LoaderCircle",ire);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const are=[["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"}]],Gn=Ie("Lock",are);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ore=[["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"}]],OM=Ie("LogOut",ore);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const lre=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],cre=Ie("MailCheck",lre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ure=[["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"}]],Sc=Ie("Mail",ure);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const dre=[["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"}]],hre=Ie("MapPin",dre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const fre=[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]],QB=Ie("MemoryStick",fre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const pre=[["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"}]],mre=Ie("Menu",pre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const gre=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],XB=Ie("MessageCircle",gre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const vre=[["path",{d:"M5 12h14",key:"1ays0h"}]],yre=Ie("Minus",vre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const xre=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],cl=Ie("Moon",xre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const _re=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],bre=Ie("Network",_re);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const wre=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],xm=Ie("Package",wre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Sre=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],kre=Ie("Palette",Sre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ere=[["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"}]],Cre=Ie("Pause",Ere);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Nre=[["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"}]],Y_=Ie("Pencil",Nre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const jre=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Q_=Ie("Play",jre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Tre=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],nr=Ie("Plus",Tre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Are=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],Rre=Ie("Puzzle",Are);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Dre=[["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"}]],Ore=Ie("Quote",Dre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Pre=[["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"}]],wn=Ie("RefreshCw",Pre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Mre=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],$r=Ie("Rocket",Mre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ire=[["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"}]],ZB=Ie("Save",Ire);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Lre=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],sv=Ie("Search",Lre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const $re=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Bre=Ie("Send",$re);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Fre=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],io=Ie("Server",Fre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const zre=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],od=Ie("ShieldCheck",zre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ure=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],wa=Ie("Shield",Ure);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Vre=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],PM=Ie("SlidersHorizontal",Vre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Hre=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],qre=Ie("Smartphone",Hre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Wre=[["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"}]],ti=Ie("Sparkles",Wre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Gre=[["path",{d:"M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"4i38lg"}],["path",{d:"M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"mlte4a"}],["rect",{width:"8",height:"8",x:"14",y:"14",rx:"2",key:"1fa9i4"}]],JB=Ie("SquareStack",Gre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Kre=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],Yre=Ie("SquareTerminal",Kre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Qre=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Xre=Ie("Square",Qre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Zre=[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]],Jre=Ie("Store",Zre);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ene=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],eF=Ie("Sun",ene);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const tne=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],rne=Ie("Tag",tne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const nne=[["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"}]],sne=Ie("Tags",nne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ine=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],Bs=Ie("Terminal",ine);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ane=[["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"}]],ds=Ie("Trash2",ane);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const one=[["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"}]],$0=Ie("Trash",one);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const lne=[["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"}]],cne=Ie("TrendingUp",lne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const une=[["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"}]],Ej=Ie("TriangleAlert",une);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const dne=[["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"}]],hne=Ie("UserPlus",dne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const fne=[["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"}]],B0=Ie("User",fne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const pne=[["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"}]],dc=Ie("Users",pne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const mne=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],MM=Ie("Wallet",mne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const gne=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],tF=Ie("WandSparkles",gne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const vne=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],yc=Ie("X",vne);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const yne=[["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"}]],hc=Ie("Zap",yne),Cj="-",xne=t=>{const e=bne(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{const l=a.split(Cj);return l[0]===""&&l.length!==1&&l.shift(),rF(l,e)||_ne(a)},getConflictingClassGroupIds:(a,l)=>{const c=r[a]||[];return l&&n[a]?[...c,...n[a]]:c}}},rF=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),s=n?rF(t.slice(1),n):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(Cj);return(a=e.validators.find(({validator:l})=>l(i)))==null?void 0:a.classGroupId},IM=/^\[(.+)\]$/,_ne=t=>{if(IM.test(t)){const e=IM.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},bne=t=>{const{theme:e,classGroups:r}=t,n={nextPart:new Map,validators:[]};for(const s in r)tC(r[s],n,s,e);return n},tC=(t,e,r,n)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:LM(e,s);i.classGroupId=r;return}if(typeof s=="function"){if(wne(s)){tC(s(n),e,r,n);return}e.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,a])=>{tC(a,LM(e,i),r,n)})})},LM=(t,e)=>{let r=t;return e.split(Cj).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},wne=t=>t.isThemeGetter,Sne=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const s=(i,a)=>{r.set(i,a),e++,e>t&&(e=0,n=r,r=new Map)};return{get(i){let a=r.get(i);if(a!==void 0)return a;if((a=n.get(i))!==void 0)return s(i,a),a},set(i,a){r.has(i)?r.set(i,a):s(i,a)}}},rC="!",nC=":",kne=nC.length,Ene=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=s=>{const i=[];let a=0,l=0,c=0,d;for(let y=0;y<s.length;y++){let x=s[y];if(a===0&&l===0){if(x===nC){i.push(s.slice(c,y)),c=y+kne;continue}if(x==="/"){d=y;continue}}x==="["?a++:x==="]"?a--:x==="("?l++:x===")"&&l--}const f=i.length===0?s:s.substring(c),p=Cne(f),m=p!==f,g=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:g}};if(e){const s=e+nC,i=n;n=a=>a.startsWith(s)?i(a.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:a,maybePostfixModifierPosition:void 0}}if(r){const s=n;n=i=>r({className:i,parseClassName:s})}return n},Cne=t=>t.endsWith(rC)?t.substring(0,t.length-1):t.startsWith(rC)?t.substring(1):t,Nne=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const s=[];let i=[];return n.forEach(a=>{a[0]==="["||e[a]?(s.push(...i.sort(),a),i=[]):i.push(a)}),s.push(...i.sort()),s}},jne=t=>({cache:Sne(t.cacheSize),parseClassName:Ene(t),sortModifiers:Nne(t),...xne(t)}),Tne=/\s+/,Ane=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],l=t.trim().split(Tne);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:x}=r(f);if(p){c=f+(c.length>0?" "+c:c);continue}let w=!!x,_=n(w?y.substring(0,x):y);if(!_){if(!w){c=f+(c.length>0?" "+c:c);continue}if(_=n(y),!_){c=f+(c.length>0?" "+c:c);continue}w=!1}const S=i(m).join(":"),k=g?S+rC:S,N=k+_;if(a.includes(N))continue;a.push(N);const j=s(_,w);for(let T=0;T<j.length;++T){const D=j[T];a.push(k+D)}c=f+(c.length>0?" "+c:c)}return c};function Rne(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=nF(e))&&(n&&(n+=" "),n+=r);return n}const nF=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=nF(t[n]))&&(r&&(r+=" "),r+=e);return r};function Dne(t,...e){let r,n,s,i=a;function a(c){const d=e.reduce((f,p)=>p(f),t());return r=jne(d),n=r.cache.get,s=r.cache.set,i=l,l(c)}function l(c){const d=n(c);if(d)return d;const f=Ane(c,r);return s(c,f),f}return function(){return i(Rne.apply(null,arguments))}}const Bn=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},sF=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,iF=/^\((?:(\w[\w-]*):)?(.+)\)$/i,One=/^\d+\/\d+$/,Pne=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mne=/\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$/,Ine=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Lne=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$ne=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Kd=t=>One.test(t),Bt=t=>!!t&&!Number.isNaN(Number(t)),uu=t=>!!t&&Number.isInteger(Number(t)),$M=t=>t.endsWith("%")&&Bt(t.slice(0,-1)),Wl=t=>Pne.test(t),Bne=()=>!0,Fne=t=>Mne.test(t)&&!Ine.test(t),Nj=()=>!1,zne=t=>Lne.test(t),Une=t=>$ne.test(t),Vne=t=>!st(t)&&!it(t),Hne=t=>bf(t,lF,Nj),st=t=>sF.test(t),du=t=>bf(t,cF,Fne),_S=t=>bf(t,tse,Bt),qne=t=>bf(t,aF,Nj),Wne=t=>bf(t,oF,Une),Gne=t=>bf(t,Nj,zne),it=t=>iF.test(t),Qy=t=>wf(t,cF),Kne=t=>wf(t,rse),Yne=t=>wf(t,aF),Qne=t=>wf(t,lF),Xne=t=>wf(t,oF),Zne=t=>wf(t,nse,!0),bf=(t,e,r)=>{const n=sF.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},wf=(t,e,r=!1)=>{const n=iF.exec(t);return n?n[1]?e(n[1]):r:!1},aF=t=>t==="position",Jne=new Set(["image","url"]),oF=t=>Jne.has(t),ese=new Set(["length","size","percentage"]),lF=t=>ese.has(t),cF=t=>t==="length",tse=t=>t==="number",rse=t=>t==="family-name",nse=t=>t==="shadow",sse=()=>{const t=Bn("color"),e=Bn("font"),r=Bn("text"),n=Bn("font-weight"),s=Bn("tracking"),i=Bn("leading"),a=Bn("breakpoint"),l=Bn("container"),c=Bn("spacing"),d=Bn("radius"),f=Bn("shadow"),p=Bn("inset-shadow"),m=Bn("drop-shadow"),g=Bn("blur"),y=Bn("perspective"),x=Bn("aspect"),w=Bn("ease"),_=Bn("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],N=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],T=()=>[it,st,c],D=()=>[Kd,"full","auto",...T()],I=()=>[uu,"none","subgrid",it,st],L=()=>["auto",{span:["full",uu,it,st]},it,st],$=()=>[uu,"auto",it,st],Q=()=>["auto","min","max","fr",it,st],M=()=>["start","end","center","between","around","evenly","stretch","baseline"],z=()=>["start","end","center","stretch"],R=()=>["auto",...T()],B=()=>[Kd,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],V=()=>[t,it,st],F=()=>[$M,du],K=()=>["","none","full",d,it,st],Y=()=>["",Bt,Qy,du],O=()=>["solid","dashed","dotted","double"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["","none",g,it,st],q=()=>["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",it,st],J=()=>["none",Bt,it,st],te=()=>["none",Bt,it,st],ve=()=>[Bt,it,st],he=()=>[Kd,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wl],breakpoint:[Wl],color:[Bne],container:[Wl],"drop-shadow":[Wl],ease:["in","out","in-out"],font:[Vne],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wl],shadow:[Wl],spacing:["px",Bt],text:[Wl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Kd,st,it,x]}],container:["container"],columns:[{columns:[Bt,st,it,l]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...k(),st,it]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[uu,"auto",it,st]}],basis:[{basis:[Kd,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Bt,Kd,"auto","initial","none",st]}],grow:[{grow:["",Bt,it,st]}],shrink:[{shrink:["",Bt,it,st]}],order:[{order:[uu,"first","last","none",it,st]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...z(),"baseline"]}],"align-self":[{self:["auto",...z(),"baseline"]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...B()]}],h:[{h:["screen",...B()]}],"min-h":[{"min-h":["screen","none",...B()]}],"max-h":[{"max-h":["screen",...B()]}],"font-size":[{text:["base",r,Qy,du]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,it,_S]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$M,st]}],"font-family":[{font:[Kne,st,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,it,st]}],"line-clamp":[{"line-clamp":[Bt,"none",it,_S]}],leading:[{leading:[i,...T()]}],"list-image":[{"list-image":["none",it,st]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",it,st]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:[Bt,"from-font","auto",it,du]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Bt,"auto",it,st]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",it,st]}],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",it,st]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...k(),Yne,qne]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:["auto","cover","contain",Qne,Hne]}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},uu,it,st],radial:["",it,st],conic:[uu,it,st]},Xne,Wne]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:F()}],"gradient-via-pos":[{via:F()}],"gradient-to-pos":[{to:F()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...O(),"hidden","none"]}],"divide-style":[{divide:[...O(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...O(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Bt,it,st]}],"outline-w":[{outline:["",Bt,Qy,du]}],"outline-color":[{outline:[t]}],shadow:[{shadow:["","none",f,Zne,Gne]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",it,st,p]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Bt,du]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":V()}],opacity:[{opacity:[Bt,it,st]}],"mix-blend":[{"mix-blend":[...H(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none",it,st]}],blur:[{blur:G()}],brightness:[{brightness:[Bt,it,st]}],contrast:[{contrast:[Bt,it,st]}],"drop-shadow":[{"drop-shadow":["","none",m,it,st]}],grayscale:[{grayscale:["",Bt,it,st]}],"hue-rotate":[{"hue-rotate":[Bt,it,st]}],invert:[{invert:["",Bt,it,st]}],saturate:[{saturate:[Bt,it,st]}],sepia:[{sepia:["",Bt,it,st]}],"backdrop-filter":[{"backdrop-filter":["","none",it,st]}],"backdrop-blur":[{"backdrop-blur":G()}],"backdrop-brightness":[{"backdrop-brightness":[Bt,it,st]}],"backdrop-contrast":[{"backdrop-contrast":[Bt,it,st]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Bt,it,st]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Bt,it,st]}],"backdrop-invert":[{"backdrop-invert":["",Bt,it,st]}],"backdrop-opacity":[{"backdrop-opacity":[Bt,it,st]}],"backdrop-saturate":[{"backdrop-saturate":[Bt,it,st]}],"backdrop-sepia":[{"backdrop-sepia":["",Bt,it,st]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",it,st]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Bt,"initial",it,st]}],ease:[{ease:["linear","initial",w,it,st]}],delay:[{delay:[Bt,it,st]}],animate:[{animate:["none",_,it,st]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,it,st]}],"perspective-origin":[{"perspective-origin":q()}],rotate:[{rotate:J()}],"rotate-x":[{"rotate-x":J()}],"rotate-y":[{"rotate-y":J()}],"rotate-z":[{"rotate-z":J()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[it,st,"","none","gpu","cpu"]}],"transform-origin":[{origin:q()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:he()}],"translate-x":[{"translate-x":he()}],"translate-y":[{"translate-y":he()}],"translate-z":[{"translate-z":he()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",it,st]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",it,st]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Bt,Qy,du,_S]}],stroke:[{stroke:["none",...V()]}],"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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["before","after","placeholder","file","marker","selection","first-line","first-letter","backdrop","*","**"]}},ise=Dne(sse);function we(...t){return ise(zB(t))}const jt=(t,e,r)=>{console.group(`🚀 [${t}]`),console.log(`🔍 ${e}`),r!==void 0&&console.log("📝 Data:",r),console.groupEnd()},ase=Iee,uF=E.forwardRef(({className:t,...e},r)=>o.jsx(PB,{ref:r,className:we("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));uF.displayName=PB.displayName;const ose=_f("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),dF=E.forwardRef(({className:t,variant:e,...r},n)=>o.jsx(MB,{ref:n,className:we(ose({variant:e}),t),...r}));dF.displayName=MB.displayName;const lse=E.forwardRef(({className:t,...e},r)=>o.jsx($B,{ref:r,className:we("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));lse.displayName=$B.displayName;const hF=E.forwardRef(({className:t,...e},r)=>o.jsx(BB,{ref:r,className:we("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:o.jsx(yc,{className:"h-4 w-4"})}));hF.displayName=BB.displayName;const fF=E.forwardRef(({className:t,...e},r)=>o.jsx(IB,{ref:r,className:we("text-sm font-semibold [&+div]:text-xs",t),...e}));fF.displayName=IB.displayName;const pF=E.forwardRef(({className:t,...e},r)=>o.jsx(LB,{ref:r,className:we("text-sm opacity-90",t),...e}));pF.displayName=LB.displayName;function mF(){const{toasts:t}=br();return o.jsxs(ase,{children:[t.map(function({id:e,title:r,description:n,action:s,...i}){return o.jsxs(dF,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[r&&o.jsx(fF,{children:r}),n&&o.jsx(pF,{children:n})]}),s,o.jsx(hF,{})]},e)}),o.jsx(uF,{})]})}var sC=function(t,e){return sC=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},sC(t,e)};function Qi(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");sC(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ue=function(){return ue=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ue.apply(this,arguments)};function ga(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function sc(t,e,r,n){function s(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function l(f){try{d(n.next(f))}catch(p){a(p)}}function c(f){try{d(n.throw(f))}catch(p){a(p)}}function d(f){f.done?i(f.value):s(f.value).then(l,c)}d((n=n.apply(t,e||[])).next())})}function ic(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(d){return function(f){return c([d,f])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,d[0]&&(r=0)),r;)try{if(n=1,s&&(i=d[0]&2?s.return:d[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,d[1])).done)return i;switch(s=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,s=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){r.label=d[1];break}if(d[0]===6&&r.label<i[1]){r.label=i[1],i=d;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(d);break}i[2]&&r.ops.pop(),r.trys.pop();continue}d=e.call(t,r)}catch(f){d=[6,f],s=0}finally{n=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function cs(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}var bS="Invariant Violation",BM=Object.setPrototypeOf,cse=BM===void 0?function(t,e){return t.__proto__=e,t}:BM,gF=function(t){Qi(e,t);function e(r){r===void 0&&(r=bS);var n=t.call(this,typeof r=="number"?bS+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=bS,cse(n,e.prototype),n}return e}(Error);function Ru(t,e){if(!t)throw new gF(e)}var vF=["debug","log","warn","error","silent"],use=vF.indexOf("log");function Xy(t){return function(){if(vF.indexOf(t)>=use){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Xy("debug"),t.log=Xy("log"),t.warn=Xy("warn"),t.error=Xy("error")})(Ru||(Ru={}));var jj="3.13.5";function fa(t){try{return t()}catch{}}const iC=fa(function(){return globalThis})||fa(function(){return window})||fa(function(){return self})||fa(function(){return global})||fa(function(){return fa.constructor("return this")()});var FM=new Map;function aC(t){var e=FM.get(t)||1;return FM.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function yF(t,e){e===void 0&&(e=0);var r=aC("stringifyForDisplay");return JSON.stringify(t,function(n,s){return s===void 0?r:s},e).split(JSON.stringify(r)).join("<undefined>")}function Zy(t){return function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(typeof e=="number"){var s=e;e=Tj(s),e||(e=Aj(s,r),r=[])}t.apply(void 0,[e].concat(r))}}var Je=Object.assign(function(e,r){for(var n=[],s=2;s<arguments.length;s++)n[s-2]=arguments[s];e||Ru(e,Tj(r,n)||Aj(r,n))},{debug:Zy(Ru.debug),log:Zy(Ru.log),warn:Zy(Ru.warn),error:Zy(Ru.error)});function zs(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return new gF(Tj(t,e)||Aj(t,e))}var zM=Symbol.for("ApolloErrorMessageHandler_"+jj);function xF(t){if(typeof t=="string")return t;try{return yF(t,2).slice(0,1e3)}catch{return"<non-serializable>"}}function Tj(t,e){if(e===void 0&&(e=[]),!!t)return iC[zM]&&iC[zM](t,e.map(xF))}function Aj(t,e){if(e===void 0&&(e=[]),!!t)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:jj,message:t,args:e.map(xF)})))}function e0(t,e){if(!!!t)throw new Error(e)}function dse(t){return typeof t=="object"&&t!==null}function hse(t,e){if(!!!t)throw new Error("Unexpected invariant triggered.")}const fse=/\r\n|[\n\r]/g;function oC(t,e){let r=0,n=1;for(const s of t.body.matchAll(fse)){if(typeof s.index=="number"||hse(!1),s.index>=e)break;r=s.index+s[0].length,n+=1}return{line:n,column:e+1-r}}function pse(t){return _F(t.source,oC(t.source,t.start))}function _F(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,s=e.line-1,i=t.locationOffset.line-1,a=e.line+i,l=e.line===1?r:0,c=e.column+l,d=`${t.name}:${a}:${c}
|
||
`,f=n.split(/\r\n|[\n\r]/g),p=f[s];if(p.length>120){const m=Math.floor(c/80),g=c%80,y=[];for(let x=0;x<p.length;x+=80)y.push(p.slice(x,x+80));return d+UM([[`${a} |`,y[0]],...y.slice(1,m+1).map(x=>["|",x]),["|","^".padStart(g)],["|",y[m+1]]])}return d+UM([[`${a-1} |`,f[s-1]],[`${a} |`,p],["|","^".padStart(c)],[`${a+1} |`,f[s+1]]])}function UM(t){const e=t.filter(([n,s])=>s!==void 0),r=Math.max(...e.map(([n])=>n.length));return e.map(([n,s])=>n.padStart(r)+(s?" "+s:"")).join(`
|
||
`)}function mse(t){const e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}class Rj extends Error{constructor(e,...r){var n,s,i;const{nodes:a,source:l,positions:c,path:d,originalError:f,extensions:p}=mse(r);super(e),this.name="GraphQLError",this.path=d??void 0,this.originalError=f??void 0,this.nodes=VM(Array.isArray(a)?a:a?[a]:void 0);const m=VM((n=this.nodes)===null||n===void 0?void 0:n.map(y=>y.loc).filter(y=>y!=null));this.source=l??(m==null||(s=m[0])===null||s===void 0?void 0:s.source),this.positions=c??(m==null?void 0:m.map(y=>y.start)),this.locations=c&&l?c.map(y=>oC(l,y)):m==null?void 0:m.map(y=>oC(y.source,y.start));const g=dse(f==null?void 0:f.extensions)?f==null?void 0:f.extensions:void 0;this.extensions=(i=p??g)!==null&&i!==void 0?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),f!=null&&f.stack?Object.defineProperty(this,"stack",{value:f.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Rj):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+=`
|
||
|
||
`+pse(r.loc));else if(this.source&&this.locations)for(const r of this.locations)e+=`
|
||
|
||
`+_F(this.source,r);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function VM(t){return t===void 0||t.length===0?void 0:t}function Wn(t,e,r){return new Rj(`Syntax Error: ${r}`,{source:t,positions:[e]})}class gse{constructor(e,r,n){this.start=e.start,this.end=r.end,this.startToken=e,this.endToken=r,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class bF{constructor(e,r,n,s,i,a){this.kind=e,this.start=r,this.end=n,this.line=s,this.column=i,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const wF={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},vse=new Set(Object.keys(wF));function HM(t){const e=t==null?void 0:t.kind;return typeof e=="string"&&vse.has(e)}var xh;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(xh||(xh={}));var lC;(function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(lC||(lC={}));var Ze;(function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(Ze||(Ze={}));function cC(t){return t===9||t===32}function vg(t){return t>=48&&t<=57}function SF(t){return t>=97&&t<=122||t>=65&&t<=90}function kF(t){return SF(t)||t===95}function yse(t){return SF(t)||vg(t)||t===95}function xse(t){var e;let r=Number.MAX_SAFE_INTEGER,n=null,s=-1;for(let a=0;a<t.length;++a){var i;const l=t[a],c=_se(l);c!==l.length&&(n=(i=n)!==null&&i!==void 0?i:a,s=a,a!==0&&c<r&&(r=c))}return t.map((a,l)=>l===0?a:a.slice(r)).slice((e=n)!==null&&e!==void 0?e:0,s+1)}function _se(t){let e=0;for(;e<t.length&&cC(t.charCodeAt(e));)++e;return e}function bse(t,e){const r=t.replace(/"""/g,'\\"""'),n=r.split(/\r\n|[\n\r]/g),s=n.length===1,i=n.length>1&&n.slice(1).every(g=>g.length===0||cC(g.charCodeAt(0))),a=r.endsWith('\\"""'),l=t.endsWith('"')&&!a,c=t.endsWith("\\"),d=l||c,f=!s||t.length>70||d||i||a;let p="";const m=s&&cC(t.charCodeAt(0));return(f&&!m||i)&&(p+=`
|
||
`),p+=r,(f||d)&&(p+=`
|
||
`),'"""'+p+'"""'}var Me;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(Me||(Me={}));class wse{constructor(e){const r=new bF(Me.SOF,0,0,0,0);this.source=e,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==Me.EOF)do if(e.next)e=e.next;else{const r=kse(this,e.end);e.next=r,r.prev=e,e=r}while(e.kind===Me.COMMENT);return e}}function Sse(t){return t===Me.BANG||t===Me.DOLLAR||t===Me.AMP||t===Me.PAREN_L||t===Me.PAREN_R||t===Me.SPREAD||t===Me.COLON||t===Me.EQUALS||t===Me.AT||t===Me.BRACKET_L||t===Me.BRACKET_R||t===Me.BRACE_L||t===Me.PIPE||t===Me.BRACE_R}function Sf(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function X_(t,e){return EF(t.charCodeAt(e))&&CF(t.charCodeAt(e+1))}function EF(t){return t>=55296&&t<=56319}function CF(t){return t>=56320&&t<=57343}function Zu(t,e){const r=t.source.body.codePointAt(e);if(r===void 0)return Me.EOF;if(r>=32&&r<=126){const n=String.fromCodePoint(r);return n==='"'?`'"'`:`"${n}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function gn(t,e,r,n,s){const i=t.line,a=1+r-t.lineStart;return new bF(e,r,n,i,a,s)}function kse(t,e){const r=t.source.body,n=r.length;let s=e;for(;s<n;){const i=r.charCodeAt(s);switch(i){case 65279:case 9:case 32:case 44:++s;continue;case 10:++s,++t.line,t.lineStart=s;continue;case 13:r.charCodeAt(s+1)===10?s+=2:++s,++t.line,t.lineStart=s;continue;case 35:return Ese(t,s);case 33:return gn(t,Me.BANG,s,s+1);case 36:return gn(t,Me.DOLLAR,s,s+1);case 38:return gn(t,Me.AMP,s,s+1);case 40:return gn(t,Me.PAREN_L,s,s+1);case 41:return gn(t,Me.PAREN_R,s,s+1);case 46:if(r.charCodeAt(s+1)===46&&r.charCodeAt(s+2)===46)return gn(t,Me.SPREAD,s,s+3);break;case 58:return gn(t,Me.COLON,s,s+1);case 61:return gn(t,Me.EQUALS,s,s+1);case 64:return gn(t,Me.AT,s,s+1);case 91:return gn(t,Me.BRACKET_L,s,s+1);case 93:return gn(t,Me.BRACKET_R,s,s+1);case 123:return gn(t,Me.BRACE_L,s,s+1);case 124:return gn(t,Me.PIPE,s,s+1);case 125:return gn(t,Me.BRACE_R,s,s+1);case 34:return r.charCodeAt(s+1)===34&&r.charCodeAt(s+2)===34?Rse(t,s):Nse(t,s)}if(vg(i)||i===45)return Cse(t,s,i);if(kF(i))return Dse(t,s);throw Wn(t.source,s,i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:Sf(i)||X_(r,s)?`Unexpected character: ${Zu(t,s)}.`:`Invalid character: ${Zu(t,s)}.`)}return gn(t,Me.EOF,n,n)}function Ese(t,e){const r=t.source.body,n=r.length;let s=e+1;for(;s<n;){const i=r.charCodeAt(s);if(i===10||i===13)break;if(Sf(i))++s;else if(X_(r,s))s+=2;else break}return gn(t,Me.COMMENT,e,s,r.slice(e+1,s))}function Cse(t,e,r){const n=t.source.body;let s=e,i=r,a=!1;if(i===45&&(i=n.charCodeAt(++s)),i===48){if(i=n.charCodeAt(++s),vg(i))throw Wn(t.source,s,`Invalid number, unexpected digit after 0: ${Zu(t,s)}.`)}else s=wS(t,s,i),i=n.charCodeAt(s);if(i===46&&(a=!0,i=n.charCodeAt(++s),s=wS(t,s,i),i=n.charCodeAt(s)),(i===69||i===101)&&(a=!0,i=n.charCodeAt(++s),(i===43||i===45)&&(i=n.charCodeAt(++s)),s=wS(t,s,i),i=n.charCodeAt(s)),i===46||kF(i))throw Wn(t.source,s,`Invalid number, expected digit but got: ${Zu(t,s)}.`);return gn(t,a?Me.FLOAT:Me.INT,e,s,n.slice(e,s))}function wS(t,e,r){if(!vg(r))throw Wn(t.source,e,`Invalid number, expected digit but got: ${Zu(t,e)}.`);const n=t.source.body;let s=e+1;for(;vg(n.charCodeAt(s));)++s;return s}function Nse(t,e){const r=t.source.body,n=r.length;let s=e+1,i=s,a="";for(;s<n;){const l=r.charCodeAt(s);if(l===34)return a+=r.slice(i,s),gn(t,Me.STRING,e,s+1,a);if(l===92){a+=r.slice(i,s);const c=r.charCodeAt(s+1)===117?r.charCodeAt(s+2)===123?jse(t,s):Tse(t,s):Ase(t,s);a+=c.value,s+=c.size,i=s;continue}if(l===10||l===13)break;if(Sf(l))++s;else if(X_(r,s))s+=2;else throw Wn(t.source,s,`Invalid character within String: ${Zu(t,s)}.`)}throw Wn(t.source,s,"Unterminated string.")}function jse(t,e){const r=t.source.body;let n=0,s=3;for(;s<12;){const i=r.charCodeAt(e+s++);if(i===125){if(s<5||!Sf(n))break;return{value:String.fromCodePoint(n),size:s}}if(n=n<<4|_m(i),n<0)break}throw Wn(t.source,e,`Invalid Unicode escape sequence: "${r.slice(e,e+s)}".`)}function Tse(t,e){const r=t.source.body,n=qM(r,e+2);if(Sf(n))return{value:String.fromCodePoint(n),size:6};if(EF(n)&&r.charCodeAt(e+6)===92&&r.charCodeAt(e+7)===117){const s=qM(r,e+8);if(CF(s))return{value:String.fromCodePoint(n,s),size:12}}throw Wn(t.source,e,`Invalid Unicode escape sequence: "${r.slice(e,e+6)}".`)}function qM(t,e){return _m(t.charCodeAt(e))<<12|_m(t.charCodeAt(e+1))<<8|_m(t.charCodeAt(e+2))<<4|_m(t.charCodeAt(e+3))}function _m(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function Ase(t,e){const r=t.source.body;switch(r.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
||
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw Wn(t.source,e,`Invalid character escape sequence: "${r.slice(e,e+2)}".`)}function Rse(t,e){const r=t.source.body,n=r.length;let s=t.lineStart,i=e+3,a=i,l="";const c=[];for(;i<n;){const d=r.charCodeAt(i);if(d===34&&r.charCodeAt(i+1)===34&&r.charCodeAt(i+2)===34){l+=r.slice(a,i),c.push(l);const f=gn(t,Me.BLOCK_STRING,e,i+3,xse(c).join(`
|
||
`));return t.line+=c.length-1,t.lineStart=s,f}if(d===92&&r.charCodeAt(i+1)===34&&r.charCodeAt(i+2)===34&&r.charCodeAt(i+3)===34){l+=r.slice(a,i),a=i+1,i+=4;continue}if(d===10||d===13){l+=r.slice(a,i),c.push(l),d===13&&r.charCodeAt(i+1)===10?i+=2:++i,l="",a=i,s=i;continue}if(Sf(d))++i;else if(X_(r,i))i+=2;else throw Wn(t.source,i,`Invalid character within String: ${Zu(t,i)}.`)}throw Wn(t.source,i,"Unterminated string.")}function Dse(t,e){const r=t.source.body,n=r.length;let s=e+1;for(;s<n;){const i=r.charCodeAt(s);if(yse(i))++s;else break}return gn(t,Me.NAME,e,s,r.slice(e,s))}const Ose=10,NF=2;function Dj(t){return Z_(t,[])}function Z_(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return Pse(t,e);default:return String(t)}}function Pse(t,e){if(t===null)return"null";if(e.includes(t))return"[Circular]";const r=[...e,t];if(Mse(t)){const n=t.toJSON();if(n!==t)return typeof n=="string"?n:Z_(n,r)}else if(Array.isArray(t))return Lse(t,r);return Ise(t,r)}function Mse(t){return typeof t.toJSON=="function"}function Ise(t,e){const r=Object.entries(t);return r.length===0?"{}":e.length>NF?"["+$se(t)+"]":"{ "+r.map(([s,i])=>s+": "+Z_(i,e)).join(", ")+" }"}function Lse(t,e){if(t.length===0)return"[]";if(e.length>NF)return"[Array]";const r=Math.min(Ose,t.length),n=t.length-r,s=[];for(let i=0;i<r;++i)s.push(Z_(t[i],e));return n===1?s.push("... 1 more item"):n>1&&s.push(`... ${n} more items`),"["+s.join(", ")+"]"}function $se(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){const r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}const Bse=globalThis.process&&!0,Fse=Bse?function(e,r){return e instanceof r}:function(e,r){if(e instanceof r)return!0;if(typeof e=="object"&&e!==null){var n;const s=r.prototype[Symbol.toStringTag],i=Symbol.toStringTag in e?e[Symbol.toStringTag]:(n=e.constructor)===null||n===void 0?void 0:n.name;if(s===i){const a=Dj(e);throw new Error(`Cannot use ${s} "${a}" from another module or realm.
|
||
|
||
Ensure that there is only one instance of "graphql" in the node_modules
|
||
directory. If different versions of "graphql" are the dependencies of other
|
||
relied on modules, use "resolutions" to ensure only one version is installed.
|
||
|
||
https://yarnpkg.com/en/docs/selective-version-resolutions
|
||
|
||
Duplicate "graphql" modules cannot be used at the same time since different
|
||
versions may have different capabilities and behavior. The data from one
|
||
version used in the function from another could produce confusing and
|
||
spurious results.`)}}return!1};class jF{constructor(e,r="GraphQL request",n={line:1,column:1}){typeof e=="string"||e0(!1,`Body must be a string. Received: ${Dj(e)}.`),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||e0(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||e0(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function zse(t){return Fse(t,jF)}function TF(t,e){const r=new Use(t,e),n=r.parseDocument();return Object.defineProperty(n,"tokenCount",{enumerable:!1,value:r.tokenCount}),n}class Use{constructor(e,r={}){const n=zse(e)?e:new jF(e);this._lexer=new wse(n),this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(Me.NAME);return this.node(e,{kind:Ze.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Ze.DOCUMENT,definitions:this.many(Me.SOF,this.parseDefinition,Me.EOF)})}parseDefinition(){if(this.peek(Me.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),r=e?this._lexer.lookahead():this._lexer.token;if(r.kind===Me.NAME){switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw Wn(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(r.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(r)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(Me.BRACE_L))return this.node(e,{kind:Ze.OPERATION_DEFINITION,operation:xh.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const r=this.parseOperationType();let n;return this.peek(Me.NAME)&&(n=this.parseName()),this.node(e,{kind:Ze.OPERATION_DEFINITION,operation:r,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Me.NAME);switch(e.value){case"query":return xh.QUERY;case"mutation":return xh.MUTATION;case"subscription":return xh.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Me.PAREN_L,this.parseVariableDefinition,Me.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Ze.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Me.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Me.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Me.DOLLAR),this.node(e,{kind:Ze.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Ze.SELECTION_SET,selections:this.many(Me.BRACE_L,this.parseSelection,Me.BRACE_R)})}parseSelection(){return this.peek(Me.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,r=this.parseName();let n,s;return this.expectOptionalToken(Me.COLON)?(n=r,s=this.parseName()):s=r,this.node(e,{kind:Ze.FIELD,alias:n,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Me.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const r=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Me.PAREN_L,r,Me.PAREN_R)}parseArgument(e=!1){const r=this._lexer.token,n=this.parseName();return this.expectToken(Me.COLON),this.node(r,{kind:Ze.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Me.SPREAD);const r=this.expectOptionalKeyword("on");return!r&&this.peek(Me.NAME)?this.node(e,{kind:Ze.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Ze.INLINE_FRAGMENT,typeCondition:r?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:Ze.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Ze.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){const r=this._lexer.token;switch(r.kind){case Me.BRACKET_L:return this.parseList(e);case Me.BRACE_L:return this.parseObject(e);case Me.INT:return this.advanceLexer(),this.node(r,{kind:Ze.INT,value:r.value});case Me.FLOAT:return this.advanceLexer(),this.node(r,{kind:Ze.FLOAT,value:r.value});case Me.STRING:case Me.BLOCK_STRING:return this.parseStringLiteral();case Me.NAME:switch(this.advanceLexer(),r.value){case"true":return this.node(r,{kind:Ze.BOOLEAN,value:!0});case"false":return this.node(r,{kind:Ze.BOOLEAN,value:!1});case"null":return this.node(r,{kind:Ze.NULL});default:return this.node(r,{kind:Ze.ENUM,value:r.value})}case Me.DOLLAR:if(e)if(this.expectToken(Me.DOLLAR),this._lexer.token.kind===Me.NAME){const n=this._lexer.token.value;throw Wn(this._lexer.source,r.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(r);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Ze.STRING,value:e.value,block:e.kind===Me.BLOCK_STRING})}parseList(e){const r=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:Ze.LIST,values:this.any(Me.BRACKET_L,r,Me.BRACKET_R)})}parseObject(e){const r=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:Ze.OBJECT,fields:this.any(Me.BRACE_L,r,Me.BRACE_R)})}parseObjectField(e){const r=this._lexer.token,n=this.parseName();return this.expectToken(Me.COLON),this.node(r,{kind:Ze.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const r=[];for(;this.peek(Me.AT);)r.push(this.parseDirective(e));return r}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const r=this._lexer.token;return this.expectToken(Me.AT),this.node(r,{kind:Ze.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let r;if(this.expectOptionalToken(Me.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(Me.BRACKET_R),r=this.node(e,{kind:Ze.LIST_TYPE,type:n})}else r=this.parseNamedType();return this.expectOptionalToken(Me.BANG)?this.node(e,{kind:Ze.NON_NULL_TYPE,type:r}):r}parseNamedType(){return this.node(this._lexer.token,{kind:Ze.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Me.STRING)||this.peek(Me.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),s=this.many(Me.BRACE_L,this.parseOperationTypeDefinition,Me.BRACE_R);return this.node(e,{kind:Ze.SCHEMA_DEFINITION,description:r,directives:n,operationTypes:s})}parseOperationTypeDefinition(){const e=this._lexer.token,r=this.parseOperationType();this.expectToken(Me.COLON);const n=this.parseNamedType();return this.node(e,{kind:Ze.OPERATION_TYPE_DEFINITION,operation:r,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),s=this.parseConstDirectives();return this.node(e,{kind:Ze.SCALAR_TYPE_DEFINITION,description:r,name:n,directives:s})}parseObjectTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:Ze.OBJECT_TYPE_DEFINITION,description:r,name:n,interfaces:s,directives:i,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Me.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Me.BRACE_L,this.parseFieldDefinition,Me.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseName(),s=this.parseArgumentDefs();this.expectToken(Me.COLON);const i=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(e,{kind:Ze.FIELD_DEFINITION,description:r,name:n,arguments:s,type:i,directives:a})}parseArgumentDefs(){return this.optionalMany(Me.PAREN_L,this.parseInputValueDef,Me.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseName();this.expectToken(Me.COLON);const s=this.parseTypeReference();let i;this.expectOptionalToken(Me.EQUALS)&&(i=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(e,{kind:Ze.INPUT_VALUE_DEFINITION,description:r,name:n,type:s,defaultValue:i,directives:a})}parseInterfaceTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:Ze.INTERFACE_TYPE_DEFINITION,description:r,name:n,interfaces:s,directives:i,fields:a})}parseUnionTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:Ze.UNION_TYPE_DEFINITION,description:r,name:n,directives:s,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(Me.EQUALS)?this.delimitedMany(Me.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:Ze.ENUM_TYPE_DEFINITION,description:r,name:n,directives:s,values:i})}parseEnumValuesDefinition(){return this.optionalMany(Me.BRACE_L,this.parseEnumValueDefinition,Me.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseEnumValueName(),s=this.parseConstDirectives();return this.node(e,{kind:Ze.ENUM_VALUE_DEFINITION,description:r,name:n,directives:s})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw Wn(this._lexer.source,this._lexer.token.start,`${Jy(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:Ze.INPUT_OBJECT_TYPE_DEFINITION,description:r,name:n,directives:s,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(Me.BRACE_L,this.parseInputValueDef,Me.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Me.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const r=this.parseConstDirectives(),n=this.optionalMany(Me.BRACE_L,this.parseOperationTypeDefinition,Me.BRACE_R);if(r.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:Ze.SCHEMA_EXTENSION,directives:r,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const r=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:Ze.SCALAR_TYPE_EXTENSION,name:r,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const r=this.parseName(),n=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(n.length===0&&s.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Ze.OBJECT_TYPE_EXTENSION,name:r,interfaces:n,directives:s,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const r=this.parseName(),n=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(n.length===0&&s.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Ze.INTERFACE_TYPE_EXTENSION,name:r,interfaces:n,directives:s,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const r=this.parseName(),n=this.parseConstDirectives(),s=this.parseUnionMemberTypes();if(n.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:Ze.UNION_TYPE_EXTENSION,name:r,directives:n,types:s})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const r=this.parseName(),n=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();if(n.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:Ze.ENUM_TYPE_EXTENSION,name:r,directives:n,values:s})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const r=this.parseName(),n=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();if(n.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:Ze.INPUT_OBJECT_TYPE_EXTENSION,name:r,directives:n,fields:s})}parseDirectiveDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Me.AT);const n=this.parseName(),s=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(e,{kind:Ze.DIRECTIVE_DEFINITION,description:r,name:n,arguments:s,repeatable:i,locations:a})}parseDirectiveLocations(){return this.delimitedMany(Me.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,r=this.parseName();if(Object.prototype.hasOwnProperty.call(lC,r.value))return r;throw this.unexpected(e)}node(e,r){return this._options.noLocation!==!0&&(r.loc=new gse(e,this._lexer.lastToken,this._lexer.source)),r}peek(e){return this._lexer.token.kind===e}expectToken(e){const r=this._lexer.token;if(r.kind===e)return this.advanceLexer(),r;throw Wn(this._lexer.source,r.start,`Expected ${AF(e)}, found ${Jy(r)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const r=this._lexer.token;if(r.kind===Me.NAME&&r.value===e)this.advanceLexer();else throw Wn(this._lexer.source,r.start,`Expected "${e}", found ${Jy(r)}.`)}expectOptionalKeyword(e){const r=this._lexer.token;return r.kind===Me.NAME&&r.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const r=e??this._lexer.token;return Wn(this._lexer.source,r.start,`Unexpected ${Jy(r)}.`)}any(e,r,n){this.expectToken(e);const s=[];for(;!this.expectOptionalToken(n);)s.push(r.call(this));return s}optionalMany(e,r,n){if(this.expectOptionalToken(e)){const s=[];do s.push(r.call(this));while(!this.expectOptionalToken(n));return s}return[]}many(e,r,n){this.expectToken(e);const s=[];do s.push(r.call(this));while(!this.expectOptionalToken(n));return s}delimitedMany(e,r){this.expectOptionalToken(e);const n=[];do n.push(r.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,r=this._lexer.advance();if(r.kind!==Me.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw Wn(this._lexer.source,r.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function Jy(t){const e=t.value;return AF(t.kind)+(e!=null?` "${e}"`:"")}function AF(t){return Sse(t)?`"${t}"`:t}function Vse(t){return`"${t.replace(Hse,qse)}"`}const Hse=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function qse(t){return Wse[t.charCodeAt(0)]}const Wse=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],J_=Object.freeze({});function Sa(t,e,r=wF){const n=new Map;for(const _ of Object.values(Ze))n.set(_,Gse(e,_));let s,i=Array.isArray(t),a=[t],l=-1,c=[],d=t,f,p;const m=[],g=[];do{l++;const _=l===a.length,S=_&&c.length!==0;if(_){if(f=g.length===0?void 0:m[m.length-1],d=p,p=g.pop(),S)if(i){d=d.slice();let N=0;for(const[j,T]of c){const D=j-N;T===null?(d.splice(D,1),N++):d[D]=T}}else{d={...d};for(const[N,j]of c)d[N]=j}l=s.index,a=s.keys,c=s.edits,i=s.inArray,s=s.prev}else if(p){if(f=i?l:a[l],d=p[f],d==null)continue;m.push(f)}let k;if(!Array.isArray(d)){var y,x;HM(d)||e0(!1,`Invalid AST Node: ${Dj(d)}.`);const N=_?(y=n.get(d.kind))===null||y===void 0?void 0:y.leave:(x=n.get(d.kind))===null||x===void 0?void 0:x.enter;if(k=N==null?void 0:N.call(e,d,f,p,m,g),k===J_)break;if(k===!1){if(!_){m.pop();continue}}else if(k!==void 0&&(c.push([f,k]),!_))if(HM(k))d=k;else{m.pop();continue}}if(k===void 0&&S&&c.push([f,d]),_)m.pop();else{var w;s={inArray:i,index:l,keys:a,edits:c,prev:s},i=Array.isArray(d),a=i?d:(w=r[d.kind])!==null&&w!==void 0?w:[],l=-1,c=[],p&&g.push(p),p=d}}while(s!==void 0);return c.length!==0?c[c.length-1][1]:t}function Gse(t,e){const r=t[e];return typeof r=="object"?r:typeof r=="function"?{enter:r,leave:void 0}:{enter:t.enter,leave:t.leave}}function Oj(t){return Sa(t,Yse)}const Kse=80,Yse={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>at(t.definitions,`
|
||
|
||
`)},OperationDefinition:{leave(t){const e=Ft("(",at(t.variableDefinitions,", "),")"),r=at([t.operation,at([t.name,e]),at(t.directives," ")]," ");return(r==="query"?"":r+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:r,directives:n})=>t+": "+e+Ft(" = ",r)+Ft(" ",at(n," "))},SelectionSet:{leave:({selections:t})=>ta(t)},Field:{leave({alias:t,name:e,arguments:r,directives:n,selectionSet:s}){const i=Ft("",t,": ")+e;let a=i+Ft("(",at(r,", "),")");return a.length>Kse&&(a=i+Ft(`(
|
||
`,t0(at(r,`
|
||
`)),`
|
||
)`)),at([a,at(n," "),s]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+Ft(" ",at(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:r})=>at(["...",Ft("on ",t),at(e," "),r]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:r,directives:n,selectionSet:s})=>`fragment ${t}${Ft("(",at(r,", "),")")} on ${e} ${Ft("",at(n," ")," ")}`+s},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?bse(t):Vse(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+at(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+at(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+Ft("(",at(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:r})=>Ft("",t,`
|
||
`)+at(["schema",at(e," "),ta(r)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:r})=>Ft("",t,`
|
||
`)+at(["scalar",e,at(r," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:r,directives:n,fields:s})=>Ft("",t,`
|
||
`)+at(["type",e,Ft("implements ",at(r," & ")),at(n," "),ta(s)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:r,type:n,directives:s})=>Ft("",t,`
|
||
`)+e+(WM(r)?Ft(`(
|
||
`,t0(at(r,`
|
||
`)),`
|
||
)`):Ft("(",at(r,", "),")"))+": "+n+Ft(" ",at(s," "))},InputValueDefinition:{leave:({description:t,name:e,type:r,defaultValue:n,directives:s})=>Ft("",t,`
|
||
`)+at([e+": "+r,Ft("= ",n),at(s," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:r,directives:n,fields:s})=>Ft("",t,`
|
||
`)+at(["interface",e,Ft("implements ",at(r," & ")),at(n," "),ta(s)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:r,types:n})=>Ft("",t,`
|
||
`)+at(["union",e,at(r," "),Ft("= ",at(n," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:r,values:n})=>Ft("",t,`
|
||
`)+at(["enum",e,at(r," "),ta(n)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:r})=>Ft("",t,`
|
||
`)+at([e,at(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:r,fields:n})=>Ft("",t,`
|
||
`)+at(["input",e,at(r," "),ta(n)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:r,repeatable:n,locations:s})=>Ft("",t,`
|
||
`)+"directive @"+e+(WM(r)?Ft(`(
|
||
`,t0(at(r,`
|
||
`)),`
|
||
)`):Ft("(",at(r,", "),")"))+(n?" repeatable":"")+" on "+at(s," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>at(["extend schema",at(t," "),ta(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>at(["extend scalar",t,at(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:r,fields:n})=>at(["extend type",t,Ft("implements ",at(e," & ")),at(r," "),ta(n)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:r,fields:n})=>at(["extend interface",t,Ft("implements ",at(e," & ")),at(r," "),ta(n)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:r})=>at(["extend union",t,at(e," "),Ft("= ",at(r," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:r})=>at(["extend enum",t,at(e," "),ta(r)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:r})=>at(["extend input",t,at(e," "),ta(r)]," ")}};function at(t,e=""){var r;return(r=t==null?void 0:t.filter(n=>n).join(e))!==null&&r!==void 0?r:""}function ta(t){return Ft(`{
|
||
`,t0(at(t,`
|
||
`)),`
|
||
}`)}function Ft(t,e,r=""){return e!=null&&e!==""?t+e+r:""}function t0(t){return Ft(" ",t.replace(/\n/g,`
|
||
`))}function WM(t){var e;return(e=t==null?void 0:t.some(r=>r.includes(`
|
||
`)))!==null&&e!==void 0?e:!1}const Qse=Object.freeze(Object.defineProperty({__proto__:null,print:Oj},Symbol.toStringTag,{value:"Module"}));function GM(t){return t.kind===Ze.FIELD||t.kind===Ze.FRAGMENT_SPREAD||t.kind===Ze.INLINE_FRAGMENT}function Xse(t,e){let r=null;for(const s of t.definitions)if(s.kind===Ze.OPERATION_DEFINITION){var n;if(e==null){if(r)return null;r=s}else if(((n=s.name)===null||n===void 0?void 0:n.value)===e)return s}return r}const Zse=Object.freeze(Object.defineProperty({__proto__:null,getOperationAST:Xse},Symbol.toStringTag,{value:"Module"}));function iv(t,e){var r=t.directives;return!r||!r.length?!0:tie(r).every(function(n){var s=n.directive,i=n.ifArgument,a=!1;return i.value.kind==="Variable"?(a=e&&e[i.value.name.value],Je(a!==void 0,78,s.name.value)):a=i.value.value,s.name.value==="skip"?!a:a})}function yg(t,e,r){var n=new Set(t),s=n.size;return Sa(e,{Directive:function(i){if(n.delete(i.name.value)&&(!r||!n.size))return J_}}),r?!n.size:n.size<s}function Jse(t){return t&&yg(["client","export"],t,!0)}function eie(t){var e=t.name.value;return e==="skip"||e==="include"}function tie(t){var e=[];return t&&t.length&&t.forEach(function(r){if(eie(r)){var n=r.arguments,s=r.name.value;Je(n&&n.length===1,79,s);var i=n[0];Je(i.name&&i.name.value==="if",80,s);var a=i.value;Je(a&&(a.kind==="Variable"||a.kind==="BooleanValue"),81,s),e.push({directive:r,ifArgument:i})}}),e}function rie(t){var e,r,n=(e=t.directives)===null||e===void 0?void 0:e.find(function(i){var a=i.name;return a.value==="unmask"});if(!n)return"mask";var s=(r=n.arguments)===null||r===void 0?void 0:r.find(function(i){var a=i.name;return a.value==="mode"});return globalThis.__DEV__!==!1&&s&&(s.value.kind===Ze.VARIABLE?globalThis.__DEV__!==!1&&Je.warn(82):s.value.kind!==Ze.STRING?globalThis.__DEV__!==!1&&Je.warn(83):s.value.value!=="migrate"&&globalThis.__DEV__!==!1&&Je.warn(84,s.value.value)),s&&"value"in s.value&&s.value.value==="migrate"?"migrate":"unmask"}const nie=()=>Object.create(null),{forEach:sie,slice:KM}=Array.prototype,{hasOwnProperty:iie}=Object.prototype;class gl{constructor(e=!0,r=nie){this.weakness=e,this.makeData=r}lookup(){return this.lookupArray(arguments)}lookupArray(e){let r=this;return sie.call(e,n=>r=r.getChildTrie(n)),iie.call(r,"data")?r.data:r.data=this.makeData(KM.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let r=this;for(let n=0,s=e.length;r&&n<s;++n){const i=r.mapFor(e[n],!1);r=i&&i.get(e[n])}return r&&r.data}remove(){return this.removeArray(arguments)}removeArray(e){let r;if(e.length){const n=e[0],s=this.mapFor(n,!1),i=s&&s.get(n);i&&(r=i.removeArray(KM.call(e,1)),!i.data&&!i.weak&&!(i.strong&&i.strong.size)&&s.delete(n))}else r=this.data,delete this.data;return r}getChildTrie(e){const r=this.mapFor(e,!0);let n=r.get(e);return n||r.set(e,n=new gl(this.weakness,this.makeData)),n}mapFor(e,r){return this.weakness&&aie(e)?this.weak||(r?this.weak=new WeakMap:void 0):this.strong||(r?this.strong=new Map:void 0)}}function aie(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var RF=fa(function(){return navigator.product})=="ReactNative",ld=typeof WeakMap=="function"&&!(RF&&!global.HermesInternal),Pj=typeof WeakSet=="function",Mj=typeof Symbol=="function"&&typeof Symbol.for=="function",eb=Mj&&Symbol.asyncIterator,DF=typeof fa(function(){return window.document.createElement})=="function",oie=fa(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,lie=(DF||RF)&&!oie;function en(t){return t!==null&&typeof t=="object"}function cie(t,e){var r=e,n=[];t.definitions.forEach(function(i){if(i.kind==="OperationDefinition")throw zs(85,i.operation,i.name?" named '".concat(i.name.value,"'"):"");i.kind==="FragmentDefinition"&&n.push(i)}),typeof r>"u"&&(Je(n.length===1,86,n.length),r=n[0].name.value);var s=ue(ue({},t),{definitions:cs([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return s}function kf(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function tb(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=t.name.value;if(typeof e=="function")return e(r);var n=e&&e[r];return Je(n,87,r),n||null}default:return null}}function uie(t){var e=!0;return Sa(t,{FragmentSpread:function(r){if(e=!!r.directives&&r.directives.some(function(n){return n.name.value==="unmask"}),!e)return J_}}),e}function die(){}class uC{constructor(e=1/0,r=die){this.max=e,this.dispose=r,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const r=this.getNode(e);return r&&r.value}get size(){return this.map.size}getNode(e){const r=this.map.get(e);if(r&&r!==this.newest){const{older:n,newer:s}=r;s&&(s.older=n),n&&(n.newer=s),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=s)}return r}set(e,r){let n=this.getNode(e);return n?n.value=r:(n={key:e,value:r,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const r=this.map.get(e);return r?(r===this.newest&&(this.newest=r.older),r===this.oldest&&(this.oldest=r.newer),r.newer&&(r.newer.older=r.older),r.older&&(r.older.newer=r.newer),this.map.delete(e),this.dispose(r.value,e),!0):!1}}function dC(){}const hie=dC,fie=typeof WeakRef<"u"?WeakRef:function(t){return{deref:()=>t}},pie=typeof WeakMap<"u"?WeakMap:Map,mie=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:dC,unregister:dC}},gie=10024;class F0{constructor(e=1/0,r=hie){this.max=e,this.dispose=r,this.map=new pie,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const n=this.unfinalizedNodes.values();for(let s=0;s<gie;s++){const i=n.next().value;if(!i)break;this.unfinalizedNodes.delete(i);const a=i.key;delete i.key,i.keyRef=new fie(a),this.registry.register(a,i,i)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new mie(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const r=this.getNode(e);return r&&r.value}getNode(e){const r=this.map.get(e);if(r&&r!==this.newest){const{older:n,newer:s}=r;s&&(s.older=n),n&&(n.newer=s),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=s)}return r}set(e,r){let n=this.getNode(e);return n?n.value=r:(n={key:e,value:r,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.scheduleFinalization(n),this.map.set(e,n),this.size++,n.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const r=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,r),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),r&&this.map.delete(r)}delete(e){const r=this.map.get(e);return r?(this.deleteNode(r),!0):!1}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}var SS=new WeakSet;function OF(t){t.size<=(t.max||-1)||SS.has(t)||(SS.add(t),setTimeout(function(){t.clean(),SS.delete(t)},100))}var Ij=function(t,e){var r=new F0(t,e);return r.set=function(n,s){var i=F0.prototype.set.call(this,n,s);return OF(this),i},r},vie=function(t,e){var r=new uC(t,e);return r.set=function(n,s){var i=uC.prototype.set.call(this,n,s);return OF(this),i},r},yie=Symbol.for("apollo.cacheSize"),go=ue({},iC[yie]),wu={};function Lj(t,e){wu[t]=e}var xie=globalThis.__DEV__!==!1?Sie:void 0,_ie=globalThis.__DEV__!==!1?kie:void 0,bie=globalThis.__DEV__!==!1?PF:void 0;function wie(){var t={parser:1e3,canonicalStringify:1e3,print:2e3,"documentTransform.cache":2e3,"queryManager.getDocumentInfo":2e3,"PersistedQueryLink.persistedQueryHashes":2e3,"fragmentRegistry.transform":2e3,"fragmentRegistry.lookup":1e3,"fragmentRegistry.findFragmentSpreads":4e3,"cache.fragmentQueryDocuments":1e3,"removeTypenameFromVariables.getVariableDefinitions":2e3,"inMemoryCache.maybeBroadcastWatch":5e3,"inMemoryCache.executeSelectionSet":5e4,"inMemoryCache.executeSubSelectedArray":1e4};return Object.fromEntries(Object.entries(t).map(function(e){var r=e[0],n=e[1];return[r,go[r]||n]}))}function Sie(){var t,e,r,n,s;if(globalThis.__DEV__===!1)throw new Error("only supported in development mode");return{limits:wie(),sizes:ue({print:(t=wu.print)===null||t===void 0?void 0:t.call(wu),parser:(e=wu.parser)===null||e===void 0?void 0:e.call(wu),canonicalStringify:(r=wu.canonicalStringify)===null||r===void 0?void 0:r.call(wu),links:fC(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:IF(this.queryManager.documentTransform)}},(s=(n=this.cache).getMemoryInternals)===null||s===void 0?void 0:s.call(n))}}function PF(){return{cache:{fragmentQueryDocuments:ac(this.getFragmentDoc)}}}function kie(){var t=this.config.fragments;return ue(ue({},PF.apply(this)),{addTypenameDocumentTransform:IF(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:ac(this.storeReader.executeSelectionSet),executeSubSelectedArray:ac(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:ac(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:ac(t==null?void 0:t.findFragmentSpreads),lookup:ac(t==null?void 0:t.lookup),transform:ac(t==null?void 0:t.transform)}})}function Eie(t){return!!t&&"dirtyKey"in t}function ac(t){return Eie(t)?t.size:void 0}function MF(t){return t!=null}function IF(t){return hC(t).map(function(e){return{cache:e}})}function hC(t){return t?cs(cs([ac(t==null?void 0:t.performWork)],hC(t==null?void 0:t.left),!0),hC(t==null?void 0:t.right),!0).filter(MF):[]}function fC(t){var e;return t?cs(cs([(e=t==null?void 0:t.getMemoryInternals)===null||e===void 0?void 0:e.call(t)],fC(t==null?void 0:t.left),!0),fC(t==null?void 0:t.right),!0).filter(MF):[]}var xc=Object.assign(function(e){return JSON.stringify(e,Cie)},{reset:function(){_h=new vie(go.canonicalStringify||1e3)}});globalThis.__DEV__!==!1&&Lj("canonicalStringify",function(){return _h.size});var _h;xc.reset();function Cie(t,e){if(e&&typeof e=="object"){var r=Object.getPrototypeOf(e);if(r===Object.prototype||r===null){var n=Object.keys(e);if(n.every(Nie))return e;var s=JSON.stringify(n),i=_h.get(s);if(!i){n.sort();var a=JSON.stringify(n);i=_h.get(a)||n,_h.set(s,i),_h.set(a,i)}var l=Object.create(r);return i.forEach(function(c){l[c]=e[c]}),l}}return e}function Nie(t,e,r){return e===0||r[e-1]<=t}function Oh(t){return{__ref:String(t)}}function lr(t){return!!(t&&typeof t=="object"&&typeof t.__ref=="string")}function jie(t){return en(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function Tie(t){return t.kind==="StringValue"}function Aie(t){return t.kind==="BooleanValue"}function Rie(t){return t.kind==="IntValue"}function Die(t){return t.kind==="FloatValue"}function Oie(t){return t.kind==="Variable"}function Pie(t){return t.kind==="ObjectValue"}function Mie(t){return t.kind==="ListValue"}function Iie(t){return t.kind==="EnumValue"}function Lie(t){return t.kind==="NullValue"}function Gh(t,e,r,n){if(Rie(r)||Die(r))t[e.value]=Number(r.value);else if(Aie(r)||Tie(r))t[e.value]=r.value;else if(Pie(r)){var s={};r.fields.map(function(a){return Gh(s,a.name,a.value,n)}),t[e.value]=s}else if(Oie(r)){var i=(n||{})[r.name.value];t[e.value]=i}else if(Mie(r))t[e.value]=r.values.map(function(a){var l={};return Gh(l,e,a,n),l[e.value]});else if(Iie(r))t[e.value]=r.value;else if(Lie(r))t[e.value]=null;else throw zs(96,e.value,r.kind)}function $ie(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(s){r[s.name.value]={},s.arguments&&s.arguments.forEach(function(i){var a=i.name,l=i.value;return Gh(r[s.name.value],a,l,e)})}));var n=null;return t.arguments&&t.arguments.length&&(n={},t.arguments.forEach(function(s){var i=s.name,a=s.value;return Gh(n,i,a,e)})),LF(t.name.value,n,r)}var Bie=["connection","include","skip","client","rest","export","nonreactive"],Up=xc,LF=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var s={};return n.forEach(function(l){s[l]=e[l]}),"".concat(r.connection.key,"(").concat(Up(s),")")}else return r.connection.key;var i=t;if(e){var a=Up(e);i+="(".concat(a,")")}return r&&Object.keys(r).forEach(function(l){Bie.indexOf(l)===-1&&(r[l]&&Object.keys(r[l]).length?i+="@".concat(l,"(").concat(Up(r[l]),")"):i+="@".concat(l))}),i},{setStringify:function(t){var e=Up;return Up=t,e}});function rb(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var s=n.name,i=n.value;return Gh(r,s,i,e)}),r}return null}function ul(t){return t.alias?t.alias.value:t.name.value}function pC(t,e,r){for(var n,s=0,i=e.selections;s<i.length;s++){var a=i[s];if(kc(a)){if(a.name.value==="__typename")return t[ul(a)]}else n?n.push(a):n=[a]}if(typeof t.__typename=="string")return t.__typename;if(n)for(var l=0,c=n;l<c.length;l++){var a=c[l],d=pC(t,tb(a,r).selectionSet,r);if(typeof d=="string")return d}}function kc(t){return t.kind==="Field"}function Fie(t){return t.kind==="InlineFragment"}function Ef(t){Je(t&&t.kind==="Document",88);var e=t.definitions.filter(function(r){return r.kind!=="FragmentDefinition"}).map(function(r){if(r.kind!=="OperationDefinition")throw zs(89,r.kind);return r});return Je(e.length<=1,90,e.length),t}function Ju(t){return Ef(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function bm(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Cf(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function $F(t){var e=Ju(t);return Je(e&&e.operation==="query",91),e}function BF(t){Je(t.kind==="Document",92),Je(t.definitions.length<=1,93);var e=t.definitions[0];return Je(e.kind==="FragmentDefinition",94),e}function Nf(t){Ef(t);for(var e,r=0,n=t.definitions;r<n.length;r++){var s=n[r];if(s.kind==="OperationDefinition"){var i=s.operation;if(i==="query"||i==="mutation"||i==="subscription")return s}s.kind==="FragmentDefinition"&&!e&&(e=s)}if(e)return e;throw zs(95)}function $j(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&Gh(e,n.variable.name,n.defaultValue)}),e}let ts=null;const YM={};let zie=1;const Uie=()=>class{constructor(){this.id=["slot",zie++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=ts;e;e=e.parent)if(this.id in e.slots){const r=e.slots[this.id];if(r===YM)break;return e!==ts&&(ts.slots[this.id]=r),!0}return ts&&(ts.slots[this.id]=YM),!1}getValue(){if(this.hasValue())return ts.slots[this.id]}withValue(e,r,n,s){const i={__proto__:null,[this.id]:e},a=ts;ts={parent:a,slots:i};try{return r.apply(s,n)}finally{ts=a}}static bind(e){const r=ts;return function(){const n=ts;try{return ts=r,e.apply(this,arguments)}finally{ts=n}}}static noContext(e,r,n){if(ts){const s=ts;try{return ts=null,e.apply(n,r)}finally{ts=s}}else return e.apply(n,r)}};function QM(t){try{return t()}catch{}}const kS="@wry/context:Slot",Vie=QM(()=>globalThis)||QM(()=>global)||Object.create(null),XM=Vie,nb=XM[kS]||Array[kS]||function(t){try{Object.defineProperty(XM,kS,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(Uie()),{bind:g5e,noContext:v5e}=nb,sb=new nb,{hasOwnProperty:Hie}=Object.prototype,Bj=Array.from||function(t){const e=[];return t.forEach(r=>e.push(r)),e};function Fj(t){const{unsubscribe:e}=t;typeof e=="function"&&(t.unsubscribe=void 0,e())}const xg=[],qie=100;function Kh(t,e){if(!t)throw new Error(e||"assertion failure")}function FF(t,e){const r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function zF(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function UF(t){return t.slice(0)}class ib{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++ib.count}peek(){if(this.value.length===1&&!Ec(this))return ZM(this),this.value[0]}recompute(e){return Kh(!this.recomputing,"already recomputing"),ZM(this),Ec(this)?Wie(this,e):zF(this.value)}setDirty(){this.dirty||(this.dirty=!0,VF(this),Fj(this))}dispose(){this.setDirty(),KF(this),zj(this,(e,r)=>{e.setDirty(),YF(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=xg.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(Bj(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),xg.push(this.deps),this.deps=null)}}ib.count=0;function ZM(t){const e=sb.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),Ec(t)?qF(e,t):WF(e,t),e}function Wie(t,e){return KF(t),sb.withValue(t,Gie,[t,e]),Yie(t,e)&&Kie(t),zF(t.value)}function Gie(t,e){t.recomputing=!0;const{normalizeResult:r}=t;let n;r&&t.value.length===1&&(n=UF(t.value)),t.value.length=0;try{if(t.value[0]=t.fn.apply(null,e),r&&n&&!FF(n,t.value))try{t.value[0]=r(t.value[0],n[0])}catch{}}catch(s){t.value[1]=s}t.recomputing=!1}function Ec(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function Kie(t){t.dirty=!1,!Ec(t)&&HF(t)}function VF(t){zj(t,qF)}function HF(t){zj(t,WF)}function zj(t,e){const r=t.parents.size;if(r){const n=Bj(t.parents);for(let s=0;s<r;++s)e(n[s],t)}}function qF(t,e){Kh(t.childValues.has(e)),Kh(Ec(e));const r=!Ec(t);if(!t.dirtyChildren)t.dirtyChildren=xg.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&VF(t)}function WF(t,e){Kh(t.childValues.has(e)),Kh(!Ec(e));const r=t.childValues.get(e);r.length===0?t.childValues.set(e,UF(e.value)):FF(r,e.value)||t.setDirty(),GF(t,e),!Ec(t)&&HF(t)}function GF(t,e){const r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(xg.length<qie&&xg.push(r),t.dirtyChildren=null))}function KF(t){t.childValues.size>0&&t.childValues.forEach((e,r)=>{YF(t,r)}),t.forgetDeps(),Kh(t.dirtyChildren===null)}function YF(t,e){e.parents.delete(t),t.childValues.delete(e),GF(t,e)}function Yie(t,e){if(typeof t.subscribe=="function")try{Fj(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}const Qie={setDirty:!0,dispose:!0,forget:!0};function QF(t){const e=new Map;function r(n){const s=sb.getValue();if(s){let i=e.get(n);i||e.set(n,i=new Set),s.dependOn(i)}}return r.dirty=function(s,i){const a=e.get(s);if(a){const l=i&&Hie.call(Qie,i)?i:"setDirty";Bj(a).forEach(c=>c[l]()),e.delete(s),Fj(a)}},r}let JM;function Xie(...t){return(JM||(JM=new gl(typeof WeakMap=="function"))).lookupArray(t)}const ES=new Set;function _g(t,{max:e=Math.pow(2,16),keyArgs:r,makeCacheKey:n=Xie,normalizeResult:s,subscribe:i,cache:a=uC}=Object.create(null)){const l=typeof a=="function"?new a(e,m=>m.dispose()):a,c=function(){const m=n.apply(null,r?r.apply(null,arguments):arguments);if(m===void 0)return t.apply(null,arguments);let g=l.get(m);g||(l.set(m,g=new ib(t)),g.normalizeResult=s,g.subscribe=i,g.forget=()=>l.delete(m));const y=g.recompute(Array.prototype.slice.call(arguments));return l.set(m,g),ES.add(l),sb.hasValue()||(ES.forEach(x=>x.clean()),ES.clear()),y};Object.defineProperty(c,"size",{get:()=>l.size,configurable:!1,enumerable:!1}),Object.freeze(c.options={max:e,keyArgs:r,makeCacheKey:n,normalizeResult:s,subscribe:i,cache:l});function d(m){const g=m&&l.get(m);g&&g.setDirty()}c.dirtyKey=d,c.dirty=function(){d(n.apply(null,arguments))};function f(m){const g=m&&l.get(m);if(g)return g.peek()}c.peekKey=f,c.peek=function(){return f(n.apply(null,arguments))};function p(m){return m?l.delete(m):!1}return c.forgetKey=p,c.forget=function(){return p(n.apply(null,arguments))},c.makeCacheKey=n,c.getKey=r?function(){return n.apply(null,r.apply(null,arguments))}:n,Object.freeze(c)}function Zie(t){return t}var XF=function(){function t(e,r){r===void 0&&(r=Object.create(null)),this.resultCache=Pj?new WeakSet:new Set,this.transform=e,r.getCacheKey&&(this.getCacheKey=r.getCacheKey),this.cached=r.cache!==!1,this.resetCache()}return t.prototype.getCacheKey=function(e){return[e]},t.identity=function(){return new t(Zie,{cache:!1})},t.split=function(e,r,n){return n===void 0&&(n=t.identity()),Object.assign(new t(function(s){var i=e(s)?r:n;return i.transformDocument(s)},{cache:!1}),{left:r,right:n})},t.prototype.resetCache=function(){var e=this;if(this.cached){var r=new gl(ld);this.performWork=_g(t.prototype.performWork.bind(this),{makeCacheKey:function(n){var s=e.getCacheKey(n);if(s)return Je(Array.isArray(s),77),r.lookupArray(s)},max:go["documentTransform.cache"],cache:F0})}},t.prototype.performWork=function(e){return Ef(e),this.transform(e)},t.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var r=this.performWork(e);return this.resultCache.add(r),r},t.prototype.concat=function(e){var r=this;return Object.assign(new t(function(n){return e.transformDocument(r.transformDocument(n))},{cache:!1}),{left:this,right:e})},t}(),Um,Pu=Object.assign(function(t){var e=Um.get(t);return e||(e=Oj(t),Um.set(t,e)),e},{reset:function(){Um=new Ij(go.print||2e3)}});Pu.reset();globalThis.__DEV__!==!1&&Lj("print",function(){return Um?Um.size:0});var tn=Array.isArray;function ka(t){return Array.isArray(t)&&t.length>0}var e5={kind:Ze.FIELD,name:{kind:Ze.NAME,value:"__typename"}};function ZF(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===Ze.FRAGMENT_SPREAD&&ZF(e[r.name.value],e)})}function Jie(t){return ZF(Ju(t)||BF(t),kf(Cf(t)))?null:t}function eae(t){var e=new Map,r=new Map;return t.forEach(function(n){n&&(n.name?e.set(n.name,n):n.test&&r.set(n.test,n))}),function(n){var s=e.get(n.name.value);return!s&&r.size&&r.forEach(function(i,a){a(n)&&(s=i)}),s}}function t5(t){var e=new Map;return function(n){n===void 0&&(n=t);var s=e.get(n);return s||e.set(n,s={variables:new Set,fragmentSpreads:new Set}),s}}function JF(t,e){Ef(e);for(var r=t5(""),n=t5(""),s=function(_){for(var S=0,k=void 0;S<_.length&&(k=_[S]);++S)if(!tn(k)){if(k.kind===Ze.OPERATION_DEFINITION)return r(k.name&&k.name.value);if(k.kind===Ze.FRAGMENT_DEFINITION)return n(k.name.value)}return globalThis.__DEV__!==!1&&Je.error(97),null},i=0,a=e.definitions.length-1;a>=0;--a)e.definitions[a].kind===Ze.OPERATION_DEFINITION&&++i;var l=eae(t),c=function(_){return ka(_)&&_.map(l).some(function(S){return S&&S.remove})},d=new Map,f=!1,p={enter:function(_){if(c(_.directives))return f=!0,null}},m=Sa(e,{Field:p,InlineFragment:p,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,S,k,N,j){var T=s(j);T&&T.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,S,k,N,j){if(c(_.directives))return f=!0,null;var T=s(j);T&&T.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,S,k,N){d.set(JSON.stringify(N),_)},leave:function(_,S,k,N){var j=d.get(JSON.stringify(N));if(_===j)return _;if(i>0&&_.selectionSet.selections.every(function(T){return T.kind===Ze.FIELD&&T.name.value==="__typename"}))return n(_.name.value).removed=!0,f=!0,null}},Directive:{leave:function(_){if(l(_))return f=!0,null}}});if(!f)return e;var g=function(_){return _.transitiveVars||(_.transitiveVars=new Set(_.variables),_.removed||_.fragmentSpreads.forEach(function(S){g(n(S)).transitiveVars.forEach(function(k){_.transitiveVars.add(k)})})),_},y=new Set;m.definitions.forEach(function(_){_.kind===Ze.OPERATION_DEFINITION?g(r(_.name&&_.name.value)).fragmentSpreads.forEach(function(S){y.add(S)}):_.kind===Ze.FRAGMENT_DEFINITION&&i===0&&!n(_.name.value).removed&&y.add(_.name.value)}),y.forEach(function(_){g(n(_)).fragmentSpreads.forEach(function(S){y.add(S)})});var x=function(_){return!!(!y.has(_)||n(_).removed)},w={enter:function(_){if(x(_.name.value))return null}};return Jie(Sa(m,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(_){if(_.variableDefinitions){var S=g(r(_.name&&_.name.value)).transitiveVars;if(S.size<_.variableDefinitions.length)return ue(ue({},_),{variableDefinitions:_.variableDefinitions.filter(function(k){return S.has(k.variable.name.value)})})}}}}))}var Uj=Object.assign(function(t){return Sa(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind===Ze.OPERATION_DEFINITION)){var s=e.selections;if(s){var i=s.some(function(l){return kc(l)&&(l.name.value==="__typename"||l.name.value.lastIndexOf("__",0)===0)});if(!i){var a=n;if(!(kc(a)&&a.directives&&a.directives.some(function(l){return l.name.value==="export"})))return ue(ue({},e),{selections:cs(cs([],s,!0),[e5],!1)})}}}}}})},{added:function(t){return t===e5}});function tae(t){var e=Nf(t),r=e.operation;if(r==="query")return t;var n=Sa(t,{OperationDefinition:{enter:function(s){return ue(ue({},s),{operation:"query"})}}});return n}function ez(t){Ef(t);var e=JF([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}function rae(t){return Ef(t),Sa(t,{FragmentSpread:function(e){var r;if(!(!((r=e.directives)===null||r===void 0)&&r.some(function(n){return n.name.value==="unmask"})))return ue(ue({},e),{directives:cs(cs([],e.directives||[],!0),[{kind:Ze.DIRECTIVE,name:{kind:Ze.NAME,value:"nonreactive"}}],!1)})}})}var nae=Object.prototype.hasOwnProperty;function r5(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ab(t)}function ab(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new Cc,s=1;s<r;++s)e=n.merge(e,t[s]);return e}var sae=function(t,e,r){return this.merge(t[r],e[r])},Cc=function(){function t(e){e===void 0&&(e=sae),this.reconciler=e,this.isObject=en,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var n=this,s=[],i=2;i<arguments.length;i++)s[i-2]=arguments[i];return en(r)&&en(e)?(Object.keys(r).forEach(function(a){if(nae.call(e,a)){var l=e[a];if(r[a]!==l){var c=n.reconciler.apply(n,cs([e,r,a],s,!1));c!==l&&(e=n.shallowCopyForMerge(e),e[a]=c)}}else e=n.shallowCopyForMerge(e),e[a]=r[a]}),e):r},t.prototype.shallowCopyForMerge=function(e){return en(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=ue({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},t}();function iae(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=aae(t))||e){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aae(t,e){if(t){if(typeof t=="string")return n5(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n5(t,e)}}function n5(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s5(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Vj(t,e,r){return e&&s5(t.prototype,e),r&&s5(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var Hj=function(){return typeof Symbol=="function"},qj=function(t){return Hj()&&!!Symbol[t]},Wj=function(t){return qj(t)?Symbol[t]:"@@"+t};Hj()&&!qj("observable")&&(Symbol.observable=Symbol("observable"));var oae=Wj("iterator"),mC=Wj("observable"),tz=Wj("species");function z0(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Vp(t){var e=t.constructor;return e!==void 0&&(e=e[tz],e===null&&(e=void 0)),e!==void 0?e:mr}function lae(t){return t instanceof mr}function Yh(t){Yh.log?Yh.log(t):setTimeout(function(){throw t})}function r0(t){Promise.resolve().then(function(){try{t()}catch(e){Yh(e)}})}function rz(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=z0(e,"unsubscribe");r&&r.call(e)}}catch(n){Yh(n)}}function gC(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function cae(t){var e=t._queue;if(e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(nz(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function nz(t,e,r){t._state="running";var n=t._observer;try{var s=z0(n,e);switch(e){case"next":s&&s.call(n,r);break;case"error":if(gC(t),s)s.call(n,r);else throw r;break;case"complete":gC(t),s&&s.call(n);break}}catch(i){Yh(i)}t._state==="closed"?rz(t):t._state==="running"&&(t._state="ready")}function CS(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],r0(function(){return cae(t)});return}nz(t,e,r)}}var uae=function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var s=new dae(this);try{this._cleanup=n.call(void 0,s)}catch(i){s.error(i)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(gC(this),rz(this))},Vj(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),dae=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){CS(this._subscription,"next",n)},e.error=function(n){CS(this._subscription,"error",n)},e.complete=function(){CS(this._subscription,"complete")},Vj(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),mr=function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new uae(n,this._subscriber)},e.forEach=function(n){var s=this;return new Promise(function(i,a){if(typeof n!="function"){a(new TypeError(n+" is not a function"));return}function l(){c.unsubscribe(),i()}var c=s.subscribe({next:function(d){try{n(d,l)}catch(f){a(f),c.unsubscribe()}},error:a,complete:i})})},e.map=function(n){var s=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var i=Vp(this);return new i(function(a){return s.subscribe({next:function(l){try{l=n(l)}catch(c){return a.error(c)}a.next(l)},error:function(l){a.error(l)},complete:function(){a.complete()}})})},e.filter=function(n){var s=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var i=Vp(this);return new i(function(a){return s.subscribe({next:function(l){try{if(!n(l))return}catch(c){return a.error(c)}a.next(l)},error:function(l){a.error(l)},complete:function(){a.complete()}})})},e.reduce=function(n){var s=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var i=Vp(this),a=arguments.length>1,l=!1,c=arguments[1],d=c;return new i(function(f){return s.subscribe({next:function(p){var m=!l;if(l=!0,!m||a)try{d=n(d,p)}catch(g){return f.error(g)}else d=p},error:function(p){f.error(p)},complete:function(){if(!l&&!a)return f.error(new TypeError("Cannot reduce an empty sequence"));f.next(d),f.complete()}})})},e.concat=function(){for(var n=this,s=arguments.length,i=new Array(s),a=0;a<s;a++)i[a]=arguments[a];var l=Vp(this);return new l(function(c){var d,f=0;function p(m){d=m.subscribe({next:function(g){c.next(g)},error:function(g){c.error(g)},complete:function(){f===i.length?(d=void 0,c.complete()):p(l.from(i[f++]))}})}return p(n),function(){d&&(d.unsubscribe(),d=void 0)}})},e.flatMap=function(n){var s=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var i=Vp(this);return new i(function(a){var l=[],c=s.subscribe({next:function(f){if(n)try{f=n(f)}catch(m){return a.error(m)}var p=i.from(f).subscribe({next:function(m){a.next(m)},error:function(m){a.error(m)},complete:function(){var m=l.indexOf(p);m>=0&&l.splice(m,1),d()}});l.push(p)},error:function(f){a.error(f)},complete:function(){d()}});function d(){c.closed&&l.length===0&&a.complete()}return function(){l.forEach(function(f){return f.unsubscribe()}),c.unsubscribe()}})},e[mC]=function(){return this},t.from=function(n){var s=typeof this=="function"?this:t;if(n==null)throw new TypeError(n+" is not an object");var i=z0(n,mC);if(i){var a=i.call(n);if(Object(a)!==a)throw new TypeError(a+" is not an object");return lae(a)&&a.constructor===s?a:new s(function(l){return a.subscribe(l)})}if(qj("iterator")&&(i=z0(n,oae),i))return new s(function(l){r0(function(){if(!l.closed){for(var c=iae(i.call(n)),d;!(d=c()).done;){var f=d.value;if(l.next(f),l.closed)return}l.complete()}})});if(Array.isArray(n))return new s(function(l){r0(function(){if(!l.closed){for(var c=0;c<n.length;++c)if(l.next(n[c]),l.closed)return;l.complete()}})});throw new TypeError(n+" is not observable")},t.of=function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];var a=typeof this=="function"?this:t;return new a(function(l){r0(function(){if(!l.closed){for(var c=0;c<s.length;++c)if(l.next(s[c]),l.closed)return;l.complete()}})})},Vj(t,null,[{key:tz,get:function(){return this}}]),t}();Hj()&&Object.defineProperty(mr,Symbol("extensions"),{value:{symbol:mC,hostReportError:Yh},configurable:!0});function hae(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var fh;typeof self<"u"?fh=self:typeof window<"u"?fh=window:typeof global<"u"?fh=global:typeof Jg<"u"?fh=Jg:fh=Function("return this")();hae(fh);var i5=mr.prototype,a5="@@observable";i5[a5]||(i5[a5]=function(){return this});function fae(t){return t.catch(function(){}),t}var pae=Object.prototype.toString;function sz(t){return vC(t)}function vC(t,e){switch(pae.call(t)){case"[object Array]":{if(e=e||new Map,e.has(t))return e.get(t);var r=t.slice(0);return e.set(t,r),r.forEach(function(s,i){r[i]=vC(s,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var n=Object.create(Object.getPrototypeOf(t));return e.set(t,n),Object.keys(t).forEach(function(s){n[s]=vC(t[s],e)}),n}default:return t}}function mae(t){var e=new Set([t]);return e.forEach(function(r){en(r)&&gae(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){en(r[n])&&e.add(r[n])})}),t}function gae(t){if(globalThis.__DEV__!==!1&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function Qh(t){return globalThis.__DEV__!==!1&&mae(t),t}function Vm(t,e,r){var n=[];t.forEach(function(s){return s[e]&&n.push(s)}),n.forEach(function(s){return s[e](r)})}function NS(t,e,r){return new mr(function(n){var s={then:function(c){return new Promise(function(d){return d(c())})}};function i(c,d){return function(f){if(c){var p=function(){return n.closed?0:c(f)};s=s.then(p,p).then(function(m){return n.next(m)},function(m){return n.error(m)})}else n[d](f)}}var a={next:i(e,"next"),error:i(r,"error"),complete:function(){s.then(function(){return n.complete()})}},l=t.subscribe(a);return function(){return l.unsubscribe()}})}function iz(t){function e(r){Object.defineProperty(t,r,{value:mr})}return Mj&&Symbol.species&&e(Symbol.species),e("@@species"),t}function o5(t){return t&&typeof t.then=="function"}var ph=function(t){Qi(e,t);function e(r){var n=t.call(this,function(s){return n.addObserver(s),function(){return n.removeObserver(s)}})||this;return n.observers=new Set,n.promise=new Promise(function(s,i){n.resolve=s,n.reject=i}),n.handlers={next:function(s){n.sub!==null&&(n.latest=["next",s],n.notify("next",s),Vm(n.observers,"next",s))},error:function(s){var i=n.sub;i!==null&&(i&&setTimeout(function(){return i.unsubscribe()}),n.sub=null,n.latest=["error",s],n.reject(s),n.notify("error",s),Vm(n.observers,"error",s))},complete:function(){var s=n,i=s.sub,a=s.sources,l=a===void 0?[]:a;if(i!==null){var c=l.shift();c?o5(c)?c.then(function(d){return n.sub=d.subscribe(n.handlers)},n.handlers.error):n.sub=c.subscribe(n.handlers):(i&&setTimeout(function(){return i.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),Vm(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(s){n.reject(s),n.sources=[],n.handlers.error(s)},n.promise.catch(function(s){}),typeof r=="function"&&(r=[new mr(r)]),o5(r)?r.then(function(s){return n.start(s)},n.handlers.error):n.start(r),n}return e.prototype.start=function(r){this.sub===void 0&&(this.sources=Array.from(r),this.handlers.complete())},e.prototype.deliverLastMessage=function(r){if(this.latest){var n=this.latest[0],s=r[n];s&&s.call(r,this.latest[1]),this.sub===null&&n==="next"&&r.complete&&r.complete()}},e.prototype.addObserver=function(r){this.observers.has(r)||(this.deliverLastMessage(r),this.observers.add(r))},e.prototype.removeObserver=function(r){this.observers.delete(r)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(r,n){var s=this.nextResultListeners;s.size&&(this.nextResultListeners=new Set,s.forEach(function(i){return i(r,n)}))},e.prototype.beforeNext=function(r){var n=!1;this.nextResultListeners.add(function(s,i){n||(n=!0,r(s,i))})},e}(mr);iz(ph);function Ph(t){return"incremental"in t}function vae(t){return"hasNext"in t&&"data"in t}function yae(t){return Ph(t)||vae(t)}function xae(t){return en(t)&&"payload"in t}function az(t,e){var r=t,n=new Cc;return Ph(e)&&ka(e.incremental)&&e.incremental.forEach(function(s){for(var i=s.data,a=s.path,l=a.length-1;l>=0;--l){var c=a[l],d=!isNaN(+c),f=d?[]:{};f[c]=i,i=f}r=n.merge(r,i)}),r}function n0(t){var e=yC(t);return ka(e)}function yC(t){var e=ka(t.errors)?t.errors.slice(0):[];return Ph(t)&&ka(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function Xh(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach(function(n){n&&Object.keys(n).forEach(function(s){var i=n[s];i!==void 0&&(r[s]=i)})}),r}function s0(t,e){return Xh(t,e,e.variables&&{variables:Xh(ue(ue({},t&&t.variables),e.variables))})}function jS(t){return new mr(function(e){e.error(t)})}var oz=function(t,e,r){var n=new Error(r);throw n.name="ServerError",n.response=t,n.statusCode=t.status,n.result=e,n};function _ae(t){for(var e=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(t);r<n.length;r++){var s=n[r];if(e.indexOf(s)<0)throw zs(46,s)}return t}function bae(t,e){var r=ue({},t),n=function(i){typeof i=="function"?r=ue(ue({},r),i(r)):r=ue(ue({},r),i)},s=function(){return ue({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:s}),e}function wae(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?bm(e.query)||void 0:""),e}function Sae(t,e){var r=ue({},t),n=new Set(Object.keys(t));return Sa(e,{Variable:function(s,i,a){a&&a.kind!=="VariableDefinition"&&n.delete(s.name.value)}}),n.forEach(function(s){delete r[s]}),r}function l5(t,e){return e?e(t):mr.of()}function Hp(t){return typeof t=="function"?new vl(t):t}function ex(t){return t.request.length<=1}var vl=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return mr.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Hp).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var s=Hp(r),i=Hp(n||new t(l5)),a;return ex(s)&&ex(i)?a=new t(function(l){return e(l)?s.request(l)||mr.of():i.request(l)||mr.of()}):a=new t(function(l,c){return e(l)?s.request(l,c)||mr.of():i.request(l,c)||mr.of()}),Object.assign(a,{left:s,right:i})},t.execute=function(e,r){return e.request(bae(r.context,wae(_ae(r))))||mr.of()},t.concat=function(e,r){var n=Hp(e);if(ex(n))return globalThis.__DEV__!==!1&&Je.warn(38,n),n;var s=Hp(r),i;return ex(s)?i=new t(function(a){return n.request(a,function(l){return s.request(l)||mr.of()})||mr.of()}):i=new t(function(a,l){return n.request(a,function(c){return s.request(c,l)||mr.of()})||mr.of()}),Object.assign(i,{left:n,right:s})},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(l5)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw zs(39)},t.prototype.onError=function(e,r){if(r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}(),kae=vl.split,xC=vl.execute;function Eae(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Cae(t){var e=null,r=null,n=!1,s=[],i=[];function a(p){if(!r){if(i.length){var m=i.shift();if(Array.isArray(m)&&m[0])return m[0]({value:p,done:!1})}s.push(p)}}function l(p){r=p;var m=i.slice();m.forEach(function(g){g[1](p)}),!e||e()}function c(){n=!0;var p=i.slice();p.forEach(function(m){m[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,t.removeListener("data",a),t.removeListener("error",l),t.removeListener("end",c),t.removeListener("finish",c),t.removeListener("close",c)},t.on("data",a),t.on("error",l),t.on("end",c),t.on("finish",c),t.on("close",c);function d(){return new Promise(function(p,m){if(r)return m(r);if(s.length)return p({value:s.shift(),done:!1});if(n)return p({value:void 0,done:!0});i.push([p,m])})}var f={next:function(){return d()}};return eb&&(f[Symbol.asyncIterator]=function(){return this}),f}function Nae(t){var e=!1,r={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,s){t.then(function(i){n({value:i,done:!1})}).catch(s)}))}};return eb&&(r[Symbol.asyncIterator]=function(){return this}),r}function c5(t){var e={next:function(){return t.read()}};return eb&&(e[Symbol.asyncIterator]=function(){return this}),e}function jae(t){return!!t.body}function Tae(t){return!!t.getReader}function Aae(t){return!!(eb&&t[Symbol.asyncIterator])}function Rae(t){return!!t.stream}function Dae(t){return!!t.arrayBuffer}function Oae(t){return!!t.pipe}function Pae(t){var e=t;if(jae(t)&&(e=t.body),Aae(e))return Eae(e);if(Tae(e))return c5(e.getReader());if(Rae(e))return c5(e.stream().getReader());if(Dae(e))return Nae(e.arrayBuffer());if(Oae(e))return Cae(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var ob=Symbol();function lz(t){return t.extensions?Array.isArray(t.extensions[ob]):!1}function cz(t){return t.hasOwnProperty("graphQLErrors")}var Mae=function(t){var e=cs(cs(cs([],t.graphQLErrors,!0),t.clientErrors,!0),t.protocolErrors,!0);return t.networkError&&e.push(t.networkError),e.map(function(r){return en(r)&&r.message||"Error message not found."}).join(`
|
||
`)},pa=function(t){Qi(e,t);function e(r){var n=r.graphQLErrors,s=r.protocolErrors,i=r.clientErrors,a=r.networkError,l=r.errorMessage,c=r.extraInfo,d=t.call(this,l)||this;return d.name="ApolloError",d.graphQLErrors=n||[],d.protocolErrors=s||[],d.clientErrors=i||[],d.networkError=a||null,d.message=l||Mae(d),d.extraInfo=c,d.cause=cs(cs(cs([a],n||[],!0),s||[],!0),i||[],!0).find(function(f){return!!f})||null,d.__proto__=e.prototype,d}return e}(Error),u5=Object.prototype.hasOwnProperty;function Iae(t,e){return sc(this,void 0,void 0,function(){var r,n,s,i,a,l,c,d,f,p,m,g,y,x,w,_,S,k,N,j,T,D,I,L;return ic(this,function($){switch($.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");r=new TextDecoder("utf-8"),n=(L=t.headers)===null||L===void 0?void 0:L.get("content-type"),s="boundary=",i=n!=null&&n.includes(s)?n==null?void 0:n.substring((n==null?void 0:n.indexOf(s))+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",a=`\r
|
||
--`.concat(i),l="",c=Pae(t),d=!0,$.label=1;case 1:return d?[4,c.next()]:[3,3];case 2:for(f=$.sent(),p=f.value,m=f.done,g=typeof p=="string"?p:r.decode(p),y=l.length-a.length+1,d=!m,l+=g,x=l.indexOf(a,y);x>-1;){if(w=void 0,D=[l.slice(0,x),l.slice(x+a.length)],w=D[0],l=D[1],_=w.indexOf(`\r
|
||
\r
|
||
`),S=Lae(w.slice(0,_)),k=S["content-type"],k&&k.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");if(N=w.slice(_),N){if(j=uz(t,N),Object.keys(j).length>1||"data"in j||"incremental"in j||"errors"in j||"payload"in j)if(xae(j)){if(T={},"payload"in j){if(Object.keys(j).length===1&&j.payload===null)return[2];T=ue({},j.payload)}"errors"in j&&(T=ue(ue({},T),{extensions:ue(ue({},"extensions"in T?T.extensions:null),(I={},I[ob]=j.errors,I))})),e(T)}else e(j);else if(Object.keys(j).length===1&&"hasNext"in j&&!j.hasNext)return[2]}x=l.indexOf(a)}return[3,1];case 3:return[2]}})})}function Lae(t){var e={};return t.split(`
|
||
`).forEach(function(r){var n=r.indexOf(":");if(n>-1){var s=r.slice(0,n).trim().toLowerCase(),i=r.slice(n+1).trim();e[s]=i}}),e}function uz(t,e){if(t.status>=300){var r=function(){try{return JSON.parse(e)}catch{return e}};oz(t,r(),"Response not successful: Received status code ".concat(t.status))}try{return JSON.parse(e)}catch(s){var n=s;throw n.name="ServerParseError",n.response=t,n.statusCode=t.status,n.bodyText=e,n}}function $ae(t,e){t.result&&t.result.errors&&t.result.data&&e.next(t.result),e.error(t)}function Bae(t){return function(e){return e.text().then(function(r){return uz(e,r)}).then(function(r){return!Array.isArray(r)&&!u5.call(r,"data")&&!u5.call(r,"errors")&&oz(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(n){return n.operationName}):t.operationName,"'.")),r})}}var _C=function(t,e){var r;try{r=JSON.stringify(t)}catch(s){var n=zs(42,e,s.message);throw n.parseError=s,n}return r},Fae={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},zae={accept:"*/*","content-type":"application/json"},Uae={method:"POST"},Vae={http:Fae,headers:zae,options:Uae},Hae=function(t,e){return e(t)};function qae(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var s={},i={};r.forEach(function(p){s=ue(ue(ue({},s),p.options),{headers:ue(ue({},s.headers),p.headers)}),p.credentials&&(s.credentials=p.credentials),i=ue(ue({},i),p.http)}),s.headers&&(s.headers=Wae(s.headers,i.preserveHeaderCase));var a=t.operationName,l=t.extensions,c=t.variables,d=t.query,f={operationName:a,variables:c};return i.includeExtensions&&(f.extensions=l),i.includeQuery&&(f.query=e(d,Pu)),{options:s,body:f}}function Wae(t,e){if(!e){var r={};return Object.keys(Object(t)).forEach(function(i){r[i.toLowerCase()]=t[i]}),r}var n={};Object.keys(Object(t)).forEach(function(i){n[i.toLowerCase()]={originalName:i,value:t[i]}});var s={};return Object.keys(n).forEach(function(i){s[n[i].originalName]=n[i].value}),s}var Gae=function(t){if(!t&&typeof fetch>"u")throw zs(40)},Kae=function(t,e){var r=t.getContext(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function Yae(t,e){var r=[],n=function(p,m){r.push("".concat(p,"=").concat(encodeURIComponent(m)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var s=void 0;try{s=_C(e.variables,"Variables map")}catch(p){return{parseError:p}}n("variables",s)}if(e.extensions){var i=void 0;try{i=_C(e.extensions,"Extensions map")}catch(p){return{parseError:p}}n("extensions",i)}var a="",l=t,c=t.indexOf("#");c!==-1&&(a=t.substr(c),l=t.substr(0,c));var d=l.indexOf("?")===-1?"?":"&",f=l+d+r.join("&")+a;return{newURI:f}}var d5=fa(function(){return fetch}),Qae=function(t){t===void 0&&(t={});var e=t.uri,r=e===void 0?"/graphql":e,n=t.fetch,s=t.print,i=s===void 0?Hae:s,a=t.includeExtensions,l=t.preserveHeaderCase,c=t.useGETForQueries,d=t.includeUnusedVariables,f=d===void 0?!1:d,p=ga(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);globalThis.__DEV__!==!1&&Gae(n||d5);var m={http:{includeExtensions:a,preserveHeaderCase:l},options:p.fetchOptions,credentials:p.credentials,headers:p.headers};return new vl(function(g){var y=Kae(g,r),x=g.getContext(),w={};if(x.clientAwareness){var _=x.clientAwareness,S=_.name,k=_.version;S&&(w["apollographql-client-name"]=S),k&&(w["apollographql-client-version"]=k)}var N=ue(ue({},w),x.headers),j={http:x.http,options:x.fetchOptions,credentials:x.credentials,headers:N};if(yg(["client"],g.query)){var T=ez(g.query);if(!T)return jS(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));g.query=T}var D=qae(g,i,Vae,m,j),I=D.options,L=D.body;L.variables&&!f&&(L.variables=Sae(L.variables,g.query));var $;!I.signal&&typeof AbortController<"u"&&($=new AbortController,I.signal=$.signal);var Q=function(Y){return Y.kind==="OperationDefinition"&&Y.operation==="mutation"},M=function(Y){return Y.kind==="OperationDefinition"&&Y.operation==="subscription"},z=M(Nf(g.query)),R=yg(["defer"],g.query);if(c&&!g.query.definitions.some(Q)&&(I.method="GET"),R||z){I.headers=I.headers||{};var B="multipart/mixed;";z&&R&&globalThis.__DEV__!==!1&&Je.warn(41),z?B+="boundary=graphql;subscriptionSpec=1.0,application/json":R&&(B+="deferSpec=20220824,application/json"),I.headers.accept=B}if(I.method==="GET"){var V=Yae(y,L),F=V.newURI,K=V.parseError;if(K)return jS(K);y=F}else try{I.body=_C(L,"Payload")}catch(Y){return jS(Y)}return new mr(function(Y){var O=n||fa(function(){return fetch})||d5,H=Y.next.bind(Y);return O(y,I).then(function(G){var q;g.setContext({response:G});var J=(q=G.headers)===null||q===void 0?void 0:q.get("content-type");return J!==null&&/^multipart\/mixed/i.test(J)?Iae(G,H):Bae(g)(G).then(H)}).then(function(){$=void 0,Y.complete()}).catch(function(G){$=void 0,$ae(G,Y)}),function(){$&&$.abort()}})})},dz=function(t){Qi(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,Qae(r).request)||this;return n.options=r,n}return e}(vl);const{toString:h5,hasOwnProperty:Xae}=Object.prototype,f5=Function.prototype.toString,bC=new Map;function ar(t,e){try{return wC(t,e)}finally{bC.clear()}}function wC(t,e){if(t===e)return!0;const r=h5.call(t),n=h5.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(m5(t,e))return!0;const s=p5(t),i=p5(e),a=s.length;if(a!==i.length)return!1;for(let l=0;l<a;++l)if(!Xae.call(e,s[l]))return!1;for(let l=0;l<a;++l){const c=s[l];if(!wC(t[c],e[c]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t==`${e}`;case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(m5(t,e))return!0;const s=t.entries(),i=r==="[object Map]";for(;;){const a=s.next();if(a.done)break;const[l,c]=a.value;if(!e.has(l)||i&&!wC(c,e.get(l)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{let s=t.byteLength;if(s===e.byteLength)for(;s--&&t[s]===e[s];);return s===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const s=f5.call(t);return s!==f5.call(e)?!1:!eoe(s,Jae)}}return!1}function p5(t){return Object.keys(t).filter(Zae,t)}function Zae(t){return this[t]!==void 0}const Jae="{ [native code] }";function eoe(t,e){const r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function m5(t,e){let r=bC.get(t);if(r){if(r.has(e))return!0}else bC.set(t,r=new Set);return r.add(e),!1}function hz(t,e,r,n){var s=e.data,i=ga(e,["data"]),a=r.data,l=ga(r,["data"]);return ar(i,l)&&i0(Nf(t).selectionSet,s,a,{fragmentMap:kf(Cf(t)),variables:n})}function i0(t,e,r,n){if(e===r)return!0;var s=new Set;return t.selections.every(function(i){if(s.has(i)||(s.add(i),!iv(i,n.variables))||g5(i))return!0;if(kc(i)){var a=ul(i),l=e&&e[a],c=r&&r[a],d=i.selectionSet;if(!d)return ar(l,c);var f=Array.isArray(l),p=Array.isArray(c);if(f!==p)return!1;if(f&&p){var m=l.length;if(c.length!==m)return!1;for(var g=0;g<m;++g)if(!i0(d,l[g],c[g],n))return!1;return!0}return i0(d,l,c,n)}else{var y=tb(i,n.fragmentMap);if(y)return g5(y)?!0:i0(y.selectionSet,e,r,n)}})}function g5(t){return!!t.directives&&t.directives.some(toe)}function toe(t){return t.name.value==="nonreactive"}var fz=ld?WeakMap:Map,pz=Pj?WeakSet:Set,Gj=new nb,v5=!1;function mz(){v5||(v5=!0,globalThis.__DEV__!==!1&&Je.warn(52))}function gz(t,e,r){return Gj.withValue(!0,function(){var n=wm(t,e,r,!1);return Object.isFrozen(t)&&Qh(n),n})}function roe(t,e){if(e.has(t))return e.get(t);var r=Array.isArray(t)?[]:Object.create(null);return e.set(t,r),r}function wm(t,e,r,n,s){var i,a=r.knownChanged,l=roe(t,r.mutableTargets);if(Array.isArray(t)){for(var c=0,d=Array.from(t.entries());c<d.length;c++){var f=d[c],p=f[0],m=f[1];if(m===null){l[p]=null;continue}var g=wm(m,e,r,n,globalThis.__DEV__!==!1?"".concat(s||"","[").concat(p,"]"):void 0);a.has(g)&&a.add(l),l[p]=g}return a.has(l)?l:t}for(var y=0,x=e.selections;y<x.length;y++){var w=x[y],_=void 0;if(n&&a.add(l),w.kind===Ze.FIELD){var S=ul(w),k=w.selectionSet;if(_=l[S]||t[S],_===void 0)continue;if(k&&_!==null){var g=wm(t[S],k,r,n,globalThis.__DEV__!==!1?"".concat(s||"",".").concat(S):void 0);a.has(g)&&(_=g)}globalThis.__DEV__===!1&&(l[S]=_),globalThis.__DEV__!==!1&&(n&&S!=="__typename"&&!(!((i=Object.getOwnPropertyDescriptor(l,S))===null||i===void 0)&&i.value)?Object.defineProperty(l,S,noe(S,_,s||"",r.operationName,r.operationType)):(delete l[S],l[S]=_))}if(w.kind===Ze.INLINE_FRAGMENT&&(!w.typeCondition||r.cache.fragmentMatches(w,t.__typename))&&(_=wm(t,w.selectionSet,r,n,s)),w.kind===Ze.FRAGMENT_SPREAD){var N=w.name.value,j=r.fragmentMap[N]||(r.fragmentMap[N]=r.cache.lookupFragment(N));Je(j,47,N);var T=rie(w);T!=="mask"&&(_=wm(t,j.selectionSet,r,T==="migrate",s))}a.has(_)&&a.add(l)}return"__typename"in t&&!("__typename"in l)&&(l.__typename=t.__typename),Object.keys(l).length!==Object.keys(t).length&&a.add(l),a.has(l)?l:t}function noe(t,e,r,n,s){var i=function(){return Gj.getValue()||(globalThis.__DEV__!==!1&&Je.warn(48,n?"".concat(s," '").concat(n,"'"):"anonymous ".concat(s),"".concat(r,".").concat(t).replace(/^\./,"")),i=function(){return e}),e};return{get:function(){return i()},set:function(a){i=function(){return a}},enumerable:!0,configurable:!0}}function vz(t,e,r,n){if(!r.fragmentMatches)return globalThis.__DEV__!==!1&&mz(),t;var s=e.definitions.filter(function(a){return a.kind===Ze.FRAGMENT_DEFINITION});typeof n>"u"&&(Je(s.length===1,49,s.length),n=s[0].name.value);var i=s.find(function(a){return a.name.value===n});return Je(!!i,50,n),t==null||ar(t,{})?t:gz(t,i.selectionSet,{operationType:"fragment",operationName:i.name.value,fragmentMap:kf(Cf(e)),cache:r,mutableTargets:new fz,knownChanged:new pz})}function soe(t,e,r){var n;if(!r.fragmentMatches)return globalThis.__DEV__!==!1&&mz(),t;var s=Ju(e);return Je(s,51),t==null?t:gz(t,s.selectionSet,{operationType:s.operation,operationName:(n=s.name)===null||n===void 0?void 0:n.value,fragmentMap:kf(Cf(e)),cache:r,mutableTargets:new fz,knownChanged:new pz})}var yz=function(){function t(){this.assumeImmutableResults=!1,this.getFragmentDoc=_g(cie,{max:go["cache.fragmentQueryDocuments"]||1e3,cache:F0})}return t.prototype.lookupFragment=function(e){return null},t.prototype.batch=function(e){var r=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,s;return this.performTransaction(function(){return s=e.update(r)},n),s},t.prototype.recordOptimisticTransaction=function(e,r){this.performTransaction(e,r)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(ue(ue({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.watchFragment=function(e){var r=this,n=e.fragment,s=e.fragmentName,i=e.from,a=e.optimistic,l=a===void 0?!0:a,c=ga(e,["fragment","fragmentName","from","optimistic"]),d=this.getFragmentDoc(n,s),f=typeof i>"u"||typeof i=="string"?i:this.identify(i),p=!!e[Symbol.for("apollo.dataMasking")];if(globalThis.__DEV__!==!1){var m=s||BF(n).name.value;f||globalThis.__DEV__!==!1&&Je.warn(1,m)}var g=ue(ue({},c),{returnPartialData:!0,id:f,query:d,optimistic:l}),y;return new mr(function(x){return r.watch(ue(ue({},g),{immediate:!0,callback:function(w){var _=p?vz(w.result,n,r,s):w.result;if(!(y&&hz(d,{data:y.result},{data:_},e.variables))){var S={data:_,complete:!!w.complete};w.missing&&(S.missing=ab(w.missing.map(function(k){return k.missing}))),y=ue(ue({},w),{result:_}),x.next(S)}}}))})},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(ue(ue({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:r}))},t.prototype.writeQuery=function(e){var r=e.id,n=e.data,s=ga(e,["id","data"]);return this.write(Object.assign(s,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(e){var r=e.id,n=e.data,s=e.fragment,i=e.fragmentName,a=ga(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(a,{query:this.getFragmentDoc(s,i),dataId:r,result:n}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(n){var s=n.readQuery(e),i=r(s);return i==null?s:(n.writeQuery(ue(ue({},e),{data:i})),i)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(n){var s=n.readFragment(e),i=r(s);return i==null?s:(n.writeFragment(ue(ue({},e),{data:i})),i)}})},t}();globalThis.__DEV__!==!1&&(yz.prototype.getMemoryInternals=bie);var xz=function(t){Qi(e,t);function e(r,n,s,i){var a,l=t.call(this,r)||this;if(l.message=r,l.path=n,l.query=s,l.variables=i,Array.isArray(l.path)){l.missing=l.message;for(var c=l.path.length-1;c>=0;--c)l.missing=(a={},a[l.path[c]]=l.missing,a)}else l.missing=l.path;return l.__proto__=e.prototype,l}return e}(Error),Un=Object.prototype.hasOwnProperty;function qp(t){return t==null}function _z(t,e){var r=t.__typename,n=t.id,s=t._id;if(typeof r=="string"&&(e&&(e.keyObject=qp(n)?qp(s)?void 0:{_id:s}:{id:n}),qp(n)&&!qp(s)&&(n=s),!qp(n)))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var bz={dataIdFromObject:_z,addTypename:!0,resultCaching:!0,canonizeResults:!1};function ioe(t){return Xh(bz,t)}function wz(t){var e=t.canonizeResults;return e===void 0?bz.canonizeResults:e}function aoe(t,e){return lr(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var Sz=/^[_a-z][_0-9a-z]*/i;function Nc(t){var e=t.match(Sz);return e?e[0]:t}function SC(t,e,r){return en(e)?tn(e)?e.every(function(n){return SC(t,n,r)}):t.selections.every(function(n){if(kc(n)&&iv(n,r)){var s=ul(n);return Un.call(e,s)&&(!n.selectionSet||SC(n.selectionSet,e[s],r))}return!0}):!1}function bh(t){return en(t)&&!lr(t)&&!tn(t)}function ooe(){return new Cc}function kz(t,e){var r=kf(Cf(t));return{fragmentMap:r,lookupFragment:function(n){var s=r[n];return!s&&e&&(s=e.lookup(n)),s||null}}}var a0=Object.create(null),TS=function(){return a0},y5=Object.create(null),bg=function(){function t(e,r){var n=this;this.policies=e,this.group=r,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(s,i){return Qh(lr(s)?n.get(s.__ref,i):s&&s[i])},this.canRead=function(s){return lr(s)?n.has(s.__ref):typeof s=="object"},this.toReference=function(s,i){if(typeof s=="string")return Oh(s);if(lr(s))return s;var a=n.policies.identify(s)[0];if(a){var l=Oh(a);return i&&n.merge(a,s),l}}}return t.prototype.toObject=function(){return ue({},this.data)},t.prototype.has=function(e){return this.lookup(e,!0)!==void 0},t.prototype.get=function(e,r){if(this.group.depend(e,r),Un.call(this.data,e)){var n=this.data[e];if(n&&Un.call(n,r))return n[r]}if(r==="__typename"&&Un.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof ec)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Un.call(this.data,e))return this.data[e];if(this instanceof ec)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var n=this,s;lr(e)&&(e=e.__ref),lr(r)&&(r=r.__ref);var i=typeof e=="string"?this.lookup(s=e):e,a=typeof r=="string"?this.lookup(s=r):r;if(a){Je(typeof s=="string",2);var l=new Cc(coe).merge(i,a);if(this.data[s]=l,l!==i&&(delete this.refs[s],this.group.caching)){var c=Object.create(null);i||(c.__exists=1),Object.keys(a).forEach(function(d){if(!i||i[d]!==l[d]){c[d]=1;var f=Nc(d);f!==d&&!n.policies.hasKeyArgs(l.__typename,f)&&(c[f]=1),l[d]===void 0&&!(n instanceof ec)&&delete l[d]}}),c.__typename&&!(i&&i.__typename)&&this.policies.rootTypenamesById[s]===l.__typename&&delete c.__typename,Object.keys(c).forEach(function(d){return n.group.dirty(s,d)})}}},t.prototype.modify=function(e,r){var n=this,s=this.lookup(e);if(s){var i=Object.create(null),a=!1,l=!0,c={DELETE:a0,INVALIDATE:y5,isReference:lr,toReference:this.toReference,canRead:this.canRead,readField:function(d,f){return n.policies.readField(typeof d=="string"?{fieldName:d,from:f||Oh(e)}:d,{store:n})}};if(Object.keys(s).forEach(function(d){var f=Nc(d),p=s[d];if(p!==void 0){var m=typeof r=="function"?r:r[d]||r[f];if(m){var g=m===TS?a0:m(Qh(p),ue(ue({},c),{fieldName:f,storeFieldName:d,storage:n.getStorage(e,d)}));if(g===y5)n.group.dirty(e,d);else if(g===a0&&(g=void 0),g!==p&&(i[d]=g,a=!0,p=g,globalThis.__DEV__!==!1)){var y=function(j){if(n.lookup(j.__ref)===void 0)return globalThis.__DEV__!==!1&&Je.warn(3,j),!0};if(lr(g))y(g);else if(Array.isArray(g))for(var x=!1,w=void 0,_=0,S=g;_<S.length;_++){var k=S[_];if(lr(k)){if(x=!0,y(k))break}else if(typeof k=="object"&&k){var N=n.policies.identify(k)[0];N&&(w=k)}if(x&&w!==void 0){globalThis.__DEV__!==!1&&Je.warn(4,w);break}}}}p!==void 0&&(l=!1)}}),a)return this.merge(e,i),l&&(this instanceof ec?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,r,n){var s,i=this.lookup(e);if(i){var a=this.getFieldValue(i,"__typename"),l=r&&n?this.policies.getStoreFieldName({typename:a,fieldName:r,args:n}):r;return this.modify(e,l?(s={},s[l]=TS,s):TS)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(Un.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof ec&&this!==r&&(n=this.parent.evict(e,r)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),n=[];return this.getRootIdSet().forEach(function(s){Un.call(e.policies.rootTypenamesById,s)||n.push(s)}),n.length&&(r.__META={extraRootIds:n.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(i){e&&Un.call(e,i)||r.delete(i)}),e){var n=e.__META,s=ga(e,["__META"]);Object.keys(s).forEach(function(i){r.merge(i,s[i])}),n&&n.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var r=--this.rootIds[e];return r||delete this.rootIds[e],r}return 0},t.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof ec?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),n=this.toObject();r.forEach(function(a){Un.call(n,a)&&(Object.keys(e.findChildRefIds(a)).forEach(r.add,r),delete n[a])});var s=Object.keys(n);if(s.length){for(var i=this;i instanceof ec;)i=i.parent;s.forEach(function(a){return i.delete(a)})}return s},t.prototype.findChildRefIds=function(e){if(!Un.call(this.refs,e)){var r=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return r;var s=new Set([n]);s.forEach(function(i){lr(i)&&(r[i.__ref]=!0),en(i)&&Object.keys(i).forEach(function(a){var l=i[a];en(l)&&s.add(l)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}(),Ez=function(){function t(e,r){r===void 0&&(r=null),this.caching=e,this.parent=r,this.d=null,this.resetCaching()}return t.prototype.resetCaching=function(){this.d=this.caching?QF():null,this.keyMaker=new gl(ld)},t.prototype.depend=function(e,r){if(this.d){this.d(AS(e,r));var n=Nc(r);n!==r&&this.d(AS(e,n)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(AS(e,r),r==="__exists"?"forget":"setDirty")},t}();function AS(t,e){return e+"#"+t}function x5(t,e){Hm(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){Qi(n,r);function n(s){var i=s.policies,a=s.resultCaching,l=a===void 0?!0:a,c=s.seed,d=r.call(this,i,new Ez(l))||this;return d.stump=new loe(d),d.storageTrie=new gl(ld),c&&d.replace(c),d}return n.prototype.addLayer=function(s,i){return this.stump.addLayer(s,i)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(t);t.Root=e})(bg||(bg={}));var ec=function(t){Qi(e,t);function e(r,n,s,i){var a=t.call(this,n.policies,i)||this;return a.id=r,a.parent=n,a.replay=s,a.group=i,s(a),a}return e.prototype.addLayer=function(r,n){return new e(r,this,n,this.group)},e.prototype.removeLayer=function(r){var n=this,s=this.parent.removeLayer(r);return r===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(i){var a=n.data[i],l=s.lookup(i);l?a?a!==l&&Object.keys(a).forEach(function(c){ar(a[c],l[c])||n.group.dirty(i,c)}):(n.group.dirty(i,"__exists"),Object.keys(l).forEach(function(c){n.group.dirty(i,c)})):n.delete(i)}),s):s===this.parent?this:s.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return ue(ue({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return Un.call(this.data,r)?ue(ue({},n),t.prototype.findChildRefIds.call(this,r)):n},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(bg),loe=function(t){Qi(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new Ez(r.group.caching,r.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(r,n){return this.parent.merge(r,n)},e}(ec);function coe(t,e,r){var n=t[r],s=e[r];return ar(n,s)?n:s}function Hm(t){return!!(t instanceof bg&&t.group.caching)}function uoe(t){return en(t)?tn(t)?t.slice(0):ue({__proto__:Object.getPrototypeOf(t)},t):t}var _5=function(){function t(){this.known=new(Pj?WeakSet:Set),this.pool=new gl(ld),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return en(e)&&this.known.has(e)},t.prototype.pass=function(e){if(en(e)){var r=uoe(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(en(e)){var n=this.passes.get(e);if(n)return n;var s=Object.getPrototypeOf(e);switch(s){case Array.prototype:{if(this.known.has(e))return e;var i=e.map(this.admit,this),a=this.pool.lookupArray(i);return a.array||(this.known.add(a.array=i),globalThis.__DEV__!==!1&&Object.freeze(i)),a.array}case null:case Object.prototype:{if(this.known.has(e))return e;var l=Object.getPrototypeOf(e),c=[l],d=this.sortedKeys(e);c.push(d.json);var f=c.length;d.sorted.forEach(function(g){c.push(r.admit(e[g]))});var a=this.pool.lookupArray(c);if(!a.object){var p=a.object=Object.create(l);this.known.add(p),d.sorted.forEach(function(g,y){p[g]=c[f+y]}),globalThis.__DEV__!==!1&&Object.freeze(p)}return a.object}}}return e},t.prototype.sortedKeys=function(e){var r=Object.keys(e),n=this.pool.lookupArray(r);if(!n.keys){r.sort();var s=JSON.stringify(r);(n.keys=this.keysByJSON.get(s))||this.keysByJSON.set(s,n.keys={sorted:r,json:s})}return n.keys},t}();function b5(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var doe=function(){function t(e){var r=this;this.knownResults=new(ld?WeakMap:Map),this.config=Xh(e,{addTypename:e.addTypename!==!1,canonizeResults:wz(e)}),this.canon=e.canon||new _5,this.executeSelectionSet=_g(function(n){var s,i=n.context.canonizeResults,a=b5(n);a[3]=!i;var l=(s=r.executeSelectionSet).peek.apply(s,a);return l?i?ue(ue({},l),{result:r.canon.admit(l.result)}):l:(x5(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize||go["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:b5,makeCacheKey:function(n,s,i,a){if(Hm(i.store))return i.store.makeCacheKey(n,lr(s)?s.__ref:s,i.varString,a)}}),this.executeSubSelectedArray=_g(function(n){return x5(n.context.store,n.enclosingRef.__ref),r.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize||go["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(n){var s=n.field,i=n.array,a=n.context;if(Hm(a.store))return a.store.makeCacheKey(s,i,a.varString)}})}return t.prototype.resetCanon=function(){this.canon=new _5},t.prototype.diffQueryAgainstStore=function(e){var r=e.store,n=e.query,s=e.rootId,i=s===void 0?"ROOT_QUERY":s,a=e.variables,l=e.returnPartialData,c=l===void 0?!0:l,d=e.canonizeResults,f=d===void 0?this.config.canonizeResults:d,p=this.config.cache.policies;a=ue(ue({},$j($F(n))),a);var m=Oh(i),g=this.executeSelectionSet({selectionSet:Nf(n).selectionSet,objectOrReference:m,enclosingRef:m,context:ue({store:r,query:n,policies:p,variables:a,varString:xc(a),canonizeResults:f},kz(n,this.config.fragments))}),y;if(g.missing&&(y=[new xz(hoe(g.missing),g.missing,n,a)],!c))throw y[0];return{result:g.result,complete:!y,missing:y}},t.prototype.isFresh=function(e,r,n,s){if(Hm(s.store)&&this.knownResults.get(e)===n){var i=this.executeSelectionSet.peek(n,r,s,this.canon.isKnown(e));if(i&&e===i.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=this,n=e.selectionSet,s=e.objectOrReference,i=e.enclosingRef,a=e.context;if(lr(s)&&!a.policies.rootTypenamesById[s.__ref]&&!a.store.has(s.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(s.__ref," object")};var l=a.variables,c=a.policies,d=a.store,f=d.getFieldValue(s,"__typename"),p=[],m,g=new Cc;this.config.addTypename&&typeof f=="string"&&!c.rootIdsByTypename[f]&&p.push({__typename:f});function y(k,N){var j;return k.missing&&(m=g.merge(m,(j={},j[N]=k.missing,j))),k.result}var x=new Set(n.selections);x.forEach(function(k){var N,j;if(iv(k,l))if(kc(k)){var T=c.readField({fieldName:k.name.value,field:k,variables:a.variables,from:s},a),D=ul(k);T===void 0?Uj.added(k)||(m=g.merge(m,(N={},N[D]="Can't find field '".concat(k.name.value,"' on ").concat(lr(s)?s.__ref+" object":"object "+JSON.stringify(s,null,2)),N))):tn(T)?T.length>0&&(T=y(r.executeSubSelectedArray({field:k,array:T,enclosingRef:i,context:a}),D)):k.selectionSet?T!=null&&(T=y(r.executeSelectionSet({selectionSet:k.selectionSet,objectOrReference:T,enclosingRef:lr(T)?T:i,context:a}),D)):a.canonizeResults&&(T=r.canon.pass(T)),T!==void 0&&p.push((j={},j[D]=T,j))}else{var I=tb(k,a.lookupFragment);if(!I&&k.kind===Ze.FRAGMENT_SPREAD)throw zs(10,k.name.value);I&&c.fragmentMatches(I,f)&&I.selectionSet.selections.forEach(x.add,x)}});var w=ab(p),_={result:w,missing:m},S=a.canonizeResults?this.canon.admit(_):Qh(_);return S.result&&this.knownResults.set(S.result,n),S},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,n=e.field,s=e.array,i=e.enclosingRef,a=e.context,l,c=new Cc;function d(f,p){var m;return f.missing&&(l=c.merge(l,(m={},m[p]=f.missing,m))),f.result}return n.selectionSet&&(s=s.filter(a.store.canRead)),s=s.map(function(f,p){return f===null?null:tn(f)?d(r.executeSubSelectedArray({field:n,array:f,enclosingRef:i,context:a}),p):n.selectionSet?d(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:f,enclosingRef:lr(f)?f:i,context:a}),p):(globalThis.__DEV__!==!1&&foe(a.store,n,f),f)}),{result:a.canonizeResults?this.canon.admit(s):s,missing:l}},t}();function hoe(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function foe(t,e,r){if(!e.selectionSet){var n=new Set([r]);n.forEach(function(s){en(s)&&(Je(!lr(s),11,aoe(t,s),e.name.value),Object.values(s).forEach(n.add,n))})}}var Kj=new nb,w5=new WeakMap;function qm(t){var e=w5.get(t);return e||w5.set(t,e={vars:new Set,dep:QF()}),e}function S5(t){qm(t).vars.forEach(function(e){return e.forgetCache(t)})}function poe(t){qm(t).vars.forEach(function(e){return e.attachCache(t)})}function moe(t){var e=new Set,r=new Set,n=function(i){if(arguments.length>0){if(t!==i){t=i,e.forEach(function(c){qm(c).dep.dirty(n),goe(c)});var a=Array.from(r);r.clear(),a.forEach(function(c){return c(t)})}}else{var l=Kj.getValue();l&&(s(l),qm(l).dep(n))}return t};n.onNextChange=function(i){return r.add(i),function(){r.delete(i)}};var s=n.attachCache=function(i){return e.add(i),qm(i).vars.add(n),n};return n.forgetCache=function(i){return e.delete(i)},n}function goe(t){t.broadcastWatches&&t.broadcastWatches()}var k5=Object.create(null);function Yj(t){var e=JSON.stringify(t);return k5[e]||(k5[e]=Object.create(null))}function E5(t){var e=Yj(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var s=function(a,l){return n.readField(l,a)},i=n.keyObject=Qj(t,function(a){var l=Mh(n.storeObject,a,s);return l===void 0&&r!==n.storeObject&&Un.call(r,a[0])&&(l=Mh(r,a,Nz)),Je(l!==void 0,5,a.join("."),r),l});return"".concat(n.typename,":").concat(JSON.stringify(i))})}function C5(t){var e=Yj(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var s=n.field,i=n.variables,a=n.fieldName,l=Qj(t,function(d){var f=d[0],p=f.charAt(0);if(p==="@"){if(s&&ka(s.directives)){var m=f.slice(1),g=s.directives.find(function(_){return _.name.value===m}),y=g&&rb(g,i);return y&&Mh(y,d.slice(1))}return}if(p==="$"){var x=f.slice(1);if(i&&Un.call(i,x)){var w=d.slice(0);return w[0]=x,Mh(i,w)}return}if(r)return Mh(r,d)}),c=JSON.stringify(l);return(r||c!=="{}")&&(a+=":"+c),a})}function Qj(t,e){var r=new Cc;return Cz(t).reduce(function(n,s){var i,a=e(s);if(a!==void 0){for(var l=s.length-1;l>=0;--l)a=(i={},i[s[l]]=a,i);n=r.merge(n,a)}return n},Object.create(null))}function Cz(t){var e=Yj(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(s,i){tn(s)?(Cz(s).forEach(function(a){return r.push(n.concat(a))}),n.length=0):(n.push(s),tn(t[i+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function Nz(t,e){return t[e]}function Mh(t,e,r){return r=r||Nz,jz(e.reduce(function n(s,i){return tn(s)?s.map(function(a){return n(a,i)}):s&&r(s,i)},t))}function jz(t){return en(t)?tn(t)?t.map(jz):Qj(Object.keys(t).sort(),function(e){return Mh(t,e)}):t}function kC(t){return t.args!==void 0?t.args:t.field?rb(t.field,t.variables):null}var voe=function(){},N5=function(t,e){return e.fieldName},j5=function(t,e,r){var n=r.mergeObjects;return n(t,e)},T5=function(t,e){return e},yoe=function(){function t(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=ue({dataIdFromObject:_z},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return t.prototype.identify=function(e,r){var n,s=this,i=r&&(r.typename||((n=r.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(i===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];var a=r&&r.storeObject||e,l=ue(ue({},r),{typename:i,storeObject:a,readField:r&&r.readField||function(){var p=Xj(arguments,a);return s.readField(p,{store:s.cache.data,variables:p.variables})}}),c,d=i&&this.getTypePolicy(i),f=d&&d.keyFn||this.config.dataIdFromObject;return Gj.withValue(!0,function(){for(;f;){var p=f(ue(ue({},e),a),l);if(tn(p))f=E5(p);else{c=p;break}}}),c=c?String(c):void 0,l.keyObject?[c,l.keyObject]:[c]},t.prototype.addTypePolicies=function(e){var r=this;Object.keys(e).forEach(function(n){var s=e[n],i=s.queryType,a=s.mutationType,l=s.subscriptionType,c=ga(s,["queryType","mutationType","subscriptionType"]);i&&r.setRootTypename("Query",n),a&&r.setRootTypename("Mutation",n),l&&r.setRootTypename("Subscription",n),Un.call(r.toBeAdded,n)?r.toBeAdded[n].push(c):r.toBeAdded[n]=[c]})},t.prototype.updateTypePolicy=function(e,r){var n=this,s=this.getTypePolicy(e),i=r.keyFields,a=r.fields;function l(c,d){c.merge=typeof d=="function"?d:d===!0?j5:d===!1?T5:c.merge}l(s,r.merge),s.keyFn=i===!1?voe:tn(i)?E5(i):typeof i=="function"?i:s.keyFn,a&&Object.keys(a).forEach(function(c){var d=n.getFieldPolicy(e,c,!0),f=a[c];if(typeof f=="function")d.read=f;else{var p=f.keyArgs,m=f.read,g=f.merge;d.keyFn=p===!1?N5:tn(p)?C5(p):typeof p=="function"?p:d.keyFn,typeof m=="function"&&(d.read=m),l(d,g)}d.read&&d.merge&&(d.keyFn=d.keyFn||N5)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var n="ROOT_"+e.toUpperCase(),s=this.rootTypenamesById[n];r!==s&&(Je(!s||s===e,6,e),s&&delete this.rootIdsByTypename[s],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){r.getSupertypeSet(n,!0),e[n].forEach(function(s){r.getSupertypeSet(s,!0).add(n);var i=s.match(Sz);(!i||i[0]!==s)&&r.fuzzySubtypes.set(s,new RegExp(s))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!Un.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var s=this.supertypeMap.get(e);!s&&this.fuzzySubtypes.size&&(s=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach(function(a,l){if(a.test(e)){var c=r.supertypeMap.get(l);c&&c.forEach(function(d){return s.add(d)})}})),s&&s.size&&s.forEach(function(a){var l=r.getTypePolicy(a),c=l.fields,d=ga(l,["fields"]);Object.assign(n,d),Object.assign(n.fields,c)})}var i=this.toBeAdded[e];return i&&i.length&&i.splice(0).forEach(function(a){r.updateTypePolicy(e,a)}),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,r,n){if(e){var s=this.getTypePolicy(e).fields;return s[r]||n&&(s[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var n=this.supertypeMap.get(e);return!n&&r&&this.supertypeMap.set(e,n=new Set),n},t.prototype.fragmentMatches=function(e,r,n,s){var i=this;if(!e.typeCondition)return!0;if(!r)return!1;var a=e.typeCondition.name.value;if(r===a)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(a))for(var l=this.getSupertypeSet(r,!0),c=[l],d=function(y){var x=i.getSupertypeSet(y,!1);x&&x.size&&c.indexOf(x)<0&&c.push(x)},f=!!(n&&this.fuzzySubtypes.size),p=!1,m=0;m<c.length;++m){var g=c[m];if(g.has(a))return l.has(a)||(p&&globalThis.__DEV__!==!1&&Je.warn(7,r,a),l.add(a)),!0;g.forEach(d),f&&m===c.length-1&&SC(e.selectionSet,n,s)&&(f=!1,p=!0,this.fuzzySubtypes.forEach(function(y,x){var w=r.match(y);w&&w[0]===r&&d(x)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var n=this.getFieldPolicy(e,r,!1);return!!(n&&n.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,n=e.fieldName,s=this.getFieldPolicy(r,n,!1),i,a=s&&s.keyFn;if(a&&r)for(var l={typename:r,fieldName:n,field:e.field||null,variables:e.variables},c=kC(e);a;){var d=a(c,l);if(tn(d))a=C5(d);else{i=d||n;break}}return i===void 0&&(i=e.field?$ie(e.field,e.variables):LF(n,kC(e))),i===!1?n:n===Nc(i)?i:n+":"+i},t.prototype.readField=function(e,r){var n=e.from;if(n){var s=e.field||e.fieldName;if(s){if(e.typename===void 0){var i=r.store.getFieldValue(n,"__typename");i&&(e.typename=i)}var a=this.getStoreFieldName(e),l=Nc(a),c=r.store.getFieldValue(n,a),d=this.getFieldPolicy(e.typename,l,!1),f=d&&d.read;if(f){var p=A5(this,n,e,r,r.store.getStorage(lr(n)?n.__ref:n,a));return Kj.withValue(this.cache,f,[c,p])}return c}}},t.prototype.getReadFunction=function(e,r){var n=this.getFieldPolicy(e,r,!1);return n&&n.read},t.prototype.getMergeFunction=function(e,r,n){var s=this.getFieldPolicy(e,r,!1),i=s&&s.merge;return!i&&n&&(s=this.getTypePolicy(n),i=s&&s.merge),i},t.prototype.runMergeFunction=function(e,r,n,s,i){var a=n.field,l=n.typename,c=n.merge;return c===j5?Tz(s.store)(e,r):c===T5?r:(s.overwrite&&(e=void 0),c(e,r,A5(this,void 0,{typename:l,fieldName:a.name.value,field:a,variables:s.variables},s,i||Object.create(null))))},t}();function A5(t,e,r,n,s){var i=t.getStoreFieldName(r),a=Nc(i),l=r.variables||n.variables,c=n.store,d=c.toReference,f=c.canRead;return{args:kC(r),field:r.field||null,fieldName:a,storeFieldName:i,variables:l,isReference:lr,toReference:d,storage:s,cache:t.cache,canRead:f,readField:function(){return t.readField(Xj(arguments,e,l),n)},mergeObjects:Tz(n.store)}}function Xj(t,e,r){var n=t[0],s=t[1],i=t.length,a;return typeof n=="string"?a={fieldName:n,from:i>1?s:e}:(a=ue({},n),Un.call(a,"from")||(a.from=e)),globalThis.__DEV__!==!1&&a.from===void 0&&globalThis.__DEV__!==!1&&Je.warn(8,yF(Array.from(t))),a.variables===void 0&&(a.variables=r),a}function Tz(t){return function(r,n){if(tn(r)||tn(n))throw zs(9);if(en(r)&&en(n)){var s=t.getFieldValue(r,"__typename"),i=t.getFieldValue(n,"__typename"),a=s&&i&&s!==i;if(a)return n;if(lr(r)&&bh(n))return t.merge(r.__ref,n),r;if(bh(r)&&lr(n))return t.merge(r,n.__ref),n;if(bh(r)&&bh(n))return ue(ue({},r),n)}return n}}function RS(t,e,r){var n="".concat(e).concat(r),s=t.flavors.get(n);return s||t.flavors.set(n,s=t.clientOnly===e&&t.deferred===r?t:ue(ue({},t),{clientOnly:e,deferred:r})),s}var xoe=function(){function t(e,r,n){this.cache=e,this.reader=r,this.fragments=n}return t.prototype.writeToStore=function(e,r){var n=this,s=r.query,i=r.result,a=r.dataId,l=r.variables,c=r.overwrite,d=Ju(s),f=ooe();l=ue(ue({},$j(d)),l);var p=ue(ue({store:e,written:Object.create(null),merge:function(g,y){return f.merge(g,y)},variables:l,varString:xc(l)},kz(s,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),m=this.processSelectionSet({result:i||Object.create(null),dataId:a,selectionSet:d.selectionSet,mergeTree:{map:new Map},context:p});if(!lr(m))throw zs(12,i);return p.incomingById.forEach(function(g,y){var x=g.storeObject,w=g.mergeTree,_=g.fieldNodeSet,S=Oh(y);if(w&&w.map.size){var k=n.applyMerges(w,S,x,p);if(lr(k))return;x=k}if(globalThis.__DEV__!==!1&&!p.overwrite){var N=Object.create(null);_.forEach(function(D){D.selectionSet&&(N[D.name.value]=!0)});var j=function(D){return N[Nc(D)]===!0},T=function(D){var I=w&&w.map.get(D);return!!(I&&I.info&&I.info.merge)};Object.keys(x).forEach(function(D){j(D)&&!T(D)&&_oe(S,x,D,p.store)})}e.merge(y,x)}),e.retain(m.__ref),m},t.prototype.processSelectionSet=function(e){var r=this,n=e.dataId,s=e.result,i=e.selectionSet,a=e.context,l=e.mergeTree,c=this.cache.policies,d=Object.create(null),f=n&&c.rootTypenamesById[n]||pC(s,i,a.fragmentMap)||n&&a.store.get(n,"__typename");typeof f=="string"&&(d.__typename=f);var p=function(){var k=Xj(arguments,d,a.variables);if(lr(k.from)){var N=a.incomingById.get(k.from.__ref);if(N){var j=c.readField(ue(ue({},k),{from:N.storeObject}),a);if(j!==void 0)return j}}return c.readField(k,a)},m=new Set;this.flattenFields(i,s,a,f).forEach(function(k,N){var j,T=ul(N),D=s[T];if(m.add(N),D!==void 0){var I=c.getStoreFieldName({typename:f,fieldName:N.name.value,field:N,variables:k.variables}),L=R5(l,I),$=r.processFieldValue(D,N,N.selectionSet?RS(k,!1,!1):k,L),Q=void 0;N.selectionSet&&(lr($)||bh($))&&(Q=p("__typename",$));var M=c.getMergeFunction(f,N.name.value,Q);M?L.info={field:N,typename:f,merge:M}:D5(l,I),d=k.merge(d,(j={},j[I]=$,j))}else globalThis.__DEV__!==!1&&!k.clientOnly&&!k.deferred&&!Uj.added(N)&&!c.getReadFunction(f,N.name.value)&&globalThis.__DEV__!==!1&&Je.error(13,ul(N),s)});try{var g=c.identify(s,{typename:f,selectionSet:i,fragmentMap:a.fragmentMap,storeObject:d,readField:p}),y=g[0],x=g[1];n=n||y,x&&(d=a.merge(d,x))}catch(k){if(!n)throw k}if(typeof n=="string"){var w=Oh(n),_=a.written[n]||(a.written[n]=[]);if(_.indexOf(i)>=0||(_.push(i),this.reader&&this.reader.isFresh(s,w,i,a)))return w;var S=a.incomingById.get(n);return S?(S.storeObject=a.merge(S.storeObject,d),S.mergeTree=EC(S.mergeTree,l),m.forEach(function(k){return S.fieldNodeSet.add(k)})):a.incomingById.set(n,{storeObject:d,mergeTree:U0(l)?void 0:l,fieldNodeSet:m}),w}return d},t.prototype.processFieldValue=function(e,r,n,s){var i=this;return!r.selectionSet||e===null?globalThis.__DEV__!==!1?sz(e):e:tn(e)?e.map(function(a,l){var c=i.processFieldValue(a,r,n,R5(s,l));return D5(s,l),c}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:n,mergeTree:s})},t.prototype.flattenFields=function(e,r,n,s){s===void 0&&(s=pC(r,e,n.fragmentMap));var i=new Map,a=this.cache.policies,l=new gl(!1);return function c(d,f){var p=l.lookup(d,f.clientOnly,f.deferred);p.visited||(p.visited=!0,d.selections.forEach(function(m){if(iv(m,n.variables)){var g=f.clientOnly,y=f.deferred;if(!(g&&y)&&ka(m.directives)&&m.directives.forEach(function(_){var S=_.name.value;if(S==="client"&&(g=!0),S==="defer"){var k=rb(_,n.variables);(!k||k.if!==!1)&&(y=!0)}}),kc(m)){var x=i.get(m);x&&(g=g&&x.clientOnly,y=y&&x.deferred),i.set(m,RS(n,g,y))}else{var w=tb(m,n.lookupFragment);if(!w&&m.kind===Ze.FRAGMENT_SPREAD)throw zs(14,m.name.value);w&&a.fragmentMatches(w,s,r,n.variables)&&c(w.selectionSet,RS(n,g,y))}}}))}(e,n),i},t.prototype.applyMerges=function(e,r,n,s,i){var a,l=this;if(e.map.size&&!lr(n)){var c=!tn(n)&&(lr(r)||bh(r))?r:void 0,d=n;c&&!i&&(i=[lr(c)?c.__ref:c]);var f,p=function(m,g){return tn(m)?typeof g=="number"?m[g]:void 0:s.store.getFieldValue(m,String(g))};e.map.forEach(function(m,g){var y=p(c,g),x=p(d,g);if(x!==void 0){i&&i.push(g);var w=l.applyMerges(m,y,x,s,i);w!==x&&(f=f||new Map,f.set(g,w)),i&&Je(i.pop()===g)}}),f&&(n=tn(d)?d.slice(0):ue({},d),f.forEach(function(m,g){n[g]=m}))}return e.info?this.cache.policies.runMergeFunction(r,n,e.info,s,i&&(a=s.store).getStorage.apply(a,i)):n},t}(),Az=[];function R5(t,e){var r=t.map;return r.has(e)||r.set(e,Az.pop()||{map:new Map}),r.get(e)}function EC(t,e){if(t===e||!e||U0(e))return t;if(!t||U0(t))return e;var r=t.info&&e.info?ue(ue({},t.info),e.info):t.info||e.info,n=t.map.size&&e.map.size,s=n?new Map:t.map.size?t.map:e.map,i={info:r,map:s};if(n){var a=new Set(e.map.keys());t.map.forEach(function(l,c){i.map.set(c,EC(l,e.map.get(c))),a.delete(c)}),a.forEach(function(l){i.map.set(l,EC(e.map.get(l),t.map.get(l)))})}return i}function U0(t){return!t||!(t.info||t.map.size)}function D5(t,e){var r=t.map,n=r.get(e);n&&U0(n)&&(Az.push(n),r.delete(e))}var O5=new Set;function _oe(t,e,r,n){var s=function(p){var m=n.getFieldValue(p,r);return typeof m=="object"&&m},i=s(t);if(i){var a=s(e);if(a&&!lr(i)&&!ar(i,a)&&!Object.keys(i).every(function(p){return n.getFieldValue(a,p)!==void 0})){var l=n.getFieldValue(t,"__typename")||n.getFieldValue(e,"__typename"),c=Nc(r),d="".concat(l,".").concat(c);if(!O5.has(d)){O5.add(d);var f=[];!tn(i)&&!tn(a)&&[i,a].forEach(function(p){var m=n.getFieldValue(p,"__typename");typeof m=="string"&&!f.includes(m)&&f.push(m)}),globalThis.__DEV__!==!1&&Je.warn(15,c,l,f.length?"either ensure all objects of type "+f.join(" and ")+" have an ID or a custom merge function, or ":"",d,ue({},i),ue({},a))}}}}var Rz=function(t){Qi(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.watches=new Set,n.addTypenameTransform=new XF(Uj),n.assumeImmutableResults=!0,n.makeVar=moe,n.txCount=0,n.config=ioe(r),n.addTypename=!!n.config.addTypename,n.policies=new yoe({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var r=this.data=new bg.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=r.stump,this.resetResultCache()},e.prototype.resetResultCache=function(r){var n=this,s=this.storeReader,i=this.config.fragments;this.storeWriter=new xoe(this,this.storeReader=new doe({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:wz(this.config),canon:r?void 0:s&&s.canon,fragments:i}),i),this.maybeBroadcastWatch=_g(function(a,l){return n.broadcastWatch(a,l)},{max:this.config.resultCacheMaxSize||go["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(a){var l=a.optimistic?n.optimisticData:n.data;if(Hm(l)){var c=a.optimistic,d=a.id,f=a.variables;return l.makeCacheKey(a.query,a.callback,xc({optimistic:c,id:d,variables:f}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(a){return a.resetCaching()})},e.prototype.restore=function(r){return this.init(),r&&this.data.replace(r),this},e.prototype.extract=function(r){return r===void 0&&(r=!1),(r?this.optimisticData:this.data).extract()},e.prototype.read=function(r){var n=r.returnPartialData,s=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(ue(ue({},r),{store:r.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:s})).result||null}catch(i){if(i instanceof xz)return null;throw i}},e.prototype.write=function(r){try{return++this.txCount,this.storeWriter.writeToStore(this.data,r)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(r){if(Un.call(r,"id")&&!r.id)return!1;var n=r.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(r.id||"ROOT_QUERY",r.fields)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(r){return this.storeReader.diffQueryAgainstStore(ue(ue({},r),{store:r.optimistic?this.optimisticData:this.data,rootId:r.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(r){var n=this;return this.watches.size||poe(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){n.watches.delete(r)&&!n.watches.size&&S5(n),n.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){var n;xc.reset(),Pu.reset(),this.addTypenameTransform.resetCache(),(n=this.config.fragments)===null||n===void 0||n.resetCaches();var s=this.optimisticData.gc();return r&&!this.txCount&&(r.resetResultCache?this.resetResultCache(r.resetResultIdentities):r.resetResultIdentities&&this.storeReader.resetCanon()),s},e.prototype.retain=function(r,n){return(n?this.optimisticData:this.data).retain(r)},e.prototype.release=function(r,n){return(n?this.optimisticData:this.data).release(r)},e.prototype.identify=function(r){if(lr(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(n){globalThis.__DEV__!==!1&&Je.warn(n)}},e.prototype.evict=function(r){if(!r.id){if(Un.call(r,"id"))return!1;r=ue(ue({},r),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(r,this.data)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(r){var n=this;return this.init(),xc.reset(),r&&r.discardWatches?(this.watches.forEach(function(s){return n.maybeBroadcastWatch.forget(s)}),this.watches.clear(),S5(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(r){var n=this.optimisticData.removeLayer(r);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(r){var n=this,s=r.update,i=r.optimistic,a=i===void 0?!0:i,l=r.removeOptimistic,c=r.onWatchUpdated,d,f=function(m){var g=n,y=g.data,x=g.optimisticData;++n.txCount,m&&(n.data=n.optimisticData=m);try{return d=s(n)}finally{--n.txCount,n.data=y,n.optimisticData=x}},p=new Set;return c&&!this.txCount&&this.broadcastWatches(ue(ue({},r),{onWatchUpdated:function(m){return p.add(m),!1}})),typeof a=="string"?this.optimisticData=this.optimisticData.addLayer(a,f):a===!1?f(this.data):f(),typeof l=="string"&&(this.optimisticData=this.optimisticData.removeLayer(l)),c&&p.size?(this.broadcastWatches(ue(ue({},r),{onWatchUpdated:function(m,g){var y=c.call(this,m,g);return y!==!1&&p.delete(m),y}})),p.size&&p.forEach(function(m){return n.maybeBroadcastWatch.dirty(m)})):this.broadcastWatches(r),d},e.prototype.performTransaction=function(r,n){return this.batch({update:r,optimistic:n||n!==null})},e.prototype.transformDocument=function(r){return this.addTypenameToDocument(this.addFragmentsToDocument(r))},e.prototype.fragmentMatches=function(r,n){return this.policies.fragmentMatches(r,n)},e.prototype.lookupFragment=function(r){var n;return((n=this.config.fragments)===null||n===void 0?void 0:n.lookup(r))||null},e.prototype.broadcastWatches=function(r){var n=this;this.txCount||this.watches.forEach(function(s){return n.maybeBroadcastWatch(s,r)})},e.prototype.addFragmentsToDocument=function(r){var n=this.config.fragments;return n?n.transform(r):r},e.prototype.addTypenameToDocument=function(r){return this.addTypename?this.addTypenameTransform.transformDocument(r):r},e.prototype.broadcastWatch=function(r,n){var s=r.lastDiff,i=this.diff(r);n&&(r.optimistic&&typeof n.optimistic=="string"&&(i.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,r,i,s)===!1)||(!s||!ar(s.result,i.result))&&r.callback(r.lastDiff=i,s)},e}(yz);globalThis.__DEV__!==!1&&(Rz.prototype.getMemoryInternals=_ie);var tr;(function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error"})(tr||(tr={}));function Ih(t){return t?t<7:!1}var P5=Object.assign,boe=Object.hasOwnProperty,CC=function(t){Qi(e,t);function e(r){var n=r.queryManager,s=r.queryInfo,i=r.options,a=t.call(this,function(w){try{var _=w._subscription._observer;_&&!_.error&&(_.error=woe)}catch{}var S=!a.observers.size;a.observers.add(w);var k=a.last;return k&&k.error?w.error&&w.error(k.error):k&&k.result&&w.next&&w.next(a.maskResult(k.result)),S&&a.reobserve().catch(function(){}),function(){a.observers.delete(w)&&!a.observers.size&&a.tearDownQuery()}})||this;a.observers=new Set,a.subscriptions=new Set,a.queryInfo=s,a.queryManager=n,a.waitForOwnResult=DS(i.fetchPolicy),a.isTornDown=!1,a.subscribeToMore=a.subscribeToMore.bind(a),a.maskResult=a.maskResult.bind(a);var l=n.defaultOptions.watchQuery,c=l===void 0?{}:l,d=c.fetchPolicy,f=d===void 0?"cache-first":d,p=i.fetchPolicy,m=p===void 0?f:p,g=i.initialFetchPolicy,y=g===void 0?m==="standby"?f:m:g;a.options=ue(ue({},i),{initialFetchPolicy:y,fetchPolicy:m}),a.queryId=s.queryId||n.generateQueryId();var x=Ju(a.query);return a.queryName=x&&x.name&&x.name.value,a}return Object.defineProperty(e.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var r=this;return new Promise(function(n,s){var i={next:function(l){n(l),r.observers.delete(i),r.observers.size||r.queryManager.removeQuery(r.queryId),setTimeout(function(){a.unsubscribe()},0)},error:s},a=r.subscribe(i)})},e.prototype.resetDiff=function(){this.queryInfo.resetDiff()},e.prototype.getCurrentFullResult=function(r){r===void 0&&(r=!0);var n=this.getLastResult(!0),s=this.queryInfo.networkStatus||n&&n.networkStatus||tr.ready,i=ue(ue({},n),{loading:Ih(s),networkStatus:s}),a=this.options.fetchPolicy,l=a===void 0?"cache-first":a;if(!(DS(l)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers))if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(i.data=c.result),ar(i.data,{})&&(i.data=void 0),c.complete?(delete i.partial,c.complete&&i.networkStatus===tr.loading&&(l==="cache-first"||l==="cache-only")&&(i.networkStatus=tr.ready,i.loading=!1)):i.partial=!0,i.networkStatus===tr.ready&&(i.error||i.errors)&&(i.networkStatus=tr.error),globalThis.__DEV__!==!1&&!c.complete&&!this.options.partialRefetch&&!i.loading&&!i.data&&!i.error&&Oz(c.missing)}return r&&this.updateLastResult(i),i},e.prototype.getCurrentResult=function(r){return r===void 0&&(r=!0),this.maskResult(this.getCurrentFullResult(r))},e.prototype.isDifferentFromLastResult=function(r,n){if(!this.last)return!0;var s=this.queryManager.getDocumentInfo(this.query),i=this.queryManager.dataMasking,a=i?s.nonReactiveQuery:this.query,l=i||s.hasNonreactiveDirective?!hz(a,this.last.result,r,this.variables):!ar(this.last.result,r);return l||n&&!ar(this.last.variables,n)},e.prototype.getLast=function(r,n){var s=this.last;if(s&&s[r]&&(!n||ar(s.variables,this.variables)))return s[r]},e.prototype.getLastResult=function(r){return this.getLast("result",r)},e.prototype.getLastError=function(r){return this.getLast("error",r)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(r){var n,s={pollInterval:0},i=this.options.fetchPolicy;if(i==="no-cache"?s.fetchPolicy="no-cache":s.fetchPolicy="network-only",globalThis.__DEV__!==!1&&r&&boe.call(r,"variables")){var a=$F(this.query),l=a.variableDefinitions;(!l||!l.some(function(c){return c.variable.name.value==="variables"}))&&globalThis.__DEV__!==!1&&Je.warn(21,r,((n=a.name)===null||n===void 0?void 0:n.value)||a)}return r&&!ar(this.options.variables,r)&&(s.variables=this.options.variables=ue(ue({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(s,tr.refetch)},e.prototype.fetchMore=function(r){var n=this,s=ue(ue({},r.query?r:ue(ue(ue(ue({},this.options),{query:this.options.query}),r),{variables:ue(ue({},this.options.variables),r.variables)})),{fetchPolicy:"no-cache"});s.query=this.transformDocument(s.query);var i=this.queryManager.generateQueryId();this.lastQuery=r.query?this.transformDocument(this.options.query):s.query;var a=this.queryInfo,l=a.networkStatus;a.networkStatus=tr.fetchMore,s.notifyOnNetworkStatusChange&&this.observe();var c=new Set,d=r==null?void 0:r.updateQuery,f=this.options.fetchPolicy!=="no-cache";return f||Je(d,22),this.queryManager.fetchQuery(i,s,tr.fetchMore).then(function(p){if(n.queryManager.removeQuery(i),a.networkStatus===tr.fetchMore&&(a.networkStatus=l),f)n.queryManager.cache.batch({update:function(y){var x=r.updateQuery;x?y.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(w){return x(w,{fetchMoreResult:p.data,variables:s.variables})}):y.writeQuery({query:s.query,variables:s.variables,data:p.data})},onWatchUpdated:function(y){c.add(y.query)}});else{var m=n.getLast("result"),g=d(m.data,{fetchMoreResult:p.data,variables:s.variables});n.reportResult(ue(ue({},m),{networkStatus:l,loading:Ih(l),data:g}),n.variables)}return n.maskResult(p)}).finally(function(){f&&!c.has(n.query)&&Dz(n)})},e.prototype.subscribeToMore=function(r){var n=this,s=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(i){var a=r.updateQuery;a&&n.updateQuery(function(l,c){return a(l,ue({subscriptionData:i},c))})},error:function(i){if(r.onError){r.onError(i);return}globalThis.__DEV__!==!1&&Je.error(23,i)}});return this.subscriptions.add(s),function(){n.subscriptions.delete(s)&&s.unsubscribe()}},e.prototype.setOptions=function(r){return this.reobserve(r)},e.prototype.silentSetOptions=function(r){var n=Xh(this.options,r||{});P5(this.options,n)},e.prototype.setVariables=function(r){return ar(this.variables,r)?this.observers.size?this.result():Promise.resolve():(this.options.variables=r,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:r},tr.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var n=this.queryManager,s=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}),i=s.result,a=s.complete,l=r(i,{variables:this.variables,complete:!!a,previousData:i});l&&(n.cache.writeQuery({query:this.options.query,data:l,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(r){this.options.pollInterval=r,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(r,n){if(n.nextFetchPolicy){var s=n.fetchPolicy,i=s===void 0?"cache-first":s,a=n.initialFetchPolicy,l=a===void 0?i:a;i==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(i,{reason:r,options:n,observable:this,initialFetchPolicy:l}):r==="variables-changed"?n.fetchPolicy=l:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(r,n,s){return this.queryManager.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(this.queryId,r,n,s)},e.prototype.updatePolling=function(){var r=this;if(!this.queryManager.ssrMode){var n=this,s=n.pollingInfo,i=n.options.pollInterval;if(!i||!this.hasObservers()){s&&(clearTimeout(s.timeout),delete this.pollingInfo);return}if(!(s&&s.interval===i)){Je(i,24);var a=s||(this.pollingInfo={});a.interval=i;var l=function(){var d,f;r.pollingInfo&&(!Ih(r.queryInfo.networkStatus)&&!(!((f=(d=r.options).skipPollAttempt)===null||f===void 0)&&f.call(d))?r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},tr.poll).then(c,c):c())},c=function(){var d=r.pollingInfo;d&&(clearTimeout(d.timeout),d.timeout=setTimeout(l,d.interval))};c()}}},e.prototype.updateLastResult=function(r,n){n===void 0&&(n=this.variables);var s=this.getLastError();return s&&this.last&&!ar(n,this.last.variables)&&(s=void 0),this.last=ue({result:this.queryManager.assumeImmutableResults?r:sz(r),variables:n},s?{error:s}:null)},e.prototype.reobserveAsConcast=function(r,n){var s=this;this.isTornDown=!1;var i=n===tr.refetch||n===tr.fetchMore||n===tr.poll,a=this.options.variables,l=this.options.fetchPolicy,c=Xh(this.options,r||{}),d=i?c:P5(this.options,c),f=this.transformDocument(d.query);this.lastQuery=f,i||(this.updatePolling(),r&&r.variables&&!ar(r.variables,a)&&d.fetchPolicy!=="standby"&&(d.fetchPolicy===l||typeof d.nextFetchPolicy=="function")&&(this.applyNextFetchPolicy("variables-changed",d),n===void 0&&(n=tr.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=DS(d.fetchPolicy));var p=function(){s.concast===y&&(s.waitForOwnResult=!1)},m=d.variables&&ue({},d.variables),g=this.fetch(d,n,f),y=g.concast,x=g.fromLink,w={next:function(_){ar(s.variables,m)&&(p(),s.reportResult(_,m))},error:function(_){ar(s.variables,m)&&(cz(_)||(_=new pa({networkError:_})),p(),s.reportError(_,m))}};return!i&&(x||!this.concast)&&(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=y,this.observer=w),y.addObserver(w),y},e.prototype.reobserve=function(r,n){return fae(this.reobserveAsConcast(r,n).promise.then(this.maskResult))},e.prototype.resubscribeAfterError=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=this.last;this.resetLastResults();var i=this.subscribe.apply(this,r);return this.last=s,i},e.prototype.observe=function(){this.reportResult(this.getCurrentFullResult(!1),this.variables)},e.prototype.reportResult=function(r,n){var s=this.getLastError(),i=this.isDifferentFromLastResult(r,n);(s||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,n),(s||i)&&Vm(this.observers,"next",this.maskResult(r))},e.prototype.reportError=function(r,n){var s=ue(ue({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:tr.error,loading:!1});this.updateLastResult(s,n),Vm(this.observers,"error",this.last.error=r)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(r){return r.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e.prototype.transformDocument=function(r){return this.queryManager.transform(r)},e.prototype.maskResult=function(r){return r&&"data"in r?ue(ue({},r),{data:this.queryManager.maskOperation({document:this.query,data:r.data,fetchPolicy:this.options.fetchPolicy,id:this.queryId})}):r},e}(mr);iz(CC);function Dz(t){var e=t.options,r=e.fetchPolicy,n=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(s,i){return this.nextFetchPolicy=n,typeof this.nextFetchPolicy=="function"?this.nextFetchPolicy(s,i):r}}):t.reobserve()}function woe(t){globalThis.__DEV__!==!1&&Je.error(25,t.message,t.stack)}function Oz(t){globalThis.__DEV__!==!1&&t&&globalThis.__DEV__!==!1&&Je.debug(26,t)}function DS(t){return t==="network-only"||t==="no-cache"||t==="standby"}var wh=new(ld?WeakMap:Map);function OS(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return wh.set(t,(wh.get(t)+1)%1e15),r.apply(this,arguments)})}function M5(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var PS=function(){function t(e,r){r===void 0&&(r=e.generateQueryId()),this.queryId=r,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;wh.has(n)||(wh.set(n,0),OS(n,"evict"),OS(n,"modify"),OS(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||tr.loading;return this.variables&&this.networkStatus!==tr.loading&&!ar(this.variables,e.variables)&&(r=tr.setVariables),ar(e.variables,this.variables)||(this.lastDiff=void 0,this.cancel()),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:r}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){M5(this),this.dirty=!1},t.prototype.resetDiff=function(){this.lastDiff=void 0},t.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&ar(e,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables);var r=this.observableQuery;if(r&&r.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(e);return this.updateLastDiff(n,e),n},t.prototype.updateLastDiff=function(e,r){this.lastDiff=e?{diff:e,options:r||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){var r;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(r=this.observableQuery)===null||r===void 0?void 0:r.options.canonizeResults}},t.prototype.setDiff=function(e){var r=this,n,s=this.lastDiff&&this.lastDiff.diff;e&&!e.complete&&(!((n=this.observableQuery)===null||n===void 0)&&n.getLastError())||(this.updateLastDiff(e),!this.dirty&&!ar(s&&s.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return r.notify()},0))))},t.prototype.setObservableQuery=function(e){var r=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=r.getDiff();n.fromOptimisticTransaction?e.observe():Dz(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;M5(this),this.shouldNotify()&&this.listeners.forEach(function(r){return r(e)}),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Ih(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel();var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){var e;(e=this.cancelWatch)===null||e===void 0||e.call(this),this.cancelWatch=void 0},t.prototype.updateWatch=function(e){var r=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var s=ue(ue({},this.getDiffOptions(e)),{watcher:this,callback:function(i){return r.setDiff(i)}});(!this.lastWatch||!ar(s,this.lastWatch))&&(this.cancel(),this.cancelWatch=this.cache.watch(this.lastWatch=s))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var n=this.lastWrite;return!(n&&n.dmCount===wh.get(this.cache)&&ar(r,n.variables)&&ar(e.data,n.result.data))},t.prototype.markResult=function(e,r,n,s){var i=this,a=new Cc,l=ka(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&ka(e.incremental)){var c=az(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var d=this.getDiff();e.data=a.merge(d.result,e.data)}this.graphQLErrors=l,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):s!==0&&(NC(e,n.errorPolicy)?this.cache.performTransaction(function(f){if(i.shouldWrite(e,n.variables))f.writeQuery({query:r,data:e.data,variables:n.variables,overwrite:s===1}),i.lastWrite={result:e,variables:n.variables,dmCount:wh.get(i.cache)};else if(i.lastDiff&&i.lastDiff.diff.complete){e.data=i.lastDiff.diff.result;return}var p=i.getDiffOptions(n.variables),m=f.diff(p);!i.stopped&&ar(i.variables,n.variables)&&i.updateWatch(n.variables),i.updateLastDiff(m,p),m.complete&&(e.data=m.result)}):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=tr.ready},t.prototype.markError=function(e){return this.networkStatus=tr.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function NC(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",n=!n0(t);return!n&&r&&t.data&&(n=!0),n}var Soe=Object.prototype.hasOwnProperty,I5=Object.create(null),koe=function(){function t(e){var r=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new Ij(go["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new gl(!1),this.noCacheWarningsByQueryId=new Set;var n=new XF(function(i){return r.cache.transformDocument(i)},{cache:!1});this.cache=e.cache,this.link=e.link,this.defaultOptions=e.defaultOptions,this.queryDeduplication=e.queryDeduplication,this.clientAwareness=e.clientAwareness,this.localState=e.localState,this.ssrMode=e.ssrMode,this.assumeImmutableResults=e.assumeImmutableResults,this.dataMasking=e.dataMasking;var s=e.documentTransform;this.documentTransform=s?n.concat(s).concat(n):n,this.defaultContext=e.defaultContext||Object.create(null),(this.onBroadcast=e.onBroadcast)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var e=this;this.queries.forEach(function(r,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(zs(27))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){return sc(this,arguments,void 0,function(r){var n,s,i,a,l,c,d,f=r.mutation,p=r.variables,m=r.optimisticResponse,g=r.updateQueries,y=r.refetchQueries,x=y===void 0?[]:y,w=r.awaitRefetchQueries,_=w===void 0?!1:w,S=r.update,k=r.onQueryUpdated,N=r.fetchPolicy,j=N===void 0?((c=this.defaultOptions.mutate)===null||c===void 0?void 0:c.fetchPolicy)||"network-only":N,T=r.errorPolicy,D=T===void 0?((d=this.defaultOptions.mutate)===null||d===void 0?void 0:d.errorPolicy)||"none":T,I=r.keepRootFields,L=r.context;return ic(this,function($){switch($.label){case 0:return Je(f,28),Je(j==="network-only"||j==="no-cache",29),n=this.generateMutationId(),f=this.cache.transformForLink(this.transform(f)),s=this.getDocumentInfo(f).hasClientExports,p=this.getVariables(f,p),s?[4,this.localState.addExportedVariables(f,p,L)]:[3,2];case 1:p=$.sent(),$.label=2;case 2:return i=this.mutationStore&&(this.mutationStore[n]={mutation:f,variables:p,loading:!0,error:null}),a=m&&this.markMutationOptimistic(m,{mutationId:n,document:f,variables:p,fetchPolicy:j,errorPolicy:D,context:L,updateQueries:g,update:S,keepRootFields:I}),this.broadcastQueries(),l=this,[2,new Promise(function(Q,M){return NS(l.getObservableFromLink(f,ue(ue({},L),{optimisticResponse:a?m:void 0}),p,{},!1),function(z){if(n0(z)&&D==="none")throw new pa({graphQLErrors:yC(z)});i&&(i.loading=!1,i.error=null);var R=ue({},z);return typeof x=="function"&&(x=x(R)),D==="ignore"&&n0(R)&&delete R.errors,l.markMutationResult({mutationId:n,result:R,document:f,variables:p,fetchPolicy:j,errorPolicy:D,context:L,update:S,updateQueries:g,awaitRefetchQueries:_,refetchQueries:x,removeOptimistic:a?n:void 0,onQueryUpdated:k,keepRootFields:I})}).subscribe({next:function(z){l.broadcastQueries(),(!("hasNext"in z)||z.hasNext===!1)&&Q(ue(ue({},z),{data:l.maskOperation({document:f,data:z.data,fetchPolicy:j,id:n})}))},error:function(z){i&&(i.loading=!1,i.error=z),a&&l.cache.removeOptimistic(n),l.broadcastQueries(),M(z instanceof pa?z:new pa({networkError:z}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var n=this;r===void 0&&(r=this.cache);var s=e.result,i=[],a=e.fetchPolicy==="no-cache";if(!a&&NC(s,e.errorPolicy)){if(Ph(s)||i.push({result:s.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Ph(s)&&ka(s.incremental)){var l=r.diff({id:"ROOT_MUTATION",query:this.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;l.result&&(c=az(l.result,s)),typeof c<"u"&&(s.data=c,i.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var d=e.updateQueries;d&&this.queries.forEach(function(p,m){var g=p.observableQuery,y=g&&g.queryName;if(!(!y||!Soe.call(d,y))){var x=d[y],w=n.queries.get(m),_=w.document,S=w.variables,k=r.diff({query:_,variables:S,returnPartialData:!0,optimistic:!1}),N=k.result,j=k.complete;if(j&&N){var T=x(N,{mutationResult:s,queryName:_&&bm(_)||void 0,queryVariables:S});T&&i.push({result:T,dataId:"ROOT_QUERY",query:_,variables:S})}}})}if(i.length>0||(e.refetchQueries||"").length>0||e.update||e.onQueryUpdated||e.removeOptimistic){var f=[];if(this.refetchQueries({updateCache:function(p){a||i.forEach(function(x){return p.write(x)});var m=e.update,g=!yae(s)||Ph(s)&&!s.hasNext;if(m){if(!a){var y=p.diff({id:"ROOT_MUTATION",query:n.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});y.complete&&(s=ue(ue({},s),{data:y.result}),"incremental"in s&&delete s.incremental,"hasNext"in s&&delete s.hasNext)}g&&m(p,s,{context:e.context,variables:e.variables})}!a&&!e.keepRootFields&&g&&p.modify({id:"ROOT_MUTATION",fields:function(x,w){var _=w.fieldName,S=w.DELETE;return _==="__typename"?x:S}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(p){return f.push(p)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(f).then(function(){return s})}return Promise.resolve(s)},t.prototype.markMutationOptimistic=function(e,r){var n=this,s=typeof e=="function"?e(r.variables,{IGNORE:I5}):e;return s===I5?!1:(this.cache.recordOptimisticTransaction(function(i){try{n.markMutationResult(ue(ue({},r),{result:{data:s}}),i)}catch(a){globalThis.__DEV__!==!1&&Je.error(a)}},r.mutationId),!0)},t.prototype.fetchQuery=function(e,r,n){return this.fetchConcastWithInfo(e,r,n).concast.promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,n){e[n]={variables:r.variables,networkStatus:r.networkStatus,networkError:r.networkError,graphQLErrors:r.graphQLErrors}}),e},t.prototype.resetErrors=function(e){var r=this.queries.get(e);r&&(r.networkError=void 0,r.graphQLErrors=[])},t.prototype.transform=function(e){return this.documentTransform.transformDocument(e)},t.prototype.getDocumentInfo=function(e){var r=this.transformCache;if(!r.has(e)){var n={hasClientExports:Jse(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:yg(["nonreactive"],e),nonReactiveQuery:rae(e),clientQuery:this.localState.clientQuery(e),serverQuery:JF([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"},{name:"unmask"}],e),defaultVars:$j(Ju(e)),asQuery:ue(ue({},e),{definitions:e.definitions.map(function(s){return s.kind==="OperationDefinition"&&s.operation!=="query"?ue(ue({},s),{operation:"query"}):s})})};r.set(e,n)}return r.get(e)},t.prototype.getVariables=function(e,r){return ue(ue({},this.getDocumentInfo(e).defaultVars),r)},t.prototype.watchQuery=function(e){var r=this.transform(e.query);e=ue(ue({},e),{variables:this.getVariables(r,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var n=new PS(this),s=new CC({queryManager:this,queryInfo:n,options:e});return s.lastQuery=r,this.queries.set(s.queryId,n),n.init({document:r,observableQuery:s,variables:s.variables}),s},t.prototype.query=function(e,r){var n=this;r===void 0&&(r=this.generateQueryId()),Je(e.query,30),Je(e.query.kind==="Document",31),Je(!e.returnPartialData,32),Je(!e.pollInterval,33);var s=this.transform(e.query);return this.fetchQuery(r,ue(ue({},e),{query:s})).then(function(i){return i&&ue(ue({},i),{data:n.maskOperation({document:s,data:i.data,fetchPolicy:e.fetchPolicy,id:r})})}).finally(function(){return n.stopQuery(r)})},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var r=this.queries.get(e);r&&r.stop()},t.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(zs(34)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=tr.loading:r.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},t.prototype.getObservableQueries=function(e){var r=this;e===void 0&&(e="active");var n=new Map,s=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(l){if(typeof l=="string")s.set(l,l),i.set(l,!1);else if(jie(l)){var c=Pu(r.transform(l));s.set(c,bm(l)),i.set(c,!1)}else en(l)&&l.query&&a.add(l)}),this.queries.forEach(function(l,c){var d=l.observableQuery,f=l.document;if(d){if(e==="all"){n.set(c,d);return}var p=d.queryName,m=d.options.fetchPolicy;if(m==="standby"||e==="active"&&!d.hasObservers())return;(e==="active"||p&&i.has(p)||f&&i.has(Pu(f)))&&(n.set(c,d),p&&i.set(p,!0),f&&i.set(Pu(f),!0))}}),a.size&&a.forEach(function(l){var c=aC("legacyOneTimeQuery"),d=r.getQuery(c).init({document:l.query,variables:l.variables}),f=new CC({queryManager:r,queryInfo:d,options:ue(ue({},l),{fetchPolicy:"network-only"})});Je(f.queryId===c),d.setObservableQuery(f),n.set(c,f)}),globalThis.__DEV__!==!1&&i.size&&i.forEach(function(l,c){if(!l){var d=s.get(c);d?globalThis.__DEV__!==!1&&Je.warn(35,d):globalThis.__DEV__!==!1&&Je.warn(36)}}),n},t.prototype.reFetchObservableQueries=function(e){var r=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(s,i){var a=s.options.fetchPolicy;s.resetLastResults(),(e||a!=="standby"&&a!=="cache-only")&&n.push(s.refetch()),r.getQuery(i).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=this,n=e.query,s=e.variables,i=e.fetchPolicy,a=e.errorPolicy,l=a===void 0?"none":a,c=e.context,d=c===void 0?{}:c,f=e.extensions,p=f===void 0?{}:f;n=this.transform(n),s=this.getVariables(n,s);var m=function(y){return r.getObservableFromLink(n,d,y,p).map(function(x){i!=="no-cache"&&(NC(x,l)&&r.cache.write({query:n,result:x.data,dataId:"ROOT_SUBSCRIPTION",variables:y}),r.broadcastQueries());var w=n0(x),_=lz(x);if(w||_){var S={};if(w&&(S.graphQLErrors=x.errors),_&&(S.protocolErrors=x.extensions[ob]),l==="none"||_)throw new pa(S)}return l==="ignore"&&delete x.errors,x})};if(this.getDocumentInfo(n).hasClientExports){var g=this.localState.addExportedVariables(n,s,d).then(m);return new mr(function(y){var x=null;return g.then(function(w){return x=w.subscribe(y)},y.error),function(){return x&&x.unsubscribe()}})}return m(s)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,r,n,s,i){var a=this,l;i===void 0&&(i=(l=r==null?void 0:r.queryDeduplication)!==null&&l!==void 0?l:this.queryDeduplication);var c,d=this.getDocumentInfo(e),f=d.serverQuery,p=d.clientQuery;if(f){var m=this,g=m.inFlightLinkObservables,y=m.link,x={query:f,variables:n,operationName:bm(f)||void 0,context:this.prepareContext(ue(ue({},r),{forceFetch:!i})),extensions:s};if(r=x.context,i){var w=Pu(f),_=xc(n),S=g.lookup(w,_);if(c=S.observable,!c){var k=new ph([xC(y,x)]);c=S.observable=k,k.beforeNext(function N(j,T){j==="next"&&"hasNext"in T&&T.hasNext?k.beforeNext(N):g.remove(w,_)})}}else c=new ph([xC(y,x)])}else c=new ph([mr.of({data:{}})]),r=this.prepareContext(r);return p&&(c=NS(c,function(N){return a.localState.runResolvers({document:p,remoteResult:N,context:r,variables:n})})),c},t.prototype.getResultsFromLink=function(e,r,n){var s=e.lastRequestId=this.generateRequestId(),i=this.cache.transformForLink(n.query);return NS(this.getObservableFromLink(i,n.context,n.variables),function(a){var l=yC(a),c=l.length>0,d=n.errorPolicy;if(s>=e.lastRequestId){if(c&&d==="none")throw e.markError(new pa({graphQLErrors:l}));e.markResult(a,i,n,r),e.markReady()}var f={data:a.data,loading:!1,networkStatus:tr.ready};return c&&d==="none"&&(f.data=void 0),c&&d!=="ignore"&&(f.errors=l,f.networkStatus=tr.error),f},function(a){var l=cz(a)?a:new pa({networkError:a});throw s>=e.lastRequestId&&e.markError(l),l})},t.prototype.fetchConcastWithInfo=function(e,r,n,s){var i=this;n===void 0&&(n=tr.loading),s===void 0&&(s=r.query);var a=this.getVariables(s,r.variables),l=this.getQuery(e),c=this.defaultOptions.watchQuery,d=r.fetchPolicy,f=d===void 0?c&&c.fetchPolicy||"cache-first":d,p=r.errorPolicy,m=p===void 0?c&&c.errorPolicy||"none":p,g=r.returnPartialData,y=g===void 0?!1:g,x=r.notifyOnNetworkStatusChange,w=x===void 0?!1:x,_=r.context,S=_===void 0?{}:_,k=Object.assign({},r,{query:s,variables:a,fetchPolicy:f,errorPolicy:m,returnPartialData:y,notifyOnNetworkStatusChange:w,context:S}),N=function(L){k.variables=L;var $=i.fetchQueryByPolicy(l,k,n);return k.fetchPolicy!=="standby"&&$.sources.length>0&&l.observableQuery&&l.observableQuery.applyNextFetchPolicy("after-fetch",r),$},j=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(L){j(),setTimeout(function(){return T.cancel(L)})});var T,D;if(this.getDocumentInfo(k.query).hasClientExports)T=new ph(this.localState.addExportedVariables(k.query,k.variables,k.context).then(N).then(function(L){return L.sources})),D=!0;else{var I=N(k.variables);D=I.fromLink,T=new ph(I.sources)}return T.promise.then(j,j),{concast:T,fromLink:D}},t.prototype.refetchQueries=function(e){var r=this,n=e.updateCache,s=e.include,i=e.optimistic,a=i===void 0?!1:i,l=e.removeOptimistic,c=l===void 0?a?aC("refetchQueries"):void 0:l,d=e.onQueryUpdated,f=new Map;s&&this.getObservableQueries(s).forEach(function(m,g){f.set(g,{oq:m,lastDiff:r.getQuery(g).getDiff()})});var p=new Map;return n&&this.cache.batch({update:n,optimistic:a&&c||!1,removeOptimistic:c,onWatchUpdated:function(m,g,y){var x=m.watcher instanceof PS&&m.watcher.observableQuery;if(x){if(d){f.delete(x.queryId);var w=d(x,g,y);return w===!0&&(w=x.refetch()),w!==!1&&p.set(x,w),w}d!==null&&f.set(x.queryId,{oq:x,lastDiff:y,diff:g})}}}),f.size&&f.forEach(function(m,g){var y=m.oq,x=m.lastDiff,w=m.diff,_;if(d){if(!w){var S=y.queryInfo;S.reset(),w=S.getDiff()}_=d(y,w,x)}(!d||_===!0)&&(_=y.refetch()),_!==!1&&p.set(y,_),g.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(g)}),c&&this.cache.removeOptimistic(c),p},t.prototype.maskOperation=function(e){var r,n,s,i=e.document,a=e.data;if(globalThis.__DEV__!==!1){var l=e.fetchPolicy,c=e.id,d=(r=Ju(i))===null||r===void 0?void 0:r.operation,f=((n=d==null?void 0:d[0])!==null&&n!==void 0?n:"o")+c;this.dataMasking&&l==="no-cache"&&!uie(i)&&!this.noCacheWarningsByQueryId.has(f)&&(this.noCacheWarningsByQueryId.add(f),globalThis.__DEV__!==!1&&Je.warn(37,(s=bm(i))!==null&&s!==void 0?s:"Unnamed ".concat(d??"operation")))}return this.dataMasking?soe(a,i,this.cache):a},t.prototype.maskFragment=function(e){var r=e.data,n=e.fragment,s=e.fragmentName;return this.dataMasking?vz(r,n,this.cache,s):r},t.prototype.fetchQueryByPolicy=function(e,r,n){var s=this,i=r.query,a=r.variables,l=r.fetchPolicy,c=r.refetchWritePolicy,d=r.errorPolicy,f=r.returnPartialData,p=r.context,m=r.notifyOnNetworkStatusChange,g=e.networkStatus;e.init({document:i,variables:a,networkStatus:n});var y=function(){return e.getDiff()},x=function(N,j){j===void 0&&(j=e.networkStatus||tr.loading);var T=N.result;globalThis.__DEV__!==!1&&!f&&!ar(T,{})&&Oz(N.missing);var D=function(I){return mr.of(ue({data:I,loading:Ih(j),networkStatus:j},N.complete?null:{partial:!0}))};return T&&s.getDocumentInfo(i).hasForcedResolvers?s.localState.runResolvers({document:i,remoteResult:{data:T},context:p,variables:a,onlyRunForcedResolvers:!0}).then(function(I){return D(I.data||void 0)}):d==="none"&&j===tr.refetch&&Array.isArray(N.missing)?D(void 0):D(T)},w=l==="no-cache"?0:n===tr.refetch&&c!=="merge"?1:2,_=function(){return s.getResultsFromLink(e,w,{query:i,variables:a,context:p,fetchPolicy:l,errorPolicy:d})},S=m&&typeof g=="number"&&g!==n&&Ih(n);switch(l){default:case"cache-first":{var k=y();return k.complete?{fromLink:!1,sources:[x(k,e.markReady())]}:f||S?{fromLink:!0,sources:[x(k),_()]}:{fromLink:!0,sources:[_()]}}case"cache-and-network":{var k=y();return k.complete||f||S?{fromLink:!0,sources:[x(k),_()]}:{fromLink:!0,sources:[_()]}}case"cache-only":return{fromLink:!1,sources:[x(y(),e.markReady())]};case"network-only":return S?{fromLink:!0,sources:[x(y()),_()]}:{fromLink:!0,sources:[_()]};case"no-cache":return S?{fromLink:!0,sources:[x(e.getDiff()),_()]}:{fromLink:!0,sources:[_()]};case"standby":return{fromLink:!1,sources:[]}}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new PS(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return ue(ue(ue({},this.defaultContext),r),{clientAwareness:this.clientAwareness})},t}(),Eoe=function(){function t(e){var r=e.cache,n=e.client,s=e.resolvers,i=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=r,n&&(this.client=n),s&&this.addResolvers(s),i&&this.setFragmentMatcher(i)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){r.resolvers=r5(r.resolvers,n)}):this.resolvers=r5(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){return sc(this,arguments,void 0,function(r){var n=r.document,s=r.remoteResult,i=r.context,a=r.variables,l=r.onlyRunForcedResolvers,c=l===void 0?!1:l;return ic(this,function(d){return n?[2,this.resolveDocument(n,s.data,i,a,this.fragmentMatcher,c).then(function(f){return ue(ue({},s),{data:f.result})})]:[2,s]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return yg(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return ez(e)},t.prototype.prepareContext=function(e){var r=this.cache;return ue(ue({},e),{cache:r,getCacheKey:function(n){return r.identify(n)}})},t.prototype.addExportedVariables=function(e){return sc(this,arguments,void 0,function(r,n,s){return n===void 0&&(n={}),s===void 0&&(s={}),ic(this,function(i){return r?[2,this.resolveDocument(r,this.buildRootValueFromCache(r,n)||{},this.prepareContext(s),n).then(function(a){return ue(ue({},n),a.exportedVariables)})]:[2,ue({},n)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return Sa(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(r=n.arguments.some(function(s){return s.name.value==="always"&&s.value.kind==="BooleanValue"&&s.value.value===!0}),r))return J_}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:tae(e),variables:r,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,r){return sc(this,arguments,void 0,function(n,s,i,a,l,c){var d,f,p,m,g,y,x,w,_,S,k;return i===void 0&&(i={}),a===void 0&&(a={}),l===void 0&&(l=function(){return!0}),c===void 0&&(c=!1),ic(this,function(N){return d=Nf(n),f=Cf(n),p=kf(f),m=this.collectSelectionsToResolve(d,p),g=d.operation,y=g?g.charAt(0).toUpperCase()+g.slice(1):"Query",x=this,w=x.cache,_=x.client,S={fragmentMap:p,context:ue(ue({},i),{cache:w,client:_}),variables:a,fragmentMatcher:l,defaultOperationType:y,exportedVariables:{},selectionsToResolve:m,onlyRunForcedResolvers:c},k=!1,[2,this.resolveSelectionSet(d.selectionSet,k,s,S).then(function(j){return{result:j,exportedVariables:S.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,n,s){return sc(this,void 0,void 0,function(){var i,a,l,c,d,f=this;return ic(this,function(p){return i=s.fragmentMap,a=s.context,l=s.variables,c=[n],d=function(m){return sc(f,void 0,void 0,function(){var g,y;return ic(this,function(x){return!r&&!s.selectionsToResolve.has(m)?[2]:iv(m,l)?kc(m)?[2,this.resolveField(m,r,n,s).then(function(w){var _;typeof w<"u"&&c.push((_={},_[ul(m)]=w,_))})]:(Fie(m)?g=m:(g=i[m.name.value],Je(g,19,m.name.value)),g&&g.typeCondition&&(y=g.typeCondition.name.value,s.fragmentMatcher(n,y,a))?[2,this.resolveSelectionSet(g.selectionSet,r,n,s).then(function(w){c.push(w)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(d)).then(function(){return ab(c)})]})})},t.prototype.resolveField=function(e,r,n,s){return sc(this,void 0,void 0,function(){var i,a,l,c,d,f,p,m,g,y=this;return ic(this,function(x){return n?(i=s.variables,a=e.name.value,l=ul(e),c=a!==l,d=n[l]||n[a],f=Promise.resolve(d),(!s.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(p=n.__typename||s.defaultOperationType,m=this.resolvers&&this.resolvers[p],m&&(g=m[c?a:l],g&&(f=Promise.resolve(Kj.withValue(this.cache,g,[n,rb(e,i),s.context,{field:e,fragmentMap:s.fragmentMap}]))))),[2,f.then(function(w){var _,S;if(w===void 0&&(w=d),e.directives&&e.directives.forEach(function(N){N.name.value==="export"&&N.arguments&&N.arguments.forEach(function(j){j.name.value==="as"&&j.value.kind==="StringValue"&&(s.exportedVariables[j.value.value]=w)})}),!e.selectionSet||w==null)return w;var k=(S=(_=e.directives)===null||_===void 0?void 0:_.some(function(N){return N.name.value==="client"}))!==null&&S!==void 0?S:!1;if(Array.isArray(w))return y.resolveSubSelectedArray(e,r||k,w,s);if(e.selectionSet)return y.resolveSelectionSet(e.selectionSet,r||k,w,s)})]):[2,null]})})},t.prototype.resolveSubSelectedArray=function(e,r,n,s){var i=this;return Promise.all(n.map(function(a){if(a===null)return null;if(Array.isArray(a))return i.resolveSubSelectedArray(e,r,a,s);if(e.selectionSet)return i.resolveSelectionSet(e.selectionSet,r,a,s)}))},t.prototype.collectSelectionsToResolve=function(e,r){var n=function(a){return!Array.isArray(a)},s=this.selectionsToResolveCache;function i(a){if(!s.has(a)){var l=new Set;s.set(a,l),Sa(a,{Directive:function(c,d,f,p,m){c.name.value==="client"&&m.forEach(function(g){n(g)&&GM(g)&&l.add(g)})},FragmentSpread:function(c,d,f,p,m){var g=r[c.name.value];Je(g,20,c.name.value);var y=i(g);y.size>0&&(m.forEach(function(x){n(x)&&GM(x)&&l.add(x)}),l.add(c),y.forEach(function(x){l.add(x)}))}})}return s.get(a)}return i(e)},t}(),L5=!1,Pz=function(){function t(e){var r=this,n;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw zs(16);var s=e.uri,i=e.credentials,a=e.headers,l=e.cache,c=e.documentTransform,d=e.ssrMode,f=d===void 0?!1:d,p=e.ssrForceFetchDelay,m=p===void 0?0:p,g=e.connectToDevTools,y=e.queryDeduplication,x=y===void 0?!0:y,w=e.defaultOptions,_=e.defaultContext,S=e.assumeImmutableResults,k=S===void 0?l.assumeImmutableResults:S,N=e.resolvers,j=e.typeDefs,T=e.fragmentMatcher,D=e.name,I=e.version,L=e.devtools,$=e.dataMasking,Q=e.link;Q||(Q=s?new dz({uri:s,credentials:i,headers:a}):vl.empty()),this.link=Q,this.cache=l,this.disableNetworkFetches=f||m>0,this.queryDeduplication=x,this.defaultOptions=w||Object.create(null),this.typeDefs=j,this.devtoolsConfig=ue(ue({},L),{enabled:(n=L==null?void 0:L.enabled)!==null&&n!==void 0?n:g}),this.devtoolsConfig.enabled===void 0&&(this.devtoolsConfig.enabled=globalThis.__DEV__!==!1),m&&setTimeout(function(){return r.disableNetworkFetches=!1},m),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.watchFragment=this.watchFragment.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),this.version=jj,this.localState=new Eoe({cache:l,client:this,resolvers:N,fragmentMatcher:T}),this.queryManager=new koe({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:_,documentTransform:c,queryDeduplication:x,ssrMode:f,dataMasking:!!$,clientAwareness:{name:D,version:I},localState:this.localState,assumeImmutableResults:k,onBroadcast:this.devtoolsConfig.enabled?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0}),this.devtoolsConfig.enabled&&this.connectToDevTools()}return t.prototype.connectToDevTools=function(){if(!(typeof window>"u")){var e=window,r=Symbol.for("apollo.devtools");(e[r]=e[r]||[]).push(this),e.__APOLLO_CLIENT__=this,!L5&&globalThis.__DEV__!==!1&&(L5=!0,window.document&&window.top===window.self&&/^(https?|file):$/.test(window.location.protocol)&&setTimeout(function(){if(!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__){var n=window.navigator,s=n&&n.userAgent,i=void 0;typeof s=="string"&&(s.indexOf("Chrome/")>-1?i="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":s.indexOf("Firefox/")>-1&&(i="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),i&&globalThis.__DEV__!==!1&&Je.log("Download the Apollo DevTools for a better development experience: %s",i)}},1e4))}},Object.defineProperty(t.prototype,"documentTransform",{get:function(){return this.queryManager.documentTransform},enumerable:!1,configurable:!0}),t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=s0(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=ue(ue({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(e){return this.defaultOptions.query&&(e=s0(this.defaultOptions.query,e)),Je(e.fetchPolicy!=="cache-and-network",17),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=ue(ue({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=s0(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){var r=this,n=this.queryManager.generateQueryId();return this.queryManager.startGraphQLSubscription(e).map(function(s){return ue(ue({},s),{data:r.queryManager.maskOperation({document:e.query,data:s.data,fetchPolicy:e.fetchPolicy,id:n})})})},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!1),this.cache.readQuery(e,r)},t.prototype.watchFragment=function(e){var r;return this.cache.watchFragment(ue(ue({},e),(r={},r[Symbol.for("apollo.dataMasking")]=this.queryManager.dataMasking,r)))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!1),this.cache.readFragment(e,r)},t.prototype.writeQuery=function(e){var r=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.writeFragment=function(e){var r=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return xC(this.link,e)},t.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(r){return r()}))}).then(function(){return e.reFetchObservableQueries()})},t.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(r){return r()}))})},t.prototype.onResetStore=function(e){var r=this;return this.resetStoreCallbacks.push(e),function(){r.resetStoreCallbacks=r.resetStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),n=[],s=[];r.forEach(function(a,l){n.push(l),s.push(a)});var i=Promise.all(s);return i.queries=n,i.results=s,i.catch(function(a){globalThis.__DEV__!==!1&&Je.debug(18,a)}),i},t.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},Object.defineProperty(t.prototype,"defaultContext",{get:function(){return this.queryManager.defaultContext},enumerable:!1,configurable:!0}),t}();globalThis.__DEV__!==!1&&(Pz.prototype.getMemoryInternals=xie);var o0=new Map,jC=new Map,Mz=!0,V0=!1;function Iz(t){return t.replace(/[\s,]+/g," ").trim()}function Coe(t){return Iz(t.source.body.substring(t.start,t.end))}function Noe(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var s=n.name.value,i=Coe(n.loc),a=jC.get(s);a&&!a.has(i)?Mz&&console.warn("Warning: fragment with name "+s+` already exists.
|
||
graphql-tag enforces all fragment names across your application to be unique; read more about
|
||
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a||jC.set(s,a=new Set),a.add(i),e.has(i)||(e.add(i),r.push(n))}else r.push(n)}),ue(ue({},t),{definitions:r})}function joe(t){var e=new Set(t.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(s){var i=n[s];i&&typeof i=="object"&&e.add(i)})});var r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function Toe(t){var e=Iz(t);if(!o0.has(e)){var r=TF(t,{experimentalFragmentVariables:V0,allowLegacyFragmentVariables:V0});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");o0.set(e,joe(Noe(r)))}return o0.get(e)}function Et(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var n=t[0];return e.forEach(function(s,i){s&&s.kind==="Document"?n+=s.loc.source.body:n+=s,n+=t[i+1]}),Toe(n)}function Aoe(){o0.clear(),jC.clear()}function Roe(){Mz=!1}function Doe(){V0=!0}function Ooe(){V0=!1}var Wp={gql:Et,resetCaches:Aoe,disableFragmentWarnings:Roe,enableExperimentalFragmentVariables:Doe,disableExperimentalFragmentVariables:Ooe};(function(t){t.gql=Wp.gql,t.resetCaches=Wp.resetCaches,t.disableFragmentWarnings=Wp.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Wp.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Wp.disableExperimentalFragmentVariables})(Et||(Et={}));Et.default=Et;var MS={exports:{}},$5;function Poe(){return $5||($5=1,function(t){t.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=void 0,t.exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=void 0,t.exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=void 0,Object.assign(t.exports,ff())}(MS)),MS.exports}var or=Poe();const Moe=ml(or),Lz=eB({__proto__:null,default:Moe},[or]);var B5=Mj?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function $z(){Je("createContext"in Lz,54);var t=or.createContext[B5];return t||(Object.defineProperty(or.createContext,B5,{value:t=or.createContext({}),enumerable:!1,writable:!1,configurable:!0}),t.displayName="ApolloContext"),t}var Ioe=function(t){var e=t.client,r=t.children,n=$z(),s=or.useContext(n),i=or.useMemo(function(){return ue(ue({},s),{client:e||s.client})},[s,e]);return Je(i.client,55),or.createElement(n.Provider,{value:i},r)};function Zj(t){var e=or.useContext($z()),r=t||e.client;return Je(!!r,58),r}var F5=!1,Loe="useSyncExternalStore",$oe=Lz[Loe],Boe=$oe||function(t,e,r){var n=e();globalThis.__DEV__!==!1&&!F5&&n!==e()&&(F5=!0,globalThis.__DEV__!==!1&&Je.error(68));var s=or.useState({inst:{value:n,getSnapshot:e}}),i=s[0].inst,a=s[1];return lie?or.useLayoutEffect(function(){Object.assign(i,{value:n,getSnapshot:e}),IS(i)&&a({inst:i})},[t,n,e]):Object.assign(i,{value:n,getSnapshot:e}),or.useEffect(function(){return IS(i)&&a({inst:i}),t(function(){IS(i)&&a({inst:i})})},[t]),n};function IS(t){var e=t.value,r=t.getSnapshot;try{return e!==r()}catch{return!0}}var lo;(function(t){t[t.Query=0]="Query",t[t.Mutation=1]="Mutation",t[t.Subscription=2]="Subscription"})(lo||(lo={}));var Mu;function z5(t){var e;switch(t){case lo.Query:e="Query";break;case lo.Mutation:e="Mutation";break;case lo.Subscription:e="Subscription";break}return e}function Bz(t){Mu||(Mu=new Ij(go.parser||1e3));var e=Mu.get(t);if(e)return e;var r,n,s;Je(!!t&&!!t.kind,70,t);for(var i=[],a=[],l=[],c=[],d=0,f=t.definitions;d<f.length;d++){var p=f[d];if(p.kind==="FragmentDefinition"){i.push(p);continue}if(p.kind==="OperationDefinition")switch(p.operation){case"query":a.push(p);break;case"mutation":l.push(p);break;case"subscription":c.push(p);break}}Je(!i.length||a.length||l.length||c.length,71),Je(a.length+l.length+c.length<=1,72,t,a.length,c.length,l.length),n=a.length?lo.Query:lo.Mutation,!a.length&&!l.length&&(n=lo.Subscription);var m=a.length?a:l.length?l:c;Je(m.length===1,73,t,m.length);var g=m[0];r=g.variableDefinitions||[],g.name&&g.name.kind==="Name"?s=g.name.value:s="data";var y={name:s,type:n,variables:r};return Mu.set(t,y),y}Bz.resetCache=function(){Mu=void 0};globalThis.__DEV__!==!1&&Lj("parser",function(){return Mu?Mu.size:0});function Fz(t,e){var r=Bz(t),n=z5(e),s=z5(r.type);Je(r.type===e,74,n,n,s)}function Foe(t,e){var r=or.useRef(void 0);return(!r.current||!ar(r.current.deps,e))&&(r.current={value:t(),deps:e}),r.current.value}var TC=DF?or.useLayoutEffect:or.useEffect;function zoe(t){return ka(t.errors)?new pa({graphQLErrors:t.errors}):t.error}Qh({loading:!0,data:void 0,error:void 0,networkStatus:tr.loading});Qh({loading:!1,data:void 0,error:void 0,networkStatus:tr.ready});function hr(t,e){var r=Zj(void 0);Fz(t,lo.Mutation);var n=or.useState({called:!1,loading:!1,client:r}),s=n[0],i=n[1],a=or.useRef({result:s,mutationId:0,isMounted:!0,client:r,mutation:t,options:e});TC(function(){Object.assign(a.current,{client:r,options:e,mutation:t})});var l=or.useCallback(function(d){d===void 0&&(d={});var f=a.current,p=f.options,m=f.mutation,g=ue(ue({},p),{mutation:m}),y=d.client||a.current.client;!a.current.result.loading&&!g.ignoreResults&&a.current.isMounted&&i(a.current.result={loading:!0,error:void 0,data:void 0,called:!0,client:y});var x=++a.current.mutationId,w=s0(g,d);return y.mutate(w).then(function(_){var S,k,N=_.data,j=_.errors,T=j&&j.length>0?new pa({graphQLErrors:j}):void 0,D=d.onError||((S=a.current.options)===null||S===void 0?void 0:S.onError);if(T&&D&&D(T,w),x===a.current.mutationId&&!w.ignoreResults){var I={called:!0,loading:!1,data:N,error:T,client:y};a.current.isMounted&&!ar(a.current.result,I)&&i(a.current.result=I)}var L=d.onCompleted||((k=a.current.options)===null||k===void 0?void 0:k.onCompleted);return T||L==null||L(_.data,w),_},function(_){var S;if(x===a.current.mutationId&&a.current.isMounted){var k={loading:!1,error:_,data:void 0,called:!0,client:y};ar(a.current.result,k)||i(a.current.result=k)}var N=d.onError||((S=a.current.options)===null||S===void 0?void 0:S.onError);if(N)return N(_,w),{data:void 0,errors:_};throw _})},[]),c=or.useCallback(function(){if(a.current.isMounted){var d={called:!1,loading:!1,client:a.current.client};Object.assign(a.current,{mutationId:0,result:d}),i(d)}},[]);return or.useEffect(function(){var d=a.current;return d.isMounted=!0,function(){d.isMounted=!1}},[]),[l,ue({reset:c},s)]}function wg(t,e){e===void 0&&(e=Object.create(null));var r=or.useRef(!1),n=Zj(e.client);Fz(t,lo.Subscription),r.current||(r.current=!0,e.onSubscriptionData&&globalThis.__DEV__!==!1&&Je.warn(e.onData?61:62),e.onSubscriptionComplete&&globalThis.__DEV__!==!1&&Je.warn(e.onComplete?63:64));var s=e.skip,i=e.fetchPolicy,a=e.errorPolicy,l=e.shouldResubscribe,c=e.context,d=e.extensions,f=e.ignoreResults,p=Foe(function(){return e.variables},[e.variables]),m=function(){return Uoe(n,t,p,i,a,c,d)},g=or.useState(e.skip?null:m),y=g[0],x=g[1],w=or.useRef(m);TC(function(){w.current=m}),s?y&&x(y=null):(!y||(n!==y.__.client||t!==y.__.query||i!==y.__.fetchPolicy||a!==y.__.errorPolicy||!ar(p,y.__.variables))&&(typeof l=="function"?!!l(e):l)!==!1)&&x(y=m());var _=or.useRef(e);or.useEffect(function(){_.current=e});var S=!s&&!f,k=or.useMemo(function(){return{loading:S,error:void 0,data:void 0,variables:p}},[S,p]),N=or.useRef(f);TC(function(){N.current=f});var j=Boe(or.useCallback(function(D){if(!y)return function(){};var I=!1,L=y.__.variables,$=y.__.client,Q=y.subscribe({next:function(M){var z,R;if(!I){var B={loading:!1,data:M.data,error:zoe(M),variables:L};y.__.setResult(B),N.current||D(),B.error?(R=(z=_.current).onError)===null||R===void 0||R.call(z,B.error):_.current.onData?_.current.onData({client:$,data:B}):_.current.onSubscriptionData&&_.current.onSubscriptionData({client:$,subscriptionData:B})}},error:function(M){var z,R;M=M instanceof pa?M:new pa({protocolErrors:[M]}),I||(y.__.setResult({loading:!1,data:void 0,error:M,variables:L}),N.current||D(),(R=(z=_.current).onError)===null||R===void 0||R.call(z,M))},complete:function(){I||(_.current.onComplete?_.current.onComplete():_.current.onSubscriptionComplete&&_.current.onSubscriptionComplete())}});return function(){I=!0,setTimeout(function(){Q.unsubscribe()})}},[y]),function(){return y&&!s&&!f?y.__.result:k},function(){return k}),T=or.useCallback(function(){Je(!_.current.skip,65),x(w.current())},[_,w]);return or.useMemo(function(){return ue(ue({},j),{restart:T})},[j,T])}function Uoe(t,e,r,n,s,i,a){var l={query:e,variables:r,fetchPolicy:n,errorPolicy:s,context:i,extensions:a},c=ue(ue({},l),{client:t,result:{loading:!0,data:void 0,error:void 0,variables:r},setResult:function(f){c.result=f}}),d=null;return Object.assign(new mr(function(f){d||(d=t.subscribe(l));var p=d.subscribe(f);return function(){return p.unsubscribe()}}),{__:c})}class Sm extends Error{}Sm.prototype.name="InvalidTokenError";function Voe(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function Hoe(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Voe(e)}catch{return atob(e)}}function zz(t,e){if(typeof t!="string")throw new Sm("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new Sm(`Invalid token specified: missing part #${r+1}`);let s;try{s=Hoe(n)}catch(i){throw new Sm(`Invalid token specified: invalid base64 for part #${r+1} (${i.message})`)}try{return JSON.parse(s)}catch(i){throw new Sm(`Invalid token specified: invalid json for part #${r+1} (${i.message})`)}}/*! *****************************************************************************
|
||
Copyright (c) Microsoft Corporation.
|
||
|
||
Permission to use, copy, modify, and/or distribute this software for any
|
||
purpose with or without fee is hereby granted.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
PERFORMANCE OF THIS SOFTWARE.
|
||
***************************************************************************** */var Ke=function(){return Ke=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ke.apply(this,arguments)};function Jj(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function Vt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function er(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],a;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){a={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Tr(t,e,r){if(arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}var gr;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(gr||(gr={}));var Zh;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Zh||(Zh={}));var AC=gr.Start,eT=gr.Stop,av=gr.Raise,lb=gr.Send,Uz=gr.Cancel,qoe=gr.NullEvent,tT=gr.Assign;gr.After;gr.DoneState;var Vz=gr.Log,Woe=gr.Init,RC=gr.Invoke;gr.ErrorExecution;var U5=gr.ErrorPlatform,Goe=gr.ErrorCustom,Hz=gr.Update,Koe=gr.Choose,Yoe=gr.Pure,qz=".",V5={},DC="xstate.guard",Qoe="",tx;function rT(t,e,r){r===void 0&&(r=qz);var n=Wm(t,r),s=Wm(e,r);return ir(s)?ir(n)?s===n:!1:ir(n)?n in s:Object.keys(n).every(function(i){return i in s?rT(n[i],s[i]):!1})}function Wz(t){try{return ir(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function OC(t,e){try{return jf(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function Xoe(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Wm(t,e){if(Xoe(t))return t.value;if(jf(t))return H0(t);if(typeof t!="string")return t;var r=OC(t,e);return H0(r)}function H0(t){if(t.length===1)return t[0];for(var e={},r=e,n=0;n<t.length-1;n++)n===t.length-2?r[t[n]]=t[n+1]:(r[t[n]]={},r=r[t[n]]);return e}function km(t,e){for(var r={},n=Object.keys(t),s=0;s<n.length;s++){var i=n[s];r[i]=e(t[i],i,t,s)}return r}function H5(t,e,r){var n,s,i={};try{for(var a=Vt(Object.keys(t)),l=a.next();!l.done;l=a.next()){var c=l.value,d=t[c];r(d)&&(i[c]=e(d,c,t))}}catch(f){n={error:f}}finally{try{l&&!l.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return i}var Zoe=function(t){return function(e){var r,n,s=e;try{for(var i=Vt(t),a=i.next();!a.done;a=i.next()){var l=a.value;s=s[l]}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s}};function Joe(t,e){return function(r){var n,s,i=r;try{for(var a=Vt(t),l=a.next();!l.done;l=a.next()){var c=l.value;i=i[e][c]}}catch(d){n={error:d}}finally{try{l&&!l.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return i}}function l0(t){if(!t)return[[]];if(ir(t))return[[t]];var e=qr(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:l0(t[r]).map(function(s){return[r].concat(s)})}));return e}function qr(t){var e;return(e=[]).concat.apply(e,Tr([],er(t),!1))}function Gz(t){return jf(t)?t:[t]}function la(t){return t===void 0?[]:Gz(t)}function q0(t,e,r){var n,s;if(rr(t))return t(e,r.data);var i={};try{for(var a=Vt(Object.keys(t)),l=a.next();!l.done;l=a.next()){var c=l.value,d=t[c];rr(d)?i[c]=d(e,r.data):i[c]=d}}catch(f){n={error:f}}finally{try{l&&!l.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return i}function ele(t){return/^(done|error)\./.test(t)}function q5(t){return!!(t instanceof Promise||t!==null&&(rr(t)||typeof t=="object")&&rr(t.then))}function tle(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function rle(t,e){var r,n,s=er([[],[]],2),i=s[0],a=s[1];try{for(var l=Vt(t),c=l.next();!c.done;c=l.next()){var d=c.value;e(d)?i.push(d):a.push(d)}}catch(f){r={error:f}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return[i,a]}function Kz(t,e){return km(t.states,function(r,n){if(r){var s=(ir(e)?void 0:e[n])||(r?r.current:void 0);if(s)return{current:s,states:Kz(r,s)}}})}function nle(t,e){return{current:e,states:Kz(t,e)}}function W5(t,e,r,n){var s=t&&r.reduce(function(i,a){var l,c,d=a.assignment,f={state:n,action:a,_event:e},p={};if(rr(d))p=d(i,e.data,f);else try{for(var m=Vt(Object.keys(d)),g=m.next();!g.done;g=m.next()){var y=g.value,x=d[y];p[y]=rr(x)?x(i,e.data,f):x}}catch(w){l={error:w}}finally{try{g&&!g.done&&(c=m.return)&&c.call(m)}finally{if(l)throw l.error}}return Object.assign({},i,p)},t);return s}var sle=function(){};function jf(t){return Array.isArray(t)}function rr(t){return typeof t=="function"}function ir(t){return typeof t=="string"}function Yz(t,e){if(t)return ir(t)?{type:DC,name:t,predicate:e?e[t]:void 0}:rr(t)?{type:DC,name:t.name,predicate:t}:t}function ile(t){try{return"subscribe"in t&&rr(t.subscribe)}catch{return!1}}var lc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();tx={},tx[lc]=function(){return this},tx[Symbol.observable]=function(){return this};function Jh(t){return!!t&&"__xstatenode"in t}function ale(t){return!!t&&typeof t.send=="function"}function cb(t,e){return ir(t)||typeof t=="number"?Ke({type:t},e):t}function rs(t,e){if(!ir(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=cb(t);return Ke({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function Yd(t,e){var r=Gz(e).map(function(n){return typeof n>"u"||typeof n=="string"||Jh(n)?{target:n,event:t}:Ke(Ke({},n),{event:t})});return r}function ole(t){if(!(t===void 0||t===Qoe))return la(t)}function Qz(t,e,r,n,s){var i=t.options.guards,a={state:s,cond:e,_event:n};if(e.type===DC)return((i==null?void 0:i[e.name])||e.predicate)(r,n.data,a);var l=i==null?void 0:i[e.type];if(!l)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return l(r,n.data,a)}function Xz(t){return typeof t=="string"?{type:t}:t}function Gm(t,e,r){var n=function(){},s=typeof t=="object",i=s?t:null;return{next:((s?t.next:t)||n).bind(i),error:((s?t.error:e)||n).bind(i),complete:((s?t.complete:r)||n).bind(i)}}function rx(t,e){return"".concat(t,":invocation[").concat(e,"]")}function PC(t){return(t.type===av||t.type===lb&&t.to===Zh.Internal)&&typeof t.delay!="number"}var Lh=rs({type:Woe});function MC(t,e){return e&&e[t]||void 0}function Sg(t,e){var r;if(ir(t)||typeof t=="number"){var n=MC(t,e);rr(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(rr(t))r={type:t.name||t.toString(),exec:t};else{var n=MC(t.type,e);if(rr(n))r=Ke(Ke({},t),{exec:n});else if(n){var s=n.type||t.type;r=Ke(Ke(Ke({},n),t),{type:s})}else r=t}return r}var cc=function(t,e){if(!t)return[];var r=jf(t)?t:[t];return r.map(function(n){return Sg(n,e)})};function nT(t){var e=Sg(t);return Ke(Ke({id:ir(t)?t:e.id},e),{type:e.type})}function lle(t,e){return{type:av,event:typeof t=="function"?t:cb(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function cle(t,e,r,n){var s={_event:r},i=rs(rr(t.event)?t.event(e,r.data,s):t.event),a;if(ir(t.delay)){var l=n&&n[t.delay];a=rr(l)?l(e,r.data,s):l}else a=rr(t.delay)?t.delay(e,r.data,s):t.delay;return Ke(Ke({},t),{type:av,_event:i,delay:a})}function Zz(t,e){return{to:e?e.to:void 0,type:lb,event:rr(t)?t:cb(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:rr(t)?t.name:Wz(t)}}function ule(t,e,r,n){var s={_event:r},i=rs(rr(t.event)?t.event(e,r.data,s):t.event),a;if(ir(t.delay)){var l=n&&n[t.delay];a=rr(l)?l(e,r.data,s):l}else a=rr(t.delay)?t.delay(e,r.data,s):t.delay;var c=rr(t.to)?t.to(e,r.data,s):t.to;return Ke(Ke({},t),{to:c,_event:i,event:i.data,delay:a})}var dle=function(t,e,r){return Ke(Ke({},t),{value:ir(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},hle=function(t){return{type:Uz,sendId:t}};function fle(t){var e=nT(t);return{type:gr.Start,activity:e,exec:void 0}}function ple(t){var e=rr(t)?t:nT(t);return{type:gr.Stop,activity:e,exec:void 0}}function mle(t,e,r){var n=rr(t.activity)?t.activity(e,r.data):t.activity,s=typeof n=="string"?{id:n}:n,i={type:gr.Stop,activity:s};return i}var gle=function(t){return{type:tT,assignment:t}};function vle(t,e){var r=e?"#".concat(e):"";return"".concat(gr.After,"(").concat(t,")").concat(r)}function nx(t,e){var r="".concat(gr.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function c0(t,e){var r="".concat(gr.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Em(t,e){var r="".concat(gr.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}var yle=function(t){var e,r,n=[];try{for(var s=Vt(t),i=s.next();!i.done;i=s.next())for(var a=i.value,l=0;l<a.actions.length;){if(a.actions[l].type===tT){n.push(a.actions[l]),a.actions.splice(l,1);continue}l++}}catch(c){e={error:c}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return n};function W0(t,e,r,n,s,i,a){a===void 0&&(a=!1);var l=a?[]:yle(s),c=l.length?W5(r,n,l,e):r,d=a?[r]:void 0,f=[];function p(y,x){var w;switch(x.type){case av:{var _=cle(x,c,n,t.options.delays);return i&&typeof _.delay=="number"&&i(_,c,n),_}case lb:var S=ule(x,c,n,t.options.delays);return i&&S.to!==Zh.Internal&&(y==="entry"?f.push(S):i(S,c,n)),S;case Vz:{var k=dle(x,c,n);return i==null||i(k,c,n),k}case Koe:{var N=x,j=(w=N.conds.find(function(V){var F=Yz(V.cond,t.options.guards);return!F||Qz(t,F,c,n,i?void 0:e)}))===null||w===void 0?void 0:w.actions;if(!j)return[];var T=er(W0(t,e,c,n,[{type:y,actions:cc(la(j),t.options.actions)}],i,a),2),D=T[0],I=T[1];return c=I,d==null||d.push(c),D}case Yoe:{var j=x.get(c,n.data);if(!j)return[];var L=er(W0(t,e,c,n,[{type:y,actions:cc(la(j),t.options.actions)}],i,a),2),$=L[0],Q=L[1];return c=Q,d==null||d.push(c),$}case eT:{var k=mle(x,c,n);return i==null||i(k,r,n),k}case tT:{c=W5(c,n,[x],i?void 0:e),d==null||d.push(c);break}default:var M=Sg(x,t.options.actions),z=M.exec;if(i)i(M,c,n);else if(z&&d){var R=d.length-1,B=Ke(Ke({},M),{exec:function(V){for(var F=[],K=1;K<arguments.length;K++)F[K-1]=arguments[K];z.apply(void 0,Tr([d[R]],er(F),!1))}});M=B}return M}}function m(y){var x,w,_=[];try{for(var S=Vt(y.actions),k=S.next();!k.done;k=S.next()){var N=k.value,j=p(y.type,N);j&&(_=_.concat(j))}}catch(T){x={error:T}}finally{try{k&&!k.done&&(w=S.return)&&w.call(S)}finally{if(x)throw x.error}}return f.forEach(function(T){i(T,c,n)}),f.length=0,_}var g=qr(s.map(m));return[g,c]}var mh=function(t,e){var r=e(t);return r};function Jz(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[lc]=function(){return this},e}function xle(t,e,r,n){var s,i=Xz(t.src),a=(s=e==null?void 0:e.options.services)===null||s===void 0?void 0:s[i.type],l=t.data?q0(t.data,r,n):void 0,c=a?e8(a,t.id,l):Jz(t.id);return c.meta=t,c}function e8(t,e,r){var n=Jz(e);if(n.deferred=!0,Jh(t)){var s=n.state=mh(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return s}}return n}function _le(t){try{return typeof t.send=="function"}catch{return!1}}function ble(t){return _le(t)&&"id"in t}function wle(t){var e;return Ke((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[lc]=function(){return this},e),t)}var G0=function(t){return t.type==="atomic"||t.type==="final"};function t8(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function kg(t){return t8(t).filter(function(e){return e.type!=="history"})}function r8(t){var e=[t];return G0(t)?e:e.concat(qr(kg(t).map(r8)))}function Cm(t,e){var r,n,s,i,a,l,c,d,f=new Set(t),p=IC(f),m=new Set(e);try{for(var g=Vt(m),y=g.next();!y.done;y=g.next())for(var x=y.value,w=x.parent;w&&!m.has(w);)m.add(w),w=w.parent}catch(L){r={error:L}}finally{try{y&&!y.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}var _=IC(m);try{for(var S=Vt(m),k=S.next();!k.done;k=S.next()){var x=k.value;if(x.type==="compound"&&(!_.get(x)||!_.get(x).length))p.get(x)?p.get(x).forEach(function($){return m.add($)}):x.initialStateNodes.forEach(function($){return m.add($)});else if(x.type==="parallel")try{for(var N=(a=void 0,Vt(kg(x))),j=N.next();!j.done;j=N.next()){var T=j.value;m.has(T)||(m.add(T),p.get(T)?p.get(T).forEach(function($){return m.add($)}):T.initialStateNodes.forEach(function($){return m.add($)}))}}catch($){a={error:$}}finally{try{j&&!j.done&&(l=N.return)&&l.call(N)}finally{if(a)throw a.error}}}}catch(L){s={error:L}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(s)throw s.error}}try{for(var D=Vt(m),I=D.next();!I.done;I=D.next())for(var x=I.value,w=x.parent;w&&!m.has(w);)m.add(w),w=w.parent}catch(L){c={error:L}}finally{try{I&&!I.done&&(d=D.return)&&d.call(D)}finally{if(c)throw c.error}}return m}function n8(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(G0(n))return n.key}else return{}}var s={};return r.forEach(function(i){s[i.key]=n8(i,e)}),s}function IC(t){var e,r,n=new Map;try{for(var s=Vt(t),i=s.next();!i.done;i=s.next()){var a=i.value;n.has(a)||n.set(a,[]),a.parent&&(n.has(a.parent)||n.set(a.parent,[]),n.get(a.parent).push(a))}}catch(l){e={error:l}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return n}function Sle(t,e){var r=Cm([t],e);return n8(t,IC(r))}function Nm(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function kle(t){return Tr([],er(new Set(qr(Tr([],er(t.map(function(e){return e.ownEvents})),!1)))),!1)}function u0(t,e){return e.type==="compound"?kg(e).some(function(r){return r.type==="final"&&Nm(t,r)}):e.type==="parallel"?kg(e).every(function(r){return u0(t,r)}):!1}function Ele(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function G5(t){return new Set(qr(t.map(function(e){return e.tags})))}function s8(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(ir(t)||ir(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(s){return s8(t[s],e[s])})}function Cle(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function Nle(t,e){var r=t.exec,n=Ke(Ke({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var ca=function(){function t(e){var r=this,n;this.actions=[],this.activities=V5,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||V5,this.meta=Ele(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(n=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&n!==void 0?n:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return kle(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,events:[],configuration:[],transitions:[],children:{}}):e;var n=Lh;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=Lh;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),ir(e))return[e];var s=Object.keys(e);return s.concat.apply(s,Tr([],er(s.map(function(i){return n.toStrings(e[i],r).map(function(a){return i+r+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=Jj(e,["configuration","transitions","tags","machine"]);return Ke(Ke({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return rT(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;sle(!!this.machine);var n=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(s){return s.target!==void 0||s.actions.length})},t}(),jle={deferEvents:!1},K5=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=Ke(Ke({},jle),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(r){throw this.clear(),r}finally{this.processingEvent=!1}},t}(),LS=new Map,Tle=0,Gp={bookId:function(){return"x:".concat(Tle++)},register:function(t,e){return LS.set(t,e),t},get:function(t){return LS.get(t)},free:function(t){LS.delete(t)}};function sT(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function Ale(){var t=sT();if(t&&"__xstate__"in t)return t.__xstate__}function Rle(t){if(sT()){var e=Ale();e&&e.register(t)}}function Dle(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,s=[],i=!1,a=function(){if(!i){for(i=!0;s.length>0;){var d=s.shift();r=t.transition(r,d,c),n.forEach(function(f){return f.next(r)})}i=!1}},l=wle({id:e.id,send:function(d){s.push(d),a()},getSnapshot:function(){return r},subscribe:function(d,f,p){var m=Gm(d,f,p);return n.add(m),m.next(r),{unsubscribe:function(){n.delete(m)}}}}),c={parent:e.parent,self:l,id:e.id||"anonymous",observers:n};return r=t.start?t.start(c):r,l}var Ole={sync:!1,autoForward:!1},Nn;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(Nn||(Nn={}));var Ple=function(){function t(e,r){r===void 0&&(r=t.defaultOptions);var n=this;this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=Nn.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(f,p){if(jf(f))return n.batch(f),n.state;var m=rs(cb(f,p));if(n.status===Nn.Stopped)return n.state;if(n.status!==Nn.Running&&!n.options.deferEvents)throw new Error('Event "'.concat(m.name,'" was sent to uninitialized service "').concat(n.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
|
||
Event: `).concat(JSON.stringify(m.data)));return n.scheduler.schedule(function(){n.forward(m);var g=n._nextState(m);n.update(g,m)}),n._state},this.sendTo=function(f,p,m){var g=n.parent&&(p===Zh.Parent||n.parent.id===p),y=g?n.parent:ir(p)?p===Zh.Internal?n:n.children.get(p)||Gp.get(p):ale(p)?p:void 0;if(!y){if(!g)throw new Error("Unable to send event to child '".concat(p,"' from service '").concat(n.id,"'."));return}if("machine"in y){if(n.status!==Nn.Stopped||n.parent!==y||n.state.done){var x=Ke(Ke({},f),{name:f.name===Goe?"".concat(Em(n.id)):f.name,origin:n.sessionId});!m&&n.machine.config.predictableActionArguments?n._outgoingQueue.push([y,x]):y.send(x)}}else!m&&n.machine.config.predictableActionArguments?n._outgoingQueue.push([y,f.data]):y.send(f.data)},this._exec=function(f,p,m,g){g===void 0&&(g=n.machine.options.actions);var y=f.exec||MC(f.type,g),x=rr(y)?y:y?y.exec:f.exec;if(x)try{return x(p,m.data,n.machine.config.predictableActionArguments?{action:f,_event:m}:{action:f,state:n.state,_event:m})}catch(R){throw n.parent&&n.parent.send({type:"xstate.error",data:R}),R}switch(f.type){case av:{var w=f;n.defer(w);break}case lb:var _=f;if(typeof _.delay=="number"){n.defer(_);return}else _.to?n.sendTo(_._event,_.to,m===Lh):n.send(_._event);break;case Uz:n.cancel(f.sendId);break;case AC:{if(n.status!==Nn.Running)return;var S=f.activity;if(!n.machine.config.predictableActionArguments&&!n.state.activities[S.id||S.type])break;if(S.type===gr.Invoke){var k=Xz(S.src),N=n.machine.options.services?n.machine.options.services[k.type]:void 0,j=S.id,T=S.data,D="autoForward"in S?S.autoForward:!!S.forward;if(!N)return;var I=T?q0(T,p,m):void 0;if(typeof N=="string")return;var L=rr(N)?N(p,m.data,{data:I,src:k,meta:S.meta}):N;if(!L)return;var $=void 0;Jh(L)&&(L=I?L.withContext(I):L,$={autoForward:D}),n.spawn(L,j,$)}else n.spawnActivity(S);break}case eT:{n.stopChild(f.activity.id);break}case Vz:var Q=f,M=Q.label,z=Q.value;M?n.logger(M,z):n.logger(z);break}};var s=Ke(Ke({},t.defaultOptions),r),i=s.clock,a=s.logger,l=s.parent,c=s.id,d=c!==void 0?c:e.id;this.id=d,this.logger=a,this.clock=i,this.parent=l,this.options=s,this.scheduler=new K5({deferEvents:this.options.deferEvents}),this.sessionId=Gp.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:mh(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,r){var n,s;try{for(var i=Vt(e.actions),a=i.next();!a.done;a=i.next()){var l=a.value;this.exec(l,e,r)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(s=i.return)&&s.call(i)}finally{if(n)throw n.error}}},t.prototype.update=function(e,r){var n,s,i,a,l,c,d,f,p=this;if(e._sessionid=this.sessionId,this._state=e,(!this.machine.config.predictableActionArguments||r===Lh)&&this.options.execute)this.execute(this.state);else for(var m=void 0;m=this._outgoingQueue.shift();)m[0].send(m[1]);if(this.children.forEach(function(L){p.state.children[L.id]=L}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var g=Vt(this.eventListeners),y=g.next();!y.done;y=g.next()){var x=y.value;x(e.event)}}catch(L){n={error:L}}finally{try{y&&!y.done&&(s=g.return)&&s.call(g)}finally{if(n)throw n.error}}try{for(var w=Vt(this.listeners),_=w.next();!_.done;_=w.next()){var x=_.value;x(e,e.event)}}catch(L){i={error:L}}finally{try{_&&!_.done&&(a=w.return)&&a.call(w)}finally{if(i)throw i.error}}try{for(var S=Vt(this.contextListeners),k=S.next();!k.done;k=S.next()){var N=k.value;N(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(L){l={error:L}}finally{try{k&&!k.done&&(c=S.return)&&c.call(S)}finally{if(l)throw l.error}}if(this.state.done){var j=e.configuration.find(function(L){return L.type==="final"&&L.parent===p.machine}),T=j&&j.doneData?q0(j.doneData,e.context,r):void 0;this._doneEvent=c0(this.id,T);try{for(var D=Vt(this.doneListeners),I=D.next();!I.done;I=D.next()){var x=I.value;x(this._doneEvent)}}catch(L){d={error:L}}finally{try{I&&!I.done&&(f=D.return)&&f.call(D)}finally{if(d)throw d.error}}this._stop(),this._stopChildren(),Gp.free(this.sessionId)}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===Nn.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,r,n){var s=this,i=Gm(e,r,n);this.listeners.add(i.next),this.status!==Nn.NotStarted&&i.next(this.state);var a=function(){s.doneListeners.delete(a),s.stopListeners.delete(a),i.complete()};return this.status===Nn.Stopped?i.complete():(this.onDone(a),this.onStop(a)),{unsubscribe:function(){s.listeners.delete(i.next),s.doneListeners.delete(a),s.stopListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.status===Nn.Stopped&&this._doneEvent?e(this._doneEvent):this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var r=this;if(this.status===Nn.Running)return this;this.machine._init(),Gp.register(this.sessionId,this),this.initialized=!0,this.status=Nn.Running;var n=e===void 0?this.initialState:mh(this,function(){return Cle(e)?r.machine.resolveState(e):r.machine.resolveState(ca.from(e,r.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){r.update(n,Lh)}),this},t.prototype._stopChildren=function(){this.children.forEach(function(e){rr(e.stop)&&e.stop()}),this.children.clear()},t.prototype._stop=function(){var e,r,n,s,i,a,l,c,d,f;try{for(var p=Vt(this.listeners),m=p.next();!m.done;m=p.next()){var g=m.value;this.listeners.delete(g)}}catch(D){e={error:D}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(e)throw e.error}}try{for(var y=Vt(this.stopListeners),x=y.next();!x.done;x=y.next()){var g=x.value;g(),this.stopListeners.delete(g)}}catch(D){n={error:D}}finally{try{x&&!x.done&&(s=y.return)&&s.call(y)}finally{if(n)throw n.error}}try{for(var w=Vt(this.contextListeners),_=w.next();!_.done;_=w.next()){var g=_.value;this.contextListeners.delete(g)}}catch(D){i={error:D}}finally{try{_&&!_.done&&(a=w.return)&&a.call(w)}finally{if(i)throw i.error}}try{for(var S=Vt(this.doneListeners),k=S.next();!k.done;k=S.next()){var g=k.value;this.doneListeners.delete(g)}}catch(D){l={error:D}}finally{try{k&&!k.done&&(c=S.return)&&c.call(S)}finally{if(l)throw l.error}}if(!this.initialized)return this;this.initialized=!1,this.status=Nn.Stopped,this._initialState=void 0;try{for(var N=Vt(Object.keys(this.delayedEventsMap)),j=N.next();!j.done;j=N.next()){var T=j.value;this.clock.clearTimeout(this.delayedEventsMap[T])}}catch(D){d={error:D}}finally{try{j&&!j.done&&(f=N.return)&&f.call(N)}finally{if(d)throw d.error}}this.scheduler.clear(),this.scheduler=new K5({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var e=this,r=this.scheduler;return this._stop(),r.schedule(function(){var n;if(!(!((n=e._state)===null||n===void 0)&&n.done)){var s=rs({type:"xstate.stop"}),i=mh(e,function(){var a=qr(Tr([],er(e.state.configuration),!1).sort(function(p,m){return m.order-p.order}).map(function(p){return cc(p.onExit,e.machine.options.actions)})),l=er(W0(e.machine,e.state,e.state.context,s,[{type:"exit",actions:a}],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),c=l[0],d=l[1],f=new ca({value:e.state.value,context:d,_event:s,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:c.filter(function(p){return!PC(p)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return f.changed=!0,f});e.update(i,s),e._stopChildren(),Gp.free(e.sessionId)}}),this},t.prototype.batch=function(e){var r=this;if(!(this.status===Nn.NotStarted&&this.options.deferEvents)){if(this.status!==Nn.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'))}if(e.length){var n=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var s,i,a=r.state,l=!1,c=[],d=function(g){var y=rs(g);r.forward(y),a=mh(r,function(){return r.machine.transition(a,y,void 0,n||void 0)}),c.push.apply(c,Tr([],er(r.machine.config.predictableActionArguments?a.actions:a.actions.map(function(x){return Nle(x,a)})),!1)),l=l||!!a.changed};try{for(var f=Vt(e),p=f.next();!p.done;p=f.next()){var m=p.value;d(m)}}catch(g){s={error:g}}finally{try{p&&!p.done&&(i=f.return)&&i.call(f)}finally{if(s)throw s.error}}a.changed=l,a.actions=c,r.update(a,rs(e[e.length-1]))})}},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype._nextState=function(e,r){var n=this;r===void 0&&(r=!!this.machine.config.predictableActionArguments&&this._exec);var s=rs(e);if(s.name.indexOf(U5)===0&&!this.state.nextEvents.some(function(a){return a.indexOf(U5)===0}))throw s.data.data;var i=mh(this,function(){return n.machine.transition(n.state,s,void 0,r||void 0)});return i},t.prototype.nextState=function(e){return this._nextState(e,!1)},t.prototype.forward=function(e){var r,n;try{for(var s=Vt(this.forwardTo),i=s.next();!i.done;i=s.next()){var a=i.value,l=this.children.get(a);if(!l)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));l.send(e)}}catch(c){r={error:c}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}},t.prototype.defer=function(e){var r=this,n=this.clock.setTimeout(function(){"to"in e&&e.to?r.sendTo(e._event,e.to,!0):r.send(e._event)},e.delay);e.id&&(this.delayedEventsMap[e.id]=n)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,r,n){n===void 0&&(n=this.machine.options.actions),this._exec(e,r.context,r._event,n)},t.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},t.prototype.stopChild=function(e){var r=this.children.get(e);r&&(this.removeChild(e),rr(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(this.status!==Nn.Running)return e8(e,r);if(q5(e))return this.spawnPromise(Promise.resolve(e),r);if(rr(e))return this.spawnCallback(e,r);if(ble(e))return this.spawnActor(e,r);if(ile(e))return this.spawnObservable(e,r);if(Jh(e))return this.spawnMachine(e,Ke(Ke({},n),{id:r}));if(tle(e))return this.spawnBehavior(e,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,r){var n=this;r===void 0&&(r={});var s=new t(e,Ke(Ke({},this.options),{parent:this,id:r.id||e.id})),i=Ke(Ke({},Ole),r);i.sync&&s.onTransition(function(l){n.send(Hz,{state:l,id:s.id})});var a=s;return this.children.set(s.id,a),i.autoForward&&this.forwardTo.add(s.id),s.onDone(function(l){n.removeChild(s.id),n.send(rs(l,{origin:s.id}))}).start(),a},t.prototype.spawnBehavior=function(e,r){var n=Dle(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,s=this,i=!1,a;e.then(function(c){i||(a=c,s.removeChild(r),s.send(rs(c0(r,c),{origin:r})))},function(c){if(!i){s.removeChild(r);var d=Em(r,c);try{s.send(rs(d,{origin:r}))}catch{s.devTools&&s.devTools.send(d,s.state),s.machine.strict&&s.stop()}}});var l=(n={id:r,send:function(){},subscribe:function(c,d,f){var p=Gm(c,d,f),m=!1;return e.then(function(g){m||(p.next(g),!m&&p.complete())},function(g){m||p.error(g)}),{unsubscribe:function(){return m=!0}}},stop:function(){i=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return a}},n[lc]=function(){return this},n);return this.children.set(r,l),l},t.prototype.spawnCallback=function(e,r){var n,s=this,i=!1,a=new Set,l=new Set,c,d=function(m){c=m,l.forEach(function(g){return g(m)}),!i&&s.send(rs(m,{origin:r}))},f;try{f=e(d,function(m){a.add(m)})}catch(m){this.send(Em(r,m))}if(q5(f))return this.spawnPromise(f,r);var p=(n={id:r,send:function(m){return a.forEach(function(g){return g(m)})},subscribe:function(m){var g=Gm(m);return l.add(g.next),{unsubscribe:function(){l.delete(g.next)}}},stop:function(){i=!0,rr(f)&&f()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[lc]=function(){return this},n);return this.children.set(r,p),p},t.prototype.spawnObservable=function(e,r){var n,s=this,i,a=e.subscribe(function(c){i=c,s.send(rs(c,{origin:r}))},function(c){s.removeChild(r),s.send(rs(Em(r,c),{origin:r}))},function(){s.removeChild(r),s.send(rs(c0(r),{origin:r}))}),l=(n={id:r,send:function(){},subscribe:function(c,d,f){return e.subscribe(c,d,f)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return i},toJSON:function(){return{id:r}}},n[lc]=function(){return this},n);return this.children.set(r,l),l},t.prototype.spawnActor=function(e,r){return this.children.set(r,e),e},t.prototype.spawnActivity=function(e){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(r){var n=r(this.state.context,e);this.spawnEffect(e.id,n)}},t.prototype.spawnEffect=function(e,r){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[lc]=function(){return this},n))},t.prototype.attachDev=function(){var e=sT();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(Ke(Ke({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:Ke({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Rle(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[lc]=function(){return this},t.prototype.getSnapshot=function(){return this.status===Nn.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,r){return setTimeout(e,r)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=Iu,t}();function Iu(t,e){var r=new Ple(t,e);return r}function Mle(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function sx(t){return Ke(Ke({type:RC},t),{toJSON:function(){t.onDone,t.onError;var e=Jj(t,["onDone","onError"]);return Ke(Ke({},e),{type:RC,src:Mle(t.src)})}})}var ix="",LC="#",$S="*",Qd={},Xd=function(t){return t[0]===LC},Ile=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Lle=function(){function t(e,r,n,s){n===void 0&&(n="context"in e?e.context:void 0);var i=this,a;this.config=e,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(Ile(),r),this.parent=s==null?void 0:s.parent,this.key=this.config.key||(s==null?void 0:s.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:qz),this.id=this.config.id||Tr([this.machine.key],er(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,this.initial=this.config.initial,this.states=this.config.states?km(this.config.states,function(d,f){var p,m=new t(d,{},void 0,{parent:i,key:f});return Object.assign(i.idMap,Ke((p={},p[m.id]=m,p),m.idMap)),m}):Qd;var l=0;function c(d){var f,p;d.order=l++;try{for(var m=Vt(t8(d)),g=m.next();!g.done;g=m.next()){var y=g.value;c(y)}}catch(x){f={error:x}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(f)throw f.error}}}c(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(d){var f=d.event;return f===ix}):ix in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=la(this.config.entry||this.config.onEntry).map(function(d){return Sg(d)}),this.onExit=la(this.config.exit||this.config.onExit).map(function(d){return Sg(d)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=la(this.config.invoke).map(function(d,f){var p,m;if(Jh(d)){var g=rx(i.id,f);return i.machine.options.services=Ke((p={},p[g]=d,p),i.machine.options.services),sx({src:g,id:g})}else if(ir(d.src)){var g=d.id||rx(i.id,f);return sx(Ke(Ke({},d),{id:g,src:d.src}))}else if(Jh(d.src)||rr(d.src)){var g=d.id||rx(i.id,f);return i.machine.options.services=Ke((m={},m[g]=d.src,m),i.machine.options.services),sx(Ke(Ke({id:g},d),{src:g}))}else{var y=d.src;return sx(Ke(Ke({id:rx(i.id,f)},d),{src:y}))}}),this.activities=la(this.config.activities).concat(this.invoke).map(function(d){return nT(d)}),this.transition=this.transition.bind(this),this.tags=la(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||r8(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,s=n.actions,i=n.activities,a=n.guards,l=n.services,c=n.delays;return new t(this.config,{actions:Ke(Ke({},s),e.actions),activities:Ke(Ke({},i),e.activities),guards:Ke(Ke({},a),e.guards),services:Ke(Ke({},l),e.services),delays:Ke(Ke({},c),e.delays)},r??this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return rr(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:km(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(r,n){return r[n.eventType]=r[n.eventType]||[],r[n.eventType].push(n),r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var r=e===ix,n=this.transitions.filter(function(s){var i=s.eventType===e;return r?i:i||s.eventType===$S});return this.__cache.candidates[e]=n,n},t.prototype.getDelayedTransitions=function(){var e=this,r=this.config.after;if(!r)return[];var n=function(i,a){var l=rr(i)?"".concat(e.id,":delay[").concat(a,"]"):i,c=vle(l,e.id);return e.onEntry.push(Zz(c,{delay:i})),e.onExit.push(hle(c)),c},s=jf(r)?r.map(function(i,a){var l=n(i.delay,a);return Ke(Ke({},i),{event:l})}):qr(Object.keys(r).map(function(i,a){var l=r[i],c=ir(l)?{target:l}:l,d=isNaN(+i)?i:+i,f=n(d,a);return la(c).map(function(p){return Ke(Ke({},p),{event:f,delay:d})})}));return s.map(function(i){var a=i.delay;return Ke(Ke({},e.formatTransition(i)),{delay:a})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var s=e instanceof ca?e.value:Wm(e,this.delimiter);if(ir(s)){var i=this.getStateNode(s).initial;return i!==void 0?this.getStateNodes((r={},r[s]=i,r)):[this,this.states[s]]}var a=Object.keys(s),l=[this];return l.push.apply(l,Tr([],er(qr(a.map(function(c){return n.getStateNode(c).getStateNodes(s[c])}))),!1)),l},t.prototype.handles=function(e){var r=Wz(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof ca?e:ca.create(e),n=Array.from(Cm([],this.getStateNodes(r.value)));return new ca(Ke(Ke({},r),{value:this.resolve(r.value),configuration:n,done:u0(n,this),tags:G5(n),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,r,n){var s=this.getStateNode(e),i=s.next(r,n);return!i||!i.transitions.length?this.next(r,n):i},t.prototype.transitionCompoundNode=function(e,r,n){var s=Object.keys(e),i=this.getStateNode(s[0]),a=i._transition(e[s[0]],r,n);return!a||!a.transitions.length?this.next(r,n):a},t.prototype.transitionParallelNode=function(e,r,n){var s,i,a={};try{for(var l=Vt(Object.keys(e)),c=l.next();!c.done;c=l.next()){var d=c.value,f=e[d];if(f){var p=this.getStateNode(d),m=p._transition(f,r,n);m&&(a[d]=m)}}}catch(_){s={error:_}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(s)throw s.error}}var g=Object.keys(a).map(function(_){return a[_]}),y=qr(g.map(function(_){return _.transitions})),x=g.some(function(_){return _.transitions.length>0});if(!x)return this.next(r,n);var w=qr(Object.keys(a).map(function(_){return a[_].configuration}));return{transitions:y,exitSet:qr(g.map(function(_){return _.exitSet})),configuration:w,source:r,actions:qr(Object.keys(a).map(function(_){return a[_].actions}))}},t.prototype._transition=function(e,r,n){return ir(e)?this.transitionLeafNode(e,r,n):Object.keys(e).length===1?this.transitionCompoundNode(e,r,n):this.transitionParallelNode(e,r,n)},t.prototype.getTransitionData=function(e,r){return this._transition(e.value,e,rs(r))},t.prototype.next=function(e,r){var n,s,i=this,a=r.name,l=[],c=[],d;try{for(var f=Vt(this.getCandidates(a)),p=f.next();!p.done;p=f.next()){var m=p.value,g=m.cond,y=m.in,x=e.context,w=y?ir(y)&&Xd(y)?e.matches(Wm(this.getStateNodeById(y).path,this.delimiter)):rT(Wm(y,this.delimiter),Zoe(this.path.slice(0,-2))(e.value)):!0,_=!1;try{_=!g||Qz(this.machine,g,x,r,e)}catch(N){throw new Error("Unable to evaluate guard '".concat(g.name||g.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
|
||
`).concat(N.message))}if(_&&w){m.target!==void 0&&(c=m.target),l.push.apply(l,Tr([],er(m.actions),!1)),d=m;break}}}catch(N){n={error:N}}finally{try{p&&!p.done&&(s=f.return)&&s.call(f)}finally{if(n)throw n.error}}if(d){if(!c.length)return{transitions:[d],exitSet:[],configuration:e.value?[this]:[],source:e,actions:l};var S=qr(c.map(function(N){return i.getRelativeStateNodes(N,e.historyValue)})),k=!!d.internal;return{transitions:[d],exitSet:k?[]:qr(c.map(function(N){return i.getPotentiallyReenteringNodes(N)})),configuration:S,source:e,actions:l}}},t.prototype.getPotentiallyReenteringNodes=function(e){if(this.order<e.order)return[this];for(var r=[],n=this,s=e;n&&n!==s;)r.push(n),n=n.parent;return n!==s?[]:(r.push(s),r)},t.prototype.getActions=function(e,r,n,s,i,a,l){var c,d,f,p,m=this,g=a?Cm([],this.getStateNodes(a.value)):[],y=new Set;try{for(var x=Vt(Array.from(e).sort(function(Q,M){return Q.order-M.order})),w=x.next();!w.done;w=x.next()){var _=w.value;(!Nm(g,_)||Nm(n.exitSet,_)||_.parent&&y.has(_.parent))&&y.add(_)}}catch(Q){c={error:Q}}finally{try{w&&!w.done&&(d=x.return)&&d.call(x)}finally{if(c)throw c.error}}try{for(var S=Vt(g),k=S.next();!k.done;k=S.next()){var _=k.value;(!Nm(e,_)||Nm(n.exitSet,_.parent))&&n.exitSet.push(_)}}catch(Q){f={error:Q}}finally{try{k&&!k.done&&(p=S.return)&&p.call(S)}finally{if(f)throw f.error}}n.exitSet.sort(function(Q,M){return M.order-Q.order});var N=Array.from(y).sort(function(Q,M){return Q.order-M.order}),j=new Set(n.exitSet),T=qr(N.map(function(Q){var M=[];if(Q.type!=="final")return M;var z=Q.parent;if(!z.parent)return M;M.push(nx(Q.id,Q.doneData),nx(z.id,Q.doneData?q0(Q.doneData,s,i):void 0));var R=z.parent;return R.type==="parallel"&&kg(R).every(function(B){return u0(n.configuration,B)})&&M.push(nx(R.id)),M})),D=N.map(function(Q){var M=Q.onEntry,z=Q.activities.map(function(R){return fle(R)});return{type:"entry",actions:cc(l?Tr(Tr([],er(M),!1),er(z),!1):Tr(Tr([],er(z),!1),er(M),!1),m.machine.options.actions)}}).concat({type:"state_done",actions:T.map(function(Q){return lle(Q)})}),I=Array.from(j).map(function(Q){return{type:"exit",actions:cc(Tr(Tr([],er(Q.onExit),!1),er(Q.activities.map(function(M){return ple(M)})),!1),m.machine.options.actions)}}),L=I.concat({type:"transition",actions:cc(n.actions,this.machine.options.actions)}).concat(D);if(r){var $=cc(qr(Tr([],er(e),!1).sort(function(Q,M){return M.order-Q.order}).map(function(Q){return Q.onExit})),this.machine.options.actions).filter(function(Q){return!PC(Q)});return L.concat({type:"stop",actions:$})}return L},t.prototype.transition=function(e,r,n,s){e===void 0&&(e=this.initialState);var i=rs(r),a;if(e instanceof ca)a=n===void 0?e:this.resolveState(ca.from(e,n));else{var l=ir(e)?this.resolve(H0(this.getResolvedPath(e))):this.resolve(e),c=n??this.machine.context;a=this.resolveState(ca.from(l,c))}if(this.strict&&!this.events.includes(i.name)&&!ele(i.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(i.name,"'"));var d=this._transition(a.value,a,i)||{transitions:[],configuration:[],exitSet:[],source:a,actions:[]},f=Cm([],this.getStateNodes(a.value)),p=d.configuration.length?Cm(f,d.configuration):f;return d.configuration=Tr([],er(p),!1),this.resolveTransition(d,a,a.context,s,i)},t.prototype.resolveRaisedTransition=function(e,r,n,s){var i,a=e.actions;return e=this.transition(e,r,void 0,s),e._event=n,e.event=n.data,(i=e.actions).unshift.apply(i,Tr([],er(a),!1)),e},t.prototype.resolveTransition=function(e,r,n,s,i){var a,l,c,d,f=this;i===void 0&&(i=Lh);var p=e.configuration,m=!r||e.transitions.length>0,g=m?e.configuration:r?r.configuration:[],y=u0(g,this),x=m?Sle(this.machine,p):void 0,w=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,_=this.getActions(new Set(g),y,e,n,i,r,s),S=r?Ke({},r.activities):{};try{for(var k=Vt(_),N=k.next();!N.done;N=k.next()){var j=N.value;try{for(var T=(c=void 0,Vt(j.actions)),D=T.next();!D.done;D=T.next()){var I=D.value;I.type===AC?S[I.activity.id||I.activity.type]=I:I.type===eT&&(S[I.activity.id||I.activity.type]=!1)}}catch(J){c={error:J}}finally{try{D&&!D.done&&(d=T.return)&&d.call(T)}finally{if(c)throw c.error}}}}catch(J){a={error:J}}finally{try{N&&!N.done&&(l=k.return)&&l.call(k)}finally{if(a)throw a.error}}var L=er(W0(this,r,n,i,_,s,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),$=L[0],Q=L[1],M=er(rle($,PC),2),z=M[0],R=M[1],B=$.filter(function(J){var te;return J.type===AC&&((te=J.activity)===null||te===void 0?void 0:te.type)===RC}),V=B.reduce(function(J,te){return J[te.activity.id]=xle(te.activity,f.machine,Q,i),J},r?Ke({},r.children):{}),F=new ca({value:x||r.value,context:Q,_event:i,_sessionid:r?r._sessionid:null,historyValue:x?w?nle(w,x):void 0:r?r.historyValue:void 0,history:!x||e.source?r:void 0,actions:x?R:[],activities:x?S:r?r.activities:{},events:[],configuration:g,transitions:e.transitions,children:V,done:y,tags:G5(g),machine:this}),K=n!==Q;F.changed=i.name===Hz||K;var Y=F.history;Y&&delete Y.history;var O=!y&&(this._transient||p.some(function(J){return J._transient}));if(!m&&(!O||i.name===ix))return F;var H=F;if(!y)for(O&&(H=this.resolveRaisedTransition(H,{type:qoe},i,s));z.length;){var G=z.shift();H=this.resolveRaisedTransition(H,G._event,i,s)}var q=H.changed||(Y?!!H.actions.length||K||typeof Y.value!=typeof H.value||!s8(H.value,Y.value):void 0);return H.changed=q,H.history=Y,H},t.prototype.getStateNode=function(e){if(Xd(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[e];if(!r)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return r},t.prototype.getStateNodeById=function(e){var r=Xd(e)?e.slice(LC.length):e;if(r===this.id)return this;var n=this.machine.idMap[r];if(!n)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return n},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Xd(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=OC(e,this.delimiter).slice(),n=this;r.length;){var s=r.shift();if(!s.length)break;n=n.getStateNode(s)}return n},t.prototype.resolve=function(e){var r,n=this;if(!e)return this.initialStateValue||Qd;switch(this.type){case"parallel":return km(this.initialStateValue,function(i,a){return i?n.getStateNode(a).resolve(e[a]||i):Qd});case"compound":if(ir(e)){var s=this.getStateNode(e);return s.type==="parallel"||s.type==="compound"?(r={},r[e]=s.initialStateValue,r):e}return Object.keys(e).length?km(e,function(i,a){return i?n.getStateNode(a).resolve(i):Qd}):this.initialStateValue||{};default:return e||Qd}},t.prototype.getResolvedPath=function(e){if(Xd(e)){var r=this.machine.idMap[e.slice(LC.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return OC(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=H5(this.states,function(n){return n.initialStateValue||Qd},function(n){return n.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=G0(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,r){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r??this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var r=this.config;ir(r.target)?e=Xd(r.target)?H0(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:e=r.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,r,n){return n===void 0&&(n=!0),n?e.type==="history"?e.resolveHistory(r):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(G0(this))return[this];if(this.type==="compound"&&!this.initial)return[this];var r=l0(this.initialStateValue);return qr(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=er(e),n=r[0],s=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var i=this.getStateNode(n);if(i.type==="history")return i.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(s)},t.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:H5(this.states,function(r,n){if(!e)return r.historyValue();var s=ir(e)?void 0:e[n];return r.historyValue(s||r.initialStateValue)},function(r){return!r.history})}},t.prototype.resolveHistory=function(e){var r=this;if(this.type!=="history")return[this];var n=this.parent;if(!e){var s=this.target;return s?qr(l0(s).map(function(a){return n.getFromRelativePath(a)})):n.initialStateNodes}var i=Joe(n.path,"states")(e).current;return ir(i)?[n.getStateNode(i)]:qr(l0(i).map(function(a){return r.history==="deep"?n.getFromRelativePath(a):[n.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=qr(Object.keys(this.states).map(function(n){return e.states[n].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,r,n,s;if(this.__cache.events)return this.__cache.events;var i=this.states,a=new Set(this.ownEvents);if(i)try{for(var l=Vt(Object.keys(i)),c=l.next();!c.done;c=l.next()){var d=c.value,f=i[d];if(f.states)try{for(var p=(n=void 0,Vt(f.events)),m=p.next();!m.done;m=p.next()){var g=m.value;a.add("".concat(g))}}catch(y){n={error:y}}finally{try{m&&!m.done&&(s=p.return)&&s.call(p)}finally{if(n)throw n.error}}}}catch(y){e={error:y}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var r=this;if(e!==void 0)return e.map(function(n){if(!ir(n))return n;var s=n[0]===r.delimiter;if(s&&!r.parent)return r.getStateNodeByPath(n.slice(1));var i=s?r.key+n:n;if(r.parent)try{var a=r.parent.getStateNodeByPath(i);return a}catch(l){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
|
||
`).concat(l.message))}else return r.getStateNodeByPath(i)})},t.prototype.formatTransition=function(e){var r=this,n=ole(e.target),s="internal"in e?e.internal:n?n.some(function(c){return ir(c)&&c[0]===r.delimiter}):!0,i=this.machine.options.guards,a=this.resolveTarget(n),l=Ke(Ke({},e),{actions:cc(la(e.actions)),cond:Yz(e.cond,i),target:a,source:this,internal:s,eventType:e.event,toJSON:function(){return Ke(Ke({},l),{target:l.target?l.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return l},t.prototype.formatTransitions=function(){var e,r,n=this,s;if(!this.config.on)s=[];else if(Array.isArray(this.config.on))s=this.config.on;else{var i=this.config.on,a=$S,l=i[a],c=l===void 0?[]:l,d=Jj(i,[typeof a=="symbol"?a:a+""]);s=qr(Object.keys(d).map(function(S){var k=Yd(S,d[S]);return k}).concat(Yd($S,c)))}var f=this.config.always?Yd("",this.config.always):[],p=this.config.onDone?Yd(String(nx(this.id)),this.config.onDone):[],m=qr(this.invoke.map(function(S){var k=[];return S.onDone&&k.push.apply(k,Tr([],er(Yd(String(c0(S.id)),S.onDone)),!1)),S.onError&&k.push.apply(k,Tr([],er(Yd(String(Em(S.id)),S.onError)),!1)),k})),g=this.after,y=qr(Tr(Tr(Tr(Tr([],er(p),!1),er(m),!1),er(s),!1),er(f),!1).map(function(S){return la(S).map(function(k){return n.formatTransition(k)})}));try{for(var x=Vt(g),w=x.next();!w.done;w=x.next()){var _=w.value;y.push(_)}}catch(S){e={error:S}}finally{try{w&&!w.done&&(r=x.return)&&r.call(x)}finally{if(e)throw e.error}}return y},t}();function ov(t,e){return new Lle(t,e)}var ln=gle,va=Zz;/*! js-cookie v3.0.5 | MIT */function ax(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}var $le={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function $C(t,e){function r(s,i,a){if(!(typeof document>"u")){a=ax({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=s+"="+t.write(i,s)+l}}function n(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),d=c.slice(1).join("=");try{var f=decodeURIComponent(c[0]);if(a[f]=t.read(d,f),s===f)break}catch{}}return s?a[s]:a}}return Object.create({set:r,get:n,remove:function(s,i){r(s,"",ax({},i,{expires:-1}))},withAttributes:function(s){return $C(this.converter,ax({},this.attributes,s))},withConverter:function(s){return $C(ax({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var BC=$C($le,{path:"/"}),jm={exports:{}},Ble=jm.exports,Y5;function Fle(){return Y5||(Y5=1,function(t,e){(function(r){function n(s){var i=s&&s.Promise||r.Promise,a=s&&s.XMLHttpRequest||r.XMLHttpRequest;return function(){var l=Object.create(r,{fetch:{value:void 0,writable:!0}});return function(c,d){d(e)}(this,function(c){var d=typeof l<"u"&&l||typeof self<"u"&&self||typeof d<"u"&&d,f={searchParams:"URLSearchParams"in d,iterable:"Symbol"in d&&"iterator"in Symbol,blob:"FileReader"in d&&"Blob"in d&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in d,arrayBuffer:"ArrayBuffer"in d};function p(F){return F&&DataView.prototype.isPrototypeOf(F)}if(f.arrayBuffer)var m=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(F){return F&&m.indexOf(Object.prototype.toString.call(F))>-1};function y(F){if(typeof F!="string"&&(F=String(F)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(F)||F==="")throw new TypeError("Invalid character in header field name");return F.toLowerCase()}function x(F){return typeof F!="string"&&(F=String(F)),F}function w(F){var K={next:function(){var Y=F.shift();return{done:Y===void 0,value:Y}}};return f.iterable&&(K[Symbol.iterator]=function(){return K}),K}function _(F){this.map={},F instanceof _?F.forEach(function(K,Y){this.append(Y,K)},this):Array.isArray(F)?F.forEach(function(K){this.append(K[0],K[1])},this):F&&Object.getOwnPropertyNames(F).forEach(function(K){this.append(K,F[K])},this)}_.prototype.append=function(F,K){F=y(F),K=x(K);var Y=this.map[F];this.map[F]=Y?Y+", "+K:K},_.prototype.delete=function(F){delete this.map[y(F)]},_.prototype.get=function(F){return F=y(F),this.has(F)?this.map[F]:null},_.prototype.has=function(F){return this.map.hasOwnProperty(y(F))},_.prototype.set=function(F,K){this.map[y(F)]=x(K)},_.prototype.forEach=function(F,K){for(var Y in this.map)this.map.hasOwnProperty(Y)&&F.call(K,this.map[Y],Y,this)},_.prototype.keys=function(){var F=[];return this.forEach(function(K,Y){F.push(Y)}),w(F)},_.prototype.values=function(){var F=[];return this.forEach(function(K){F.push(K)}),w(F)},_.prototype.entries=function(){var F=[];return this.forEach(function(K,Y){F.push([Y,K])}),w(F)},f.iterable&&(_.prototype[Symbol.iterator]=_.prototype.entries);function S(F){if(F.bodyUsed)return i.reject(new TypeError("Already read"));F.bodyUsed=!0}function k(F){return new i(function(K,Y){F.onload=function(){K(F.result)},F.onerror=function(){Y(F.error)}})}function N(F){var K=new FileReader,Y=k(K);return K.readAsArrayBuffer(F),Y}function j(F){var K=new FileReader,Y=k(K);return K.readAsText(F),Y}function T(F){for(var K=new Uint8Array(F),Y=new Array(K.length),O=0;O<K.length;O++)Y[O]=String.fromCharCode(K[O]);return Y.join("")}function D(F){if(F.slice)return F.slice(0);var K=new Uint8Array(F.byteLength);return K.set(new Uint8Array(F)),K.buffer}function I(){return this.bodyUsed=!1,this._initBody=function(F){this.bodyUsed=this.bodyUsed,this._bodyInit=F,F?typeof F=="string"?this._bodyText=F:f.blob&&Blob.prototype.isPrototypeOf(F)?this._bodyBlob=F:f.formData&&FormData.prototype.isPrototypeOf(F)?this._bodyFormData=F:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(F)?this._bodyText=F.toString():f.arrayBuffer&&f.blob&&p(F)?(this._bodyArrayBuffer=D(F.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(F)||g(F))?this._bodyArrayBuffer=D(F):this._bodyText=F=Object.prototype.toString.call(F):this._bodyText="",this.headers.get("content-type")||(typeof F=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(F)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var F=S(this);if(F)return F;if(this._bodyBlob)return i.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return i.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return i.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var F=S(this);return F||(ArrayBuffer.isView(this._bodyArrayBuffer)?i.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):i.resolve(this._bodyArrayBuffer))}else return this.blob().then(N)}),this.text=function(){var F=S(this);if(F)return F;if(this._bodyBlob)return j(this._bodyBlob);if(this._bodyArrayBuffer)return i.resolve(T(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return i.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(M)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(F){var K=F.toUpperCase();return L.indexOf(K)>-1?K:F}function Q(F,K){if(!(this instanceof Q))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');K=K||{};var Y=K.body;if(F instanceof Q){if(F.bodyUsed)throw new TypeError("Already read");this.url=F.url,this.credentials=F.credentials,K.headers||(this.headers=new _(F.headers)),this.method=F.method,this.mode=F.mode,this.signal=F.signal,!Y&&F._bodyInit!=null&&(Y=F._bodyInit,F.bodyUsed=!0)}else this.url=String(F);if(this.credentials=K.credentials||this.credentials||"same-origin",(K.headers||!this.headers)&&(this.headers=new _(K.headers)),this.method=$(K.method||this.method||"GET"),this.mode=K.mode||this.mode||null,this.signal=K.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&Y)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(Y),(this.method==="GET"||this.method==="HEAD")&&(K.cache==="no-store"||K.cache==="no-cache")){var O=/([?&])_=[^&]*/;if(O.test(this.url))this.url=this.url.replace(O,"$1_="+new Date().getTime());else{var H=/\?/;this.url+=(H.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Q.prototype.clone=function(){return new Q(this,{body:this._bodyInit})};function M(F){var K=new FormData;return F.trim().split("&").forEach(function(Y){if(Y){var O=Y.split("="),H=O.shift().replace(/\+/g," "),G=O.join("=").replace(/\+/g," ");K.append(decodeURIComponent(H),decodeURIComponent(G))}}),K}function z(F){var K=new _,Y=F.replace(/\r?\n[\t ]+/g," ");return Y.split("\r").map(function(O){return O.indexOf(`
|
||
`)===0?O.substr(1,O.length):O}).forEach(function(O){var H=O.split(":"),G=H.shift().trim();if(G){var q=H.join(":").trim();K.append(G,q)}}),K}I.call(Q.prototype);function R(F,K){if(!(this instanceof R))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');K||(K={}),this.type="default",this.status=K.status===void 0?200:K.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in K?K.statusText:"",this.headers=new _(K.headers),this.url=K.url||"",this._initBody(F)}I.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new _(this.headers),url:this.url})},R.error=function(){var F=new R(null,{status:0,statusText:""});return F.type="error",F};var B=[301,302,303,307,308];R.redirect=function(F,K){if(B.indexOf(K)===-1)throw new RangeError("Invalid status code");return new R(null,{status:K,headers:{location:F}})},c.DOMException=d.DOMException;try{new c.DOMException}catch{c.DOMException=function(K,Y){this.message=K,this.name=Y;var O=Error(K);this.stack=O.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function V(F,K){return new i(function(Y,O){var H=new Q(F,K);if(H.signal&&H.signal.aborted)return O(new c.DOMException("Aborted","AbortError"));var G=new a;function q(){G.abort()}G.onload=function(){var te={status:G.status,statusText:G.statusText,headers:z(G.getAllResponseHeaders()||"")};te.url="responseURL"in G?G.responseURL:te.headers.get("X-Request-URL");var ve="response"in G?G.response:G.responseText;setTimeout(function(){Y(new R(ve,te))},0)},G.onerror=function(){setTimeout(function(){O(new TypeError("Network request failed"))},0)},G.ontimeout=function(){setTimeout(function(){O(new TypeError("Network request failed"))},0)},G.onabort=function(){setTimeout(function(){O(new c.DOMException("Aborted","AbortError"))},0)};function J(te){try{return te===""&&d.location.href?d.location.href:te}catch{return te}}G.open(H.method,J(H.url),!0),H.credentials==="include"?G.withCredentials=!0:H.credentials==="omit"&&(G.withCredentials=!1),"responseType"in G&&(f.blob?G.responseType="blob":f.arrayBuffer&&H.headers.get("Content-Type")&&H.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(G.responseType="arraybuffer")),K&&typeof K.headers=="object"&&!(K.headers instanceof _)?Object.getOwnPropertyNames(K.headers).forEach(function(te){G.setRequestHeader(te,x(K.headers[te]))}):H.headers.forEach(function(te,ve){G.setRequestHeader(ve,te)}),H.signal&&(H.signal.addEventListener("abort",q),G.onreadystatechange=function(){G.readyState===4&&H.signal.removeEventListener("abort",q)}),G.send(typeof H._bodyInit>"u"?null:H._bodyInit)})}V.polyfill=!0,d.fetch||(d.fetch=V,d.Headers=_,d.Request=Q,d.Response=R),c.Headers=_,c.Request=Q,c.Response=R,c.fetch=V,Object.defineProperty(c,"__esModule",{value:!0})}),{fetch:l.fetch,Headers:l.Headers,Request:l.Request,Response:l.Response,DOMException:l.DOMException}}()}t.exports=n})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof uc<"u"?uc:Ble)}(jm,jm.exports)),jm.exports}var zle=Fle();const iT=ml(zle),Kp="nhostRefreshToken",ox="nhostRefreshTokenId",Zd="nhostRefreshTokenExpiresAt",Ule=3,Vle=60,Q5=5,i8=0,a8=1,Ic=10,ub=20;let Du=class extends Error{constructor(e){super(e.message),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),e instanceof Error?(this.name=e.name,this.error={error:e.name,status:a8,message:e.message}):(this.name=e.error,this.error=e)}};const to={status:Ic,error:"invalid-email",message:"Email is incorrectly formatted"},FC={status:Ic,error:"invalid-password",message:"Password is incorrectly formatted"},X5={status:Ic,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},Hle={status:Ic,error:"invalid-mfa-ticket",message:"MFA ticket is invalid"},qle={status:Ic,error:"no-mfa-ticket",message:"No MFA ticket has been provided"},Wle={status:Ic,error:"no-refresh-token",message:"No refresh token has been provided"},Gle={status:ub,error:"refresher-already-running",message:"The token refresher is already running. You must wait until is has finished before submitting a new token."},ri={status:ub,error:"already-signed-in",message:"User is already signed in"},Kle={status:ub,error:"unauthenticated-user",message:"User is not authenticated"},Yle={status:ub,error:"unverified-user",message:"Email needs verification"},Qle={status:Ic,error:"invalid-refresh-token",message:"Invalid or expired refresh token"},Xle={status:a8,error:"invalid-sign-in-method",message:"Invalid sign-in method"},BS={user:null,mfa:null,accessToken:{value:null,expiresAt:null,expiresInSeconds:15},refreshTimer:{startedAt:null,attempts:0,lastAttempt:null},refreshToken:{value:null},importTokenAttempts:0,errors:{}};function Zle(t){return new TextEncoder().encode(t)}function Yo(t){const e=new Uint8Array(t);let r="";for(const n of e)r+=String.fromCharCode(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function aT(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),r=(4-e.length%4)%4,n=e.padEnd(e.length+r,"="),s=atob(n),i=new ArrayBuffer(s.length),a=new Uint8Array(i);for(let l=0;l<s.length;l++)a[l]=s.charCodeAt(l);return i}function o8(){return(window==null?void 0:window.PublicKeyCredential)!==void 0&&typeof window.PublicKeyCredential=="function"}function l8(t){const{id:e}=t;return{...t,id:aT(e),transports:t.transports}}function c8(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}let xs=class extends Error{constructor({message:e,code:r,cause:n,name:s}){super(e,{cause:n}),this.name=s??n.name,this.code=r}};function Jle({error:t,options:e}){var r,n;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 xs({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=s.authenticatorSelection)==null?void 0:r.requireResidentKey)===!0)return new xs({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(((n=s.authenticatorSelection)==null?void 0:n.userVerification)==="required")return new xs({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 xs({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new xs({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(i=>i.type==="public-key").length===0?new xs({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new xs({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 i=window.location.hostname;if(c8(i)){if(s.rp.id!==i)return new xs({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new xs({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 xs({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 xs({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 t}let ece=class{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}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 u8=new ece,tce=["cross-platform","platform"];function d8(t){if(t&&!(tce.indexOf(t)<0))return t}async function h8(t){var e;if(!o8())throw new Error("WebAuthn is not supported in this browser");const r={publicKey:{...t,challenge:aT(t.challenge),user:{...t.user,id:Zle(t.user.id)},excludeCredentials:(e=t.excludeCredentials)==null?void 0:e.map(l8)}};r.signal=u8.createNewAbortSignal();let n;try{n=await navigator.credentials.create(r)}catch(m){throw Jle({error:m,options:r})}if(!n)throw new Error("Registration was not completed");const{id:s,rawId:i,response:a,type:l}=n;let c;typeof a.getTransports=="function"&&(c=a.getTransports());let d;if(typeof a.getPublicKeyAlgorithm=="function")try{d=a.getPublicKeyAlgorithm()}catch(m){FS("getPublicKeyAlgorithm()",m)}let f;if(typeof a.getPublicKey=="function")try{const m=a.getPublicKey();m!==null&&(f=Yo(m))}catch(m){FS("getPublicKey()",m)}let p;if(typeof a.getAuthenticatorData=="function")try{p=Yo(a.getAuthenticatorData())}catch(m){FS("getAuthenticatorData()",m)}return{id:s,rawId:Yo(i),response:{attestationObject:Yo(a.attestationObject),clientDataJSON:Yo(a.clientDataJSON),transports:c,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:d8(n.authenticatorAttachment)}}function FS(t,e){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${t}. You should report this error to them.
|
||
`,e)}function rce(t){return new TextDecoder("utf-8").decode(t)}function nce(){const t=window.PublicKeyCredential;return t.isConditionalMediationAvailable===void 0?new Promise(e=>e(!1)):t.isConditionalMediationAvailable()}function sce({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new xs({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new xs({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(c8(n)){if(r.rpId!==n)return new xs({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new xs({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new xs({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 t}async function zC(t,e=!1){var r,n;if(!o8())throw new Error("WebAuthn is not supported in this browser");let s;((r=t.allowCredentials)==null?void 0:r.length)!==0&&(s=(n=t.allowCredentials)==null?void 0:n.map(l8));const i={...t,challenge:aT(t.challenge),allowCredentials:s},a={};if(e){if(!await nce())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');a.mediation="conditional",i.allowCredentials=[]}a.publicKey=i,a.signal=u8.createNewAbortSignal();let l;try{l=await navigator.credentials.get(a)}catch(g){throw sce({error:g,options:a})}if(!l)throw new Error("Authentication was not completed");const{id:c,rawId:d,response:f,type:p}=l;let m;return f.userHandle&&(m=rce(f.userHandle)),{id:c,rawId:Yo(d),response:{authenticatorData:Yo(f.authenticatorData),clientDataJSON:Yo(f.clientDataJSON),signature:Yo(f.signature),userHandle:m},type:p,clientExtensionResults:l.getClientExtensionResults(),authenticatorAttachment:d8(l.authenticatorAttachment)}}const db=typeof window<"u",d0=new Map,ice=t=>{var e;return db&&typeof localStorage<"u"?localStorage.getItem(t):(e=d0.get(t))!=null?e:null},ace=(t,e)=>{db&&typeof localStorage<"u"?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?d0.set(t,e):d0.has(t)&&d0.delete(t)},oce=(t,e)=>{if(t==="localStorage"||t==="web")return ice;if(t==="cookie")return r=>{var n;return db&&(n=BC.get(r))!=null?n:null};if(!e)throw Error(`clientStorageType is set to '${t}' but no clientStorage has been given`);if(t==="react-native")return r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)};if(t==="custom"){if(e.getItem&&e.removeItem)return e.getItem;if(e.getItemAsync)return e.getItemAsync;throw Error(`clientStorageType is set to 'custom' but clientStorage is missing either "getItem" and "removeItem" properties or "getItemAsync" property`)}throw Error(`Unknown storage type: ${t}`)},lce=(t,e)=>{if(t==="localStorage"||t==="web")return ace;if(t==="cookie")return(r,n)=>{db&&(n?BC.set(r,n,{expires:30,sameSite:"lax",httpOnly:!1}):BC.remove(r))};if(!e)throw Error(`clientStorageType is set to '${t}' but no clienStorage has been given`);if(t==="react-native")return(r,n)=>{var s,i;return n?(s=e.setItem)==null?void 0:s.call(e,r,n):(i=e.removeItem)==null?void 0:i.call(e,r)};if(t==="capacitor")return(r,n)=>{var s,i;return n?(s=e.set)==null?void 0:s.call(e,{key:r,value:n}):(i=e.remove)==null?void 0:i.call(e,{key:r})};if(t==="expo-secure-storage")return async(r,n)=>{var s,i;return n?(s=e.setItemAsync)==null?void 0:s.call(e,r,n):(i=e.deleteItemAsync)==null?void 0:i.call(e,r)};if(t==="custom"){if(!e.removeItem)throw Error("clientStorageType is set to 'custom' but clientStorage is missing a removeItem property");if(e.setItem)return(r,n)=>{var s,i;return n?(s=e.setItem)==null?void 0:s.call(e,r,n):(i=e.removeItem)==null?void 0:i.call(e,r)};if(e.setItemAsync)return async(r,n)=>{var s,i;return n?(s=e.setItemAsync)==null?void 0:s.call(e,r,n):(i=e.removeItem)==null?void 0:i.call(e,r)};throw Error("clientStorageType is set to 'custom' but clientStorage is missing setItem or setItemAsync property")}throw Error(`Unknown storage type: ${t}`)},lx=t=>!t||!t.accessToken.value||!t.accessToken.expiresAt||!t.user?null:{accessToken:t.accessToken.value,accessTokenExpiresIn:(t.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:t.refreshToken.value,user:t.user},ra=({accessToken:t,refreshToken:e,isError:r,user:n,error:s})=>r?{session:null,error:s}:n&&t?{session:{accessToken:t,accessTokenExpiresIn:0,refreshToken:e,user:n},error:null}:{session:null,error:null},Z5=()=>typeof window<"u"&&typeof window.location<"u";let f8=globalThis.fetch;typeof EdgeRuntime!="string"&&(f8=iT().fetch);const cce=async(t,e,{token:r,body:n,extraHeaders:s}={})=>{const i={"Content-Type":"application/json",Accept:"*/*"};r&&(i.Authorization=`Bearer ${r}`);const a={...i,...s},l={method:e,headers:a};n&&(l.body=JSON.stringify(n));try{const c=await f8(t,l);if(!c.ok){const d=await c.json();return Promise.reject({error:d})}try{return{data:await c.json(),error:null}}catch{return console.warn(`Unexpected response: can't parse the response of the server at ${t}`),{data:"OK",error:null}}}catch{const c={message:"Network Error",status:i8,error:"network"};return Promise.reject({error:c})}},Ea=async(t,e,r,n)=>cce(t,"POST",{token:r,body:e,extraHeaders:n}),UC=(t,e)=>{const r=e&&Object.entries(e).map(([n,s])=>{const i=Array.isArray(s)?s.join(","):typeof s=="object"?JSON.stringify(s):s;return`${n}=${encodeURIComponent(i)}`}).join("&");return r?`${t}?${r}`:t},Fi=(t,e)=>{if(!(e!=null&&e.redirectTo))return e;const{redirectTo:r,...n}=e;if(!t)return r.startsWith("/")?n:e;const s=new URL(t),i=Object.fromEntries(new URLSearchParams(s.search)),a=new URL(r.startsWith("/")?s.origin+r:r),l=new URLSearchParams(a.search);let c=Object.fromEntries(l);r.startsWith("/")&&(c={...i,...c});let d=s.pathname;return a.pathname.length>1&&(d+=a.pathname.slice(1)),{...n,redirectTo:UC(a.origin+d,c)}};function cx(t,e){var r;if(!e){if(typeof window>"u")return;e=((r=window.location)==null?void 0:r.href)||""}t=t.replace(/[\[\]]/g,"\\$&");const n=new RegExp("[?&#]"+t+"(=([^&#]*)|&|#|$)"),s=n.exec(e);return s?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null}function J5(t){var e;if(typeof window>"u")return;const r=window==null?void 0:window.location;if(r&&r){const n=new URLSearchParams(r.search),s=new URLSearchParams((e=r.hash)==null?void 0:e.slice(1));n.delete(t),s.delete(t);let i=window.location.pathname;Array.from(n).length&&(i+=`?${n.toString()}`),Array.from(s).length&&(i+=`#${s.toString()}`),window.history.pushState({},"",i)}}const ro=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),VC=t=>!!t&&typeof t=="string"&&t.length>=Ule,e4=t=>!!t&&typeof t=="string",uce=t=>t&&typeof t=="string"&&t.match(/^mfaTotp:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),dce=({backendUrl:t,clientUrl:e,broadcastKey:r,clientStorageType:n="web",clientStorage:s,refreshIntervalTime:i,autoRefreshToken:a=!0,autoSignIn:l=!0})=>{const c=oce(n,s),d=lce(n,s),f=async(p,m,g,y)=>(await Ea(`${t}${p}`,m,g,y)).data;return ov({schema:{context:{},events:{},services:{}},tsTypes:{},context:BS,predictableActionArguments:!0,id:"nhost",type:"parallel",states:{authentication:{initial:"starting",on:{SESSION_UPDATE:[{cond:"hasSession",actions:["saveSession","resetTimer","reportTokenChanged"],target:".signedIn"}]},states:{starting:{tags:["loading"],always:{cond:"isSignedIn",target:"signedIn"},invoke:{id:"importRefreshToken",src:"importRefreshToken",onDone:[{cond:"hasSession",actions:["saveSession","reportTokenChanged"],target:"signedIn"},{target:"signedOut"}],onError:[{cond:"shouldRetryImportToken",actions:"incrementTokenImportAttempts",target:"retryTokenImport"},{actions:["saveAuthenticationError"],target:"signedOut"}]}},retryTokenImport:{tags:["loading"],after:{RETRY_IMPORT_TOKEN_DELAY:"starting"}},signedOut:{initial:"noErrors",entry:"reportSignedOut",states:{noErrors:{},success:{},needsSmsOtp:{},needsMfa:{},failed:{},signingOut:{entry:["clearContextExceptTokens"],exit:["destroyAccessToken","destroyRefreshToken","reportTokenChanged"],invoke:{src:"signout",id:"signingOut",onDone:{target:"success"},onError:{target:"failed",actions:["saveAuthenticationError"]}}}},on:{SIGNIN_PASSWORD:"authenticating.password",SIGNIN_ANONYMOUS:"authenticating.anonymous",SIGNIN_SECURITY_KEY_EMAIL:"authenticating.securityKeyEmail",SIGNIN_SECURITY_KEY:"authenticating.securityKey",SIGNIN_MFA_TOTP:"authenticating.mfa.totp",SIGNIN_PAT:"authenticating.pat",SIGNIN_ID_TOKEN:"authenticating.idToken"}},authenticating:{entry:"resetErrors",states:{password:{invoke:{src:"signInPassword",id:"authenticateUserWithPassword",onDone:[{cond:"hasMfaTicket",actions:["saveMfaTicket"],target:"#nhost.authentication.signedOut.needsMfa"},{actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"}],onError:[{cond:"unverified",target:["#nhost.authentication.signedOut","#nhost.registration.incomplete.needsEmailVerification"]},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed"}]}},pat:{invoke:{src:"signInPAT",id:"authenticateWithPAT",onDone:{actions:["savePATSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed"}}},idToken:{invoke:{src:"signInIdToken",id:"authenticateWithIdToken",onDone:{actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed"}}},anonymous:{invoke:{src:"signInAnonymous",id:"authenticateAnonymously",onDone:{actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed"}}},mfa:{states:{totp:{invoke:{src:"signInMfaTotp",id:"signInMfaTotp",onDone:{actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:["saveAuthenticationError"],target:"#nhost.authentication.signedOut.failed"}}}}},securityKeyEmail:{invoke:{src:"signInSecurityKeyEmail",id:"authenticateUserWithSecurityKey",onDone:{actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:[{cond:"unverified",target:["#nhost.authentication.signedOut","#nhost.registration.incomplete.needsEmailVerification"]},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed"}]}},securityKey:{invoke:{src:"signInSecurityKey",id:"authenticateUserWithSecurityKey",onDone:{actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:[{cond:"unverified",target:["#nhost.authentication.signedOut","#nhost.registration.incomplete.needsEmailVerification"]},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed"}]}}}},signedIn:{type:"parallel",entry:["reportSignedIn","cleanUrl","broadcastToken","resetErrors"],on:{SIGNOUT:"signedOut.signingOut"},states:{refreshTimer:{id:"timer",initial:"idle",states:{disabled:{type:"final"},stopped:{always:{cond:"noToken",target:"idle"}},idle:{always:[{cond:"isAutoRefreshDisabled",target:"disabled"},{cond:"isRefreshTokenPAT",target:"disabled"},{cond:"hasRefreshToken",target:"running"}]},running:{initial:"pending",entry:"resetTimer",states:{pending:{after:{1e3:{internal:!1,target:"pending"}},always:{cond:"refreshTimerShouldRefresh",target:"refreshing"}},refreshing:{invoke:{src:"refreshToken",id:"refreshToken",onDone:{actions:["saveSession","resetTimer","reportTokenChanged"],target:"pending"},onError:[{cond:"isUnauthorizedError",target:"#nhost.authentication.signedOut"},{actions:"saveRefreshAttempt",target:"pending"}]}}}}}}}}}},token:{initial:"idle",states:{idle:{on:{TRY_TOKEN:"running"},initial:"noErrors",states:{noErrors:{},error:{}}},running:{invoke:{src:"refreshToken",id:"authenticateWithToken",onDone:{actions:["saveSession","reportTokenChanged"],target:["#nhost.authentication.signedIn","idle.noErrors"]},onError:[{cond:"isSignedIn",target:"idle.error"},{actions:"saveAuthenticationError",target:["#nhost.authentication.signedOut.failed","idle.error"]}]}}}},registration:{initial:"incomplete",on:{SIGNED_IN:[{cond:"isAnonymous",target:".incomplete"},".complete"]},states:{incomplete:{on:{SIGNUP_EMAIL_PASSWORD:"emailPassword",SIGNUP_SECURITY_KEY:"securityKey",PASSWORDLESS_EMAIL:"passwordlessEmail",PASSWORDLESS_SMS:"passwordlessSms",PASSWORDLESS_SMS_OTP:"passwordlessSmsOtp",SIGNIN_EMAIL_OTP:"signInEmailOTP",VERIFY_EMAIL_OTP:"verifyEmailOTP"},initial:"noErrors",states:{noErrors:{},needsEmailVerification:{},needsOtp:{},failed:{}}},emailPassword:{entry:["resetErrors"],invoke:{src:"signUpEmailPassword",id:"signUpEmailPassword",onDone:[{cond:"hasSession",actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},{actions:"clearContext",target:["#nhost.authentication.signedOut","incomplete.needsEmailVerification"]}],onError:[{cond:"unverified",target:"incomplete.needsEmailVerification"},{actions:"saveRegistrationError",target:"incomplete.failed"}]}},securityKey:{entry:["resetErrors"],invoke:{src:"signUpSecurityKey",id:"signUpSecurityKey",onDone:[{cond:"hasSession",actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},{actions:"clearContext",target:["#nhost.authentication.signedOut","incomplete.needsEmailVerification"]}],onError:[{cond:"unverified",target:"incomplete.needsEmailVerification"},{actions:"saveRegistrationError",target:"incomplete.failed"}]}},passwordlessEmail:{entry:["resetErrors"],invoke:{src:"passwordlessEmail",id:"passwordlessEmail",onDone:{actions:"clearContext",target:["#nhost.authentication.signedOut","incomplete.needsEmailVerification"]},onError:{actions:"saveRegistrationError",target:"incomplete.failed"}}},passwordlessSms:{entry:["resetErrors"],invoke:{src:"passwordlessSms",id:"passwordlessSms",onDone:{actions:"clearContext",target:["#nhost.authentication.signedOut","incomplete.needsOtp"]},onError:{actions:"saveRegistrationError",target:"incomplete.failed"}}},passwordlessSmsOtp:{entry:["resetErrors"],invoke:{src:"passwordlessSmsOtp",id:"passwordlessSmsOtp",onDone:{actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveRegistrationError",target:"incomplete.failed"}}},signInEmailOTP:{entry:["resetErrors"],invoke:{src:"signInEmailOTP",id:"signInEmailOTP",onDone:{actions:"clearContext",target:["#nhost.authentication.signedOut","incomplete.needsOtp"]},onError:{actions:"saveRegistrationError",target:"incomplete.failed"}}},verifyEmailOTP:{entry:["resetErrors"],invoke:{src:"verifyEmailOTP",id:"verifyEmailOTP",onDone:{actions:["saveSession","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveRegistrationError",target:"incomplete.failed"}}},complete:{on:{SIGNED_OUT:"incomplete"}}}}}},{actions:{reportSignedIn:va("SIGNED_IN"),reportSignedOut:va("SIGNED_OUT"),reportTokenChanged:va("TOKEN_CHANGED"),incrementTokenImportAttempts:ln({importTokenAttempts:({importTokenAttempts:p})=>p+1}),clearContext:ln(()=>(d(Zd,null),d(Kp,null),d(ox,null),{...BS})),clearContextExceptTokens:ln(({accessToken:p,refreshToken:m})=>({...BS,accessToken:p,refreshToken:m})),saveSession:ln({user:(p,{data:m})=>{var g;return((g=m==null?void 0:m.session)==null?void 0:g.user)||null},accessToken:(p,{data:m})=>{if(m.session){const{accessTokenExpiresIn:g,accessToken:y}=m.session,x=new Date(Date.now()+g*1e3);return d(Zd,x.toISOString()),{value:y,expiresAt:x,expiresInSeconds:g}}return d(Zd,null),{value:null,expiresAt:null,expiresInSeconds:null}},refreshToken:(p,{data:m})=>{var g,y;const x=((g=m.session)==null?void 0:g.refreshToken)||null,w=((y=m.session)==null?void 0:y.refreshTokenId)||null;return x&&d(Kp,x),w&&d(ox,w),{value:x}}}),savePATSession:ln({user:(p,{data:m})=>{var g;return((g=m==null?void 0:m.session)==null?void 0:g.user)||null},accessToken:(p,{data:m})=>{if(m.session){const{accessTokenExpiresIn:g,accessToken:y}=m.session,x=new Date(Date.now()+g*1e3);return d(Zd,x.toISOString()),{value:y,expiresAt:x,expiresInSeconds:g}}return d(Zd,null),{value:null,expiresAt:null,expiresInSeconds:null}},refreshToken:(p,{data:m})=>{var g,y;const x=((g=m.session)==null?void 0:g.refreshToken)||null,w=((y=m.session)==null?void 0:y.refreshTokenId)||null;return x&&d(Kp,x),w&&d(ox,w),{value:x,isPAT:!0}}}),saveMfaTicket:ln({mfa:(p,m)=>{var g;return(g=m.data)==null?void 0:g.mfa}}),resetTimer:ln({refreshTimer:p=>({startedAt:new Date,attempts:0,lastAttempt:null})}),saveRefreshAttempt:ln({refreshTimer:(p,m)=>({startedAt:p.refreshTimer.startedAt,attempts:p.refreshTimer.attempts+1,lastAttempt:new Date})}),saveAuthenticationError:ln({errors:({errors:p},{data:{error:m}})=>({...p,authentication:m})}),resetErrors:ln({errors:p=>({}),importTokenAttempts:p=>0}),saveRegistrationError:ln({errors:({errors:p},{data:{error:m}})=>({...p,registration:m})}),destroyRefreshToken:ln({refreshToken:p=>(d(Kp,null),d(ox,null),{value:null})}),destroyAccessToken:ln({accessToken:p=>(d(Zd,null),{value:null,expiresAt:null,expiresInSeconds:null})}),cleanUrl:()=>{l&&cx("refreshToken")&&(J5("refreshToken"),J5("type"))},broadcastToken:p=>{if(l&&r)try{new BroadcastChannel(r).postMessage({type:"broadcast_token",payload:{token:p.refreshToken.value}})}catch{}}},guards:{isAnonymous:(p,m)=>{var g;return!!((g=p.user)!=null&&g.isAnonymous)},isSignedIn:p=>!!p.user&&!!p.accessToken.value,noToken:p=>!p.refreshToken.value,isRefreshTokenPAT:p=>{var m;return!!((m=p.refreshToken)!=null&&m.isPAT)},hasRefreshToken:p=>!!p.refreshToken.value,isAutoRefreshDisabled:()=>!a,refreshTimerShouldRefresh:p=>{const{expiresAt:m}=p.accessToken;if(!m)return!1;if(p.refreshTimer.lastAttempt)return p.refreshTimer.attempts>Q5?!1:Date.now()-p.refreshTimer.lastAttempt.getTime()>Math.pow(2,p.refreshTimer.attempts-1)*5e3;if(m.getTime()<Date.now()||i&&Date.now()-p.refreshTimer.startedAt.getTime()>i*1e3)return!0;const g=p.accessToken.expiresInSeconds;return g?m.getTime()-Date.now()-1e3*Math.min(Vle,g*.5)<=0:!1},shouldRetryImportToken:(p,m)=>p.importTokenAttempts<Q5&&(m.data.error.status===i8||m.data.error.status>=500),unverified:(p,{data:{error:m}})=>m.status===401&&(m.message==="Email is not verified"||m.error==="unverified-user"),hasSession:(p,m)=>{var g;return!!((g=m.data)!=null&&g.session)},hasMfaTicket:(p,m)=>{var g;return!!((g=m.data)!=null&&g.mfa)},isUnauthorizedError:(p,{data:{error:m}})=>m.status===401},services:{signInPassword:(p,{email:m,password:g})=>ro(m)?VC(g)?f("/signin/email-password",{email:m,password:g}):Promise.reject({error:FC}):Promise.reject({error:to}),signInPAT:(p,{pat:m})=>f("/signin/pat",{personalAccessToken:m}),signInIdToken:(p,{provider:m,idToken:g,nonce:y})=>f("/signin/idtoken",{provider:m,idToken:g,...y&&{nonce:y}}),passwordlessSms:(p,{phoneNumber:m,options:g})=>{var y;return e4(m)?(y=p.user)!=null&&y.isAnonymous?(console.warn("Deanonymisation from a phone number is not yet implemented in hasura-auth"),f("/user/deanonymize",{signInMethod:"passwordless",connection:"sms",phoneNumber:m,options:Fi(e,g)},p.accessToken.value)):f("/signin/passwordless/sms",{phoneNumber:m,options:Fi(e,g)}):Promise.reject({error:X5})},passwordlessSmsOtp:(p,{phoneNumber:m,otp:g})=>e4(m)?f("/signin/passwordless/sms/otp",{phoneNumber:m,otp:g}):Promise.reject({error:X5}),signInEmailOTP:(p,{email:m,options:g})=>ro(m)?f("/signin/otp/email",{email:m,options:Fi(e,g)}):Promise.reject({error:to}),verifyEmailOTP:(p,{email:m,otp:g})=>ro(m)?f("/signin/otp/email/verify",{email:m,otp:g}):Promise.reject({error:to}),passwordlessEmail:(p,{email:m,options:g})=>{var y;return ro(m)?(y=p.user)!=null&&y.isAnonymous?f("/user/deanonymize",{signInMethod:"passwordless",connection:"email",email:m,options:Fi(e,g)},p.accessToken.value):f("/signin/passwordless/email",{email:m,options:Fi(e,g)}):Promise.reject({error:to})},signInAnonymous:p=>f("/signin/anonymous"),signInMfaTotp:(p,m)=>{var g;const y=m.ticket||((g=p.mfa)==null?void 0:g.ticket);return y?uce(y)?f("/signin/mfa/totp",{ticket:y,otp:m.otp}):Promise.reject({error:Hle}):Promise.reject({error:qle})},signInSecurityKeyEmail:async(p,{email:m})=>{if(!ro(m))throw new Du(to);const g=await f("/signin/webauthn",{email:m});let y;try{y=await zC(g)}catch(x){throw new Du(x)}return f("/signin/webauthn/verify",{email:m,credential:y})},refreshToken:async(p,m)=>{const g=m.type==="TRY_TOKEN"?m.token:p.refreshToken.value;return{session:await f("/token",{refreshToken:g}),error:null}},signInSecurityKey:async()=>{try{const p=await f("/signin/webauthn",{});let m;try{m=await zC(p)}catch(g){throw new Du(g)}return f("/signin/webauthn/verify",{credential:m})}catch(p){throw new Du(p)}},signout:async(p,m)=>{const g=await f("/signout",{refreshToken:p.refreshToken.value,all:!!m.all},m.all?p.accessToken.value:void 0);if(r)try{new BroadcastChannel(r).postMessage({type:"signout"})}catch{}return g},signUpEmailPassword:async(p,{email:m,password:g,options:y,requestOptions:x})=>{var w;return ro(m)?VC(g)?(w=p.user)!=null&&w.isAnonymous?f("/user/deanonymize",{signInMethod:"email-password",email:m,password:g,options:Fi(e,y)},p.accessToken.value,x==null?void 0:x.headers):f("/signup/email-password",{email:m,password:g,options:Fi(e,y)},null,x==null?void 0:x.headers):Promise.reject({error:FC}):Promise.reject({error:to})},signUpSecurityKey:async(p,{email:m,options:g,requestOptions:y})=>{if(!ro(m))return Promise.reject({error:to});const x=g==null?void 0:g.nickname;x&&delete g.nickname;const w=await f("/signup/webauthn",{email:m,options:g},null,y==null?void 0:y.headers);let _;try{_=await h8(w)}catch(S){throw new Du(S)}return f("/signup/webauthn/verify",{credential:_,options:{redirectTo:g==null?void 0:g.redirectTo,nickname:x}})},importRefreshToken:async p=>{if(p.user&&p.refreshToken.value&&p.accessToken.value&&p.accessToken.expiresAt)return{session:{accessToken:p.accessToken.value,accessTokenExpiresIn:p.accessToken.expiresAt.getTime()-Date.now(),refreshToken:p.refreshToken.value,user:p.user},error:null};let m=null;if(l){const y=cx("refreshToken")||null;if(y)try{return{session:await f("/token",{refreshToken:y}),error:null}}catch(x){m=x.error}else{const x=cx("error"),w=cx("errorDescription");if(x&&w!=="social user already exists")return Promise.reject({session:null,error:{status:Ic,error:x,message:w||x}})}}const g=await c(Kp);if(g)try{return{session:await f("/token",{refreshToken:g}),error:null}}catch(y){m=y.error}return m?Promise.reject({error:m,session:null}):{error:null,session:null}}},delays:{RETRY_IMPORT_TOKEN_DELAY:({importTokenAttempts:p})=>Math.pow(2,p-1)*5e3}})},hce=({backendUrl:t,clientUrl:e,interpreter:r})=>ov({schema:{context:{},events:{},services:{}},tsTypes:{},predictableActionArguments:!0,id:"changeEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:ln({error:n=>to}),saveRequestError:ln({error:(n,{data:{error:s}})=>s}),reportError:va(n=>({type:"ERROR",error:n.error})),reportSuccess:va("SUCCESS")},guards:{invalidEmail:(n,{email:s})=>!ro(s)},services:{requestChange:async(n,{email:s,options:i})=>(await Ea(`${t}/user/email/change`,{newEmail:s,options:Fi(e,i)},r==null?void 0:r.getSnapshot().context.accessToken.value)).data}}),p8=({backendUrl:t,interpreter:e})=>ov({schema:{context:{},events:{},services:{}},tsTypes:{},predictableActionArguments:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidPassword",actions:"saveInvalidPasswordError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidPasswordError:ln({error:r=>FC}),saveRequestError:ln({error:(r,{data:{error:n}})=>n}),reportError:va(r=>({type:"ERROR",error:r.error})),reportSuccess:va("SUCCESS")},guards:{invalidPassword:(r,{password:n})=>!VC(n)},services:{requestChange:(r,{password:n,ticket:s})=>Ea(`${t}/user/password`,{newPassword:n,ticket:s},e==null?void 0:e.getSnapshot().context.accessToken.value)}}),m8=({backendUrl:t,clientUrl:e})=>ov({schema:{context:{},events:{},services:{}},tsTypes:{},predictableActionArguments:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:ln({error:r=>to}),saveRequestError:ln({error:(r,{data:{error:n}})=>n}),reportError:va(r=>({type:"ERROR",error:r.error})),reportSuccess:va("SUCCESS")},guards:{invalidEmail:(r,{email:n})=>!ro(n)},services:{requestChange:(r,{email:n,options:s})=>Ea(`${t}/user/password/reset`,{email:n,options:Fi(e,s)})}}),g8=({backendUrl:t,clientUrl:e})=>ov({schema:{context:{},events:{},services:{}},tsTypes:{},predictableActionArguments:!0,id:"sendVerificationEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"request",id:"request",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:ln({error:r=>to}),saveRequestError:ln({error:(r,{data:{error:n}})=>n}),reportError:va(r=>({type:"ERROR",error:r.error})),reportSuccess:va("SUCCESS")},guards:{invalidEmail:(r,{email:n})=>!ro(n)},services:{request:async(r,{email:n,options:s})=>(await Ea(`${t}/user/email/send-verification-email`,{email:n,options:Fi(e,s)})).data}});let fce=class{constructor({clientStorageType:e="web",autoSignIn:r=!0,autoRefreshToken:n=!0,start:s=!0,backendUrl:i,clientUrl:a,broadcastKey:l,devTools:c,...d}){var f;if(this._started=!1,this._subscriptionsQueue=new Set,this._subscriptions=new Set,this.backendUrl=i,this.clientUrl=a,this._machine=dce({...d,backendUrl:i,clientUrl:a,broadcastKey:l,clientStorageType:e,autoSignIn:r,autoRefreshToken:n}),s&&this.start({devTools:c}),typeof window<"u"&&l)try{this._channel=new BroadcastChannel(l),r&&((f=this._channel)==null||f.addEventListener("message",p=>{var m;const{type:g,payload:y}=p.data;if(g==="broadcast_token"){const x=(m=this.interpreter)==null?void 0:m.getSnapshot().context.refreshToken.value;this.interpreter&&y.token&&y.token!==x&&this.interpreter.send("TRY_TOKEN",{token:y.token})}})),this._channel.addEventListener("message",p=>{const{type:m}=p.data;m==="signout"&&this.interpreter&&this.interpreter.send("SIGNOUT")})}catch{}}start({devTools:e=!1,initialSession:r,interpreter:n}={}){var s,i;const a={...this.machine.context,accessToken:{...this.machine.context.accessToken},refreshToken:{...this.machine.context.refreshToken}};r&&(a.user=r.user,a.refreshToken.value=(s=r.refreshToken)!=null?s:null,a.accessToken.value=(i=r.accessToken)!=null?i:null,a.accessToken.expiresAt=new Date(Date.now()+r.accessTokenExpiresIn*1e3));const l=this.machine.withContext(a);this._interpreter||(this._interpreter=n||Iu(l,{devTools:e})),(!this._started||typeof window>"u")&&(this._interpreter.initialized&&(this._interpreter.stop(),this._subscriptions.forEach(c=>c())),this._interpreter.start(l.initialState),this._subscriptionsQueue.forEach(c=>c(this))),this._started=!0}get machine(){return this._machine}get interpreter(){return this._interpreter}get started(){return this._started}subscribe(e){if(this.started){const r=e(this);return this._subscriptions.add(r),r}else return this._subscriptionsQueue.add(e),()=>{console.log("onTokenChanged was added before the interpreter started. Cannot unsubscribe listener.")}}};const pce=async({backendUrl:t,interpreter:e},r)=>{try{const{data:n}=await Ea(`${t}/user/webauthn/add`,{},e==null?void 0:e.getSnapshot().context.accessToken.value);let s;try{s=await h8(n)}catch(a){throw new Du(a)}const{data:i}=await Ea(`${t}/user/webauthn/verify`,{credential:s,nickname:r},e==null?void 0:e.getSnapshot().context.accessToken.value);return{key:i,isError:!1,error:null,isSuccess:!0}}catch(n){const{error:s}=n;return{isError:!0,error:s,isSuccess:!1}}},mce=async(t,e,r)=>new Promise(n=>{t.send("REQUEST",{email:e,options:r}),t.onTransition(s=>{s.matches({idle:"error"})?n({error:s.context.error,isError:!0,needsEmailVerification:!1}):s.matches({idle:"success"})&&n({error:null,isError:!1,needsEmailVerification:!0})})}),v8=async(t,e,r)=>new Promise(n=>{t.send("REQUEST",{password:e,ticket:r}),t.onTransition(s=>{s.matches({idle:"error"})?n({error:s.context.error,isError:!0,isSuccess:!1}):s.matches({idle:"success"})&&n({error:null,isError:!1,isSuccess:!0})})}),y8=async(t,e,r)=>new Promise(n=>{t.send("REQUEST",{email:e,options:r}),t.onTransition(s=>{s.matches({idle:"error"})?n({error:s.context.error,isError:!0,isSent:!1}):s.matches({idle:"success"})&&n({error:null,isError:!1,isSent:!0})})}),x8=(t,e,r)=>new Promise(n=>{t.send("REQUEST",{email:e,options:r}),t.onTransition(s=>{s.matches({idle:"error"})?n({error:s.context.error,isError:!0,isSent:!1}):s.matches({idle:"success"})&&n({error:null,isError:!1,isSent:!0})})}),gce=t=>new Promise(e=>{const{changed:r}=t.send("SIGNIN_ANONYMOUS");r||e({isSuccess:!1,isError:!0,error:ri,user:null,accessToken:null,refreshToken:null}),t.onTransition(n=>{n.matches({authentication:"signedIn"})&&e({isSuccess:!0,isError:!1,error:null,user:n.context.user,accessToken:n.context.accessToken.value,refreshToken:n.context.refreshToken.value}),n.matches({authentication:{signedOut:"failed"}})&&e({isSuccess:!1,isError:!0,error:n.context.errors.authentication||null,user:null,accessToken:null,refreshToken:null})})}),_8=(t,e,r)=>new Promise(n=>{const{changed:s,context:i}=t.send("SIGNIN_PASSWORD",{email:e,password:r});if(!s)return n({accessToken:i.accessToken.value,refreshToken:i.refreshToken.value,error:ri,isError:!0,isSuccess:!1,needsEmailVerification:!1,needsMfaOtp:!1,mfa:null,user:i.user});t.onTransition(a=>{a.matches({authentication:{signedOut:"noErrors"},registration:{incomplete:"needsEmailVerification"}})?n({accessToken:null,refreshToken:null,error:null,isError:!1,isSuccess:!1,needsEmailVerification:!0,needsMfaOtp:!1,mfa:null,user:null}):a.matches({authentication:{signedOut:"needsMfa"}})?n({accessToken:null,refreshToken:null,error:null,isError:!1,isSuccess:!1,needsEmailVerification:!1,needsMfaOtp:!0,mfa:a.context.mfa,user:null}):a.matches({authentication:{signedOut:"failed"}})?n({accessToken:null,refreshToken:null,error:a.context.errors.authentication||null,isError:!0,isSuccess:!1,needsEmailVerification:!1,needsMfaOtp:!1,mfa:null,user:null}):a.matches({authentication:"signedIn"})&&n({accessToken:a.context.accessToken.value,refreshToken:a.context.refreshToken.value,error:null,isError:!1,isSuccess:!0,needsEmailVerification:!1,needsMfaOtp:!1,mfa:null,user:a.context.user})})}),t4=(t,e,r)=>new Promise(n=>{const{changed:s}=t.send("PASSWORDLESS_EMAIL",{email:e,options:r});if(!s)return n({error:ri,isError:!0,isSuccess:!1});t.onTransition(i=>{i.matches("registration.incomplete.failed")?n({error:i.context.errors.registration||null,isError:!0,isSuccess:!1}):i.matches({authentication:{signedOut:"noErrors"},registration:{incomplete:"needsEmailVerification"}})&&n({error:null,isError:!1,isSuccess:!0})})}),vce=(t,e)=>new Promise(r=>{const{changed:n,context:s}=t.send({type:"SIGNIN_SECURITY_KEY_EMAIL",email:e});if(!n)return r({accessToken:s.accessToken.value,refreshToken:s.refreshToken.value,error:ri,isError:!0,isSuccess:!1,needsEmailVerification:!1,user:s.user});t.onTransition(i=>{i.matches({authentication:{signedOut:"noErrors"},registration:{incomplete:"needsEmailVerification"}})?r({accessToken:null,refreshToken:null,error:null,isError:!1,isSuccess:!1,needsEmailVerification:!0,user:null}):i.matches({authentication:{signedOut:"failed"}})?r({accessToken:null,refreshToken:null,error:i.context.errors.authentication||null,isError:!0,isSuccess:!1,needsEmailVerification:!1,user:null}):i.matches({authentication:"signedIn"})&&r({accessToken:i.context.accessToken.value,refreshToken:i.context.refreshToken.value,error:null,isError:!1,isSuccess:!0,needsEmailVerification:!1,user:i.context.user})})}),yce=(t,e)=>new Promise(async r=>{var n,s;const i=(n=t.interpreter)==null?void 0:n.getSnapshot(),a=i==null?void 0:i.context.accessToken.value,{data:l}=await Ea(`${t.backendUrl}/elevate/webauthn`,{email:e},a);let c;try{c=await zC(l)}catch(d){throw new Du(d)}try{const{data:{session:d},error:f}=await Ea(`${t.backendUrl}/elevate/webauthn/verify`,{email:e,credential:c},a);d&&!f&&((s=t.interpreter)==null||s.send({type:"SESSION_UPDATE",data:{session:d}}),r({error:null,isError:!1,isSuccess:!0,elevated:!0}))}catch(d){const{error:f}=d;r({error:f,isError:!0,isSuccess:!1,elevated:!1})}}),b8=(t,e,r)=>new Promise(n=>{const{changed:s,context:i}=t.send("SIGNIN_MFA_TOTP",{otp:e,ticket:r});if(!s)return n({accessToken:i.accessToken.value,refreshToken:i.refreshToken.value,error:ri,isError:!0,isSuccess:!1,user:i.user});t.onTransition(a=>{a.matches({authentication:{signedOut:"failed"}})?n({accessToken:null,refreshToken:null,error:a.context.errors.authentication||null,isError:!0,isSuccess:!1,user:null}):a.matches({authentication:"signedIn"})&&n({accessToken:a.context.accessToken.value,refreshToken:a.context.refreshToken.value,error:null,isError:!1,isSuccess:!0,user:a.context.user})})}),xce=(t,e)=>new Promise(r=>{const{changed:n}=t.send("SIGNIN_PAT",{pat:e});n||r({isSuccess:!1,isError:!0,error:ri,user:null,accessToken:null,refreshToken:null}),t.onTransition(s=>{if(s.matches({authentication:{signedOut:"failed"}}))return r({accessToken:null,refreshToken:null,user:null,error:s.context.errors.authentication||null,isError:!0,isSuccess:!1});if(s.matches({authentication:"signedIn"}))return r({accessToken:s.context.accessToken.value,refreshToken:s.context.refreshToken.value,user:s.context.user,error:null,isError:!1,isSuccess:!0})})}),r4=(t,e,r)=>new Promise(n=>{const{changed:s}=t.send("PASSWORDLESS_SMS",{phoneNumber:e,options:r});if(!s)return n({error:ri,isError:!0,isSuccess:!1,needsOtp:!1});t.onTransition(i=>{i.matches("registration.incomplete.needsOtp")?n({error:null,isError:!1,isSuccess:!1,needsOtp:!0}):i.matches("registration.incomplete.failed")&&n({error:i.context.errors.authentication||null,isError:!0,isSuccess:!1,needsOtp:!1})})}),_ce=(t,e,r)=>new Promise(n=>{const{changed:s}=t.send({type:"PASSWORDLESS_SMS_OTP",phoneNumber:e,otp:r});if(!s)return n({error:ri,isError:!0,isSuccess:!1,user:null,accessToken:null,refreshToken:null});t.onTransition(i=>{i.matches({authentication:"signedIn"})?n({error:null,isError:!1,isSuccess:!0,user:i.context.user,accessToken:i.context.accessToken.value,refreshToken:i.context.refreshToken.value}):i.matches({registration:{incomplete:"failed"}})&&n({error:i.context.errors.authentication||null,isError:!0,isSuccess:!1,user:null,accessToken:null,refreshToken:null})})}),w8=async(t,e)=>new Promise(r=>{const{event:n}=t.send("SIGNOUT",{all:e});if(n.type!=="SIGNED_OUT")return r({isSuccess:!1,isError:!0,error:Kle});t.onTransition(s=>{s.matches({authentication:{signedOut:"success"}})?r({isSuccess:!0,isError:!1,error:null}):s.matches("authentication.signedOut.failed")&&r({isSuccess:!1,isError:!0,error:s.context.errors.signout||null})})}),HC=(t,e,r,n,s)=>new Promise(i=>{const{changed:a,context:l}=t.send("SIGNUP_EMAIL_PASSWORD",{email:e,password:r,options:n,requestOptions:s});if(!a)return i({error:ri,accessToken:l.accessToken.value,refreshToken:l.refreshToken.value,isError:!0,isSuccess:!1,needsEmailVerification:!1,user:l.user});t.onTransition(c=>{c.matches("registration.incomplete.failed")?i({accessToken:null,refreshToken:null,error:c.context.errors.registration||null,isError:!0,isSuccess:!1,needsEmailVerification:!1,user:null}):c.matches({authentication:{signedOut:"noErrors"},registration:{incomplete:"needsEmailVerification"}})?i({accessToken:null,refreshToken:null,error:null,isError:!1,isSuccess:!1,needsEmailVerification:!0,user:null}):c.matches({authentication:"signedIn",registration:"complete"})&&i({accessToken:c.context.accessToken.value,refreshToken:c.context.refreshToken.value,error:null,isError:!1,isSuccess:!0,needsEmailVerification:!1,user:c.context.user})})}),bce=(t,e,r,n)=>new Promise(s=>{const{changed:i,context:a}=t.send("SIGNUP_SECURITY_KEY",{email:e,options:r,requestOptions:n});if(!i)return s({error:ri,accessToken:a.accessToken.value,refreshToken:a.refreshToken.value,isError:!0,isSuccess:!1,needsEmailVerification:!1,user:a.user});t.onTransition(l=>{l.matches("registration.incomplete.failed")?s({accessToken:null,refreshToken:null,error:l.context.errors.registration||null,isError:!0,isSuccess:!1,needsEmailVerification:!1,user:null}):l.matches({authentication:{signedOut:"noErrors"},registration:{incomplete:"needsEmailVerification"}})?s({accessToken:null,refreshToken:null,error:null,isError:!1,isSuccess:!1,needsEmailVerification:!0,user:null}):l.matches({authentication:"signedIn",registration:"complete"})&&s({accessToken:l.context.accessToken.value,refreshToken:l.context.refreshToken.value,error:null,isError:!1,isSuccess:!0,needsEmailVerification:!1,user:l.context.user})})}),wce=(t,e,r)=>new Promise(n=>{const{changed:s}=t.send("SIGNIN_EMAIL_OTP",{email:e,options:r});if(!s)return n({error:ri,isError:!0,isSuccess:!1,needsOtp:!1});t.onTransition(i=>{i.matches("registration.incomplete.needsOtp")?n({error:null,isError:!1,isSuccess:!0,needsOtp:!0}):i.matches("registration.incomplete.failed")&&n({error:i.context.errors.authentication||null,isError:!0,isSuccess:!1,needsOtp:!1})})}),Sce=(t,e,r)=>new Promise(n=>{const{changed:s}=t.send({type:"VERIFY_EMAIL_OTP",email:e,otp:r});if(!s)return n({error:ri,isError:!0,isSuccess:!1,user:null,accessToken:null,refreshToken:null});t.onTransition(i=>{i.matches({authentication:"signedIn"})?n({error:null,isError:!1,isSuccess:!0,user:i.context.user,accessToken:i.context.accessToken.value,refreshToken:i.context.refreshToken.value}):i.matches({registration:{incomplete:"failed"}})&&n({error:i.context.errors.authentication||null,isError:!0,isSuccess:!1,user:null,accessToken:null,refreshToken:null})})}),kce=(t,{provider:e,idToken:r,nonce:n})=>new Promise(s=>{const{changed:i}=t.send("SIGNIN_ID_TOKEN",{provider:e,idToken:r,...n&&{nonce:n}});i||s({isSuccess:!1,isError:!0,error:ri,user:null,accessToken:null,refreshToken:null}),t.onTransition(a=>{if(a.matches({authentication:{signedOut:"failed"}}))return s({accessToken:null,refreshToken:null,user:null,error:a.context.errors.authentication||null,isError:!0,isSuccess:!1});if(a.matches({authentication:"signedIn"}))return s({accessToken:a.context.accessToken.value,refreshToken:a.context.refreshToken.value,user:a.context.user,error:null,isError:!1,isSuccess:!0})})}),Ece=async({backendUrl:t,interpreter:e},{provider:r,idToken:n,nonce:s})=>{try{return await Ea(`${t}/link/idtoken`,{provider:r,idToken:n,...s&&{nonce:s}},e==null?void 0:e.getSnapshot().context.accessToken.value),{isError:!1,error:null,isSuccess:!0}}catch(i){const{error:a}=i;return{isError:!0,error:a,isSuccess:!1}}},Cce=t=>new Promise(e=>{const{changed:r,context:n}=t.send({type:"SIGNIN_SECURITY_KEY"});if(!r)return e({accessToken:n.accessToken.value,refreshToken:n.refreshToken.value,error:ri,isError:!0,isSuccess:!1,needsEmailVerification:!1,user:n.user});t.onTransition(s=>{s.matches({authentication:{signedOut:"noErrors"},registration:{incomplete:"needsEmailVerification"}})?e({accessToken:null,refreshToken:null,error:null,isError:!1,isSuccess:!1,needsEmailVerification:!0,user:null}):s.matches({authentication:{signedOut:"failed"}})?e({accessToken:null,refreshToken:null,error:s.context.errors.authentication||null,isError:!0,isSuccess:!1,needsEmailVerification:!1,user:null}):s.matches({authentication:"signedIn"})&&e({accessToken:s.context.accessToken.value,refreshToken:s.context.refreshToken.value,error:null,isError:!1,isSuccess:!0,needsEmailVerification:!1,user:s.context.user})})}),Nce=async({backendUrl:t,interpreter:e},{expiresAt:r,metadata:n})=>{try{const{data:s}=await Ea(`${t}/pat`,{expiresAt:r.toISOString(),metadata:n},e==null?void 0:e.getSnapshot().context.accessToken.value);return{data:s?{id:s.id||null,personalAccessToken:s.personalAccessToken||null}:null,isError:!1,error:null,isSuccess:!0}}catch(s){const{error:i}=s;return{isError:!0,error:i,isSuccess:!1,data:null}}};let jce=class{constructor({url:e,broadcastKey:r,autoRefreshToken:n=!0,autoSignIn:s=!0,clientStorage:i,clientStorageType:a,refreshIntervalTime:l,start:c=!0}){var d;this.url=e,this._client=new fce({backendUrl:e,clientUrl:typeof window<"u"&&((d=window.location)==null?void 0:d.origin)||"",broadcastKey:r,autoRefreshToken:n,autoSignIn:s,start:c,clientStorage:i,clientStorageType:a,refreshIntervalTime:l})}async signUp(e,r){const n=await this.waitUntilReady();if("securityKey"in e){const{email:l,options:c}=e;return ra(await bce(n,l,c,r))}const{email:s,password:i,options:a}=e;return ra(await HC(n,s,i,a,r))}async connectProvider(e){const r=(await this.waitUntilReady()).getSnapshot().context.accessToken.value,{provider:n,options:s}=e,i=UC(`${this._client.backendUrl}/signin/provider/${n}`,Fi(this._client.clientUrl,{...s,connect:r}));return Z5()&&(window.location.href=i),{providerUrl:i}}async signInIdToken(e){const r=await this.waitUntilReady(),n=await kce(r,e);return{...ra(n),mfa:null}}async linkIdToken(e){return Ece(this._client,e)}async signIn(e){const r=await this.waitUntilReady();if(!e){const n=await gce(r);return{...ra(n),mfa:null}}if("provider"in e){const{provider:n,options:s}=e,i=UC(`${this._client.backendUrl}/signin/provider/${n}`,Fi(this._client.clientUrl,s));return Z5()&&(window.location.href=i),{providerUrl:i,provider:n,session:null,mfa:null,error:null}}if("email"in e&&"password"in e){const n=await _8(r,e.email,e.password);return n.needsEmailVerification?{session:null,mfa:null,error:Yle}:n.needsMfaOtp?{session:null,mfa:n.mfa,error:null}:{...ra(n),mfa:null}}if("email"in e&&"securityKey"in e){if(e.securityKey!==!0)throw Error("securityKey must be true");const n=await vce(r,e.email);return{...ra(n),mfa:null}}if("email"in e){const{email:n,options:s}=e,{error:i}=await t4(r,n,s);return{session:null,mfa:null,error:i}}if("phoneNumber"in e&&"otp"in e){const n=await _ce(r,e.phoneNumber,e.otp);return{...ra(n),mfa:null}}if("phoneNumber"in e){const{error:n}=await r4(r,e.phoneNumber,e.options);return{error:n,mfa:null,session:null}}if("otp"in e){const n=await b8(r,e.otp,e.ticket);return{...ra(n),mfa:null}}return{error:Xle,mfa:null,session:null}}async signInPAT(e){const r=await this.waitUntilReady(),n=await xce(r,e);return ra(n)}async signInEmailOTP(e,r){const n=await this.waitUntilReady(),{error:s}=await wce(n,e,r);return{error:s,session:null,mfa:null}}async verifyEmailOTP(e,r){const n=await this.waitUntilReady(),s=await Sce(n,e,r);return{...ra(s),mfa:null}}async signInSecurityKey(){const e=await this.waitUntilReady(),r=await Cce(e);return{...ra(r),mfa:null}}async signOut(e){const r=await this.waitUntilReady(),{error:n}=await w8(r,e==null?void 0:e.all);return{error:n}}async resetPassword({email:e,options:r}){const n=Iu(m8(this._client)).start(),{error:s}=await y8(n,e,r);return{error:s}}async changePassword({newPassword:e,ticket:r}){const n=Iu(p8(this._client)).start(),{error:s}=await v8(n,e,r);return{error:s}}async sendVerificationEmail({email:e,options:r}){const n=Iu(g8(this._client)).start(),{error:s}=await x8(n,e,r);return{error:s}}async changeEmail({newEmail:e,options:r}){const n=Iu(hce(this._client)).start(),{error:s}=await mce(n,e,r);return{error:s}}async deanonymize(e){const r=await this.waitUntilReady();if(e.signInMethod==="passwordless"){if(e.connection==="email"){const{error:n}=await t4(r,e.email,e.options);return{error:n}}if(e.connection==="sms"){const{error:n}=await r4(r,e.phoneNumber,e.options);return{error:n}}}if(e.signInMethod==="email-password"){const{error:n}=await HC(r,e.email,e.password,e.options);return{error:n}}throw Error("Unknown deanonymization method")}async addSecurityKey(e){const{error:r,key:n}=await pce(this._client,e);return{error:r,key:n}}async elevateEmailSecurityKey(e){if(!e)throw Error("A user email is required");return{...await yce(this._client,e),mfa:null}}async createPAT(e,r){return Nce(this._client,{expiresAt:e,metadata:r})}onTokenChanged(e){return this._client.subscribe(()=>{var r;const n=(r=this._client.interpreter)==null?void 0:r.onTransition(({event:s,context:i})=>{s.type==="TOKEN_CHANGED"&&e(lx(i))});return()=>n==null?void 0:n.stop()})}onAuthStateChanged(e){return this._client.subscribe(()=>{var r;const n=(r=this._client.interpreter)==null?void 0:r.onTransition(({event:s,context:i})=>{(s.type==="SIGNED_IN"||s.type==="SIGNED_OUT")&&e(s.type,lx(i))});return()=>n==null?void 0:n.stop()})}isAuthenticated(){var e;return!!((e=this._client.interpreter)!=null&&e.getSnapshot().matches({authentication:"signedIn"}))}async isAuthenticatedAsync(){return(await this.waitUntilReady()).getSnapshot().matches({authentication:"signedIn"})}getAuthenticationStatus(){var e;const r=((e=this.client.interpreter)==null?void 0:e.getSnapshot().context.importTokenAttempts)||0;return this.isReady()?{isAuthenticated:this.isAuthenticated(),isLoading:!1,connectionAttempts:r}:{isAuthenticated:!1,isLoading:!0,connectionAttempts:r}}getAccessToken(){var e,r;return(r=(e=this._client.interpreter)==null?void 0:e.getSnapshot().context.accessToken.value)!=null?r:void 0}getDecodedAccessToken(){const e=this.getAccessToken();return e?zz(e):null}getHasuraClaims(){var e;return((e=this.getDecodedAccessToken())==null?void 0:e["https://hasura.io/jwt/claims"])||null}getHasuraClaim(e){var r;return((r=this.getHasuraClaims())==null?void 0:r[e.startsWith("x-hasura-")?e:`x-hasura-${e}`])||null}async refreshSession(e){try{const r=await this.waitUntilReady();return new Promise(n=>{const s=e||r.getSnapshot().context.refreshToken.value;if(!s)return n({session:null,error:Wle});const{changed:i}=r.send("TRY_TOKEN",{token:s});if(!i)return n({session:null,error:Gle});r.onTransition(a=>{a.matches({token:{idle:"error"}})?n({session:null,error:Qle}):a.event.type==="TOKEN_CHANGED"&&n({session:lx(a.context),error:null})})})}catch(r){return{session:null,error:r.message}}}getSession(){var e,r;return lx((r=(e=this._client.interpreter)==null?void 0:e.getSnapshot())==null?void 0:r.context)}async initWithSession({session:e}){this.client.start({initialSession:e}),await this.waitUntilReady()}getUser(){var e,r,n;return((n=(r=(e=this._client.interpreter)==null?void 0:e.getSnapshot())==null?void 0:r.context)==null?void 0:n.user)||null}waitUntilReady(){const e=this._client.interpreter;if(!e)throw Error("Auth interpreter not set");return e.getSnapshot().hasTag("loading")?new Promise((r,n)=>{let s=setTimeout(()=>n("The state machine is not yet ready after 15 seconds."),15e3);e.onTransition(i=>{if(!i.hasTag("loading"))return clearTimeout(s),r(e)})}):Promise.resolve(e)}isReady(){var e,r;return!((r=(e=this._client.interpreter)==null?void 0:e.getSnapshot())!=null&&r.hasTag("loading"))}get client(){return this._client}};var zS,n4;function Tce(){return n4||(n4=1,zS=typeof self=="object"?self.FormData:window.FormData),zS}var Ace=Tce();const S8=ml(Ace);let s4=globalThis.fetch;const i4=async(t,e,{accessToken:r,name:n,fileId:s,bucketId:i,adminSecret:a,onUploadProgress:l,headers:c={}}={})=>{var d;const f={...c};i&&e.append("bucket-id",i),a&&(f["x-hasura-admin-secret"]=a),r&&(f.Authorization=`Bearer ${r}`);const p=`${t}/files`;if(typeof XMLHttpRequest>"u")try{e instanceof S8&&(s4=iT().fetch);const m=await s4(p,{method:"POST",headers:f,body:e}),g=await m.json();return m.ok?{fileMetadata:g,error:null}:{error:{status:m.status,message:((d=g==null?void 0:g.error)==null?void 0:d.message)||m.statusText,error:m.statusText},fileMetadata:null}}catch(m){return{error:{status:0,message:m.message,error:m.message},fileMetadata:null}}return new Promise(m=>{let g=new XMLHttpRequest;g.responseType="json",g.onload=()=>{var y,x,w,_,S,k,N,j;if(g.status<200||g.status>=300){const T={error:(S=(_=(x=(y=g.response)==null?void 0:y.error)==null?void 0:x.message)!=null?_:(w=g.response)==null?void 0:w.error)!=null?S:g.response,message:(j=(N=(k=g.response)==null?void 0:k.error)==null?void 0:N.message)!=null?j:g.response,status:g.status};return m({fileMetadata:null,error:T})}return m({fileMetadata:g.response,error:null})},g.onerror=()=>{const y={error:g.statusText,message:g.statusText,status:g.status};return m({fileMetadata:null,error:y})},l&&g.upload.addEventListener("progress",l,!1),g.open("POST",p,!0),Object.entries(f).forEach(([y,x])=>{g.setRequestHeader(y,x)}),g.send(e)})};function qC(t,e){if(!e||Object.keys(e).length===0)return t;const r=new URL(t),n=Object.entries(e).reduce((s,[i,a])=>({...s,[i.charAt(0)]:a}),{});return Object.entries(n).forEach(([s,i])=>{i&&r.searchParams.set(s,i)}),r.toString()}let Km;typeof Km>"u"&&(Km=iT().fetch);let Rce=class{constructor({url:e}){this.headers={},this.url=e}async uploadFormData({formData:e,bucketId:r,headers:n}){const{error:s,fileMetadata:i}=await i4(this.url,e,{bucketId:r,headers:{...this.headers,...n},accessToken:this.accessToken,adminSecret:this.adminSecret});return s?{fileMetadata:null,error:s}:i&&!("processedFiles"in i)?{fileMetadata:{processedFiles:[i]},error:null}:{fileMetadata:i,error:null}}async uploadFile({file:e,bucketId:r,id:n,name:s,headers:i}){const a=typeof window>"u"?new S8:new FormData;a.append("file[]",e),a.append("metadata[]",JSON.stringify({id:n,name:s}));const{error:l,fileMetadata:c}=await i4(this.url,a,{accessToken:this.accessToken,adminSecret:this.adminSecret,bucketId:r,fileId:n,name:s,headers:{...this.headers,...i}});return l?{fileMetadata:null,error:l}:c&&"processedFiles"in c?{fileMetadata:c.processedFiles[0],error:null}:{fileMetadata:c,error:null}}async downloadFile(e){try{const{fileId:r,headers:n,...s}=e,i=qC(`${this.url}/files/${r}`,s),a=await Km(i,{method:"GET",headers:{...this.generateAuthHeaders(),...this.headers,...n}});if(!a.ok)throw new Error(await a.text());return{file:await a.blob(),error:null}}catch(r){return{file:null,error:r}}}async getPresignedUrl(e){try{const{fileId:r,headers:n}=e,s=await Km(`${this.url}/files/${r}/presignedurl`,{method:"GET",headers:{...this.generateAuthHeaders(),...this.headers,...n}});if(!s.ok)throw new Error(await s.text());return{presignedUrl:await s.json(),error:null}}catch(r){return{presignedUrl:null,error:r}}}async delete(e){try{const{fileId:r,headers:n}=e,s=await Km(`${this.url}/files/${r}`,{method:"DELETE",headers:{...this.generateAuthHeaders(),...this.headers,...n}});if(!s.ok)throw new Error(await s.text());return{error:null}}catch(r){return{error:r}}}setAccessToken(e){return this.accessToken=e,this}setAdminSecret(e){return this.adminSecret=e,this}getHeaders(){return this.headers}setHeaders(e){return e?(this.headers={...this.headers,...e},this):this}unsetHeaders(){const e=this.headers["x-hasura-role"];return this.headers=e?{"x-hasura-role":e}:{},this}generateAuthHeaders(){if(!(!this.adminSecret&&!this.accessToken))return this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:{Authorization:`Bearer ${this.accessToken}`}}},Dce=class{constructor({url:e,adminSecret:r}){this.url=e,this.api=new Rce({url:e}),this.setAdminSecret(r)}async upload(e){return"file"in e?this.api.uploadFile(e):this.api.uploadFormData(e)}getPublicUrl(e){const{fileId:r,...n}=e;return qC(`${this.url}/files/${r}`,n)}async getPresignedUrl(e){const{fileId:r,headers:n,...s}=e,{presignedUrl:i,error:a}=await this.api.getPresignedUrl(e);if(a)return{presignedUrl:null,error:a};if(!i)return{presignedUrl:null,error:new Error("Invalid file id")};const l=qC(i.url,s);return{presignedUrl:{...i,url:l},error:null}}async download(e){const{file:r,error:n}=await this.api.downloadFile(e);return n?{file:null,error:n}:r?{file:r,error:null}:{file:null,error:new Error("File does not exist")}}async delete(e){const{error:r}=await this.api.delete(e);return r?{error:r}:{error:null}}setAccessToken(e){return this.api.setAccessToken(e),this}setAdminSecret(e){return this.api.setAdminSecret(e),this}getHeaders(){return this.api.getHeaders()}setHeaders(e){return this.api.setHeaders(e),this}unsetHeaders(){return this.api.unsetHeaders(),this}};function Oce(t,e){return e=e||{},new Promise(function(r,n){var s=new XMLHttpRequest,i=[],a=[],l={},c=function(){return{ok:(s.status/100|0)==2,statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:c,headers:{keys:function(){return i},entries:function(){return a},get:function(f){return l[f.toLowerCase()]},has:function(f){return f.toLowerCase()in l}}}};for(var d in s.open(e.method||"get",t,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(f,p,m){i.push(p=p.toLowerCase()),a.push([p,m]),l[p]=l[p]?l[p]+","+m:m}),r(c())},s.onerror=n,s.withCredentials=e.credentials=="include",e.headers)s.setRequestHeader(d,e.headers[d]);s.send(e.body||null)})}const Pce=Object.freeze(Object.defineProperty({__proto__:null,default:Oce},Symbol.toStringTag,{value:"Module"})),a4=z_(Pce);var US,o4;function Mce(){return o4||(o4=1,US=self.fetch||(self.fetch=a4.default||a4)),US}var Ice=Mce();const k8=ml(Ice);var Lce={};function $ce(t,e,r){return t.document?t:{document:t,variables:e,config:r}}function l4(t){var e;let r;const n=t.definitions.filter(s=>s.kind==="OperationDefinition");return n.length===1&&(r=(e=n[0].name)==null?void 0:e.value),r}function Bce(t){if(typeof t=="string"){let r;try{const n=TF(t);r=l4(n)}catch{}return{query:t,operationName:r}}const e=l4(t);return{query:Oj(t),operationName:e}}let Fce=class{constructor(e){this.headers={},this.isAccessTokenValidOrNull=()=>{if(!this.accessToken)return!0;try{const s=zz(this.accessToken);return s.exp!=null&&s.exp*1e3>Date.now()}catch(s){return console.error("Error decoding token:",s),!1}},this.awaitForValidAccessTokenOrNull=async()=>{if(this.isAccessTokenValidOrNull())return!0;const s=()=>this.isAccessTokenValidOrNull()?Promise.resolve(!0):new Promise(i=>{setTimeout(()=>s().then(i),100)});return s()};const{url:r,adminSecret:n}=e;this._url=r,this.accessToken=null,this.adminSecret=n}async request(e,...r){const[n,s]=r,i=$ce(e,n,s),{headers:a,...l}=s||{},{query:c,operationName:d}=Bce(i.document);typeof process<"u"&&!Lce.TEST_MODE&&await this.awaitForValidAccessTokenOrNull();try{const f=await k8(this.httpUrl,{method:"POST",body:JSON.stringify({operationName:d,query:c,variables:n}),headers:{"Content-Type":"application/json",...this.generateAccessTokenHeaders(),...this.headers,...a},...l});if(!f.ok)return{data:null,error:{error:f.statusText,message:f.statusText,status:f.status}};const{data:p,errors:m}=await f.json();return m?{data:null,error:m}:typeof p!="object"||Array.isArray(p)||p===null?{data:null,error:{error:"invalid-response",message:"incorrect response data from GraphQL server",status:0}}:{data:p,error:null}}catch(f){const p=f;return{data:null,error:{message:p.message,status:p.name==="AbortError"?0:500,error:p.name==="AbortError"?"abort-error":"unknown"}}}}get httpUrl(){return this._url}get wsUrl(){return this._url.replace(/^(http)(s?):\/\//,"ws$2://")}get url(){return this._url}getUrl(){return this._url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}getHeaders(){return this.headers}setHeaders(e){e&&(this.headers={...this.headers,...e})}unsetHeaders(){const e=this.headers["x-hasura-role"];this.headers=e?{"x-hasura-role":e}:{}}generateAccessTokenHeaders(){return this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:{}}};var E8={};const zce=/^((?<protocol>http[s]?):\/\/)?(?<host>(localhost|local))(:(?<port>(\d+|__\w+__)))?$/;function hb(t,e){const{subdomain:r,region:n}=t;if(!r)throw new Error("A `subdomain` must be set.");const s=r.match(zce);if(s!=null&&s.groups){const{protocol:i,host:a,port:l}=s.groups;return Hce(e)||(a==="localhost"?(console.warn('The `subdomain` is set to "localhost". Support for this will be removed in a future release. Please use "local" instead.'),`${i||"http"}://localhost:${l||1337}/v1/${e}`):l?`${i||"https"}://local.${e}.local.nhost.run:${l}/v1`:`${i||"https"}://local.${e}.local.nhost.run/v1`)}if(!n)throw new Error('`region` must be set when using a `subdomain` other than "local".');return`https://${r}.${e}.${n}.nhost.run/v1`}function Uce(){return typeof window<"u"}function Vce(){return typeof process<"u"&&E8}function Hce(t){return Uce()||!Vce()?null:E8[`NHOST_${t.toUpperCase()}_URL`]}function qce(t,e){const r=e.startsWith("/")?e:`/${e}`;return t+r}function Wce(t){const e="subdomain"in t?hb(t,"auth"):t.authUrl,{subdomain:r,region:n}=t;if(!e)throw new Error("Please provide `subdomain` or `authUrl`.");return new jce({url:e,broadcastKey:`${r}${n??"local"}`,...t})}function Gce(t){const e="subdomain"in t?hb(t,"functions"):t.functionsUrl;if(!e)throw new Error("Please provide `subdomain` or `functionsUrl`.");return new Kce({url:e,...t})}let Kce=class{constructor(e){this.headers={};const{url:r,adminSecret:n}=e;this.url=r,this.accessToken=null,this.adminSecret=n}async call(e,r,n){var s,i;const a={"Content-Type":"application/json",...this.generateAccessTokenHeaders(),...n==null?void 0:n.headers,...this.headers},l=qce(this.url,e);try{const c=await k8(l,{body:r?JSON.stringify(r):null,headers:a,method:"POST"});if(!c.ok){let f;return(s=c.headers.get("content-type"))!=null&&s.includes("application/json")?f=await c.json():f=await c.text(),{res:null,error:{message:f,error:c.statusText,status:c.status}}}let d;return(i=c.headers.get("content-type"))!=null&&i.includes("application/json")?d=await c.json():d=await c.text(),{res:{data:d,status:c.status,statusText:c.statusText},error:null}}catch(c){const d=c;return{res:null,error:{message:d.message,status:d.name==="AbortError"?0:500,error:d.name==="AbortError"?"abort-error":"unknown"}}}}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}getHeaders(){return this.headers}setHeaders(e){e&&(this.headers={...this.headers,...e})}unsetHeaders(){const e=this.headers["x-hasura-role"];this.headers=e?{"x-hasura-role":e}:{}}generateAccessTokenHeaders(){return this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:{}}};function Yce(t){const e="subdomain"in t?hb(t,"graphql"):t.graphqlUrl;if(!e)throw new Error("Please provide `subdomain` or `graphqlUrl`.");return new Fce({url:e,...t})}function Qce(t){const e="subdomain"in t?hb(t,"storage"):t.storageUrl;if(!e)throw new Error("Please provide `subdomain` or `storageUrl`.");return new Dce({url:e,...t})}let Xce=class{constructor({refreshIntervalTime:e,clientStorage:r,clientStorageType:n,autoRefreshToken:s,autoSignIn:i,adminSecret:a,devTools:l,start:c=!0,...d}){this.auth=Wce({refreshIntervalTime:e,clientStorage:r,clientStorageType:n,autoRefreshToken:s,autoSignIn:i,start:c,...d}),this.storage=Qce({adminSecret:a,...d}),this.functions=Gce({adminSecret:a,...d}),this.graphql=Yce({adminSecret:a,...d}),this.auth.onAuthStateChanged((f,p)=>{if(f==="SIGNED_OUT"){this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0);return}const m=p==null?void 0:p.accessToken;this.storage.setAccessToken(m),this.functions.setAccessToken(m),this.graphql.setAccessToken(m)}),this.auth.onTokenChanged(f=>{const p=f==null?void 0:f.accessToken;this.storage.setAccessToken(p),this.functions.setAccessToken(p),this.graphql.setAccessToken(p)}),this._adminSecret=a,this.devTools=l}get adminSecret(){return this._adminSecret}set adminSecret(e){this._adminSecret=e,this.storage.setAdminSecret(e)}setRole(e){this.graphql.setHeaders({"x-hasura-role":e}),this.storage.setHeaders({"x-hasura-role":e}),this.functions.setHeaders({"x-hasura-role":e})}unsetRole(){this.graphql.setHeaders((({"x-hasura-role":e,...r})=>r)(this.graphql.getHeaders())),this.storage.setHeaders((({"x-hasura-role":e,...r})=>r)(this.storage.getHeaders())),this.functions.setHeaders((({"x-hasura-role":e,...r})=>r)(this.functions.getHeaders()))}};var VS={exports:{}},HS={},qS={exports:{}},WS={};/**
|
||
* @license React
|
||
* use-sync-external-store-shim.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var c4;function Zce(){if(c4)return WS;c4=1;var t=ff();function e(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,s=t.useEffect,i=t.useLayoutEffect,a=t.useDebugValue;function l(p,m){var g=m(),y=n({inst:{value:g,getSnapshot:m}}),x=y[0].inst,w=y[1];return i(function(){x.value=g,x.getSnapshot=m,c(x)&&w({inst:x})},[p,g,m]),s(function(){return c(x)&&w({inst:x}),p(function(){c(x)&&w({inst:x})})},[p]),a(g),g}function c(p){var m=p.getSnapshot;p=p.value;try{var g=m();return!r(p,g)}catch{return!0}}function d(p,m){return m()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return WS.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,WS}var u4;function Jce(){return u4||(u4=1,qS.exports=Zce()),qS.exports}/**
|
||
* @license React
|
||
* use-sync-external-store-shim/with-selector.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var d4;function eue(){if(d4)return HS;d4=1;var t=ff(),e=Jce();function r(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:r,s=e.useSyncExternalStore,i=t.useRef,a=t.useEffect,l=t.useMemo,c=t.useDebugValue;return HS.useSyncExternalStoreWithSelector=function(d,f,p,m,g){var y=i(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=l(function(){function _(T){if(!S){if(S=!0,k=T,T=m(T),g!==void 0&&x.hasValue){var D=x.value;if(g(D,T))return N=D}return N=T}if(D=N,n(k,T))return D;var I=m(T);return g!==void 0&&g(D,I)?(k=T,D):(k=T,N=I)}var S=!1,k,N,j=p===void 0?null:p;return[function(){return _(f())},j===null?void 0:function(){return _(j())}]},[f,p,m,g]);var w=s(d,y[0],y[1]);return a(function(){x.hasValue=!0,x.value=w},[w]),c(w),w},HS}var h4;function tue(){return h4||(h4=1,VS.exports=eue()),VS.exports}var rue=tue(),nue=E.useLayoutEffect;function f4(t){var e=E.useRef();return e.current||(e.current={v:t()}),e.current.v}var K0=function(){return K0=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},K0.apply(this,arguments)},sue=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r},iue=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],a;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){a={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i};function aue(t,e){var r=f4(function(){return typeof t=="function"?t():t}),n=e.context,s=e.guards,i=e.actions,a=e.activities,l=e.services,c=e.delays;e.state;var d=sue(e,["context","guards","actions","activities","services","delays","state"]),f=f4(function(){var p={context:n,guards:s,actions:i,activities:a,services:l,delays:c},m=r.withConfig(p,function(){return K0(K0({},r.context),n)});return Iu(m,d)});return nue(function(){Object.assign(f.machine.options.actions,i),Object.assign(f.machine.options.guards,s),Object.assign(f.machine.options.activities,a),Object.assign(f.machine.options.services,l),Object.assign(f.machine.options.delays,c)},[i,s,a,l,c]),f}function fb(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=iue(e,2),s=n[0],i=s===void 0?{}:s,a=n[1],l=aue(t,i);return E.useEffect(function(){if(a){var c=l.subscribe(Gm(a));return function(){c.unsubscribe()}}},[a]),E.useEffect(function(){var c=i.state;return l.start(c?ca.create(c):void 0),function(){l.stop(),l.status=Nn.NotStarted}},[]),l}function oue(t){return t.status!==0?t.getSnapshot():t.machine.initialState}function lue(t){return"state"in t&&"machine"in t}function cue(t){return"state"in t}var uue=function(t,e){return t===e},due=function(t,e){if(lue(t)){if(t.status===0&&e.current)return e.current;var r=oue(t);return e.current=t.status===0?r:null,r}return cue(t)?t.state:void 0};function zt(t,e,r,n){r===void 0&&(r=uue);var s=E.useRef(null),i=E.useCallback(function(c){var d=t.subscribe(c).unsubscribe;return d},[t]),a=E.useCallback(function(){return due(t,s)},[t,n]),l=rue.useSyncExternalStoreWithSelector(i,a,a,e,r);return l}const hue=Xce;let fue=class extends hue{constructor(e){super({...e,start:!1})}};const oT=E.createContext({}),pue=({nhost:t,initial:e,...r})=>{const n=fb(t.auth.client.machine,{devTools:t.devTools});t.auth.client.start({interpreter:n,initialSession:e,devTools:t.devTools});const s=E.useRef(!0);return E.useEffect(()=>{s.current?s.current=!1:e&&n.send("SESSION_UPDATE",{data:{session:e}})},[e,n]),Ss.createElement(oT.Provider,{value:t},r.children)},cd=()=>{var t;const e=(t=E.useContext(oT).auth)==null?void 0:t.client.interpreter;if(!e)throw Error("Could not find the Nhost auth client. Did you wrap your app in <NhostProvider />?");return e},pb=()=>{const t=cd();return zt(t,e=>({isAuthenticated:e.matches({authentication:"signedIn"}),isLoading:e.hasTag("loading"),error:e.context.errors.authentication||null,isError:e.matches({authentication:{signedOut:"failed"}}),connectionAttempts:e.context.importTokenAttempts}),(e,r)=>e.isAuthenticated===r.isAuthenticated&&e.isLoading===r.isLoading&&e.connectionAttempts===r.connectionAttempts)},bo=()=>{const t=cd();return zt(t,e=>e.context.accessToken.value)},mb=()=>E.useContext(oT),C8=()=>{const t=mb(),e=E.useMemo(()=>p8(t.auth.client),[t]),r=fb(e),n=zt(r,l=>l.matches({idle:"error"})),s=zt(r,l=>l.matches({idle:"success"})),i=zt(r,l=>l.context.error),a=zt(r,l=>l.matches("requesting"));return{changePassword:l=>v8(r,l),isLoading:a,isSuccess:s,isError:n,error:i}},mue=t=>{const e=mb(),r=E.useMemo(()=>m8(e.auth.client),[e]),n=fb(r),s=zt(n,c=>c.matches("requesting")),i=zt(n,c=>c.context.error),a=zt(n,c=>c.matches("idle.error")),l=zt(n,c=>c.matches("idle.success"));return{resetPassword:(c,d=t)=>y8(n,c,d),isLoading:s,isSent:l,isError:a,error:i}},gue=t=>{const e=mb(),r=E.useMemo(()=>g8(e.auth.client),[e]),n=fb(r),s=zt(n,c=>c.matches({idle:"error"})),i=zt(n,c=>c.matches({idle:"success"})),a=zt(n,c=>c.context.error),l=zt(n,c=>c.matches("requesting"));return{sendEmail:(c,d=t)=>x8(n,c,d),isLoading:l,isSent:i,isError:s,error:a}},vue=()=>{const t=cd(),e=(g,y)=>_8(t,g,y),r=g=>b8(t,g),n=zt(t,g=>g.context.user,(g,y)=>(g==null?void 0:g.id)===(y==null?void 0:y.id)),s=zt(t,g=>g.context.accessToken.value),i=zt(t,g=>g.context.refreshToken.value),a=zt(t,g=>g.context.errors.authentication||null,(g,y)=>(g==null?void 0:g.error)===(y==null?void 0:y.error)),l=zt(t,g=>g.matches({authentication:"signedIn"})),c=zt(t,g=>g.matches({authentication:{authenticating:"password"}}),(g,y)=>g===y),d=zt(t,g=>g.matches({authentication:{signedOut:"noErrors"},registration:{incomplete:"needsEmailVerification"}}),(g,y)=>g===y),f=zt(t,g=>g.matches({authentication:{signedOut:"needsMfa"}}),(g,y)=>g===y),p=zt(t,g=>g.matches({authentication:{signedOut:"failed"}}),(g,y)=>g===y),m=zt(t,g=>g.context.mfa);return{accessToken:s,refreshToken:i,error:a,isError:p,isLoading:c,isSuccess:l,needsEmailVerification:d,needsMfaOtp:f,mfa:m,sendMfaOtp:r,signInEmailPassword:e,user:n}},yl=()=>{const t=cd();return zt(t,e=>e.context.user,(e,r)=>(e&&JSON.stringify(e))===(r&&JSON.stringify(r)))},N8=(t=!1)=>{const e=cd(),r=i=>w8(e,typeof i=="boolean"?i:t),n=zt(e,i=>i.matches({authentication:{signedOut:"success"}}),(i,a)=>i===a),s=zt(e,i=>i.context.errors.signout||null,(i,a)=>(i==null?void 0:i.error)===(a==null?void 0:a.error));return{signOut:r,isSuccess:n,error:s}},yue=t=>{const e=cd(),r=zt(e,p=>!!p.context.errors.registration),n=zt(e,p=>p.context.errors.registration||null,(p,m)=>(p==null?void 0:p.error)===(m==null?void 0:m.error)),s=zt(e,p=>p.matches("registration.emailPassword")),i=zt(e,p=>p.matches("registration.incomplete.needsEmailVerification")),a=zt(e,p=>p.matches({authentication:"signedIn",registration:"complete"})),l=(p,m,g=t,y)=>HC(e,p,m,g,y),c=zt(e,p=>p.context.user,(p,m)=>(p==null?void 0:p.id)===(m==null?void 0:m.id)),d=zt(e,p=>p.context.accessToken.value),f=zt(e,p=>p.context.refreshToken.value);return{accessToken:d,refreshToken:f,error:n,isError:r,isLoading:s,isSuccess:a,needsEmailVerification:i,signUpEmailPassword:l,user:c}},j8=()=>{const t=cd();return zt(t,e=>{var r;return(r=e.context.user)==null?void 0:r.id},(e,r)=>e===r)};function Ir(t){var r,n,s,i;const e=(i=(s=(n=(r=t==null?void 0:t.extensions)==null?void 0:r.internal)==null?void 0:n.response)==null?void 0:s.body)==null?void 0:i.error;return typeof e=="string"&&e.trim()?e.trim():(t==null?void 0:t.message)||"An unknown error occurred"}const xue=Et`
|
||
subscription GetResources($userId: uuid) {
|
||
ghaymah_cloud_resources(
|
||
where: {
|
||
user_id: { _eq: $userId },
|
||
deleted: { _eq: false }
|
||
}
|
||
order_by: { updated_at: desc }
|
||
) {
|
||
id
|
||
user_id
|
||
chart_name
|
||
chart_version
|
||
values
|
||
status
|
||
message
|
||
created_at
|
||
updated_at
|
||
deleted
|
||
}
|
||
}
|
||
`,_ue=Et`
|
||
subscription GetManagedResources($userId: uuid) {
|
||
ghaymah_cloud_managed_resources(
|
||
where: {
|
||
user_id: { _eq: $userId }
|
||
}
|
||
order_by: { created_at: desc }
|
||
) {
|
||
id
|
||
user_id
|
||
values
|
||
status
|
||
created_at
|
||
updated_at
|
||
}
|
||
}
|
||
`,bue=Et`
|
||
mutation CreateResourceWithId(
|
||
$id: uuid!,
|
||
$userId: uuid!,
|
||
$chartName: String!,
|
||
$chartVersion: String!,
|
||
$values: json!
|
||
) {
|
||
insert_ghaymah_cloud_resources_one(
|
||
object: {
|
||
id: $id,
|
||
user_id: $userId,
|
||
chart_name: $chartName,
|
||
chart_version: $chartVersion,
|
||
values: $values
|
||
}
|
||
) {
|
||
id
|
||
}
|
||
}
|
||
`,wue=Et`
|
||
mutation CreateResource(
|
||
$userId: uuid!,
|
||
$chartName: String!,
|
||
$chartVersion: String!,
|
||
$values: json!
|
||
) {
|
||
insert_ghaymah_cloud_resources_one(
|
||
object: {
|
||
user_id: $userId,
|
||
chart_name: $chartName,
|
||
chart_version: $chartVersion,
|
||
values: $values
|
||
}
|
||
) {
|
||
id
|
||
}
|
||
}
|
||
`,Sue=Et`
|
||
mutation UpdateResourceValues($id: uuid!, $values: json!) {
|
||
update_ghaymah_cloud_resources_by_pk(
|
||
pk_columns: { id: $id },
|
||
_set: { values: $values }
|
||
) {
|
||
id
|
||
}
|
||
}
|
||
`,kue=Et`
|
||
mutation DeleteResource($id: uuid!) {
|
||
update_ghaymah_cloud_resources_by_pk(
|
||
pk_columns: { id: $id },
|
||
_set: { deleted: true }
|
||
) {
|
||
id
|
||
}
|
||
}
|
||
`,Eue=Et`
|
||
mutation GeneratePat($duration: String!) {
|
||
GeneratePAT(arg1: { duration: $duration } ) {
|
||
personalAccessToken
|
||
|
||
}
|
||
}
|
||
`,Cue=Et`
|
||
mutation CreatePostgresDb(
|
||
$name: String!
|
||
$dbName: String!
|
||
$username: String!
|
||
$password: String!
|
||
) {
|
||
createPostgresDb(
|
||
arg1: {
|
||
name: $name
|
||
dbName: $dbName
|
||
username: $username
|
||
password: $password
|
||
}
|
||
) {
|
||
name
|
||
url
|
||
alias
|
||
status
|
||
id
|
||
}
|
||
}
|
||
`,Nue=Et`
|
||
mutation DeletePostgresDb($dbId: String!, $mrId: String!) {
|
||
deletePostgresDb(
|
||
arg1: {
|
||
dbId: $dbId,
|
||
mrId: $mrId
|
||
}
|
||
) {
|
||
output
|
||
}
|
||
}
|
||
`,jue=Et`
|
||
mutation CreateS3Bucket($name: String!, $maxSize: Int!) {
|
||
createS3Bucket(
|
||
arg1: {
|
||
name: $name
|
||
maxSize: $maxSize
|
||
}
|
||
) {
|
||
id
|
||
name
|
||
endpoint
|
||
max_size
|
||
status
|
||
keys {
|
||
id
|
||
access_key_id
|
||
secret_access_key
|
||
endpoint
|
||
read
|
||
write
|
||
owner
|
||
}
|
||
}
|
||
}
|
||
`,Tue=Et`
|
||
mutation ListS3Buckets {
|
||
listS3Buckets {
|
||
id
|
||
name
|
||
endpoint
|
||
max_size
|
||
description
|
||
}
|
||
}
|
||
`,Aue=Et`
|
||
mutation DeleteS3Bucket($bucketId: String!) {
|
||
deleteS3Bucket(arg1: { bucketId: $bucketId }) {
|
||
output
|
||
}
|
||
}
|
||
`,Rue=Et`
|
||
mutation ListS3BucketKeys($bucketId: String!) {
|
||
listS3BucketKeys(arg1: { bucketId: $bucketId }) {
|
||
id
|
||
access_key_id
|
||
secret_access_key
|
||
endpoint
|
||
read
|
||
write
|
||
owner
|
||
}
|
||
}
|
||
`,Due=Et`
|
||
mutation RotateS3BucketKey($bucketId: String!) {
|
||
rotateS3BucketKey(arg1: { bucketId: $bucketId }) {
|
||
id
|
||
access_key_id
|
||
secret_access_key
|
||
endpoint
|
||
read
|
||
write
|
||
owner
|
||
}
|
||
}
|
||
`,Oue=Et`
|
||
mutation DeleteS3BucketKey($bucketId: String!, $keyId: String!) {
|
||
deleteS3BucketKey(arg1: { bucketId: $bucketId, keyId: $keyId }) {
|
||
output
|
||
}
|
||
}
|
||
`,Pue=Et`
|
||
mutation ListPostgresDb {
|
||
listPostgresDb {
|
||
id
|
||
name
|
||
url
|
||
alias
|
||
status
|
||
postgres_user
|
||
postgres_db
|
||
postgres_version
|
||
size
|
||
}
|
||
}
|
||
`,Mue=Et`
|
||
mutation ListApps {
|
||
listApps {
|
||
id
|
||
name
|
||
image
|
||
alias
|
||
url
|
||
args
|
||
cpu
|
||
memory
|
||
status
|
||
instances
|
||
hibernated
|
||
ephemeral
|
||
pull_secret_id
|
||
ports {
|
||
name
|
||
number
|
||
hostname
|
||
health {
|
||
path
|
||
interval
|
||
timeout
|
||
}
|
||
}
|
||
env {
|
||
name
|
||
value
|
||
is_secret
|
||
file_path
|
||
}
|
||
mounts {
|
||
volume_id
|
||
path
|
||
}
|
||
tags {
|
||
key
|
||
value
|
||
}
|
||
created_at
|
||
updated_at
|
||
}
|
||
}
|
||
`,Iue=Et`
|
||
mutation ListVolumes {
|
||
listVolumes {
|
||
id
|
||
project_id
|
||
name
|
||
size
|
||
created_at
|
||
}
|
||
}
|
||
`,Lue=Et`
|
||
mutation ListPullSecrets {
|
||
listPullSecrets {
|
||
id
|
||
project_id
|
||
server
|
||
username
|
||
created_at
|
||
updated_at
|
||
}
|
||
}
|
||
`,$ue=Et`
|
||
mutation CreatePullSecret($server: String!, $username: String!, $password: String!) {
|
||
createPullSecret(arg1: { server: $server, username: $username, password: $password }) {
|
||
id
|
||
server
|
||
username
|
||
}
|
||
}
|
||
`,Bue=Et`
|
||
mutation DeletePullSecret($id: String!) {
|
||
deletePullSecret(arg1: { id: $id }) {
|
||
output
|
||
}
|
||
}
|
||
`,Fue=Et`
|
||
mutation ListSecrets {
|
||
listSecrets {
|
||
id
|
||
project_id
|
||
name
|
||
created_at
|
||
updated_at
|
||
}
|
||
}
|
||
`,zue=Et`
|
||
mutation CreateSecret($name: String!, $value: String!) {
|
||
createSecret(arg1: { name: $name, value: $value }) {
|
||
id
|
||
name
|
||
}
|
||
}
|
||
`,Uue=Et`
|
||
mutation DeleteSecret($id: String!) {
|
||
deleteSecret(arg1: { id: $id }) {
|
||
output
|
||
}
|
||
}
|
||
`,Vue=Et`
|
||
mutation CreateApp($arg1: CreateAppInput!) {
|
||
createApp(arg1: $arg1) {
|
||
id
|
||
name
|
||
image
|
||
alias
|
||
url
|
||
args
|
||
cpu
|
||
memory
|
||
status
|
||
instances
|
||
hibernated
|
||
ephemeral
|
||
pull_secret_id
|
||
ports {
|
||
name
|
||
number
|
||
hostname
|
||
health {
|
||
path
|
||
interval
|
||
timeout
|
||
}
|
||
}
|
||
env {
|
||
name
|
||
value
|
||
is_secret
|
||
file_path
|
||
}
|
||
mounts {
|
||
volume_id
|
||
path
|
||
}
|
||
tags {
|
||
key
|
||
value
|
||
}
|
||
}
|
||
}
|
||
`,Hue=Et`
|
||
mutation UpdateApp($arg1: UpdateAppInput!) {
|
||
updateApp(arg1: $arg1) {
|
||
id
|
||
name
|
||
image
|
||
alias
|
||
url
|
||
args
|
||
cpu
|
||
memory
|
||
status
|
||
instances
|
||
hibernated
|
||
ephemeral
|
||
pull_secret_id
|
||
ports {
|
||
name
|
||
number
|
||
hostname
|
||
health {
|
||
path
|
||
interval
|
||
timeout
|
||
}
|
||
}
|
||
env {
|
||
name
|
||
value
|
||
is_secret
|
||
file_path
|
||
}
|
||
mounts {
|
||
volume_id
|
||
path
|
||
}
|
||
tags {
|
||
key
|
||
value
|
||
}
|
||
}
|
||
}
|
||
`,que=Et`
|
||
mutation DeleteApp($id: String!) {
|
||
deleteApp(arg1: { id: $id }) {
|
||
output
|
||
}
|
||
}
|
||
`,Wue=Et`
|
||
mutation CreateVolume($name: String!, $size: Int!) {
|
||
createVolume(arg1: { name: $name, size: $size }) {
|
||
id
|
||
project_id
|
||
name
|
||
size
|
||
created_at
|
||
}
|
||
}
|
||
`,Gue=Et`
|
||
mutation DeleteVolume($id: String!) {
|
||
deleteVolume(arg1: { id: $id }) {
|
||
output
|
||
}
|
||
}
|
||
`,Kue=Et`
|
||
mutation AppLogs($appId: String!, $max: Int!) {
|
||
appLogs(arg1: { appId: $appId, max: $max }) {
|
||
timestamp
|
||
message
|
||
source
|
||
severity
|
||
}
|
||
}
|
||
`,ks={PROJECT:"ghaymah-project",APP:"ghaymah-app",CREDENTIAL:"ghaymah-credential",VOLUME:"ghaymah-volume",DNS:"ghaymah-dns",S3_BUCKET:"ghaymah-s3-bucket",S3_KEY:"ghaymah-s3-key"},Jd={CHART_PROJECT_VERSION:"0.0",CHART_APP_VERSION:"0.1",CHART_VOLUME_VERSION:"0.0",CHART_DNS_VERSION:"0.0",CHART_S3_BUCKET_VERSION:"0.0",CHART_S3_KEY_VERSION:"0.0"};async function WC(t,e){const r=`${t}-${e}`,n=new TextEncoder().encode(r);try{const s=await crypto.subtle.digest("SHA-256",n),i=Array.from(new Uint8Array(s)).map(a=>a.toString(16).padStart(2,"0")).join("").substring(0,12);return`${t}-${i}`}catch{return t}}const Y0={GITLAB:"gitlab",DOCKERHUB:"dockerhub"};function T8(t){return t.chart_name===ks.APP}function GC(t){return t.chart_name===ks.CREDENTIAL}function p4(t){return t.chart_name===ks.PROJECT}function Yue(t){return t.chart_name===ks.VOLUME}function Que(t){return t.chart_name===ks.DNS}function m4(t){return t.chart_name===ks.S3_BUCKET}function g4(t){return t.chart_name===ks.S3_KEY}const A8=E.createContext(void 0);function Xue({children:t}){const e=yl(),r=bo(),n=e==null?void 0:e.id,[s,i]=E.useState([]),[a,l]=E.useState([]),[c,d]=E.useState(!1),[f,p]=E.useState(null),{data:m,loading:g,error:y}=wg(xue,{variables:{userId:n},skip:!n||!r}),{data:x,loading:w,error:_}=wg(_ue,{variables:{userId:n},skip:!n||!r}),[S]=hr(wue),[k]=hr(bue),[N]=hr(Sue),[j]=hr(kue),[T]=hr(Eue),[D]=hr(Cue),[I]=hr(Nue),[L]=hr(jue),[$]=hr(Tue),[Q]=hr(Aue),[M]=hr(Rue),[z]=hr(Due),[R]=hr(Oue),[B]=hr(Pue),[V]=hr(Mue),[F]=hr(Iue),[K]=hr(Lue),[Y]=hr($ue),[O]=hr(Bue),[H]=hr(Fue),[G]=hr(zue),[q]=hr(Uue),[J]=hr(Vue),[te]=hr(Hue),[ve]=hr(que),[he]=hr(Wue),[xe]=hr(Gue),[ke]=hr(Kue);E.useEffect(()=>{y&&console.error("Resources subscription error:",y)},[y]),E.useEffect(()=>{m!=null&&m.ghaymah_cloud_resources&&(jt("Resources",`Received ${m.ghaymah_cloud_resources.length} resources`,m.ghaymah_cloud_resources),i(m.ghaymah_cloud_resources))},[m]),E.useEffect(()=>{console.log("Managed resources subscription data:",x),x!=null&&x.ghaymah_cloud_managed_resources&&(jt("Managed Resources",`Received ${x.ghaymah_cloud_managed_resources.length} managed resources`,x.ghaymah_cloud_managed_resources),l(x.ghaymah_cloud_managed_resources))},[x]),E.useEffect(()=>{r||(jt("Auth","Access token removed, clearing data"),i([]))},[r]);const[Oe,He]=E.useState([]),[Ye,lt]=E.useState([]),[P,ne]=E.useState([]),[X,W]=E.useState([]);E.useEffect(()=>{const je=async()=>{const Qe=s.filter(T8),sr=await Promise.all(Qe.map(async dn=>{const ms=await WC(dn.values.name,dn.id);return{...dn,uniqueName:ms}}));He(sr)},be=async()=>{const Qe=s.filter(Yue),sr=await Promise.all(Qe.map(async dn=>{const ms=await WC(dn.values.name,dn.id);return{...dn,uniqueName:ms}}));lt(sr)},Ue=()=>{const Qe=s.filter(m4),sr=s.filter(g4);ne(Qe),W(sr)};s.length>0?(je(),be(),Ue()):(He([]),lt([]),ne([]),W([]))},[s]);const Z=s.filter(GC),re=s.filter(p4),ae=je=>s.filter(be=>be.chart_name===je),fe=je=>{console.log(`Looking for resource ${je} in ${s.length} resources`);const be=s.find(Ue=>Ue.id===je);return console.log(`Resource ${je} found:`,be?"yes":"no"),be&&console.log(`Resource ${je} status:`,be.status),be},oe=je=>Oe.find(be=>be.id===je),Ae=je=>{const be=fe(je);return be&&GC(be)?be:void 0},Ne=je=>{const be=fe(je);return be&&p4(be)?be:void 0},Le=async je=>{var be,Ue;if(!n){jt("Actions","Cannot create resource: No user ID");return}d(!0),p(null);try{const Qe={userId:n,chartName:je.chart_name,chartVersion:je.chart_version,values:je.values};let sr;je.id!==void 0?(Qe.id=je.id,sr=await k({variables:Qe})):sr=await S({variables:Qe});const dn=(Ue=(be=sr.data)==null?void 0:be.insert_ghaymah_cloud_resources_one)==null?void 0:Ue.id;return jt("Actions",`Created resource: ${dn}`,sr.data),dn}catch(Qe){jt("Actions","Error creating resource",Qe),p(Qe);return}finally{d(!1)}},pe=async(je,be)=>{d(!0),p(null);try{return await N({variables:{id:je,values:be}}),jt("Actions",`Updated resource values: ${je}`),!0}catch(Ue){return jt("Actions","Error updating resource values",Ue),p(Ue),!1}finally{d(!1)}},De=async je=>{d(!0),p(null);try{return await j({variables:{id:je}}),jt("Actions",`Deleted resource: ${je}`),!0}catch(be){return jt("Actions","Error deleting resource",be),p(be),!1}finally{d(!1)}},qe=async je=>Le({chart_name:ks.APP,chart_version:Jd.CHART_APP_VERSION,values:je.values,id:je.id}),mt=async je=>Le({chart_name:ks.PROJECT,chart_version:Jd.CHART_PROJECT_VERSION,values:je.values,id:je.id}),Ot=async je=>Le({chart_name:ks.VOLUME,chart_version:Jd.CHART_VOLUME_VERSION,values:je.values,id:je.id}),wr=async(je,be)=>pe(je,be),Xn=async(je,be)=>pe(je,be),Tt=async je=>Le({chart_name:ks.DNS,chart_version:Jd.CHART_DNS_VERSION,values:je.values,id:je.id}),Sr=async(je,be)=>pe(je,be),si=async je=>{var be;d(!0),p(null);try{const Ue=await T({variables:{duration:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return(be=Ue.data)==null?void 0:be.GeneratePAT}catch(Ue){p(Ue);return}finally{d(!1)}},qt=je=>Ye.find(be=>be.id===je),jr=je=>{const be=fe(je);return be&&Que(be)?be:void 0},As=je=>{const be=fe(je);return be&&m4(be)?be:void 0},Uf=je=>{const be=fe(je);return be&&g4(be)?be:void 0},Vf=async je=>Le({chart_name:ks.S3_BUCKET,chart_version:Jd.CHART_S3_BUCKET_VERSION,values:je.values,id:je.id}),Eo=async je=>Le({chart_name:ks.S3_KEY,chart_version:Jd.CHART_S3_KEY_VERSION,values:je.values,id:je.id}),bi=async(je,be)=>pe(je,be),Ws=async(je,be)=>pe(je,be),md=async(je,be,Ue,Qe)=>{var sr;d(!0),p(null);try{const dn=await D({variables:{name:je,dbName:be,username:Ue,password:Qe}});if(dn.errors)throw new Error(Ir(dn.errors[0]));if((sr=dn.data)!=null&&sr.createPostgresDb){const ms=dn.data.createPostgresDb;return{name:ms.name||je,url:ms.url||"",status:ms.status||"synced",id:ms.id}}return}catch(dn){p(dn);return}finally{d(!1)}},zc=async(je,be)=>{var Ue;d(!0),p(null);try{const Qe=await I({variables:{dbId:je,mrId:be}});if(Qe.errors)throw new Error(Ir(Qe.errors[0]));return(Ue=Qe.data)!=null&&Ue.deletePostgresDb?{output:Qe.data.deletePostgresDb.output}:void 0}catch(Qe){p(Qe);return}finally{d(!1)}},tw=E.useCallback(async(je,be)=>{var Ue;d(!0),p(null);try{const Qe=Math.round(be/1048576),sr=await L({variables:{name:je,maxSize:Qe}});if(sr.errors)throw new Error(Ir(sr.errors[0]));return(Ue=sr.data)==null?void 0:Ue.createS3Bucket}catch(Qe){p(Qe);return}finally{d(!1)}},[L]),Ov=E.useCallback(async()=>{var je;d(!0),p(null);try{const be=await $();if(be.errors)throw new Error(Ir(be.errors[0]));return((je=be.data)==null?void 0:je.listS3Buckets)??[]}catch(be){p(be);return}finally{d(!1)}},[$]),Pv=E.useCallback(async je=>{var be;d(!0),p(null);try{const Ue=await Q({variables:{bucketId:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return(be=Ue.data)==null?void 0:be.deleteS3Bucket}catch(Ue){p(Ue);return}finally{d(!1)}},[Q]),Hf=E.useCallback(async je=>{var be;d(!0),p(null);try{const Ue=await M({variables:{bucketId:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return((be=Ue.data)==null?void 0:be.listS3BucketKeys)??[]}catch(Ue){p(Ue);return}finally{d(!1)}},[M]),Uc=E.useCallback(async je=>{var be;d(!0),p(null);try{const Ue=await z({variables:{bucketId:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return(be=Ue.data)==null?void 0:be.rotateS3BucketKey}catch(Ue){p(Ue);return}finally{d(!1)}},[z]),rw=E.useCallback(async(je,be)=>{var Ue;d(!0),p(null);try{const Qe=await R({variables:{bucketId:je,keyId:be}});if(Qe.errors)throw new Error(Ir(Qe.errors[0]));return(Ue=Qe.data)==null?void 0:Ue.deleteS3BucketKey}catch(Qe){p(Qe);return}finally{d(!1)}},[R]),Mv=E.useCallback(async()=>{var je;d(!0),p(null);try{const be=await B();if(be.errors)throw new Error(Ir(be.errors[0]));return((je=be.data)==null?void 0:je.listPostgresDb)??[]}catch(be){p(be);return}finally{d(!1)}},[B]),Iv=E.useCallback(async()=>{var je;d(!0),p(null);try{const be=await V();if(be.errors)throw new Error(Ir(be.errors[0]));return((je=be.data)==null?void 0:je.listApps)??[]}catch(be){p(be);return}finally{d(!1)}},[V]),Lv=E.useCallback(async()=>{var je;d(!0),p(null);try{const be=await F();if(be.errors)throw new Error(Ir(be.errors[0]));return((je=be.data)==null?void 0:je.listVolumes)??[]}catch(be){p(be);return}finally{d(!1)}},[F]),$v=E.useCallback(async()=>{var je;d(!0),p(null);try{const be=await K();if(be.errors)throw new Error(Ir(be.errors[0]));return((je=be.data)==null?void 0:je.listPullSecrets)??[]}catch(be){p(be);return}finally{d(!1)}},[K]),nw=E.useCallback(async(je,be,Ue)=>{var Qe;d(!0),p(null);try{const sr=await Y({variables:{server:je,username:be,password:Ue}});if(sr.errors)throw new Error(Ir(sr.errors[0]));return(Qe=sr.data)==null?void 0:Qe.createPullSecret}catch(sr){p(sr);return}finally{d(!1)}},[Y]),Fa=E.useCallback(async je=>{var be;d(!0),p(null);try{const Ue=await O({variables:{id:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return(be=Ue.data)==null?void 0:be.deletePullSecret}catch(Ue){p(Ue);return}finally{d(!1)}},[O]),Mn=E.useCallback(async()=>{var je;d(!0),p(null);try{const be=await H();if(be.errors)throw new Error(Ir(be.errors[0]));return((je=be.data)==null?void 0:je.listSecrets)??[]}catch(be){p(be);return}finally{d(!1)}},[H]),ps=E.useCallback(async(je,be)=>{var Ue;d(!0),p(null);try{const Qe=await G({variables:{name:je,value:be}});if(Qe.errors)throw new Error(Ir(Qe.errors[0]));return(Ue=Qe.data)==null?void 0:Ue.createSecret}catch(Qe){p(Qe);return}finally{d(!1)}},[G]),kl=E.useCallback(async je=>{var be;d(!0),p(null);try{const Ue=await q({variables:{id:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return(be=Ue.data)==null?void 0:be.deleteSecret}catch(Ue){p(Ue);return}finally{d(!1)}},[q]),qf=E.useCallback(async je=>{var be;d(!0),p(null);try{const Ue=await J({variables:{arg1:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return(be=Ue.data)==null?void 0:be.createApp}catch(Ue){p(Ue);return}finally{d(!1)}},[J]),sw=E.useCallback(async je=>{var be;d(!0),p(null);try{const Ue=await ve({variables:{id:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return(be=Ue.data)==null?void 0:be.deleteApp}catch(Ue){p(Ue);return}finally{d(!1)}},[ve]),iw=E.useCallback(async(je,be)=>{var Ue;d(!0),p(null);try{const Qe=await te({variables:{arg1:{id:je,...be}}});if(Qe.errors)throw new Error(Ir(Qe.errors[0]));return(Ue=Qe.data)==null?void 0:Ue.updateApp}catch(Qe){p(Qe);return}finally{d(!1)}},[te]),Bv=E.useCallback(async(je,be)=>{var Ue;d(!0),p(null);try{const Qe=Math.round(be/1048576),sr=await he({variables:{name:je,size:Qe}});if(sr.errors)throw new Error(Ir(sr.errors[0]));return(Ue=sr.data)==null?void 0:Ue.createVolume}catch(Qe){p(Qe);return}finally{d(!1)}},[he]),Vc=E.useCallback(async je=>{var be;d(!0),p(null);try{const Ue=await xe({variables:{id:je}});if(Ue.errors)throw new Error(Ir(Ue.errors[0]));return(be=Ue.data)==null?void 0:be.deleteVolume}catch(Ue){p(Ue);return}finally{d(!1)}},[xe]),Wf=E.useCallback(async(je,be=200)=>{var Ue;d(!0),p(null);try{const Qe=await ke({variables:{appId:je,max:be}});if(Qe.errors)throw new Error(Ir(Qe.errors[0]));return((Ue=Qe.data)==null?void 0:Ue.appLogs)??[]}catch(Qe){p(Qe);return}finally{d(!1)}},[ke]),Co={resources:s,apps:Oe,integrations:Z,projects:re,volumes:Ye,s3Buckets:P,s3Keys:X,managedResources:a,loading:g||w,error:y||_,mutationLoading:c,mutationError:f,createResource:Le,updateResourceValues:pe,deleteResource:De,createApp:qe,createProject:mt,createVolume:Ot,createDNS:Tt,createS3Bucket:Vf,createS3Key:Eo,updateApp:wr,updateProject:Xn,updateDNS:Sr,updateS3Bucket:bi,updateS3Key:Ws,generatePat:si,createPostgresDb:md,deletePostgresDb:zc,createManagedS3Bucket:tw,listS3Buckets:Ov,deleteS3Bucket:Pv,listS3BucketKeys:Hf,rotateS3BucketKey:Uc,deleteS3BucketKey:rw,listPostgresDb:Mv,listApps:Iv,listVolumes:Lv,listPullSecrets:$v,createPullSecret:nw,deletePullSecret:Fa,listSecrets:Mn,createSecret:ps,deleteSecret:kl,createManagedApp:qf,updateManagedApp:iw,deleteManagedApp:sw,createManagedVolume:Bv,deleteManagedVolume:Vc,appLogs:Wf,getResourcesByChartName:ae,getResourceById:fe,getAppById:oe,getIntegrationById:Ae,getProjectById:Ne,getVolumeById:qt,getDNSById:jr,getS3BucketById:As,getS3KeyById:Uf};return o.jsx(A8.Provider,{value:Co,children:t})}function Nr(){const t=E.useContext(A8);if(t===void 0)throw new Error("useResources must be used within a ResourceContextProvider");return t}function Zue(t,e){const r={};if(t.variables)for(const[n,s]of Object.entries(t.variables)){const i=e[n];if(s.required&&(i===void 0||i===""))throw new Error(`Required variable '${n}' is missing`);if(i===void 0&&s.default!==void 0){r[n]=s.default;continue}if(i!==void 0){let a;switch(s.type){case"string":case"text":{a=String(i);break}case"number":{const l=Number(i);if(isNaN(l))throw new Error(`Variable '${n}' must be a number`);a=l;break}case"boolean":{if(typeof i=="boolean")a=i;else{const l=String(i).toLowerCase();if(l==="true")a=!0;else if(l==="false")a=!1;else throw new Error(`Variable '${n}' must be a boolean`)}break}case"dropdown":{if(s.options&&!s.options.includes(String(i)))throw new Error(`Variable '${n}' value '${i}' is not in allowed options: ${s.options.join(", ")}`);a=String(i);break}}r[n]=a}}for(const[n,s]of Object.entries(e))n in r||(r[n]=s);return r}function KC(t,e,r,n){if(typeof t=="string"){let s=t;for(const[l,c]of Object.entries(e)){const d=`{{${l}}}`;s.includes(d)&&(s=s.replace(new RegExp(d,"g"),String(c)))}const i=/\{\{resources\[(\d+)\]\.uniqueName\}\}/g;let a;for(;(a=i.exec(s))!==null;){const l=parseInt(a[1]);if(l>=0&&l<r.length){const c=r[l].uniqueName;s=s.replace(a[0],c)}else throw n!==void 0&&l===n?new Error(`Self-reference to resource index ${l} is not available yet - orchestrator bug`):new Error(`Cross-reference to resource index ${l} is out of bounds`)}return s}else if(typeof t=="object"&&t!==null){if(Array.isArray(t))return t.map(s=>KC(s,e,r,n));{const s={};for(const[i,a]of Object.entries(t))s[i]=KC(a,e,r,n);return s}}return t}function Jue(t,e,r,n){return{type:t.type,values:KC(t.values,e,r,n)}}let YC=null;function ede(t){YC=t}class tde{constructor(e,r,n,s){cu(this,"template");cu(this,"variables");cu(this,"projectId");cu(this,"deployedResources",[]);cu(this,"resourceIds",[]);cu(this,"onProgress");this.template=e,this.variables=r,this.projectId=n,this.onProgress=s}getResourceActions(){if(!YC)throw new Error("Resource context actions not initialized. Make sure TemplateDeploymentContextProvider is mounted.");return YC}updateProgress(e,r,n,s,i=null){this.onProgress&&this.onProgress({current:e,total:r,resource:n,status:s,error:i})}async waitForResourceSync(e,r=3e5){const n=Date.now();for(console.log(`Waiting for resource ${e} to sync...`);Date.now()-n<r;){const{getResourceById:s}=this.getResourceActions(),i=s(e);if(i){if(console.log(`Resource ${e} found with status:`,i.status),i.status==="synced")return console.log(`Resource ${e} synced successfully`),!0;if(i.status==="backoff")throw new Error(`Resource failed to deploy: ${i.message||"Unknown error"}`);console.log(`Resource ${e} status is ${i.status}, waiting...`)}else console.log(`Resource ${e} not found, waiting...`);await new Promise(a=>setTimeout(a,1e3))}throw new Error("Resource deployment timeout")}async deploy(){try{const e=this.template.resources.length;this.resourceIds=[],this.deployedResources=[];const r=Zue(this.template,this.variables);r.projectId=this.projectId,this.updateProgress(0,e,null,"deploying",null);for(let s=0;s<e;s++)try{const i=this.template.resources[s],a=crypto.randomUUID();let l=`resource-${s}`;i.values.name&&(l=await WC(i.values.name,a));const c={id:a,type:i.type,uniqueName:l,values:i.values};this.deployedResources.push(c);const d=Jue(i,r,this.deployedResources,s);this.updateProgress(s,e,d,"deploying",null);let f;const{createApp:p,createVolume:m}=this.getResourceActions();switch(d.type){case"app":{f=await p({values:d.values,id:a});break}case"volume":{f=await m({values:d.values,id:a});break}default:throw new Error(`Unsupported resource type: ${d.type}`)}if(!f)throw new Error(`Failed to create resource at index ${s}`);this.resourceIds.push(f),this.updateProgress(s+.5,e,d,"deploying",null),await this.waitForResourceSync(f);const{getAppById:g,getVolumeById:y}=this.getResourceActions();let x=l;if(d.type==="app"){const _=g(f);_!=null&&_.uniqueName&&(x=_.uniqueName)}else if(d.type==="volume"){const _=y(f);_!=null&&_.uniqueName&&(x=_.uniqueName)}const w=this.deployedResources.findIndex(_=>_.id===f);w!==-1&&(this.deployedResources[w].uniqueName=x),this.updateProgress(s+1,e,d,"synced",null)}catch(i){const a=i instanceof Error?i.message:"Unknown error";return this.updateProgress(s,e,null,"failed",a),await this.cleanup(),{success:!1,projectId:this.projectId,resourceIds:this.resourceIds,error:a}}this.updateProgress(e,e,null,"synced",null),console.log("Deployment orchestrator completed successfully, returning result");const n={success:!0,projectId:this.projectId,resourceIds:this.resourceIds};return console.log("Returning result:",n),n}catch(e){const r=e instanceof Error?e.message:"Unknown error";return await this.cleanup(),{success:!1,projectId:this.projectId,resourceIds:this.resourceIds,error:r}}}async cleanup(){console.log("Starting cleanup for resources:",this.resourceIds);try{for(let e=this.resourceIds.length-1;e>=0;e--){const r=this.resourceIds[e];try{console.log(`Cleaning up resource ${e+1}/${this.resourceIds.length}: ${r}`);const{deleteResource:n}=this.getResourceActions(),s=await n(r);console.log(`Successfully deleted resource ${r}:`,s)}catch(n){console.error(`Failed to cleanup resource ${r}:`,n)}}console.log("Resource cleanup completed")}catch(e){console.error("Error during resource cleanup:",e)}}getDeployedResourceIds(){return[...this.resourceIds]}}const rde=E.createContext(void 0);function nde({children:t}){const[e,r]=E.useState({isDeploying:!1,progress:{current:0,total:0,resource:null,status:"idle",error:null},result:null,error:null}),{createResource:n,createApp:s,createVolume:i,getResourceById:a,getAppById:l,getVolumeById:c,deleteResource:d}=Nr(),f=E.useRef(null);E.useEffect(()=>{ede({createResource:n,createApp:s,createVolume:i,getResourceById:a,getAppById:l,getVolumeById:c,deleteResource:d})},[n,s,i,a,l,c,d]);const p=E.useCallback(async(y,x,w)=>{r(_=>({..._,isDeploying:!0,error:null})),f.current=new tde(y,x,w,_=>{r(S=>({...S,progress:_}))});try{const _=await f.current.deploy();return console.log("Deployment completed with result:",_),r(S=>{const k={...S,isDeploying:!1,result:_,error:_.error||null};return console.log("Setting deployment state to:",k),k}),_}catch(_){const S=_ instanceof Error?_.message:"Unknown error";return r(k=>({...k,isDeploying:!1,result:{success:!1,projectId:w,resourceIds:[],error:S},error:S})),{success:!1,projectId:w,resourceIds:[],error:S}}},[n,s,i,a,d]),m=E.useCallback(()=>{f.current&&(f.current=null),r({isDeploying:!1,progress:{current:0,total:0,resource:null,status:"idle",error:null},result:null,error:null})},[]),g={deploymentState:e,deployTemplate:p,resetDeployment:m};return o.jsx(rde.Provider,{value:g,children:t})}function v4(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function sde(...t){return e=>{let r=!1;const n=t.map(s=>{const i=v4(s,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let s=0;s<n.length;s++){const i=n[s];typeof i=="function"?i():v4(t[s],null)}}}}function ide(t){const e=ode(t),r=E.forwardRef((n,s)=>{const{children:i,...a}=n,l=E.Children.toArray(i),c=l.find(cde);if(c){const d=c.props.children,f=l.map(p=>p===c?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:p);return o.jsx(e,{...a,ref:s,children:E.isValidElement(d)?E.cloneElement(d,void 0,f):null})}return o.jsx(e,{...a,ref:s,children:i})});return r.displayName=`${t}.Slot`,r}var ade=ide("Slot");function ode(t){const e=E.forwardRef((r,n)=>{const{children:s,...i}=r;if(E.isValidElement(s)){const a=dde(s),l=ude(i,s.props);return s.type!==E.Fragment&&(l.ref=n?sde(n,a):a),E.cloneElement(s,l)}return E.Children.count(s)>1?E.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var lde=Symbol("radix.slottable");function cde(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===lde}function ude(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{i(...l),s(...l)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function dde(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}const lT=_f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),le=E.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...s},i)=>{const a=n?ade:"button";return o.jsx(a,{className:we(lT({variant:e,size:r,className:t})),ref:i,...s})});le.displayName="Button";var cT="Avatar",[hde,T5e]=Us(cT),[fde,R8]=hde(cT),D8=E.forwardRef((t,e)=>{const{__scopeAvatar:r,...n}=t,[s,i]=E.useState("idle");return o.jsx(fde,{scope:r,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:o.jsx(pt.span,{...n,ref:e})})});D8.displayName=cT;var O8="AvatarImage",P8=E.forwardRef((t,e)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:s=()=>{},...i}=t,a=R8(O8,r),l=pde(n,i.referrerPolicy),c=us(d=>{s(d),a.onImageLoadingStatusChange(d)});return Kn(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?o.jsx(pt.img,{...i,ref:e,src:n}):null});P8.displayName=O8;var M8="AvatarFallback",I8=E.forwardRef((t,e)=>{const{__scopeAvatar:r,delayMs:n,...s}=t,i=R8(M8,r),[a,l]=E.useState(n===void 0);return E.useEffect(()=>{if(n!==void 0){const c=window.setTimeout(()=>l(!0),n);return()=>window.clearTimeout(c)}},[n]),a&&i.imageLoadingStatus!=="loaded"?o.jsx(pt.span,{...s,ref:e}):null});I8.displayName=M8;function pde(t,e){const[r,n]=E.useState("idle");return Kn(()=>{if(!t){n("error");return}let s=!0;const i=new window.Image,a=l=>()=>{s&&n(l)};return n("loading"),i.onload=a("loaded"),i.onerror=a("error"),i.src=t,e&&(i.referrerPolicy=e),()=>{s=!1}},[t,e]),r}var L8=D8,$8=P8,B8=I8;const uT=E.forwardRef(({className:t,...e},r)=>o.jsx(L8,{ref:r,className:we("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));uT.displayName=L8.displayName;const mde=E.forwardRef(({className:t,...e},r)=>o.jsx($8,{ref:r,className:we("aspect-square h-full w-full",t),...e}));mde.displayName=$8.displayName;const dT=E.forwardRef(({className:t,...e},r)=>o.jsx(B8,{ref:r,className:we("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));dT.displayName=B8.displayName;var gde=(t,e,r,n,s,i,a,l)=>{let c=document.documentElement,d=["light","dark"];function f(g){(Array.isArray(t)?t:[t]).forEach(y=>{let x=y==="class",w=x&&i?s.map(_=>i[_]||_):s;x?(c.classList.remove(...w),c.classList.add(g)):c.setAttribute(y,g)}),p(g)}function p(g){l&&d.includes(g)&&(c.style.colorScheme=g)}function m(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)f(n);else try{let g=localStorage.getItem(e)||r,y=a&&g==="system"?m():g;f(y)}catch{}},y4=["light","dark"],F8="(prefers-color-scheme: dark)",vde=typeof window>"u",hT=E.createContext(void 0),yde={setTheme:t=>{},themes:[]},xde=()=>{var t;return(t=E.useContext(hT))!=null?t:yde},_de=t=>E.useContext(hT)?E.createElement(E.Fragment,null,t.children):E.createElement(wde,{...t}),bde=["light","dark"],wde=({forcedTheme:t,disableTransitionOnChange:e=!1,enableSystem:r=!0,enableColorScheme:n=!0,storageKey:s="theme",themes:i=bde,defaultTheme:a=r?"system":"light",attribute:l="data-theme",value:c,children:d,nonce:f,scriptProps:p})=>{let[m,g]=E.useState(()=>x4(s,a)),[y,x]=E.useState(()=>x4(s)),w=c?Object.values(c):i,_=E.useCallback(j=>{let T=j;if(!T)return;j==="system"&&r&&(T=_4());let D=c?c[T]:T,I=e?kde(f):null,L=document.documentElement,$=Q=>{Q==="class"?(L.classList.remove(...w),D&&L.classList.add(D)):Q.startsWith("data-")&&(D?L.setAttribute(Q,D):L.removeAttribute(Q))};if(Array.isArray(l)?l.forEach($):$(l),n){let Q=y4.includes(a)?a:null,M=y4.includes(T)?T:Q;L.style.colorScheme=M}I==null||I()},[f]),S=E.useCallback(j=>{let T=typeof j=="function"?j(m):j;g(T);try{localStorage.setItem(s,T)}catch{}},[m]),k=E.useCallback(j=>{let T=_4(j);x(T),m==="system"&&r&&!t&&_("system")},[m,t]);E.useEffect(()=>{let j=window.matchMedia(F8);return j.addListener(k),k(j),()=>j.removeListener(k)},[k]),E.useEffect(()=>{let j=T=>{T.key===s&&(T.newValue?g(T.newValue):S(a))};return window.addEventListener("storage",j),()=>window.removeEventListener("storage",j)},[S]),E.useEffect(()=>{_(t??m)},[t,m]);let N=E.useMemo(()=>({theme:m,setTheme:S,forcedTheme:t,resolvedTheme:m==="system"?y:m,themes:r?[...i,"system"]:i,systemTheme:r?y:void 0}),[m,S,t,y,r,i]);return E.createElement(hT.Provider,{value:N},E.createElement(Sde,{forcedTheme:t,storageKey:s,attribute:l,enableSystem:r,enableColorScheme:n,defaultTheme:a,value:c,themes:i,nonce:f,scriptProps:p}),d)},Sde=E.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:i,value:a,themes:l,nonce:c,scriptProps:d})=>{let f=JSON.stringify([r,e,i,t,l,a,n,s]).slice(1,-1);return E.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?c:"",dangerouslySetInnerHTML:{__html:`(${gde.toString()})(${f})`}})}),x4=(t,e)=>{if(vde)return;let r;try{r=localStorage.getItem(t)||void 0}catch{}return r||e},kde=t=>{let e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},_4=t=>(t||(t=window.matchMedia(F8)),t.matches?"dark":"light"),Ede=cZ.useId||(()=>{}),Cde=0;function ya(t){const[e,r]=E.useState(Ede());return Kn(()=>{r(n=>n??String(Cde++))},[t]),e?`radix-${e}`:""}var GS="focusScope.autoFocusOnMount",KS="focusScope.autoFocusOnUnmount",b4={bubbles:!1,cancelable:!0},Nde="FocusScope",gb=E.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...a}=t,[l,c]=E.useState(null),d=us(s),f=us(i),p=E.useRef(null),m=Ht(e,x=>c(x)),g=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(n){let x=function(k){if(g.paused||!l)return;const N=k.target;l.contains(N)?p.current=N:tc(p.current,{select:!0})},w=function(k){if(g.paused||!l)return;const N=k.relatedTarget;N!==null&&(l.contains(N)||tc(p.current,{select:!0}))},_=function(k){if(document.activeElement===document.body)for(const j of k)j.removedNodes.length>0&&tc(l)};document.addEventListener("focusin",x),document.addEventListener("focusout",w);const S=new MutationObserver(_);return l&&S.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",w),S.disconnect()}}},[n,l,g.paused]),E.useEffect(()=>{if(l){S4.add(g);const x=document.activeElement;if(!l.contains(x)){const _=new CustomEvent(GS,b4);l.addEventListener(GS,d),l.dispatchEvent(_),_.defaultPrevented||(jde(Ode(z8(l)),{select:!0}),document.activeElement===x&&tc(l))}return()=>{l.removeEventListener(GS,d),setTimeout(()=>{const _=new CustomEvent(KS,b4);l.addEventListener(KS,f),l.dispatchEvent(_),_.defaultPrevented||tc(x??document.body,{select:!0}),l.removeEventListener(KS,f),S4.remove(g)},0)}}},[l,d,f,g]);const y=E.useCallback(x=>{if(!r&&!n||g.paused)return;const w=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,_=document.activeElement;if(w&&_){const S=x.currentTarget,[k,N]=Tde(S);k&&N?!x.shiftKey&&_===N?(x.preventDefault(),r&&tc(k,{select:!0})):x.shiftKey&&_===k&&(x.preventDefault(),r&&tc(N,{select:!0})):_===S&&x.preventDefault()}},[r,n,g.paused]);return o.jsx(pt.div,{tabIndex:-1,...a,ref:m,onKeyDown:y})});gb.displayName=Nde;function jde(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(tc(n,{select:e}),document.activeElement!==r)return}function Tde(t){const e=z8(t),r=w4(e,t),n=w4(e.reverse(),t);return[r,n]}function z8(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function w4(t,e){for(const r of t)if(!Ade(r,{upTo:e}))return r}function Ade(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 Rde(t){return t instanceof HTMLInputElement&&"select"in t}function tc(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Rde(t)&&e&&t.select()}}var S4=Dde();function Dde(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=k4(t,e),t.unshift(e)},remove(e){var r;t=k4(t,e),(r=t[0])==null||r.resume()}}}function k4(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Ode(t){return t.filter(e=>e.tagName!=="A")}var YS=0;function fT(){E.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??E4()),document.body.insertAdjacentElement("beforeend",t[1]??E4()),YS++,()=>{YS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),YS--}},[])}function E4(){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 h0="right-scroll-bar-position",f0="width-before-scroll-bar",Pde="with-scroll-bars-hidden",Mde="--removed-body-scroll-bar-size";function QS(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Ide(t,e){var r=E.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=e,r.facade}var Lde=typeof window<"u"?E.useLayoutEffect:E.useEffect,C4=new WeakMap;function $de(t,e){var r=Ide(null,function(n){return t.forEach(function(s){return QS(s,n)})});return Lde(function(){var n=C4.get(r);if(n){var s=new Set(n),i=new Set(t),a=r.current;s.forEach(function(l){i.has(l)||QS(l,null)}),i.forEach(function(l){s.has(l)||QS(l,a)})}C4.set(r,t)},[t]),r}function Bde(t){return t}function Fde(t,e){e===void 0&&(e=Bde);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(i){var a=e(i,n);return r.push(a),function(){r=r.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(n=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(l){return i(l)},filter:function(){return r}}},assignMedium:function(i){n=!0;var a=[];if(r.length){var l=r;r=[],l.forEach(i),a=r}var c=function(){var f=a;a=[],f.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(f){a.push(f),d()},filter:function(f){return a=a.filter(f),r}}}};return s}function zde(t){t===void 0&&(t={});var e=Fde(null);return e.options=ue({async:!0,ssr:!1},t),e}var U8=function(t){var e=t.sideCar,r=ga(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return E.createElement(n,ue({},r))};U8.isSideCarExport=!0;function Ude(t,e){return t.useMedium(e),U8}var V8=zde(),XS=function(){},vb=E.forwardRef(function(t,e){var r=E.useRef(null),n=E.useState({onScrollCapture:XS,onWheelCapture:XS,onTouchMoveCapture:XS}),s=n[0],i=n[1],a=t.forwardProps,l=t.children,c=t.className,d=t.removeScrollBar,f=t.enabled,p=t.shards,m=t.sideCar,g=t.noIsolation,y=t.inert,x=t.allowPinchZoom,w=t.as,_=w===void 0?"div":w,S=t.gapMode,k=ga(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,j=$de([r,e]),T=ue(ue({},k),s);return E.createElement(E.Fragment,null,f&&E.createElement(N,{sideCar:V8,removeScrollBar:d,shards:p,noIsolation:g,inert:y,setCallbacks:i,allowPinchZoom:!!x,lockRef:r,gapMode:S}),a?E.cloneElement(E.Children.only(l),ue(ue({},T),{ref:j})):E.createElement(_,ue({},T,{className:c,ref:j}),l))});vb.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vb.classNames={fullWidth:f0,zeroRight:h0};var Vde=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Hde(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Vde();return e&&t.setAttribute("nonce",e),t}function qde(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Wde(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Gde=function(){var t=0,e=null;return{add:function(r){t==0&&(e=Hde())&&(qde(e,r),Wde(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Kde=function(){var t=Gde();return function(e,r){E.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},H8=function(){var t=Kde(),e=function(r){var n=r.styles,s=r.dynamic;return t(n,s),null};return e},Yde={left:0,top:0,right:0,gap:0},ZS=function(t){return parseInt(t||"",10)||0},Qde=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[ZS(r),ZS(n),ZS(s)]},Xde=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Yde;var e=Qde(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},Zde=H8(),$h="data-scroll-locked",Jde=function(t,e,r,n){var s=t.left,i=t.top,a=t.right,l=t.gap;return r===void 0&&(r="margin"),`
|
||
.`.concat(Pde,` {
|
||
overflow: hidden `).concat(n,`;
|
||
padding-right: `).concat(l,"px ").concat(n,`;
|
||
}
|
||
body[`).concat($h,`] {
|
||
overflow: hidden `).concat(n,`;
|
||
overscroll-behavior: contain;
|
||
`).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
|
||
padding-left: `.concat(s,`px;
|
||
padding-top: `).concat(i,`px;
|
||
padding-right: `).concat(a,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(l,"px ").concat(n,`;
|
||
`),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(h0,` {
|
||
right: `).concat(l,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(f0,` {
|
||
margin-right: `).concat(l,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(h0," .").concat(h0,` {
|
||
right: 0 `).concat(n,`;
|
||
}
|
||
|
||
.`).concat(f0," .").concat(f0,` {
|
||
margin-right: 0 `).concat(n,`;
|
||
}
|
||
|
||
body[`).concat($h,`] {
|
||
`).concat(Mde,": ").concat(l,`px;
|
||
}
|
||
`)},N4=function(){var t=parseInt(document.body.getAttribute($h)||"0",10);return isFinite(t)?t:0},ehe=function(){E.useEffect(function(){return document.body.setAttribute($h,(N4()+1).toString()),function(){var t=N4()-1;t<=0?document.body.removeAttribute($h):document.body.setAttribute($h,t.toString())}},[])},the=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,s=n===void 0?"margin":n;ehe();var i=E.useMemo(function(){return Xde(s)},[s]);return E.createElement(Zde,{styles:Jde(i,!e,s,r?"":"!important")})},QC=!1;if(typeof window<"u")try{var ux=Object.defineProperty({},"passive",{get:function(){return QC=!0,!0}});window.addEventListener("test",ux,ux),window.removeEventListener("test",ux,ux)}catch{QC=!1}var eh=QC?{passive:!1}:!1,rhe=function(t){return t.tagName==="TEXTAREA"},q8=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!rhe(t)&&r[e]==="visible")},nhe=function(t){return q8(t,"overflowY")},she=function(t){return q8(t,"overflowX")},j4=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=W8(t,n);if(s){var i=G8(t,n),a=i[1],l=i[2];if(a>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},ihe=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},ahe=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},W8=function(t,e){return t==="v"?nhe(e):she(e)},G8=function(t,e){return t==="v"?ihe(e):ahe(e)},ohe=function(t,e){return t==="h"&&e==="rtl"?-1:1},lhe=function(t,e,r,n,s){var i=ohe(t,window.getComputedStyle(e).direction),a=i*n,l=r.target,c=e.contains(l),d=!1,f=a>0,p=0,m=0;do{var g=G8(t,l),y=g[0],x=g[1],w=g[2],_=x-w-i*y;(y||_)&&W8(t,l)&&(p+=_,m+=y),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(f&&Math.abs(p)<1||!f&&Math.abs(m)<1)&&(d=!0),d},dx=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},T4=function(t){return[t.deltaX,t.deltaY]},A4=function(t){return t&&"current"in t?t.current:t},che=function(t,e){return t[0]===e[0]&&t[1]===e[1]},uhe=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},dhe=0,th=[];function hhe(t){var e=E.useRef([]),r=E.useRef([0,0]),n=E.useRef(),s=E.useState(dhe++)[0],i=E.useState(H8)[0],a=E.useRef(t);E.useEffect(function(){a.current=t},[t]),E.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var x=cs([t.lockRef.current],(t.shards||[]).map(A4),!0).filter(Boolean);return x.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),x.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=E.useCallback(function(x,w){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!a.current.allowPinchZoom;var _=dx(x),S=r.current,k="deltaX"in x?x.deltaX:S[0]-_[0],N="deltaY"in x?x.deltaY:S[1]-_[1],j,T=x.target,D=Math.abs(k)>Math.abs(N)?"h":"v";if("touches"in x&&D==="h"&&T.type==="range")return!1;var I=j4(D,T);if(!I)return!0;if(I?j=D:(j=D==="v"?"h":"v",I=j4(D,T)),!I)return!1;if(!n.current&&"changedTouches"in x&&(k||N)&&(n.current=j),!j)return!0;var L=n.current||j;return lhe(L,w,x,L==="h"?k:N)},[]),c=E.useCallback(function(x){var w=x;if(!(!th.length||th[th.length-1]!==i)){var _="deltaY"in w?T4(w):dx(w),S=e.current.filter(function(j){return j.name===w.type&&(j.target===w.target||w.target===j.shadowParent)&&che(j.delta,_)})[0];if(S&&S.should){w.cancelable&&w.preventDefault();return}if(!S){var k=(a.current.shards||[]).map(A4).filter(Boolean).filter(function(j){return j.contains(w.target)}),N=k.length>0?l(w,k[0]):!a.current.noIsolation;N&&w.cancelable&&w.preventDefault()}}},[]),d=E.useCallback(function(x,w,_,S){var k={name:x,delta:w,target:_,should:S,shadowParent:fhe(_)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(N){return N!==k})},1)},[]),f=E.useCallback(function(x){r.current=dx(x),n.current=void 0},[]),p=E.useCallback(function(x){d(x.type,T4(x),x.target,l(x,t.lockRef.current))},[]),m=E.useCallback(function(x){d(x.type,dx(x),x.target,l(x,t.lockRef.current))},[]);E.useEffect(function(){return th.push(i),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",c,eh),document.addEventListener("touchmove",c,eh),document.addEventListener("touchstart",f,eh),function(){th=th.filter(function(x){return x!==i}),document.removeEventListener("wheel",c,eh),document.removeEventListener("touchmove",c,eh),document.removeEventListener("touchstart",f,eh)}},[]);var g=t.removeScrollBar,y=t.inert;return E.createElement(E.Fragment,null,y?E.createElement(i,{styles:uhe(s)}):null,g?E.createElement(the,{gapMode:t.gapMode}):null)}function fhe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const phe=Ude(V8,hhe);var yb=E.forwardRef(function(t,e){return E.createElement(vb,ue({},t,{ref:e,sideCar:phe}))});yb.classNames=vb.classNames;var mhe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rh=new WeakMap,hx=new WeakMap,fx={},JS=0,K8=function(t){return t&&(t.host||K8(t.parentNode))},ghe=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=K8(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},vhe=function(t,e,r,n){var s=ghe(e,Array.isArray(t)?t:[t]);fx[r]||(fx[r]=new WeakMap);var i=fx[r],a=[],l=new Set,c=new Set(s),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};s.forEach(d);var f=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(m){if(l.has(m))f(m);else try{var g=m.getAttribute(n),y=g!==null&&g!=="false",x=(rh.get(m)||0)+1,w=(i.get(m)||0)+1;rh.set(m,x),i.set(m,w),a.push(m),x===1&&y&&hx.set(m,!0),w===1&&m.setAttribute(r,"true"),y||m.setAttribute(n,"true")}catch(_){console.error("aria-hidden: cannot operate on ",m,_)}})};return f(e),l.clear(),JS++,function(){a.forEach(function(p){var m=rh.get(p)-1,g=i.get(p)-1;rh.set(p,m),i.set(p,g),m||(hx.has(p)||p.removeAttribute(n),hx.delete(p)),g||p.removeAttribute(r)}),JS--,JS||(rh=new WeakMap,rh=new WeakMap,hx=new WeakMap,fx={})}},pT=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=mhe(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),vhe(n,s,r,"aria-hidden")):function(){return null}},Y8=E.forwardRef((t,e)=>{const{children:r,...n}=t,s=E.Children.toArray(r),i=s.find(xhe);if(i){const a=i.props.children,l=s.map(c=>c===i?E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null:c);return o.jsx(XC,{...n,ref:e,children:E.isValidElement(a)?E.cloneElement(a,void 0,l):null})}return o.jsx(XC,{...n,ref:e,children:r})});Y8.displayName="Slot";var XC=E.forwardRef((t,e)=>{const{children:r,...n}=t;if(E.isValidElement(r)){const s=bhe(r),i=_he(n,r.props);return r.type!==E.Fragment&&(i.ref=e?_o(e,s):s),E.cloneElement(r,i)}return E.Children.count(r)>1?E.Children.only(null):null});XC.displayName="SlotClone";var yhe=({children:t})=>o.jsx(o.Fragment,{children:t});function xhe(t){return E.isValidElement(t)&&t.type===yhe}function _he(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{i(...l),s(...l)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function bhe(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var mT="Dialog",[Q8,X8]=Us(mT),[whe,Da]=Q8(mT),Z8=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:a=!0}=t,l=E.useRef(null),c=E.useRef(null),[d=!1,f]=po({prop:n,defaultProp:s,onChange:i});return o.jsx(whe,{scope:e,triggerRef:l,contentRef:c,contentId:ya(),titleId:ya(),descriptionId:ya(),open:d,onOpenChange:f,onOpenToggle:E.useCallback(()=>f(p=>!p),[f]),modal:a,children:r})};Z8.displayName=mT;var J8="DialogTrigger",eU=E.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Da(J8,r),i=Ht(e,s.triggerRef);return o.jsx(pt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":yT(s.open),...n,ref:i,onClick:Ge(t.onClick,s.onOpenToggle)})});eU.displayName=J8;var gT="DialogPortal",[She,tU]=Q8(gT,{forceMount:void 0}),rU=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:s}=t,i=Da(gT,e);return o.jsx(She,{scope:e,forceMount:r,children:E.Children.map(n,a=>o.jsx(_i,{present:r||i.open,children:o.jsx(xf,{asChild:!0,container:s,children:a})}))})};rU.displayName=gT;var Q0="DialogOverlay",nU=E.forwardRef((t,e)=>{const r=tU(Q0,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=Da(Q0,t.__scopeDialog);return i.modal?o.jsx(_i,{present:n||i.open,children:o.jsx(khe,{...s,ref:e})}):null});nU.displayName=Q0;var khe=E.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Da(Q0,r);return o.jsx(yb,{as:Y8,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(pt.div,{"data-state":yT(s.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),ed="DialogContent",sU=E.forwardRef((t,e)=>{const r=tU(ed,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=Da(ed,t.__scopeDialog);return o.jsx(_i,{present:n||i.open,children:i.modal?o.jsx(Ehe,{...s,ref:e}):o.jsx(Che,{...s,ref:e})})});sU.displayName=ed;var Ehe=E.forwardRef((t,e)=>{const r=Da(ed,t.__scopeDialog),n=E.useRef(null),s=Ht(e,r.contentRef,n);return E.useEffect(()=>{const i=n.current;if(i)return pT(i)},[]),o.jsx(iU,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ge(t.onCloseAutoFocus,i=>{var a;i.preventDefault(),(a=r.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ge(t.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&i.preventDefault()}),onFocusOutside:Ge(t.onFocusOutside,i=>i.preventDefault())})}),Che=E.forwardRef((t,e)=>{const r=Da(ed,t.__scopeDialog),n=E.useRef(!1),s=E.useRef(!1);return o.jsx(iU,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,l;(a=t.onCloseAutoFocus)==null||a.call(t,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var c,d;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;((d=r.triggerRef.current)==null?void 0:d.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),iU=E.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,...a}=t,l=Da(ed,r),c=E.useRef(null),d=Ht(e,c);return fT(),o.jsxs(o.Fragment,{children:[o.jsx(gb,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:o.jsx(yf,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":yT(l.open),...a,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(jhe,{titleId:l.titleId}),o.jsx(Ahe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),vT="DialogTitle",aU=E.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Da(vT,r);return o.jsx(pt.h2,{id:s.titleId,...n,ref:e})});aU.displayName=vT;var oU="DialogDescription",lU=E.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Da(oU,r);return o.jsx(pt.p,{id:s.descriptionId,...n,ref:e})});lU.displayName=oU;var cU="DialogClose",uU=E.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Da(cU,r);return o.jsx(pt.button,{type:"button",...n,ref:e,onClick:Ge(t.onClick,()=>s.onOpenChange(!1))})});uU.displayName=cU;function yT(t){return t?"open":"closed"}var dU="DialogTitleWarning",[Nhe,hU]=WJ(dU,{contentName:ed,titleName:vT,docsSlug:"dialog"}),jhe=({titleId:t})=>{const e=hU(dU),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
||
|
||
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||
|
||
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return E.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},The="DialogDescriptionWarning",Ahe=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hU(The).contentName}}.`;return E.useEffect(()=>{var i;const s=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},xT=Z8,fU=eU,_T=rU,lv=nU,cv=sU,uv=aU,dv=lU,xb=uU;const Rhe=xT,Dhe=fU,Ohe=_T,pU=E.forwardRef(({className:t,...e},r)=>o.jsx(lv,{className:we("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));pU.displayName=lv.displayName;const Phe=_f("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),mU=E.forwardRef(({side:t="right",className:e,children:r,...n},s)=>o.jsxs(Ohe,{children:[o.jsx(pU,{}),o.jsxs(cv,{ref:s,className:we(Phe({side:t}),e),...n,children:[o.jsxs(xb,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[o.jsx(yc,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]}));mU.displayName=cv.displayName;const Mhe=E.forwardRef(({className:t,...e},r)=>o.jsx(uv,{ref:r,className:we("text-lg font-semibold text-foreground",t),...e}));Mhe.displayName=uv.displayName;const Ihe=E.forwardRef(({className:t,...e},r)=>o.jsx(dv,{ref:r,className:we("text-sm text-muted-foreground",t),...e}));Ihe.displayName=dv.displayName;var Lhe=E.createContext(void 0);function _b(t){const e=E.useContext(Lhe);return t||e||"ltr"}const $he=["top","right","bottom","left"],jc=Math.min,pi=Math.max,X0=Math.round,px=Math.floor,co=t=>({x:t,y:t}),Bhe={left:"right",right:"left",bottom:"top",top:"bottom"},Fhe={start:"end",end:"start"};function ZC(t,e,r){return pi(t,jc(e,r))}function dl(t,e){return typeof t=="function"?t(e):t}function hl(t){return t.split("-")[0]}function Tf(t){return t.split("-")[1]}function bT(t){return t==="x"?"y":"x"}function wT(t){return t==="y"?"height":"width"}function Tc(t){return["top","bottom"].includes(hl(t))?"y":"x"}function ST(t){return bT(Tc(t))}function zhe(t,e,r){r===void 0&&(r=!1);const n=Tf(t),s=ST(t),i=wT(s);let a=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=Z0(a)),[a,Z0(a)]}function Uhe(t){const e=Z0(t);return[JC(t),e,JC(e)]}function JC(t){return t.replace(/start|end/g,e=>Fhe[e])}function Vhe(t,e,r){const n=["left","right"],s=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return r?e?s:n:e?n:s;case"left":case"right":return e?i:a;default:return[]}}function Hhe(t,e,r,n){const s=Tf(t);let i=Vhe(hl(t),r==="start",n);return s&&(i=i.map(a=>a+"-"+s),e&&(i=i.concat(i.map(JC)))),i}function Z0(t){return t.replace(/left|right|bottom|top/g,e=>Bhe[e])}function qhe(t){return{top:0,right:0,bottom:0,left:0,...t}}function gU(t){return typeof t!="number"?qhe(t):{top:t,right:t,bottom:t,left:t}}function J0(t){const{x:e,y:r,width:n,height:s}=t;return{width:n,height:s,top:r,left:e,right:e+n,bottom:r+s,x:e,y:r}}function R4(t,e,r){let{reference:n,floating:s}=t;const i=Tc(e),a=ST(e),l=wT(a),c=hl(e),d=i==="y",f=n.x+n.width/2-s.width/2,p=n.y+n.height/2-s.height/2,m=n[l]/2-s[l]/2;let g;switch(c){case"top":g={x:f,y:n.y-s.height};break;case"bottom":g={x:f,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:p};break;case"left":g={x:n.x-s.width,y:p};break;default:g={x:n.x,y:n.y}}switch(Tf(e)){case"start":g[a]-=m*(r&&d?-1:1);break;case"end":g[a]+=m*(r&&d?-1:1);break}return g}const Whe=async(t,e,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:a}=r,l=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(e));let d=await a.getElementRects({reference:t,floating:e,strategy:s}),{x:f,y:p}=R4(d,n,c),m=n,g={},y=0;for(let x=0;x<l.length;x++){const{name:w,fn:_}=l[x],{x:S,y:k,data:N,reset:j}=await _({x:f,y:p,initialPlacement:n,placement:m,strategy:s,middlewareData:g,rects:d,platform:a,elements:{reference:t,floating:e}});f=S??f,p=k??p,g={...g,[w]:{...g[w],...N}},j&&y<=50&&(y++,typeof j=="object"&&(j.placement&&(m=j.placement),j.rects&&(d=j.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:s}):j.rects),{x:f,y:p}=R4(d,m,c)),x=-1)}return{x:f,y:p,placement:m,strategy:s,middlewareData:g}};async function Eg(t,e){var r;e===void 0&&(e={});const{x:n,y:s,platform:i,rects:a,elements:l,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=dl(e,t),y=gU(g),w=l[m?p==="floating"?"reference":"floating":p],_=J0(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(w)))==null||r?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),S=p==="floating"?{x:n,y:s,width:a.floating.width,height:a.floating.height}:a.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},j=J0(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:S,offsetParent:k,strategy:c}):S);return{top:(_.top-j.top+y.top)/N.y,bottom:(j.bottom-_.bottom+y.bottom)/N.y,left:(_.left-j.left+y.left)/N.x,right:(j.right-_.right+y.right)/N.x}}const Ghe=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=e,{element:d,padding:f=0}=dl(t,e)||{};if(d==null)return{};const p=gU(f),m={x:r,y:n},g=ST(s),y=wT(g),x=await a.getDimensions(d),w=g==="y",_=w?"top":"left",S=w?"bottom":"right",k=w?"clientHeight":"clientWidth",N=i.reference[y]+i.reference[g]-m[g]-i.floating[y],j=m[g]-i.reference[g],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let D=T?T[k]:0;(!D||!await(a.isElement==null?void 0:a.isElement(T)))&&(D=l.floating[k]||i.floating[y]);const I=N/2-j/2,L=D/2-x[y]/2-1,$=jc(p[_],L),Q=jc(p[S],L),M=$,z=D-x[y]-Q,R=D/2-x[y]/2+I,B=ZC(M,R,z),V=!c.arrow&&Tf(s)!=null&&R!==B&&i.reference[y]/2-(R<M?$:Q)-x[y]/2<0,F=V?R<M?R-M:R-z:0;return{[g]:m[g]+F,data:{[g]:B,centerOffset:R-B-F,...V&&{alignmentOffset:F}},reset:V}}}),Khe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:d}=e,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=dl(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const _=hl(s),S=Tc(l),k=hl(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),j=m||(k||!x?[Z0(l)]:Uhe(l)),T=y!=="none";!m&&T&&j.push(...Hhe(l,x,y,N));const D=[l,...j],I=await Eg(e,w),L=[];let $=((n=i.flip)==null?void 0:n.overflows)||[];if(f&&L.push(I[_]),p){const R=zhe(s,a,N);L.push(I[R[0]],I[R[1]])}if($=[...$,{placement:s,overflows:L}],!L.every(R=>R<=0)){var Q,M;const R=(((Q=i.flip)==null?void 0:Q.index)||0)+1,B=D[R];if(B)return{data:{index:R,overflows:$},reset:{placement:B}};let V=(M=$.filter(F=>F.overflows[0]<=0).sort((F,K)=>F.overflows[1]-K.overflows[1])[0])==null?void 0:M.placement;if(!V)switch(g){case"bestFit":{var z;const F=(z=$.filter(K=>{if(T){const Y=Tc(K.placement);return Y===S||Y==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(Y=>Y>0).reduce((Y,O)=>Y+O,0)]).sort((K,Y)=>K[1]-Y[1])[0])==null?void 0:z[0];F&&(V=F);break}case"initialPlacement":V=l;break}if(s!==V)return{reset:{placement:V}}}return{}}}};function D4(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function O4(t){return $he.some(e=>t[e]>=0)}const Yhe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...s}=dl(t,e);switch(n){case"referenceHidden":{const i=await Eg(e,{...s,elementContext:"reference"}),a=D4(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:O4(a)}}}case"escaped":{const i=await Eg(e,{...s,altBoundary:!0}),a=D4(i,r.floating);return{data:{escapedOffsets:a,escaped:O4(a)}}}default:return{}}}}};async function Qhe(t,e){const{placement:r,platform:n,elements:s}=t,i=await(n.isRTL==null?void 0:n.isRTL(s.floating)),a=hl(r),l=Tf(r),c=Tc(r)==="y",d=["left","top"].includes(a)?-1:1,f=i&&c?-1:1,p=dl(e,t);let{mainAxis:m,crossAxis:g,alignmentAxis:y}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof y=="number"&&(g=l==="end"?y*-1:y),c?{x:g*f,y:m*d}:{x:m*d,y:g*f}}const Xhe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:s,y:i,placement:a,middlewareData:l}=e,c=await Qhe(e,t);return a===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},Zhe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:s}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x:_,y:S}=w;return{x:_,y:S}}},...c}=dl(t,e),d={x:r,y:n},f=await Eg(e,c),p=Tc(hl(s)),m=bT(p);let g=d[m],y=d[p];if(i){const w=m==="y"?"top":"left",_=m==="y"?"bottom":"right",S=g+f[w],k=g-f[_];g=ZC(S,g,k)}if(a){const w=p==="y"?"top":"left",_=p==="y"?"bottom":"right",S=y+f[w],k=y-f[_];y=ZC(S,y,k)}const x=l.fn({...e,[m]:g,[p]:y});return{...x,data:{x:x.x-r,y:x.y-n,enabled:{[m]:i,[p]:a}}}}}},Jhe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:s,rects:i,middlewareData:a}=e,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=dl(t,e),f={x:r,y:n},p=Tc(s),m=bT(p);let g=f[m],y=f[p];const x=dl(l,e),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const k=m==="y"?"height":"width",N=i.reference[m]-i.floating[k]+w.mainAxis,j=i.reference[m]+i.reference[k]-w.mainAxis;g<N?g=N:g>j&&(g=j)}if(d){var _,S;const k=m==="y"?"width":"height",N=["top","left"].includes(hl(s)),j=i.reference[p]-i.floating[k]+(N&&((_=a.offset)==null?void 0:_[p])||0)+(N?0:w.crossAxis),T=i.reference[p]+i.reference[k]+(N?0:((S=a.offset)==null?void 0:S[p])||0)-(N?w.crossAxis:0);y<j?y=j:y>T&&(y=T)}return{[m]:g,[p]:y}}}},efe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;const{placement:s,rects:i,platform:a,elements:l}=e,{apply:c=()=>{},...d}=dl(t,e),f=await Eg(e,d),p=hl(s),m=Tf(s),g=Tc(s)==="y",{width:y,height:x}=i.floating;let w,_;p==="top"||p==="bottom"?(w=p,_=m===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(_=p,w=m==="end"?"top":"bottom");const S=x-f.top-f.bottom,k=y-f.left-f.right,N=jc(x-f[w],S),j=jc(y-f[_],k),T=!e.middlewareData.shift;let D=N,I=j;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(I=k),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(D=S),T&&!m){const $=pi(f.left,0),Q=pi(f.right,0),M=pi(f.top,0),z=pi(f.bottom,0);g?I=y-2*($!==0||Q!==0?$+Q:pi(f.left,f.right)):D=x-2*(M!==0||z!==0?M+z:pi(f.top,f.bottom))}await c({...e,availableWidth:I,availableHeight:D});const L=await a.getDimensions(l.floating);return y!==L.width||x!==L.height?{reset:{rects:!0}}:{}}}};function bb(){return typeof window<"u"}function Af(t){return vU(t)?(t.nodeName||"").toLowerCase():"#document"}function vi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function wo(t){var e;return(e=(vU(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function vU(t){return bb()?t instanceof Node||t instanceof vi(t).Node:!1}function Ca(t){return bb()?t instanceof Element||t instanceof vi(t).Element:!1}function vo(t){return bb()?t instanceof HTMLElement||t instanceof vi(t).HTMLElement:!1}function P4(t){return!bb()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof vi(t).ShadowRoot}function hv(t){const{overflow:e,overflowX:r,overflowY:n,display:s}=Na(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(s)}function tfe(t){return["table","td","th"].includes(Af(t))}function wb(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function kT(t){const e=ET(),r=Ca(t)?Na(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function rfe(t){let e=Ac(t);for(;vo(e)&&!ef(e);){if(kT(e))return e;if(wb(e))return null;e=Ac(e)}return null}function ET(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ef(t){return["html","body","#document"].includes(Af(t))}function Na(t){return vi(t).getComputedStyle(t)}function Sb(t){return Ca(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ac(t){if(Af(t)==="html")return t;const e=t.assignedSlot||t.parentNode||P4(t)&&t.host||wo(t);return P4(e)?e.host:e}function yU(t){const e=Ac(t);return ef(e)?t.ownerDocument?t.ownerDocument.body:t.body:vo(e)&&hv(e)?e:yU(e)}function Cg(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const s=yU(t),i=s===((n=t.ownerDocument)==null?void 0:n.body),a=vi(s);if(i){const l=eN(a);return e.concat(a,a.visualViewport||[],hv(s)?s:[],l&&r?Cg(l):[])}return e.concat(s,Cg(s,[],r))}function eN(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function xU(t){const e=Na(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=vo(t),i=s?t.offsetWidth:r,a=s?t.offsetHeight:n,l=X0(r)!==i||X0(n)!==a;return l&&(r=i,n=a),{width:r,height:n,$:l}}function CT(t){return Ca(t)?t:t.contextElement}function Bh(t){const e=CT(t);if(!vo(e))return co(1);const r=e.getBoundingClientRect(),{width:n,height:s,$:i}=xU(e);let a=(i?X0(r.width):r.width)/n,l=(i?X0(r.height):r.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const nfe=co(0);function _U(t){const e=vi(t);return!ET()||!e.visualViewport?nfe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function sfe(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==vi(t)?!1:e}function td(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const s=t.getBoundingClientRect(),i=CT(t);let a=co(1);e&&(n?Ca(n)&&(a=Bh(n)):a=Bh(t));const l=sfe(i,r,n)?_U(i):co(0);let c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,f=s.width/a.x,p=s.height/a.y;if(i){const m=vi(i),g=n&&Ca(n)?vi(n):n;let y=m,x=eN(y);for(;x&&n&&g!==y;){const w=Bh(x),_=x.getBoundingClientRect(),S=Na(x),k=_.left+(x.clientLeft+parseFloat(S.paddingLeft))*w.x,N=_.top+(x.clientTop+parseFloat(S.paddingTop))*w.y;c*=w.x,d*=w.y,f*=w.x,p*=w.y,c+=k,d+=N,y=vi(x),x=eN(y)}}return J0({width:f,height:p,x:c,y:d})}function NT(t,e){const r=Sb(t).scrollLeft;return e?e.left+r:td(wo(t)).left+r}function bU(t,e,r){r===void 0&&(r=!1);const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-(r?0:NT(t,n)),i=n.top+e.scrollTop;return{x:s,y:i}}function ife(t){let{elements:e,rect:r,offsetParent:n,strategy:s}=t;const i=s==="fixed",a=wo(n),l=e?wb(e.floating):!1;if(n===a||l&&i)return r;let c={scrollLeft:0,scrollTop:0},d=co(1);const f=co(0),p=vo(n);if((p||!p&&!i)&&((Af(n)!=="body"||hv(a))&&(c=Sb(n)),vo(n))){const g=td(n);d=Bh(n),f.x=g.x+n.clientLeft,f.y=g.y+n.clientTop}const m=a&&!p&&!i?bU(a,c,!0):co(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:r.y*d.y-c.scrollTop*d.y+f.y+m.y}}function afe(t){return Array.from(t.getClientRects())}function ofe(t){const e=wo(t),r=Sb(t),n=t.ownerDocument.body,s=pi(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=pi(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+NT(t);const l=-r.scrollTop;return Na(n).direction==="rtl"&&(a+=pi(e.clientWidth,n.clientWidth)-s),{width:s,height:i,x:a,y:l}}function lfe(t,e){const r=vi(t),n=wo(t),s=r.visualViewport;let i=n.clientWidth,a=n.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const d=ET();(!d||d&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:i,height:a,x:l,y:c}}function cfe(t,e){const r=td(t,!0,e==="fixed"),n=r.top+t.clientTop,s=r.left+t.clientLeft,i=vo(t)?Bh(t):co(1),a=t.clientWidth*i.x,l=t.clientHeight*i.y,c=s*i.x,d=n*i.y;return{width:a,height:l,x:c,y:d}}function M4(t,e,r){let n;if(e==="viewport")n=lfe(t,r);else if(e==="document")n=ofe(wo(t));else if(Ca(e))n=cfe(e,r);else{const s=_U(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return J0(n)}function wU(t,e){const r=Ac(t);return r===e||!Ca(r)||ef(r)?!1:Na(r).position==="fixed"||wU(r,e)}function ufe(t,e){const r=e.get(t);if(r)return r;let n=Cg(t,[],!1).filter(l=>Ca(l)&&Af(l)!=="body"),s=null;const i=Na(t).position==="fixed";let a=i?Ac(t):t;for(;Ca(a)&&!ef(a);){const l=Na(a),c=kT(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||hv(a)&&!c&&wU(t,a))?n=n.filter(f=>f!==a):s=l,a=Ac(a)}return e.set(t,n),n}function dfe(t){let{element:e,boundary:r,rootBoundary:n,strategy:s}=t;const a=[...r==="clippingAncestors"?wb(e)?[]:ufe(e,this._c):[].concat(r),n],l=a[0],c=a.reduce((d,f)=>{const p=M4(e,f,s);return d.top=pi(p.top,d.top),d.right=jc(p.right,d.right),d.bottom=jc(p.bottom,d.bottom),d.left=pi(p.left,d.left),d},M4(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function hfe(t){const{width:e,height:r}=xU(t);return{width:e,height:r}}function ffe(t,e,r){const n=vo(e),s=wo(e),i=r==="fixed",a=td(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const c=co(0);if(n||!n&&!i)if((Af(e)!=="body"||hv(s))&&(l=Sb(e)),n){const m=td(e,!0,i,e);c.x=m.x+e.clientLeft,c.y=m.y+e.clientTop}else s&&(c.x=NT(s));const d=s&&!n&&!i?bU(s,l):co(0),f=a.left+l.scrollLeft-c.x-d.x,p=a.top+l.scrollTop-c.y-d.y;return{x:f,y:p,width:a.width,height:a.height}}function ek(t){return Na(t).position==="static"}function I4(t,e){if(!vo(t)||Na(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return wo(t)===r&&(r=r.ownerDocument.body),r}function SU(t,e){const r=vi(t);if(wb(t))return r;if(!vo(t)){let s=Ac(t);for(;s&&!ef(s);){if(Ca(s)&&!ek(s))return s;s=Ac(s)}return r}let n=I4(t,e);for(;n&&tfe(n)&&ek(n);)n=I4(n,e);return n&&ef(n)&&ek(n)&&!kT(n)?r:n||rfe(t)||r}const pfe=async function(t){const e=this.getOffsetParent||SU,r=this.getDimensions,n=await r(t.floating);return{reference:ffe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function mfe(t){return Na(t).direction==="rtl"}const gfe={convertOffsetParentRelativeRectToViewportRelativeRect:ife,getDocumentElement:wo,getClippingRect:dfe,getOffsetParent:SU,getElementRects:pfe,getClientRects:afe,getDimensions:hfe,getScale:Bh,isElement:Ca,isRTL:mfe};function kU(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function vfe(t,e){let r=null,n;const s=wo(t);function i(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=t.getBoundingClientRect(),{left:f,top:p,width:m,height:g}=d;if(l||e(),!m||!g)return;const y=px(p),x=px(s.clientWidth-(f+m)),w=px(s.clientHeight-(p+g)),_=px(f),k={rootMargin:-y+"px "+-x+"px "+-w+"px "+-_+"px",threshold:pi(0,jc(1,c))||1};let N=!0;function j(T){const D=T[0].intersectionRatio;if(D!==c){if(!N)return a();D?a(!1,D):n=setTimeout(()=>{a(!1,1e-7)},1e3)}D===1&&!kU(d,t.getBoundingClientRect())&&a(),N=!1}try{r=new IntersectionObserver(j,{...k,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,k)}r.observe(t)}return a(!0),i}function yfe(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,d=CT(t),f=s||i?[...d?Cg(d):[],...Cg(e)]:[];f.forEach(_=>{s&&_.addEventListener("scroll",r,{passive:!0}),i&&_.addEventListener("resize",r)});const p=d&&l?vfe(d,r):null;let m=-1,g=null;a&&(g=new ResizeObserver(_=>{let[S]=_;S&&S.target===d&&g&&(g.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=g)==null||k.observe(e)})),r()}),d&&!c&&g.observe(d),g.observe(e));let y,x=c?td(t):null;c&&w();function w(){const _=td(t);x&&!kU(x,_)&&r(),x=_,y=requestAnimationFrame(w)}return r(),()=>{var _;f.forEach(S=>{s&&S.removeEventListener("scroll",r),i&&S.removeEventListener("resize",r)}),p==null||p(),(_=g)==null||_.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const xfe=Xhe,_fe=Zhe,bfe=Khe,wfe=efe,Sfe=Yhe,L4=Ghe,kfe=Jhe,Efe=(t,e,r)=>{const n=new Map,s={platform:gfe,...r},i={...s.platform,_c:n};return Whe(t,e,{...s,platform:i})};var p0=typeof document<"u"?E.useLayoutEffect:E.useEffect;function e_(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!e_(t[n],e[n]))return!1;return!0}if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){const i=s[n];if(!(i==="_owner"&&t.$$typeof)&&!e_(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function EU(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function $4(t,e){const r=EU(t);return Math.round(e*r)/r}function tk(t){const e=E.useRef(t);return p0(()=>{e.current=t}),e}function Cfe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:d}=t,[f,p]=E.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[m,g]=E.useState(n);e_(m,n)||g(n);const[y,x]=E.useState(null),[w,_]=E.useState(null),S=E.useCallback(K=>{K!==T.current&&(T.current=K,x(K))},[]),k=E.useCallback(K=>{K!==D.current&&(D.current=K,_(K))},[]),N=i||y,j=a||w,T=E.useRef(null),D=E.useRef(null),I=E.useRef(f),L=c!=null,$=tk(c),Q=tk(s),M=tk(d),z=E.useCallback(()=>{if(!T.current||!D.current)return;const K={placement:e,strategy:r,middleware:m};Q.current&&(K.platform=Q.current),Efe(T.current,D.current,K).then(Y=>{const O={...Y,isPositioned:M.current!==!1};R.current&&!e_(I.current,O)&&(I.current=O,vf.flushSync(()=>{p(O)}))})},[m,e,r,Q,M]);p0(()=>{d===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[d]);const R=E.useRef(!1);p0(()=>(R.current=!0,()=>{R.current=!1}),[]),p0(()=>{if(N&&(T.current=N),j&&(D.current=j),N&&j){if($.current)return $.current(N,j,z);z()}},[N,j,z,$,L]);const B=E.useMemo(()=>({reference:T,floating:D,setReference:S,setFloating:k}),[S,k]),V=E.useMemo(()=>({reference:N,floating:j}),[N,j]),F=E.useMemo(()=>{const K={position:r,left:0,top:0};if(!V.floating)return K;const Y=$4(V.floating,f.x),O=$4(V.floating,f.y);return l?{...K,transform:"translate("+Y+"px, "+O+"px)",...EU(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Y,top:O}},[r,l,V.floating,f.x,f.y]);return E.useMemo(()=>({...f,update:z,refs:B,elements:V,floatingStyles:F}),[f,z,B,V,F])}const Nfe=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:s}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?L4({element:n.current,padding:s}).fn(r):{}:n?L4({element:n,padding:s}).fn(r):{}}}},jfe=(t,e)=>({...xfe(t),options:[t,e]}),Tfe=(t,e)=>({..._fe(t),options:[t,e]}),Afe=(t,e)=>({...kfe(t),options:[t,e]}),Rfe=(t,e)=>({...bfe(t),options:[t,e]}),Dfe=(t,e)=>({...wfe(t),options:[t,e]}),Ofe=(t,e)=>({...Sfe(t),options:[t,e]}),Pfe=(t,e)=>({...Nfe(t),options:[t,e]});var Mfe="Arrow",CU=E.forwardRef((t,e)=>{const{children:r,width:n=10,height:s=5,...i}=t;return o.jsx(pt.svg,{...i,ref:e,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});CU.displayName=Mfe;var Ife=CU;function jT(t){const[e,r]=E.useState(void 0);return Kn(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let a,l;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;a=d.inlineSize,l=d.blockSize}else a=t.offsetWidth,l=t.offsetHeight;r({width:a,height:l})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var TT="Popper",[NU,Rf]=Us(TT),[Lfe,jU]=NU(TT),TU=t=>{const{__scopePopper:e,children:r}=t,[n,s]=E.useState(null);return o.jsx(Lfe,{scope:e,anchor:n,onAnchorChange:s,children:r})};TU.displayName=TT;var AU="PopperAnchor",RU=E.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...s}=t,i=jU(AU,r),a=E.useRef(null),l=Ht(e,a);return E.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||a.current)}),n?null:o.jsx(pt.div,{...s,ref:l})});RU.displayName=AU;var AT="PopperContent",[$fe,Bfe]=NU(AT),DU=E.forwardRef((t,e)=>{var he,xe,ke,Oe,He,Ye;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:y,...x}=t,w=jU(AT,r),[_,S]=E.useState(null),k=Ht(e,lt=>S(lt)),[N,j]=E.useState(null),T=jT(N),D=(T==null?void 0:T.width)??0,I=(T==null?void 0:T.height)??0,L=n+(i!=="center"?"-"+i:""),$=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},Q=Array.isArray(d)?d:[d],M=Q.length>0,z={padding:$,boundary:Q.filter(zfe),altBoundary:M},{refs:R,floatingStyles:B,placement:V,isPositioned:F,middlewareData:K}=Cfe({strategy:"fixed",placement:L,whileElementsMounted:(...lt)=>yfe(...lt,{animationFrame:g==="always"}),elements:{reference:w.anchor},middleware:[jfe({mainAxis:s+I,alignmentAxis:a}),c&&Tfe({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Afe():void 0,...z}),c&&Rfe({...z}),Dfe({...z,apply:({elements:lt,rects:P,availableWidth:ne,availableHeight:X})=>{const{width:W,height:Z}=P.reference,re=lt.floating.style;re.setProperty("--radix-popper-available-width",`${ne}px`),re.setProperty("--radix-popper-available-height",`${X}px`),re.setProperty("--radix-popper-anchor-width",`${W}px`),re.setProperty("--radix-popper-anchor-height",`${Z}px`)}}),N&&Pfe({element:N,padding:l}),Ufe({arrowWidth:D,arrowHeight:I}),m&&Ofe({strategy:"referenceHidden",...z})]}),[Y,O]=MU(V),H=us(y);Kn(()=>{F&&(H==null||H())},[F,H]);const G=(he=K.arrow)==null?void 0:he.x,q=(xe=K.arrow)==null?void 0:xe.y,J=((ke=K.arrow)==null?void 0:ke.centerOffset)!==0,[te,ve]=E.useState();return Kn(()=>{_&&ve(window.getComputedStyle(_).zIndex)},[_]),o.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:F?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(Oe=K.transformOrigin)==null?void 0:Oe.x,(He=K.transformOrigin)==null?void 0:He.y].join(" "),...((Ye=K.hide)==null?void 0:Ye.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx($fe,{scope:r,placedSide:Y,onArrowChange:j,arrowX:G,arrowY:q,shouldHideArrow:J,children:o.jsx(pt.div,{"data-side":Y,"data-align":O,...x,ref:k,style:{...x.style,animation:F?void 0:"none"}})})})});DU.displayName=AT;var OU="PopperArrow",Ffe={top:"bottom",right:"left",bottom:"top",left:"right"},PU=E.forwardRef(function(e,r){const{__scopePopper:n,...s}=e,i=Bfe(OU,n),a=Ffe[i.placedSide];return o.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:o.jsx(Ife,{...s,ref:r,style:{...s.style,display:"block"}})})});PU.displayName=OU;function zfe(t){return t!==null}var Ufe=t=>({name:"transformOrigin",options:t,fn(e){var w,_,S;const{placement:r,rects:n,middlewareData:s}=e,a=((w=s.arrow)==null?void 0:w.centerOffset)!==0,l=a?0:t.arrowWidth,c=a?0:t.arrowHeight,[d,f]=MU(r),p={start:"0%",center:"50%",end:"100%"}[f],m=(((_=s.arrow)==null?void 0:_.x)??0)+l/2,g=(((S=s.arrow)==null?void 0:S.y)??0)+c/2;let y="",x="";return d==="bottom"?(y=a?p:`${m}px`,x=`${-c}px`):d==="top"?(y=a?p:`${m}px`,x=`${n.floating.height+c}px`):d==="right"?(y=`${-c}px`,x=a?p:`${g}px`):d==="left"&&(y=`${n.floating.width+c}px`,x=a?p:`${g}px`),{data:{x:y,y:x}}}});function MU(t){const[e,r="center"]=t.split("-");return[e,r]}var RT=TU,DT=RU,OT=DU,PT=PU,rk="rovingFocusGroup.onEntryFocus",Vfe={bubbles:!1,cancelable:!0},kb="RovingFocusGroup",[tN,IU,Hfe]=H_(kb),[qfe,Eb]=Us(kb,[Hfe]),[Wfe,Gfe]=qfe(kb),LU=E.forwardRef((t,e)=>o.jsx(tN.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(tN.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(Kfe,{...t,ref:e})})}));LU.displayName=kb;var Kfe=E.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=t,m=E.useRef(null),g=Ht(e,m),y=_b(i),[x=null,w]=po({prop:a,defaultProp:l,onChange:c}),[_,S]=E.useState(!1),k=us(d),N=IU(r),j=E.useRef(!1),[T,D]=E.useState(0);return E.useEffect(()=>{const I=m.current;if(I)return I.addEventListener(rk,k),()=>I.removeEventListener(rk,k)},[k]),o.jsx(Wfe,{scope:r,orientation:n,dir:y,loop:s,currentTabStopId:x,onItemFocus:E.useCallback(I=>w(I),[w]),onItemShiftTab:E.useCallback(()=>S(!0),[]),onFocusableItemAdd:E.useCallback(()=>D(I=>I+1),[]),onFocusableItemRemove:E.useCallback(()=>D(I=>I-1),[]),children:o.jsx(pt.div,{tabIndex:_||T===0?-1:0,"data-orientation":n,...p,ref:g,style:{outline:"none",...t.style},onMouseDown:Ge(t.onMouseDown,()=>{j.current=!0}),onFocus:Ge(t.onFocus,I=>{const L=!j.current;if(I.target===I.currentTarget&&L&&!_){const $=new CustomEvent(rk,Vfe);if(I.currentTarget.dispatchEvent($),!$.defaultPrevented){const Q=N().filter(V=>V.focusable),M=Q.find(V=>V.active),z=Q.find(V=>V.id===x),B=[M,z,...Q].filter(Boolean).map(V=>V.ref.current);FU(B,f)}}j.current=!1}),onBlur:Ge(t.onBlur,()=>S(!1))})})}),$U="RovingFocusGroupItem",BU=E.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:i,...a}=t,l=ya(),c=i||l,d=Gfe($U,r),f=d.currentTabStopId===c,p=IU(r),{onFocusableItemAdd:m,onFocusableItemRemove:g}=d;return E.useEffect(()=>{if(n)return m(),()=>g()},[n,m,g]),o.jsx(tN.ItemSlot,{scope:r,id:c,focusable:n,active:s,children:o.jsx(pt.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:e,onMouseDown:Ge(t.onMouseDown,y=>{n?d.onItemFocus(c):y.preventDefault()}),onFocus:Ge(t.onFocus,()=>d.onItemFocus(c)),onKeyDown:Ge(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=Xfe(y,d.orientation,d.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=p().filter(S=>S.focusable).map(S=>S.ref.current);if(x==="last")_.reverse();else if(x==="prev"||x==="next"){x==="prev"&&_.reverse();const S=_.indexOf(y.currentTarget);_=d.loop?Zfe(_,S+1):_.slice(S+1)}setTimeout(()=>FU(_))}})})})});BU.displayName=$U;var Yfe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qfe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Xfe(t,e,r){const n=Qfe(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Yfe[n]}function FU(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function Zfe(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var zU=LU,UU=BU,VU=E.forwardRef((t,e)=>{const{children:r,...n}=t,s=E.Children.toArray(r),i=s.find(epe);if(i){const a=i.props.children,l=s.map(c=>c===i?E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null:c);return o.jsx(rN,{...n,ref:e,children:E.isValidElement(a)?E.cloneElement(a,void 0,l):null})}return o.jsx(rN,{...n,ref:e,children:r})});VU.displayName="Slot";var rN=E.forwardRef((t,e)=>{const{children:r,...n}=t;if(E.isValidElement(r)){const s=rpe(r),i=tpe(n,r.props);return r.type!==E.Fragment&&(i.ref=e?_o(e,s):s),E.cloneElement(r,i)}return E.Children.count(r)>1?E.Children.only(null):null});rN.displayName="SlotClone";var Jfe=({children:t})=>o.jsx(o.Fragment,{children:t});function epe(t){return E.isValidElement(t)&&t.type===Jfe}function tpe(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{i(...l),s(...l)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function rpe(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var nN=["Enter"," "],npe=["ArrowDown","PageUp","Home"],HU=["ArrowUp","PageDown","End"],spe=[...npe,...HU],ipe={ltr:[...nN,"ArrowRight"],rtl:[...nN,"ArrowLeft"]},ape={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fv="Menu",[Ng,ope,lpe]=H_(fv),[ud,qU]=Us(fv,[lpe,Rf,Eb]),Cb=Rf(),WU=Eb(),[cpe,dd]=ud(fv),[upe,pv]=ud(fv),GU=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:s,onOpenChange:i,modal:a=!0}=t,l=Cb(e),[c,d]=E.useState(null),f=E.useRef(!1),p=us(i),m=_b(s);return E.useEffect(()=>{const g=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),o.jsx(RT,{...l,children:o.jsx(cpe,{scope:e,open:r,onOpenChange:p,content:c,onContentChange:d,children:o.jsx(upe,{scope:e,onClose:E.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:a,children:n})})})};GU.displayName=fv;var dpe="MenuAnchor",MT=E.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=Cb(r);return o.jsx(DT,{...s,...n,ref:e})});MT.displayName=dpe;var IT="MenuPortal",[hpe,KU]=ud(IT,{forceMount:void 0}),YU=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:s}=t,i=dd(IT,e);return o.jsx(hpe,{scope:e,forceMount:r,children:o.jsx(_i,{present:r||i.open,children:o.jsx(xf,{asChild:!0,container:s,children:n})})})};YU.displayName=IT;var Vi="MenuContent",[fpe,LT]=ud(Vi),QU=E.forwardRef((t,e)=>{const r=KU(Vi,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=dd(Vi,t.__scopeMenu),a=pv(Vi,t.__scopeMenu);return o.jsx(Ng.Provider,{scope:t.__scopeMenu,children:o.jsx(_i,{present:n||i.open,children:o.jsx(Ng.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx(ppe,{...s,ref:e}):o.jsx(mpe,{...s,ref:e})})})})}),ppe=E.forwardRef((t,e)=>{const r=dd(Vi,t.__scopeMenu),n=E.useRef(null),s=Ht(e,n);return E.useEffect(()=>{const i=n.current;if(i)return pT(i)},[]),o.jsx($T,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Ge(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),mpe=E.forwardRef((t,e)=>{const r=dd(Vi,t.__scopeMenu);return o.jsx($T,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),$T=E.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,disableOutsideScroll:y,...x}=t,w=dd(Vi,r),_=pv(Vi,r),S=Cb(r),k=WU(r),N=ope(r),[j,T]=E.useState(null),D=E.useRef(null),I=Ht(e,D,w.onContentChange),L=E.useRef(0),$=E.useRef(""),Q=E.useRef(0),M=E.useRef(null),z=E.useRef("right"),R=E.useRef(0),B=y?yb:E.Fragment,V=y?{as:VU,allowPinchZoom:!0}:void 0,F=Y=>{var he,xe;const O=$.current+Y,H=N().filter(ke=>!ke.disabled),G=document.activeElement,q=(he=H.find(ke=>ke.ref.current===G))==null?void 0:he.textValue,J=H.map(ke=>ke.textValue),te=Npe(J,O,q),ve=(xe=H.find(ke=>ke.textValue===te))==null?void 0:xe.ref.current;(function ke(Oe){$.current=Oe,window.clearTimeout(L.current),Oe!==""&&(L.current=window.setTimeout(()=>ke(""),1e3))})(O),ve&&setTimeout(()=>ve.focus())};E.useEffect(()=>()=>window.clearTimeout(L.current),[]),fT();const K=E.useCallback(Y=>{var H,G;return z.current===((H=M.current)==null?void 0:H.side)&&Tpe(Y,(G=M.current)==null?void 0:G.area)},[]);return o.jsx(fpe,{scope:r,searchRef:$,onItemEnter:E.useCallback(Y=>{K(Y)&&Y.preventDefault()},[K]),onItemLeave:E.useCallback(Y=>{var O;K(Y)||((O=D.current)==null||O.focus(),T(null))},[K]),onTriggerLeave:E.useCallback(Y=>{K(Y)&&Y.preventDefault()},[K]),pointerGraceTimerRef:Q,onPointerGraceIntentChange:E.useCallback(Y=>{M.current=Y},[]),children:o.jsx(B,{...V,children:o.jsx(gb,{asChild:!0,trapped:s,onMountAutoFocus:Ge(i,Y=>{var O;Y.preventDefault(),(O=D.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(yf,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,children:o.jsx(zU,{asChild:!0,...k,dir:_.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:T,onEntryFocus:Ge(c,Y=>{_.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(OT,{role:"menu","aria-orientation":"vertical","data-state":hV(w.open),"data-radix-menu-content":"",dir:_.dir,...S,...x,ref:I,style:{outline:"none",...x.style},onKeyDown:Ge(x.onKeyDown,Y=>{const H=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,G=Y.ctrlKey||Y.altKey||Y.metaKey,q=Y.key.length===1;H&&(Y.key==="Tab"&&Y.preventDefault(),!G&&q&&F(Y.key));const J=D.current;if(Y.target!==J||!spe.includes(Y.key))return;Y.preventDefault();const ve=N().filter(he=>!he.disabled).map(he=>he.ref.current);HU.includes(Y.key)&&ve.reverse(),Epe(ve)}),onBlur:Ge(t.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(L.current),$.current="")}),onPointerMove:Ge(t.onPointerMove,jg(Y=>{const O=Y.target,H=R.current!==Y.clientX;if(Y.currentTarget.contains(O)&&H){const G=Y.clientX>R.current?"right":"left";z.current=G,R.current=Y.clientX}}))})})})})})})});QU.displayName=Vi;var gpe="MenuGroup",BT=E.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return o.jsx(pt.div,{role:"group",...n,ref:e})});BT.displayName=gpe;var vpe="MenuLabel",XU=E.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return o.jsx(pt.div,{...n,ref:e})});XU.displayName=vpe;var t_="MenuItem",B4="menu.itemSelect",Nb=E.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...s}=t,i=E.useRef(null),a=pv(t_,t.__scopeMenu),l=LT(t_,t.__scopeMenu),c=Ht(e,i),d=E.useRef(!1),f=()=>{const p=i.current;if(!r&&p){const m=new CustomEvent(B4,{bubbles:!0,cancelable:!0});p.addEventListener(B4,g=>n==null?void 0:n(g),{once:!0}),vj(p,m),m.defaultPrevented?d.current=!1:a.onClose()}};return o.jsx(ZU,{...s,ref:c,disabled:r,onClick:Ge(t.onClick,f),onPointerDown:p=>{var m;(m=t.onPointerDown)==null||m.call(t,p),d.current=!0},onPointerUp:Ge(t.onPointerUp,p=>{var m;d.current||(m=p.currentTarget)==null||m.click()}),onKeyDown:Ge(t.onKeyDown,p=>{const m=l.searchRef.current!=="";r||m&&p.key===" "||nN.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Nb.displayName=t_;var ZU=E.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...i}=t,a=LT(t_,r),l=WU(r),c=E.useRef(null),d=Ht(e,c),[f,p]=E.useState(!1),[m,g]=E.useState("");return E.useEffect(()=>{const y=c.current;y&&g((y.textContent??"").trim())},[i.children]),o.jsx(Ng.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:o.jsx(UU,{asChild:!0,...l,focusable:!n,children:o.jsx(pt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:d,onPointerMove:Ge(t.onPointerMove,jg(y=>{n?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ge(t.onPointerLeave,jg(y=>a.onItemLeave(y))),onFocus:Ge(t.onFocus,()=>p(!0)),onBlur:Ge(t.onBlur,()=>p(!1))})})})}),ype="MenuCheckboxItem",JU=E.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...s}=t;return o.jsx(sV,{scope:t.__scopeMenu,checked:r,children:o.jsx(Nb,{role:"menuitemcheckbox","aria-checked":r_(r)?"mixed":r,...s,ref:e,"data-state":zT(r),onSelect:Ge(s.onSelect,()=>n==null?void 0:n(r_(r)?!0:!r),{checkForDefaultPrevented:!1})})})});JU.displayName=ype;var eV="MenuRadioGroup",[xpe,_pe]=ud(eV,{value:void 0,onValueChange:()=>{}}),tV=E.forwardRef((t,e)=>{const{value:r,onValueChange:n,...s}=t,i=us(n);return o.jsx(xpe,{scope:t.__scopeMenu,value:r,onValueChange:i,children:o.jsx(BT,{...s,ref:e})})});tV.displayName=eV;var rV="MenuRadioItem",nV=E.forwardRef((t,e)=>{const{value:r,...n}=t,s=_pe(rV,t.__scopeMenu),i=r===s.value;return o.jsx(sV,{scope:t.__scopeMenu,checked:i,children:o.jsx(Nb,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":zT(i),onSelect:Ge(n.onSelect,()=>{var a;return(a=s.onValueChange)==null?void 0:a.call(s,r)},{checkForDefaultPrevented:!1})})})});nV.displayName=rV;var FT="MenuItemIndicator",[sV,bpe]=ud(FT,{checked:!1}),iV=E.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...s}=t,i=bpe(FT,r);return o.jsx(_i,{present:n||r_(i.checked)||i.checked===!0,children:o.jsx(pt.span,{...s,ref:e,"data-state":zT(i.checked)})})});iV.displayName=FT;var wpe="MenuSeparator",aV=E.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return o.jsx(pt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});aV.displayName=wpe;var Spe="MenuArrow",oV=E.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=Cb(r);return o.jsx(PT,{...s,...n,ref:e})});oV.displayName=Spe;var kpe="MenuSub",[A5e,lV]=ud(kpe),Tm="MenuSubTrigger",cV=E.forwardRef((t,e)=>{const r=dd(Tm,t.__scopeMenu),n=pv(Tm,t.__scopeMenu),s=lV(Tm,t.__scopeMenu),i=LT(Tm,t.__scopeMenu),a=E.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,d={__scopeMenu:t.__scopeMenu},f=E.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return E.useEffect(()=>f,[f]),E.useEffect(()=>{const p=l.current;return()=>{window.clearTimeout(p),c(null)}},[l,c]),o.jsx(MT,{asChild:!0,...d,children:o.jsx(ZU,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":hV(r.open),...t,ref:_o(e,s.onTriggerChange),onClick:p=>{var m;(m=t.onClick)==null||m.call(t,p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Ge(t.onPointerMove,jg(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:Ge(t.onPointerLeave,jg(p=>{var g,y;f();const m=(g=r.content)==null?void 0:g.getBoundingClientRect();if(m){const x=(y=r.content)==null?void 0:y.dataset.side,w=x==="right",_=w?-5:5,S=m[w?"left":"right"],k=m[w?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+_,y:p.clientY},{x:S,y:m.top},{x:k,y:m.top},{x:k,y:m.bottom},{x:S,y:m.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ge(t.onKeyDown,p=>{var g;const m=i.searchRef.current!=="";t.disabled||m&&p.key===" "||ipe[n.dir].includes(p.key)&&(r.onOpenChange(!0),(g=r.content)==null||g.focus(),p.preventDefault())})})})});cV.displayName=Tm;var uV="MenuSubContent",dV=E.forwardRef((t,e)=>{const r=KU(Vi,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=dd(Vi,t.__scopeMenu),a=pv(Vi,t.__scopeMenu),l=lV(uV,t.__scopeMenu),c=E.useRef(null),d=Ht(e,c);return o.jsx(Ng.Provider,{scope:t.__scopeMenu,children:o.jsx(_i,{present:n||i.open,children:o.jsx(Ng.Slot,{scope:t.__scopeMenu,children:o.jsx($T,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var p;a.isUsingKeyboardRef.current&&((p=c.current)==null||p.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ge(t.onFocusOutside,f=>{f.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ge(t.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:Ge(t.onKeyDown,f=>{var g;const p=f.currentTarget.contains(f.target),m=ape[a.dir].includes(f.key);p&&m&&(i.onOpenChange(!1),(g=l.trigger)==null||g.focus(),f.preventDefault())})})})})})});dV.displayName=uV;function hV(t){return t?"open":"closed"}function r_(t){return t==="indeterminate"}function zT(t){return r_(t)?"indeterminate":t?"checked":"unchecked"}function Epe(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function Cpe(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function Npe(t,e,r){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let a=Cpe(t,Math.max(i,0));s.length===1&&(a=a.filter(d=>d!==r));const c=a.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function jpe(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i].x,c=e[i].y,d=e[a].x,f=e[a].y;c>n!=f>n&&r<(d-l)*(n-c)/(f-c)+l&&(s=!s)}return s}function Tpe(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return jpe(r,e)}function jg(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Ape=GU,Rpe=MT,Dpe=YU,Ope=QU,Ppe=BT,Mpe=XU,Ipe=Nb,Lpe=JU,$pe=tV,Bpe=nV,Fpe=iV,zpe=aV,Upe=oV,Vpe=cV,Hpe=dV,UT="DropdownMenu",[qpe,R5e]=Us(UT,[qU]),Vs=qU(),[Wpe,fV]=qpe(UT),pV=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:a,modal:l=!0}=t,c=Vs(e),d=E.useRef(null),[f=!1,p]=po({prop:s,defaultProp:i,onChange:a});return o.jsx(Wpe,{scope:e,triggerId:ya(),triggerRef:d,contentId:ya(),open:f,onOpenChange:p,onOpenToggle:E.useCallback(()=>p(m=>!m),[p]),modal:l,children:o.jsx(Ape,{...c,open:f,onOpenChange:p,dir:n,modal:l,children:r})})};pV.displayName=UT;var mV="DropdownMenuTrigger",gV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=t,i=fV(mV,r),a=Vs(r);return o.jsx(Rpe,{asChild:!0,...a,children:o.jsx(pt.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:_o(e,i.triggerRef),onPointerDown:Ge(t.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:Ge(t.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});gV.displayName=mV;var Gpe="DropdownMenuPortal",vV=t=>{const{__scopeDropdownMenu:e,...r}=t,n=Vs(e);return o.jsx(Dpe,{...n,...r})};vV.displayName=Gpe;var yV="DropdownMenuContent",xV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=fV(yV,r),i=Vs(r),a=E.useRef(!1);return o.jsx(Ope,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...n,ref:e,onCloseAutoFocus:Ge(t.onCloseAutoFocus,l=>{var c;a.current||(c=s.triggerRef.current)==null||c.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:Ge(t.onInteractOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!s.modal||f)&&(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)"}})});xV.displayName=yV;var Kpe="DropdownMenuGroup",Ype=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Ppe,{...s,...n,ref:e})});Ype.displayName=Kpe;var Qpe="DropdownMenuLabel",_V=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Mpe,{...s,...n,ref:e})});_V.displayName=Qpe;var Xpe="DropdownMenuItem",bV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Ipe,{...s,...n,ref:e})});bV.displayName=Xpe;var Zpe="DropdownMenuCheckboxItem",wV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Lpe,{...s,...n,ref:e})});wV.displayName=Zpe;var Jpe="DropdownMenuRadioGroup",eme=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx($pe,{...s,...n,ref:e})});eme.displayName=Jpe;var tme="DropdownMenuRadioItem",SV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Bpe,{...s,...n,ref:e})});SV.displayName=tme;var rme="DropdownMenuItemIndicator",kV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Fpe,{...s,...n,ref:e})});kV.displayName=rme;var nme="DropdownMenuSeparator",EV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(zpe,{...s,...n,ref:e})});EV.displayName=nme;var sme="DropdownMenuArrow",ime=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Upe,{...s,...n,ref:e})});ime.displayName=sme;var ame="DropdownMenuSubTrigger",CV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Vpe,{...s,...n,ref:e})});CV.displayName=ame;var ome="DropdownMenuSubContent",NV=E.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Vs(r);return o.jsx(Hpe,{...s,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});NV.displayName=ome;var lme=pV,cme=gV,ume=vV,jV=xV,TV=_V,AV=bV,RV=wV,DV=SV,OV=kV,PV=EV,MV=CV,IV=NV;const F4=lme,z4=cme,dme=E.forwardRef(({className:t,inset:e,children:r,...n},s)=>o.jsxs(MV,{ref:s,className:we("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),...n,children:[r,o.jsx(_s,{className:"ml-auto"})]}));dme.displayName=MV.displayName;const hme=E.forwardRef(({className:t,...e},r)=>o.jsx(IV,{ref:r,className:we("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",t),...e}));hme.displayName=IV.displayName;const sN=E.forwardRef(({className:t,sideOffset:e=4,...r},n)=>o.jsx(ume,{children:o.jsx(jV,{ref:n,sideOffset:e,className:we("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-dropdown-menu-content-transform-origin]",t),...r})}));sN.displayName=jV.displayName;const gh=E.forwardRef(({className:t,inset:e,...r},n)=>o.jsx(AV,{ref:n,className:we("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]:size-4 [&>svg]:shrink-0",e&&"pl-8",t),...r}));gh.displayName=AV.displayName;const fme=E.forwardRef(({className:t,children:e,checked:r,...n},s)=>o.jsxs(RV,{ref:s,className:we("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(OV,{children:o.jsx(Lr,{className:"h-4 w-4"})})}),e]}));fme.displayName=RV.displayName;const pme=E.forwardRef(({className:t,children:e,...r},n)=>o.jsxs(DV,{ref:n,className:we("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(OV,{children:o.jsx(vte,{className:"h-2 w-2 fill-current"})})}),e]}));pme.displayName=DV.displayName;const LV=E.forwardRef(({className:t,inset:e,...r},n)=>o.jsx(TV,{ref:n,className:we("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...r}));LV.displayName=TV.displayName;const Am=E.forwardRef(({className:t,...e},r)=>o.jsx(PV,{ref:r,className:we("-mx-1 my-1 h-px bg-muted",t),...e}));Am.displayName=PV.displayName;const Df="https://gateway.ghaymah.systems";async function jb(t,e,r){const n=await fetch(`${Df}${t}`,{...r,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...(r==null?void 0:r.headers)||{}}}),s=await n.json().catch(()=>({}));if(!n.ok)throw new Error((s==null?void 0:s.error)||`Request failed (${n.status})`);return s.data}function $V(t){return jb("/v1/billing/status",t)}function BV(t){return jb("/v1/billing/usage",t)}function mme(t,e,r){const n=new URLSearchParams({success_url:e,cancel_url:r});return jb(`/v1/billing/setup-card?${n}`,t,{method:"POST"})}function gme(t,e){const r=new URLSearchParams({return_url:e});return jb(`/v1/billing/portal?${r}`,t,{method:"POST"})}const vme=`${Df}/v1/billing/plans`,yme=2e4,U4=2;function xme(){const[t,e]=E.useState("checking"),r=E.useRef(0);return E.useEffect(()=>{let n=!1,s=null;const i=async()=>{if(!(typeof navigator<"u"&&!navigator.onLine))try{s=new AbortController;const c=await fetch(vme,{method:"GET",cache:"no-store",signal:s.signal});if(n)return;c.ok?(r.current=0,e("up")):(r.current+=1,r.current>=U4&&e("down"))}catch(c){if(n||(c==null?void 0:c.name)==="AbortError")return;r.current+=1,r.current>=U4&&e("down")}finally{s=null}};i();const a=window.setInterval(i,yme),l=()=>{r.current=0,i()};return window.addEventListener("online",l),()=>{n=!0,s==null||s.abort(),window.clearInterval(a),window.removeEventListener("online",l)}},[]),{status:t,isDown:t==="down"}}function _me(){const{isDown:t}=xme();return t?o.jsxs("div",{role:"alert","aria-live":"polite",className:"flex items-center justify-center gap-3 border-b border-amber-500/30 bg-amber-500/10 px-4 py-2.5",children:[o.jsx(wte,{className:"h-4 w-4 shrink-0 animate-pulse text-amber-600 dark:text-amber-400"}),o.jsxs("div",{className:"min-w-0 text-center text-sm text-amber-900 dark:text-amber-200",children:[o.jsx("p",{className:"font-semibold leading-snug",children:"We're upgrading our system — your apps are running intact."}),o.jsxs("p",{className:"mt-0.5 flex items-center justify-center gap-1.5 text-xs text-amber-700/90 dark:text-amber-300/90",children:[o.jsx(od,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{dir:"rtl",lang:"ar",children:"نقوم بتحديث النظام — تطبيقاتك تعمل دون انقطاع. سنعود قريبًا."})]})]})]}):null}const bme=[{name:"ghaymah",color:"hsl(224.44, 64.29%, 32.94%)"},{name:"blue",color:"hsl(220, 80%, 55%)"},{name:"green",color:"hsl(150, 80%, 40%)"},{name:"teal",color:"hsl(175, 80%, 40%)"},{name:"indigo",color:"hsl(250, 70%, 55%)"},{name:"purple",color:"hsl(270, 70%, 60%)"},{name:"pink",color:"hsl(330, 80%, 60%)"},{name:"red",color:"hsl(0, 80%, 55%)"},{name:"orange",color:"hsl(25, 95%, 50%)"}],nk=()=>o.jsxs(ba,{to:"/dashboard",className:"group flex items-center gap-2.5",children:[o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("div",{className:"absolute -inset-1 rounded-2xl bg-gradient-to-br from-primary/40 via-primary/10 to-transparent opacity-0 blur-md transition-opacity duration-300 group-hover:opacity-100"}),o.jsx("img",{src:"/Logo.png",alt:"Ghaymah",className:"relative h-9 w-9 rounded-xl object-contain shadow-sm ring-1 ring-border/70"})]}),o.jsxs("div",{className:"leading-tight",children:[o.jsx("span",{className:"block text-sm font-bold tracking-tight",children:"غيمة"}),o.jsx("span",{className:"block text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Ghaymah Cloud"})]})]}),V4=[{label:"General",items:[{label:"Assistant",icon:I0,href:"/dashboard",description:"Chat with your cloud",keywords:"agent ai assistant chat deploy logs"},{label:"Overview",icon:rre,href:"/dashboard/overview",description:"Your cloud at a glance",keywords:"home dashboard"},{label:"Projects",icon:zte,href:"/dashboard/projects",description:"Deploy and manage apps",keywords:"apps applications deploy"}]},{label:"Services",items:[{label:"Apps",icon:HB,href:"/dashboard/apps",description:"Managed applications",keywords:"apps applications deploy v2"},{label:"Static Sites",icon:An,href:"/dashboard/static-deploy",description:"Host static sites in seconds",keywords:"deploy hosting web"},{label:"PostgreSQL",icon:Zs,href:"/dashboard/postgres",description:"Fully-managed databases",keywords:"db database sql"},{label:"S3 Storage",icon:Au,href:"/dashboard/storage",description:"Object storage & buckets",keywords:"bucket object storage"},{label:"Managed Volumes",icon:Wh,href:"/dashboard/managed-volumes",description:"Ghaymah v2 volumes",keywords:"disk storage volume v2"},{label:"Pull Secrets",icon:Gn,href:"/dashboard/pull-secrets",description:"Private registry credentials",keywords:"registry dockerhub pull secret credentials"},{label:"Secrets",icon:gi,href:"/dashboard/secrets",description:"API keys & tokens",keywords:"secret key token api environment"},{label:"Teams",icon:dc,href:"/dashboard/teams",description:"Share your cloud with teammates",keywords:"team share collaborate member"},{label:"Tunnels",icon:WB,href:"/dashboard/tunnels",description:"Expose services securely",keywords:"expose ngrok network"},{label:"Integrations",icon:Rre,href:"/dashboard/integrations",description:"Connect your tools",keywords:"dockerhub gitlab connect"}]},{label:"Platform",items:[{label:"Store",icon:Jre,href:"/dashboard/store",description:"One-click templates",keywords:"templates marketplace"},{label:"GenAI",icon:tte,href:"/dashboard/genai",description:"AI-powered features",keywords:"ai artificial intelligence"},{label:"Usage & Billing",icon:KB,href:"/dashboard/billing",description:"Monitor usage and costs",keywords:"billing credits cost"}]}],wme=t=>{var n,s;const e=(n=t==null?void 0:t.displayName)==null?void 0:n.trim();if(e){const i=e.split(/\s+/).filter(Boolean);return i.length>=2?`${i[0][0]}${i[1][0]}`.toUpperCase():e.slice(0,2).toUpperCase()}const r=(s=t==null?void 0:t.email)==null?void 0:s.trim();if(r){const i=r.split("@")[0];if(i)return i.slice(0,2).toUpperCase()}return"غ"},Sme=t=>{const e=["bg-emerald-600","bg-blue-600","bg-violet-600","bg-rose-600","bg-amber-600","bg-teal-600"];if(!t)return e[0];const r=t.split("").reduce((n,s)=>n+s.charCodeAt(0),0);return e[r%e.length]};function kme(){const{signOut:t}=N8(),e=Yn(),r=Ra(),{setTheme:n,resolvedTheme:s}=xde(),i=yl(),{projects:a,loading:l}=Nr(),[c,d]=E.useState(!1),[f,p]=E.useState(!1),[m,g]=E.useState(()=>localStorage.getItem("accentColor")||"ghaymah"),y=new Set(["/dashboard/projects"]),x=a.length>0,w=E.useMemo(()=>l||x?V4:V4.map(B=>({...B,items:B.items.filter(V=>!y.has(V.href))})).filter(B=>B.items.length>0),[l,x]),[_,S]=E.useState(""),[k,N]=E.useState(!1),j=E.useRef(null),T=E.useRef(null),D=E.useMemo(()=>w.flatMap(B=>B.items.map(V=>({...V,section:B.label,haystack:`${V.label} ${V.description??""} ${V.keywords??""} ${B.label}`.toLowerCase()}))),[w]),I=E.useMemo(()=>{const B=_.trim().toLowerCase();return B?D.filter(V=>V.haystack.includes(B)):D},[_,D]);E.useEffect(()=>{const B=()=>p(window.scrollY>8);return window.addEventListener("scroll",B),()=>window.removeEventListener("scroll",B)},[]),E.useEffect(()=>{document.documentElement.setAttribute("data-accent",m),localStorage.setItem("accentColor",m)},[m]),E.useEffect(()=>{const B=V=>{j.current&&!j.current.contains(V.target)&&N(!1)};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]),E.useEffect(()=>{const B=V=>{var F;(V.metaKey||V.ctrlKey)&&V.key.toLowerCase()==="k"&&(V.preventDefault(),(F=T.current)==null||F.focus(),N(!0))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]);const L=()=>{t(),e("/login")},$=()=>e("/dashboard/user/profile"),Q=B=>r.pathname===B||B!=="/dashboard"&&r.pathname.startsWith(B),M=B=>window.open(B,"_blank"),z=B=>{var V;e(B),N(!1),S(""),(V=T.current)==null||V.blur()},R=(B,V)=>{const F=Q(B.href);return o.jsxs("button",{onClick:()=>{e(B.href),V==null||V()},className:we("group relative flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-150",F?"bg-primary/10 text-primary shadow-sm":"text-muted-foreground hover:translate-x-0.5 hover:bg-accent hover:text-foreground"),children:[F&&o.jsx("span",{className:"absolute left-0 top-1/2 h-5 w-1 -translate-y-1/2 rounded-r-full bg-primary"}),o.jsx(B.icon,{className:we("h-[18px] w-[18px] shrink-0 transition-transform duration-150 group-hover:scale-110",F?"text-primary":"text-muted-foreground group-hover:text-foreground")}),o.jsx("span",{className:"truncate",children:B.label}),F&&o.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-primary/80"})]},B.href)};return o.jsx(Rhe,{open:c,onOpenChange:d,children:o.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-background to-background/95",children:[o.jsxs("aside",{className:"fixed inset-y-0 left-0 z-40 hidden w-[264px] flex-col border-r border-border/60 bg-card lg:flex",children:[o.jsx("div",{className:"flex h-16 shrink-0 items-center px-5",children:o.jsx(nk,{})}),o.jsx("nav",{className:"flex-1 overflow-y-auto px-3 py-2",children:w.map(B=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"px-3 pb-1.5 pt-4 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:B.label}),o.jsx("div",{className:"space-y-0.5",children:B.items.map(V=>R(V))})]},B.label))}),o.jsx("div",{className:"shrink-0 border-t border-border/60 p-3",children:o.jsxs("button",{onClick:()=>M("https://status.ghaymah.systems/status/ghaymah"),className:"group flex w-full items-center gap-3 rounded-lg border border-primary/10 bg-primary/5 p-3 text-left transition-colors hover:bg-primary/10",children:[o.jsxs("span",{className:"relative flex h-2.5 w-2.5 shrink-0",children:[o.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-60"}),o.jsx("span",{className:"relative inline-flex h-2.5 w-2.5 rounded-full bg-green-500"})]}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"All systems operational"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Ghaymah Cloud status"})]}),o.jsx(al,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100"})]})})]}),o.jsxs(mU,{side:"left",className:"flex w-80 flex-col border-r border-primary/10 bg-background p-0",children:[o.jsx("div",{className:"flex h-16 items-center px-5",children:o.jsx(nk,{})}),o.jsx("nav",{className:"flex-1 overflow-y-auto px-3 py-2",children:w.map(B=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"px-3 pb-1.5 pt-4 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:B.label}),o.jsx("div",{className:"space-y-0.5",children:B.items.map(V=>R(V,()=>d(!1)))})]},B.label))}),o.jsxs("div",{className:"shrink-0 border-t border-border/60 p-4",children:[o.jsxs("div",{className:"mb-3 flex items-center gap-3 rounded-lg border border-primary/10 bg-primary/5 p-3",children:[o.jsx(ti,{className:"h-4 w-4 shrink-0 text-primary"}),o.jsxs("div",{children:[o.jsx("span",{className:"block text-sm font-medium",children:"Cloud Status"}),o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500"}),"All services operational"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>{d(!1),$()},children:[o.jsx(AM,{className:"mr-2 h-4 w-4"})," Profile"]}),o.jsxs(le,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{d(!1),L()},children:[o.jsx(OM,{className:"mr-2 h-4 w-4"})," Sign out"]})]})]})]}),o.jsxs("div",{className:"flex min-h-screen flex-col lg:pl-[264px]",children:[o.jsx(_me,{}),o.jsxs("header",{className:we("sticky top-0 z-30 w-full border-b transition-all duration-300 backdrop-blur-xl",f?"border-border bg-background/90 shadow-sm":"border-transparent bg-background/70"),children:[o.jsx("div",{className:"h-0.5 w-full bg-gradient-to-r from-primary/70 via-primary/25 to-transparent"}),o.jsxs("div",{className:"flex h-16 items-center gap-2 px-4 md:px-6",children:[o.jsx(Dhe,{asChild:!0,children:o.jsxs(le,{variant:"ghost",size:"icon",className:"lg:hidden -ml-2",children:[o.jsx(mre,{className:"h-5 w-5"}),o.jsx("span",{className:"sr-only",children:"Toggle menu"})]})}),o.jsx("div",{className:"lg:hidden",children:o.jsx(nk,{})}),o.jsxs("div",{ref:j,className:"relative hidden w-full max-w-sm md:block lg:ml-2",children:[o.jsx(sv,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx("input",{ref:T,value:_,onChange:B=>{S(B.target.value),N(!0)},onFocus:()=>N(!0),onKeyDown:B=>{B.key==="Enter"&&I.length>0&&z(I[0].href),B.key==="Escape"&&N(!1)},placeholder:"Search services, docs, actions…",className:"h-9 w-full rounded-lg border border-border/60 bg-muted/40 pl-9 pr-14 text-sm text-foreground placeholder:text-muted-foreground transition-colors focus:border-primary/40 focus:bg-background focus:outline-none focus:ring-2 focus:ring-primary/20"}),o.jsx("kbd",{className:"absolute right-2.5 top-1/2 hidden -translate-y-1/2 items-center gap-0.5 rounded border border-border bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground sm:flex",children:"⌘K"}),k&&o.jsx("div",{className:"absolute left-0 right-0 top-full z-50 mt-2 max-h-96 overflow-y-auto rounded-xl border border-border bg-popover p-1.5 shadow-xl",children:I.length===0?o.jsxs("p",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:["No results for “",_,"”"]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"px-2.5 pb-1 pt-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:_.trim()?"Results":"Quick navigation"}),I.map(B=>{const V=Q(B.href);return o.jsxs("button",{onMouseDown:F=>F.preventDefault(),onClick:()=>z(B.href),className:we("flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left transition-colors",V?"bg-primary/5":"hover:bg-accent"),children:[o.jsx("div",{className:we("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg",V?"bg-primary/15":"bg-muted"),children:o.jsx(B.icon,{className:we("h-4 w-4",V?"text-primary":"text-muted-foreground")})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:B.label}),B.description&&o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:B.description})]}),o.jsx("span",{className:"shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70",children:B.section})]},B.href)})]})})]}),o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[o.jsx(le,{variant:"ghost",size:"icon",title:s==="dark"?"Switch to light mode":"Switch to dark mode",onClick:()=>n(s==="dark"?"light":"dark"),children:s==="dark"?o.jsx(eF,{className:"h-5 w-5"}):o.jsx(cl,{className:"h-5 w-5"})}),o.jsxs(F4,{children:[o.jsx(z4,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",title:"Resources",children:o.jsx(GB,{className:"h-5 w-5"})})}),o.jsxs(sN,{align:"end",className:"w-56",children:[o.jsx(LV,{children:"Resources"}),o.jsx(Am,{}),o.jsxs(gh,{onSelect:()=>M("https://docs.ghaymah.cloud"),children:[o.jsx(Kee,{className:"mr-2 h-4 w-4 text-primary"}),"Documentation"]}),o.jsxs(gh,{onSelect:()=>M("https://wa.me/15145064526?text=Hello%2C%20I%27d%20like%20to%20book%20a%20call."),children:[o.jsx(XB,{className:"mr-2 h-4 w-4 text-primary"}),"Book a call"]}),o.jsxs(gh,{onSelect:()=>M("https://status.ghaymah.systems/status/ghaymah"),children:[o.jsx(xte,{className:"mr-2 h-4 w-4 text-primary"}),"System status"]})]})]}),o.jsxs(le,{className:"hidden gap-1.5 md:inline-flex ml-1 bg-gradient-to-r from-primary to-primary/90 shadow-sm hover:from-primary hover:to-primary",onClick:()=>e("/dashboard/static-deploy"),children:[o.jsx($r,{className:"h-4 w-4"}),"Deploy"]}),o.jsxs(F4,{children:[o.jsx(z4,{asChild:!0,children:o.jsx("button",{title:"Account",className:"ml-1 flex h-9 w-9 items-center justify-center rounded-full transition-transform hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:o.jsx(uT,{className:"h-8 w-8 ring-2 ring-primary/20",children:o.jsx(dT,{className:we("flex items-center justify-center text-sm font-bold leading-none text-white",Sme((i==null?void 0:i.id)||(i==null?void 0:i.email))),children:wme(i)})})})}),o.jsxs(sN,{align:"end",className:"w-64",children:[o.jsxs("div",{className:"px-2 py-1.5",children:[o.jsx("p",{className:"truncate text-sm font-semibold",children:(i==null?void 0:i.displayName)||"Ghaymah User"}),(i==null?void 0:i.email)&&o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:i.email})]}),o.jsx(Am,{}),o.jsxs(gh,{onSelect:$,children:[o.jsx(AM,{className:"mr-2 h-4 w-4 text-primary"}),"Profile"]}),o.jsx(Am,{}),o.jsxs("div",{className:"px-3 py-2",children:[o.jsxs("p",{className:"flex items-center gap-2 pb-2 text-xs text-muted-foreground",children:[o.jsx(kre,{className:"h-3.5 w-3.5"})," Accent color"]}),o.jsx("div",{className:"grid grid-cols-9 gap-1.5",children:bme.map(B=>o.jsx("button",{type:"button",title:B.name,onClick:()=>g(B.name),className:we("flex h-6 w-6 items-center justify-center rounded-md border border-transparent transition-all hover:scale-110",m===B.name&&"border-primary bg-primary/10 ring-1 ring-primary"),children:o.jsx("span",{className:"h-3.5 w-3.5 rounded-full",style:{backgroundColor:B.color}})},B.name))})]}),o.jsx(Am,{}),o.jsxs(gh,{onSelect:L,className:"text-destructive focus:text-destructive",children:[o.jsx(OM,{className:"mr-2 h-4 w-4"}),"Sign out"]})]})]})]})]})]}),o.jsx("main",{className:"flex-1",children:o.jsx("div",{className:"container max-w-7xl mx-auto py-6 px-4 md:px-6 lg:py-8",children:o.jsx(aJ,{})})}),o.jsx("footer",{className:"border-t bg-background/60 backdrop-blur-sm",children:o.jsxs("div",{className:"container max-w-7xl mx-auto px-4 md:px-6 py-8",children:[o.jsxs("div",{className:"flex flex-col gap-8 md:flex-row md:items-start md:justify-between",children:[o.jsxs("div",{className:"max-w-sm space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("img",{src:"/Logo.png",alt:"Ghaymah Cloud",className:"h-10 w-10 rounded-xl object-contain shadow-sm ring-1 ring-border/70"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-base font-semibold",children:"Ghaymah Cloud"}),o.jsx("p",{className:"text-xs text-muted-foreground",dir:"rtl",lang:"ar",children:"غيمة — قوة السحابة، ببساطة"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Deploy, scale, and manage your apps, databases, and storage in minutes — built for the region, ready for the world."})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Product"}),o.jsxs("nav",{className:"flex flex-col gap-2.5 text-sm",children:[o.jsx("button",{className:"text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>M("https://docs.ghaymah.cloud"),children:"Documentation"}),o.jsx("button",{className:"text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>M("https://status.ghaymah.systems/status/ghaymah"),children:"System status"}),o.jsx("button",{className:"text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>M("https://wa.me/15145064526?text=Hello%2C%20I%27d%20like%20to%20book%20a%20call."),children:"Support"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Locations"}),o.jsx("ul",{className:"flex flex-col gap-2.5 text-sm",children:["Montreal","Cairo","Damascus","Beirut"].map(B=>o.jsxs("li",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(hre,{className:"h-3.5 w-3.5 text-primary"}),B]},B))})]})]}),o.jsxs("div",{className:"mt-8 flex flex-col items-center justify-between gap-3 border-t border-border/60 pt-5 text-xs text-muted-foreground md:flex-row",children:[o.jsx("span",{children:"© 1448–2026 غيمة — Ghaymah Cloud. All rights reserved."}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx(ti,{className:"h-3 w-3 text-primary"}),"Made with إتقان in the region."]})]})]})})]}),o.jsx(mF,{})]})})}function Eme(){const{pathname:t}=Ra();return E.useEffect(()=>{window.scrollTo(0,0)},[t]),null}const FV=E.createContext({});function Cme(t){const e=E.useRef(null);return e.current===null&&(e.current=t()),e.current}const VT=typeof window<"u",Nme=VT?E.useLayoutEffect:E.useEffect,HT=E.createContext(null),zV=E.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function jme(t=!0){const e=E.useContext(HT);if(e===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:s}=e,i=E.useId();E.useEffect(()=>{if(t)return s(i)},[t]);const a=E.useCallback(()=>t&&n&&n(i),[i,n,t]);return!r&&n?[!1,a]:[!0]}function qT(t,e){t.indexOf(e)===-1&&t.push(e)}function WT(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}const yi=t=>t;let UV=yi;const Tme={useManualTiming:!1};function GT(t){let e;return()=>(e===void 0&&(e=t()),e)}const tf=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n};class KT{constructor(){this.subscriptions=[]}add(e){return qT(this.subscriptions,e),()=>WT(this.subscriptions,e)}notify(e,r,n){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,r,n);else for(let i=0;i<s;i++){const a=this.subscriptions[i];a&&a(e,r,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const rl=t=>t*1e3,nl=t=>t/1e3;function VV(t,e){return e?t*(1e3/e):0}const Ame=GT(()=>window.ScrollTimeline!==void 0);class Rme{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=r}attachTimeline(e,r){const n=this.animations.map(s=>{if(Ame()&&s.attachTimeline)return s.attachTimeline(e);if(typeof r=="function")return r(s)});return()=>{n.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;r<this.animations.length;r++)e=Math.max(e,this.animations[r].duration);return e}runAll(e){this.animations.forEach(r=>r[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Dme extends Rme{then(e,r){return Promise.all(this.animations).then(e).catch(r)}}function YT(t,e){return t?t[e]||t.default||t:void 0}const iN=2e4;function HV(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e<iN;)e+=r,n=t.next(e);return e>=iN?1/0:e}function QT(t){return typeof t=="function"}function H4(t,e){t.timeline=e,t.onfinish=null}const XT=t=>Array.isArray(t)&&typeof t[0]=="number",Ome={linearEasing:void 0};function Pme(t,e){const r=GT(t);return()=>{var n;return(n=Ome[e])!==null&&n!==void 0?n:r()}}const n_=Pme(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),qV=(t,e,r=10)=>{let n="";const s=Math.max(Math.round(e/r),2);for(let i=0;i<s;i++)n+=t(tf(0,s-1,i))+", ";return`linear(${n.substring(0,n.length-2)})`};function WV(t){return!!(typeof t=="function"&&n_()||!t||typeof t=="string"&&(t in aN||n_())||XT(t)||Array.isArray(t)&&t.every(WV))}const Rm=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,aN={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Rm([0,.65,.55,1]),circOut:Rm([.55,0,1,.45]),backIn:Rm([.31,.01,.66,-.59]),backOut:Rm([.33,1.53,.69,.99])};function GV(t,e){if(t)return typeof t=="function"&&n_()?qV(t,e):XT(t)?Rm(t):Array.isArray(t)?t.map(r=>GV(r,e)||aN.easeOut):aN[t]}const mx=["read","resolveKeyframes","update","preRender","render","postRender"],q4={value:null};function Mme(t,e){let r=new Set,n=new Set,s=!1,i=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},c=0;function d(p){a.has(p)&&(f.schedule(p),t()),c++,p(l)}const f={schedule:(p,m=!1,g=!1)=>{const x=g&&s?r:n;return m&&a.add(p),x.has(p)||x.add(p),p},cancel:p=>{n.delete(p),a.delete(p)},process:p=>{if(l=p,s){i=!0;return}s=!0,[r,n]=[n,r],r.forEach(d),e&&q4.value&&q4.value.frameloop[e].push(c),c=0,r.clear(),s=!1,i&&(i=!1,f.process(p))}};return f}const Ime=40;function KV(t,e){let r=!1,n=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,a=mx.reduce((_,S)=>(_[S]=Mme(i,e?S:void 0),_),{}),{read:l,resolveKeyframes:c,update:d,preRender:f,render:p,postRender:m}=a,g=()=>{const _=performance.now();r=!1,s.delta=n?1e3/60:Math.max(Math.min(_-s.timestamp,Ime),1),s.timestamp=_,s.isProcessing=!0,l.process(s),c.process(s),d.process(s),f.process(s),p.process(s),m.process(s),s.isProcessing=!1,r&&e&&(n=!1,t(g))},y=()=>{r=!0,n=!0,s.isProcessing||t(g)};return{schedule:mx.reduce((_,S)=>{const k=a[S];return _[S]=(N,j=!1,T=!1)=>(r||y(),k.schedule(N,j,T)),_},{}),cancel:_=>{for(let S=0;S<mx.length;S++)a[mx[S]].cancel(_)},state:s,steps:a}}const{schedule:Cr,cancel:Rc,state:ns,steps:sk}=KV(typeof requestAnimationFrame<"u"?requestAnimationFrame:yi,!0),{schedule:ZT}=KV(queueMicrotask,!1);let m0;function Lme(){m0=void 0}const uo={now:()=>(m0===void 0&&uo.set(ns.isProcessing||Tme.useManualTiming?ns.timestamp:performance.now()),m0),set:t=>{m0=t,queueMicrotask(Lme)}},aa={x:!1,y:!1};function YV(){return aa.x||aa.y}function $me(t){return t==="x"||t==="y"?aa[t]?null:(aa[t]=!0,()=>{aa[t]=!1}):aa.x||aa.y?null:(aa.x=aa.y=!0,()=>{aa.x=aa.y=!1})}function Bme(t,e,r){var n;if(t instanceof EventTarget)return[t];if(typeof t=="string"){let s=document;const i=(n=void 0)!==null&&n!==void 0?n:s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}function QV(t,e){const r=Bme(t),n=new AbortController,s={passive:!0,...e,signal:n.signal};return[r,s,()=>n.abort()]}function W4(t){return!(t.pointerType==="touch"||YV())}function Fme(t,e,r={}){const[n,s,i]=QV(t,r),a=l=>{if(!W4(l))return;const{target:c}=l,d=e(c,l);if(typeof d!="function"||!c)return;const f=p=>{W4(p)&&(d(p),c.removeEventListener("pointerleave",f))};c.addEventListener("pointerleave",f,s)};return n.forEach(l=>{l.addEventListener("pointerenter",a,s)}),i}const XV=(t,e)=>e?t===e?!0:XV(t,e.parentElement):!1,JT=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,zme=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ume(t){return zme.has(t.tagName)||t.tabIndex!==-1}const Dm=new WeakSet;function G4(t){return e=>{e.key==="Enter"&&t(e)}}function ik(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Vme=(t,e)=>{const r=t.currentTarget;if(!r)return;const n=G4(()=>{if(Dm.has(r))return;ik(r,"down");const s=G4(()=>{ik(r,"up")}),i=()=>ik(r,"cancel");r.addEventListener("keyup",s,e),r.addEventListener("blur",i,e)});r.addEventListener("keydown",n,e),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),e)};function K4(t){return JT(t)&&!YV()}function Hme(t,e,r={}){const[n,s,i]=QV(t,r),a=l=>{const c=l.currentTarget;if(!K4(l)||Dm.has(c))return;Dm.add(c);const d=e(c,l),f=(g,y)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",m),!(!K4(g)||!Dm.has(c))&&(Dm.delete(c),typeof d=="function"&&d(g,{success:y}))},p=g=>{f(g,c===window||c===document||r.useGlobalTarget||XV(c,g.target))},m=g=>{f(g,!1)};window.addEventListener("pointerup",p,s),window.addEventListener("pointercancel",m,s)};return n.forEach(l=>{(r.useGlobalTarget?window:l).addEventListener("pointerdown",a,s),l instanceof HTMLElement&&(l.addEventListener("focus",d=>Vme(d,s)),!Ume(l)&&l.tabIndex===null&&(l.tabIndex=0))}),i}const Y4=30,qme=t=>!isNaN(parseFloat(t));class Wme{constructor(e,r={}){this.version="12.6.1",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,s=!0)=>{const i=uo.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=uo.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=qme(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new KT);const n=this.events[e].add(r);return e==="change"?()=>{n(),Cr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=uo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Y4)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,Y4);return VV(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Tg(t,e){return new Wme(t,e)}const ZV=E.createContext({strict:!1}),Q4={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},rf={};for(const t in Q4)rf[t]={isEnabled:e=>Q4[t].some(r=>!!e[r])};function Gme(t){for(const e in t)rf[e]={...rf[e],...t[e]}}const Kme=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function s_(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Kme.has(t)}let JV=t=>!s_(t);function Yme(t){t&&(JV=e=>e.startsWith("on")?!s_(e):t(e))}try{Yme(require("@emotion/is-prop-valid").default)}catch{}function Qme(t,e,r){const n={};for(const s in t)s==="values"&&typeof t.values=="object"||(JV(s)||r===!0&&s_(s)||!e&&!s_(s)||t.draggable&&s.startsWith("onDrag"))&&(n[s]=t[s]);return n}function Xme(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>t(...n);return new Proxy(r,{get:(n,s)=>s==="create"?t:(e.has(s)||e.set(s,t(s)),e.get(s))})}const Tb=E.createContext({});function Ab(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Ag(t){return typeof t=="string"||Array.isArray(t)}const eA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],tA=["initial",...eA];function Rb(t){return Ab(t.animate)||tA.some(e=>Ag(t[e]))}function e9(t){return!!(Rb(t)||t.variants)}function Zme(t,e){if(Rb(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Ag(r)?r:void 0,animate:Ag(n)?n:void 0}}return t.inherit!==!1?e:{}}function Jme(t){const{initial:e,animate:r}=Zme(t,E.useContext(Tb));return E.useMemo(()=>({initial:e,animate:r}),[X4(e),X4(r)])}function X4(t){return Array.isArray(t)?t.join(" "):t}const ege=Symbol.for("motionComponentSymbol");function Sh(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function tge(t,e,r){return E.useCallback(n=>{n&&t.onMount&&t.onMount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Sh(r)&&(r.current=n))},[e])}const rA=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),rge="framerAppearId",t9="data-"+rA(rge),r9=E.createContext({});function nge(t,e,r,n,s){var i,a;const{visualElement:l}=E.useContext(Tb),c=E.useContext(ZV),d=E.useContext(HT),f=E.useContext(zV).reducedMotion,p=E.useRef(null);n=n||c.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:l,props:r,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:f}));const m=p.current,g=E.useContext(r9);m&&!m.projection&&s&&(m.type==="html"||m.type==="svg")&&sge(p.current,r,s,g);const y=E.useRef(!1);E.useInsertionEffect(()=>{m&&y.current&&m.update(r,d)});const x=r[t9],w=E.useRef(!!x&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,x))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,x)));return Nme(()=>{m&&(y.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),ZT.render(m.render),w.current&&m.animationState&&m.animationState.animateChanges())}),E.useEffect(()=>{m&&(!w.current&&m.animationState&&m.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var _;(_=window.MotionHandoffMarkAsComplete)===null||_===void 0||_.call(window,x)}),w.current=!1))}),m}function sge(t,e,r,n){const{layoutId:s,layout:i,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:d}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:n9(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||l&&Sh(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,layoutScroll:c,layoutRoot:d})}function n9(t){if(t)return t.options.allowProjection!==!1?t.projection:n9(t.parent)}function ige({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:s}){var i,a;t&&Gme(t);function l(d,f){let p;const m={...E.useContext(zV),...d,layoutId:age(d)},{isStatic:g}=m,y=Jme(d),x=n(d,g);if(!g&&VT){oge();const w=lge(m);p=w.MeasureLayout,y.visualElement=nge(s,x,m,e,w.ProjectionNode)}return o.jsxs(Tb.Provider,{value:y,children:[p&&y.visualElement?o.jsx(p,{visualElement:y.visualElement,...m}):null,r(s,d,tge(x,y.visualElement,f),x,g,y.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(a=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&a!==void 0?a:""})`}`;const c=E.forwardRef(l);return c[ege]=s,c}function age({layoutId:t}){const e=E.useContext(FV).id;return e&&t!==void 0?e+"-"+t:t}function oge(t,e){E.useContext(ZV).strict}function lge(t){const{drag:e,layout:r}=rf;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const s9=t=>e=>typeof e=="string"&&e.startsWith(t),nA=s9("--"),cge=s9("var(--"),sA=t=>cge(t)?uge.test(t.split("/*")[0].trim()):!1,uge=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Rg={};function dge(t){for(const e in t)Rg[e]=t[e],nA(e)&&(Rg[e].isCSSVariable=!0)}const Of=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],hd=new Set(Of);function i9(t,{layout:e,layoutId:r}){return hd.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Rg[t]||t==="opacity")}const Cs=t=>!!(t&&t.getVelocity),a9=(t,e)=>e&&typeof t=="number"?e.transform(t):t,fl=(t,e,r)=>r>e?e:r<t?t:r,Pf={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Dg={...Pf,transform:t=>fl(0,1,t)},gx={...Pf,default:1},mv=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),rc=mv("deg"),ho=mv("%"),xt=mv("px"),hge=mv("vh"),fge=mv("vw"),Z4={...ho,parse:t=>ho.parse(t)/100,transform:t=>ho.transform(t*100)},pge={borderWidth:xt,borderTopWidth:xt,borderRightWidth:xt,borderBottomWidth:xt,borderLeftWidth:xt,borderRadius:xt,radius:xt,borderTopLeftRadius:xt,borderTopRightRadius:xt,borderBottomRightRadius:xt,borderBottomLeftRadius:xt,width:xt,maxWidth:xt,height:xt,maxHeight:xt,top:xt,right:xt,bottom:xt,left:xt,padding:xt,paddingTop:xt,paddingRight:xt,paddingBottom:xt,paddingLeft:xt,margin:xt,marginTop:xt,marginRight:xt,marginBottom:xt,marginLeft:xt,backgroundPositionX:xt,backgroundPositionY:xt},mge={rotate:rc,rotateX:rc,rotateY:rc,rotateZ:rc,scale:gx,scaleX:gx,scaleY:gx,scaleZ:gx,skew:rc,skewX:rc,skewY:rc,distance:xt,translateX:xt,translateY:xt,translateZ:xt,x:xt,y:xt,z:xt,perspective:xt,transformPerspective:xt,opacity:Dg,originX:Z4,originY:Z4,originZ:xt},J4={...Pf,transform:Math.round},iA={...pge,...mge,zIndex:J4,size:xt,fillOpacity:Dg,strokeOpacity:Dg,numOctaves:J4},gge={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},vge=Of.length;function yge(t,e,r){let n="",s=!0;for(let i=0;i<vge;i++){const a=Of[i],l=t[a];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(a.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||r){const d=a9(l,iA[a]);if(!c){s=!1;const f=gge[a]||a;n+=`${f}(${d}) `}r&&(e[a]=d)}}return n=n.trim(),r?n=r(e,s?"":n):s&&(n="none"),n}function aA(t,e,r){const{style:n,vars:s,transformOrigin:i}=t;let a=!1,l=!1;for(const c in e){const d=e[c];if(hd.has(c)){a=!0;continue}else if(nA(c)){s[c]=d;continue}else{const f=a9(d,iA[c]);c.startsWith("origin")?(l=!0,i[c]=f):n[c]=f}}if(e.transform||(a||r?n.transform=yge(e,t.transform,r):n.transform&&(n.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:f=0}=i;n.transformOrigin=`${c} ${d} ${f}`}}const oA=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function o9(t,e,r){for(const n in e)!Cs(e[n])&&!i9(n,r)&&(t[n]=e[n])}function xge({transformTemplate:t},e){return E.useMemo(()=>{const r=oA();return aA(r,e,t),Object.assign({},r.vars,r.style)},[e])}function _ge(t,e){const r=t.style||{},n={};return o9(n,r,t),Object.assign(n,xge(t,e)),n}function bge(t,e){const r={},n=_ge(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const wge=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function lA(t){return typeof t!="string"||t.includes("-")?!1:!!(wge.indexOf(t)>-1||/[A-Z]/u.test(t))}const Sge={offset:"stroke-dashoffset",array:"stroke-dasharray"},kge={offset:"strokeDashoffset",array:"strokeDasharray"};function Ege(t,e,r=1,n=0,s=!0){t.pathLength=1;const i=s?Sge:kge;t[i.offset]=xt.transform(-n);const a=xt.transform(e),l=xt.transform(r);t[i.array]=`${a} ${l}`}function eI(t,e,r){return typeof t=="string"?t:xt.transform(e+r*t)}function Cge(t,e,r){const n=eI(e,t.x,t.width),s=eI(r,t.y,t.height);return`${n} ${s}`}function cA(t,{attrX:e,attrY:r,attrScale:n,originX:s,originY:i,pathLength:a,pathSpacing:l=1,pathOffset:c=0,...d},f,p){if(aA(t,d,p),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:m,style:g,dimensions:y}=t;m.transform&&(y&&(g.transform=m.transform),delete m.transform),y&&(s!==void 0||i!==void 0||g.transform)&&(g.transformOrigin=Cge(y,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(m.x=e),r!==void 0&&(m.y=r),n!==void 0&&(m.scale=n),a!==void 0&&Ege(m,a,l,c,!1)}const l9=()=>({...oA(),attrs:{}}),uA=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Nge(t,e,r,n){const s=E.useMemo(()=>{const i=l9();return cA(i,e,uA(n),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};o9(i,t.style,t),s.style={...i,...s.style}}return s}function jge(t=!1){return(r,n,s,{latestValues:i},a)=>{const c=(lA(r)?Nge:bge)(n,i,a,r),d=Qme(n,typeof r=="string",t),f=r!==E.Fragment?{...d,...c,ref:s}:{},{children:p}=n,m=E.useMemo(()=>Cs(p)?p.get():p,[p]);return E.createElement(r,{...f,children:m})}}function tI(t){const e=[{},{}];return t==null||t.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function dA(t,e,r,n){if(typeof e=="function"){const[s,i]=tI(n);e=e(r!==void 0?r:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=tI(n);e=e(r!==void 0?r:t.custom,s,i)}return e}const oN=t=>Array.isArray(t),Tge=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),Age=t=>oN(t)?t[t.length-1]||0:t;function g0(t){const e=Cs(t)?t.get():t;return Tge(e)?e.toValue():e}function Rge({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:r},n,s,i){const a={latestValues:Dge(n,s,i,t),renderState:e()};return r&&(a.onMount=l=>r({props:n,current:l,...a}),a.onUpdate=l=>r(l)),a}const c9=t=>(e,r)=>{const n=E.useContext(Tb),s=E.useContext(HT),i=()=>Rge(t,e,n,s);return r?i():Cme(i)};function Dge(t,e,r,n){const s={},i=n(t,{});for(const m in i)s[m]=g0(i[m]);let{initial:a,animate:l}=t;const c=Rb(t),d=e9(t);e&&d&&!c&&t.inherit!==!1&&(a===void 0&&(a=e.initial),l===void 0&&(l=e.animate));let f=r?r.initial===!1:!1;f=f||a===!1;const p=f?l:a;if(p&&typeof p!="boolean"&&!Ab(p)){const m=Array.isArray(p)?p:[p];for(let g=0;g<m.length;g++){const y=dA(t,m[g]);if(y){const{transitionEnd:x,transition:w,..._}=y;for(const S in _){let k=_[S];if(Array.isArray(k)){const N=f?k.length-1:0;k=k[N]}k!==null&&(s[S]=k)}for(const S in x)s[S]=x[S]}}}return s}function hA(t,e,r){var n;const{style:s}=t,i={};for(const a in s)(Cs(s[a])||e.style&&Cs(e.style[a])||i9(a,t)||((n=r==null?void 0:r.getValue(a))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(i[a]=s[a]);return i}const Oge={useVisualState:c9({scrapeMotionValuesFromProps:hA,createRenderState:oA})};function u9(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}function d9(t,{style:e,vars:r},n,s){Object.assign(t.style,e,s&&s.getProjectionStyles(n));for(const i in r)t.style.setProperty(i,r[i])}const h9=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function f9(t,e,r,n){d9(t,e,void 0,n);for(const s in e.attrs)t.setAttribute(h9.has(s)?s:rA(s),e.attrs[s])}function p9(t,e,r){const n=hA(t,e,r);for(const s in t)if(Cs(t[s])||Cs(e[s])){const i=Of.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;n[i]=t[s]}return n}const rI=["x","y","width","height","cx","cy","r"],Pge={useVisualState:c9({scrapeMotionValuesFromProps:p9,createRenderState:l9,onUpdate:({props:t,prevProps:e,current:r,renderState:n,latestValues:s})=>{if(!r)return;let i=!!t.drag;if(!i){for(const l in s)if(hd.has(l)){i=!0;break}}if(!i)return;let a=!e;if(e)for(let l=0;l<rI.length;l++){const c=rI[l];t[c]!==e[c]&&(a=!0)}a&&Cr.read(()=>{u9(r,n),Cr.render(()=>{cA(n,s,uA(r.tagName),t.transformTemplate),f9(r,n)})})}})};function Mge(t,e){return function(n,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...lA(n)?Pge:Oge,preloadedFeatures:t,useRender:jge(s),createVisualElement:e,Component:n};return ige(a)}}function Og(t,e,r){const n=t.getProps();return dA(n,e,r!==void 0?r:n.custom,t)}const m9=new Set(["width","height","top","left","right","bottom",...Of]);function Ige(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,Tg(r))}function Lge(t,e){const r=Og(t,e);let{transitionEnd:n={},transition:s={},...i}=r||{};i={...i,...n};for(const a in i){const l=Age(i[a]);Ige(t,a,l)}}function $ge(t){return!!(Cs(t)&&t.add)}function lN(t,e){const r=t.getValue("willChange");if($ge(r))return r.add(e)}function g9(t){return t.props[t9]}const v9=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,Bge=1e-7,Fge=12;function zge(t,e,r,n,s){let i,a,l=0;do a=e+(r-e)/2,i=v9(a,n,s)-t,i>0?r=a:e=a;while(Math.abs(i)>Bge&&++l<Fge);return a}function gv(t,e,r,n){if(t===e&&r===n)return yi;const s=i=>zge(i,0,1,t,r);return i=>i===0||i===1?i:v9(s(i),e,n)}const y9=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,x9=t=>e=>1-t(1-e),_9=gv(.33,1.53,.69,.99),fA=x9(_9),b9=y9(fA),w9=t=>(t*=2)<1?.5*fA(t):.5*(2-Math.pow(2,-10*(t-1))),pA=t=>1-Math.sin(Math.acos(t)),S9=x9(pA),k9=y9(pA),E9=t=>/^0[^.\s]+$/u.test(t);function Uge(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||E9(t):!0}const Ym=t=>Math.round(t*1e5)/1e5,mA=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Vge(t){return t==null}const Hge=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,gA=(t,e)=>r=>!!(typeof r=="string"&&Hge.test(r)&&r.startsWith(t)||e&&!Vge(r)&&Object.prototype.hasOwnProperty.call(r,e)),C9=(t,e,r)=>n=>{if(typeof n!="string")return n;const[s,i,a,l]=n.match(mA);return{[t]:parseFloat(s),[e]:parseFloat(i),[r]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},qge=t=>fl(0,255,t),ak={...Pf,transform:t=>Math.round(qge(t))},Lu={test:gA("rgb","red"),parse:C9("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+ak.transform(t)+", "+ak.transform(e)+", "+ak.transform(r)+", "+Ym(Dg.transform(n))+")"};function Wge(t){let e="",r="",n="",s="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),s=t.substring(4,5),e+=e,r+=r,n+=n,s+=s),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}}const cN={test:gA("#"),parse:Wge,transform:Lu.transform},kh={test:gA("hsl","hue"),parse:C9("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+ho.transform(Ym(e))+", "+ho.transform(Ym(r))+", "+Ym(Dg.transform(n))+")"},bs={test:t=>Lu.test(t)||cN.test(t)||kh.test(t),parse:t=>Lu.test(t)?Lu.parse(t):kh.test(t)?kh.parse(t):cN.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Lu.transform(t):kh.transform(t)},Gge=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Kge(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(mA))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(Gge))===null||r===void 0?void 0:r.length)||0)>0}const N9="number",j9="color",Yge="var",Qge="var(",nI="${}",Xge=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Pg(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace(Xge,c=>(bs.test(c)?(n.color.push(i),s.push(j9),r.push(bs.parse(c))):c.startsWith(Qge)?(n.var.push(i),s.push(Yge),r.push(c)):(n.number.push(i),s.push(N9),r.push(parseFloat(c))),++i,nI)).split(nI);return{values:r,split:l,indexes:n,types:s}}function T9(t){return Pg(t).values}function A9(t){const{split:e,types:r}=Pg(t),n=e.length;return s=>{let i="";for(let a=0;a<n;a++)if(i+=e[a],s[a]!==void 0){const l=r[a];l===N9?i+=Ym(s[a]):l===j9?i+=bs.transform(s[a]):i+=s[a]}return i}}const Zge=t=>typeof t=="number"?0:t;function Jge(t){const e=T9(t);return A9(t)(e.map(Zge))}const Dc={test:Kge,parse:T9,createTransformer:A9,getAnimatableNone:Jge},eve=new Set(["brightness","contrast","saturate","opacity"]);function tve(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(mA)||[];if(!n)return t;const s=r.replace(n,"");let i=eve.has(e)?1:0;return n!==r&&(i*=100),e+"("+i+s+")"}const rve=/\b([a-z-]*)\(.*?\)/gu,uN={...Dc,getAnimatableNone:t=>{const e=t.match(rve);return e?e.map(tve).join(" "):t}},nve={...iA,color:bs,backgroundColor:bs,outlineColor:bs,fill:bs,stroke:bs,borderColor:bs,borderTopColor:bs,borderRightColor:bs,borderBottomColor:bs,borderLeftColor:bs,filter:uN,WebkitFilter:uN},R9=t=>nve[t];function D9(t,e){let r=R9(t);return r!==uN&&(r=Dc),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const sve=new Set(["auto","none","0"]);function ive(t,e,r){let n=0,s;for(;n<t.length&&!s;){const i=t[n];typeof i=="string"&&!sve.has(i)&&Pg(i).values.length&&(s=t[n]),n++}if(s&&r)for(const i of e)t[i]=D9(r,s)}const $u=t=>t*180/Math.PI,dN=t=>{const e=$u(Math.atan2(t[1],t[0]));return hN(e)},ave={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:dN,rotateZ:dN,skewX:t=>$u(Math.atan(t[1])),skewY:t=>$u(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},hN=t=>(t=t%360,t<0&&(t+=360),t),sI=dN,iI=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),aI=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),ove={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:iI,scaleY:aI,scale:t=>(iI(t)+aI(t))/2,rotateX:t=>hN($u(Math.atan2(t[6],t[5]))),rotateY:t=>hN($u(Math.atan2(-t[2],t[0]))),rotateZ:sI,rotate:sI,skewX:t=>$u(Math.atan(t[4])),skewY:t=>$u(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function oI(t){return t.includes("scale")?1:0}function fN(t,e){if(!t||t==="none")return oI(e);const r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,s;if(r)n=ove,s=r;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=ave,s=l}if(!s)return oI(e);const i=n[e],a=s[1].split(",").map(cve);return typeof i=="function"?i(a):a[i]}const lve=(t,e)=>{const{transform:r="none"}=getComputedStyle(t);return fN(r,e)};function cve(t){return parseFloat(t.trim())}const lI=t=>t===Pf||t===xt,uve=new Set(["x","y","z"]),dve=Of.filter(t=>!uve.has(t));function hve(t){const e=[];return dve.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const nf={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>fN(e,"x"),y:(t,{transform:e})=>fN(e,"y")};nf.translateX=nf.x;nf.translateY=nf.y;const qu=new Set;let pN=!1,mN=!1;function O9(){if(mN){const t=Array.from(qu).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const s=hve(n);s.length&&(r.set(n,s),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const s=r.get(n);s&&s.forEach(([i,a])=>{var l;(l=n.getValue(i))===null||l===void 0||l.set(a)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}mN=!1,pN=!1,qu.forEach(t=>t.complete()),qu.clear()}function P9(){qu.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(mN=!0)})}function fve(){P9(),O9()}class vA{constructor(e,r,n,s,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(qu.add(this),pN||(pN=!0,Cr.read(P9),Cr.resolveKeyframes(O9))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const a=s==null?void 0:s.get(),l=e[e.length-1];if(a!==void 0)e[0]=a;else if(n&&r){const c=n.readValue(r,l);c!=null&&(e[0]=c)}e[0]===void 0&&(e[0]=l),s&&a===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),qu.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,qu.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const M9=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),pve=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function mve(t){const e=pve.exec(t);if(!e)return[,];const[,r,n,s]=e;return[`--${r??n}`,s]}function I9(t,e,r=1){const[n,s]=mve(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const a=i.trim();return M9(a)?parseFloat(a):a}return sA(s)?I9(s,e,r+1):s}const L9=t=>e=>e.test(t),gve={test:t=>t==="auto",parse:t=>t},$9=[Pf,xt,ho,rc,fge,hge,gve],cI=t=>$9.find(L9(t));class B9 extends vA{constructor(e,r,n,s,i){super(e,r,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:r,name:n}=this;if(!r||!r.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let d=e[c];if(typeof d=="string"&&(d=d.trim(),sA(d))){const f=I9(d,r.current);f!==void 0&&(e[c]=f),c===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!m9.has(n)||e.length!==2)return;const[s,i]=e,a=cI(s),l=cI(i);if(a!==l)if(lI(a)&&lI(l))for(let c=0;c<e.length;c++){const d=e[c];typeof d=="string"&&(e[c]=parseFloat(d))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:r}=this,n=[];for(let s=0;s<e.length;s++)Uge(e[s])&&n.push(s);n.length&&ive(e,n,r)}measureInitialState(){const{element:e,unresolvedKeyframes:r,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=nf[n](e.measureViewportBox(),window.getComputedStyle(e.current)),r[0]=this.measuredOrigin;const s=r[r.length-1];s!==void 0&&e.getValue(n,s).jump(s,!1)}measureEndState(){var e;const{element:r,name:n,unresolvedKeyframes:s}=this;if(!r||!r.current)return;const i=r.getValue(n);i&&i.jump(this.measuredOrigin,!1);const a=s.length-1,l=s[a];s[a]=nf[n](r.measureViewportBox(),window.getComputedStyle(r.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([c,d])=>{r.getValue(c).set(d)}),this.resolveNoneKeyframes()}}const uI=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Dc.test(t)||t==="0")&&!t.startsWith("url("));function vve(t){const e=t[0];if(t.length===1)return!0;for(let r=0;r<t.length;r++)if(t[r]!==e)return!0}function yve(t,e,r,n){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],a=uI(s,e),l=uI(i,e);return!a||!l?!1:vve(t)||(r==="spring"||QT(r))&&n}const xve=t=>t!==null;function Db(t,{repeat:e,repeatType:r="loop"},n){const s=t.filter(xve),i=e&&r!=="loop"&&e%2===1?0:s.length-1;return!i||n===void 0?s[i]:n}const _ve=40;class F9{constructor({autoplay:e=!0,delay:r=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=uo.now(),this.options={autoplay:e,delay:r,type:n,repeat:s,repeatDelay:i,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>_ve?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&fve(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=uo.now(),this.hasAttemptedResolve=!0;const{name:n,type:s,velocity:i,delay:a,onComplete:l,onUpdate:c,isGenerator:d}=this.options;if(!d&&!yve(e,n,s,i))if(a)this.options.duration=0;else{c&&c(Db(e,this.options,r)),l&&l(),this.resolveFinishedPromise();return}const f=this.initPlayback(e,r);f!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...f},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear")}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Kr=(t,e,r)=>t+(e-t)*r;function ok(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function bve({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let s=0,i=0,a=0;if(!e)s=i=a=r;else{const l=r<.5?r*(1+e):r+e-r*e,c=2*r-l;s=ok(c,l,t+1/3),i=ok(c,l,t),a=ok(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:n}}function i_(t,e){return r=>r>0?e:t}const lk=(t,e,r)=>{const n=t*t,s=r*(e*e-n)+n;return s<0?0:Math.sqrt(s)},wve=[cN,Lu,kh],Sve=t=>wve.find(e=>e.test(t));function dI(t){const e=Sve(t);if(!e)return!1;let r=e.parse(t);return e===kh&&(r=bve(r)),r}const hI=(t,e)=>{const r=dI(t),n=dI(e);if(!r||!n)return i_(t,e);const s={...r};return i=>(s.red=lk(r.red,n.red,i),s.green=lk(r.green,n.green,i),s.blue=lk(r.blue,n.blue,i),s.alpha=Kr(r.alpha,n.alpha,i),Lu.transform(s))},kve=(t,e)=>r=>e(t(r)),vv=(...t)=>t.reduce(kve),gN=new Set(["none","hidden"]);function Eve(t,e){return gN.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function Cve(t,e){return r=>Kr(t,e,r)}function yA(t){return typeof t=="number"?Cve:typeof t=="string"?sA(t)?i_:bs.test(t)?hI:Tve:Array.isArray(t)?z9:typeof t=="object"?bs.test(t)?hI:Nve:i_}function z9(t,e){const r=[...t],n=r.length,s=t.map((i,a)=>yA(i)(i,e[a]));return i=>{for(let a=0;a<n;a++)r[a]=s[a](i);return r}}function Nve(t,e){const r={...t,...e},n={};for(const s in r)t[s]!==void 0&&e[s]!==void 0&&(n[s]=yA(t[s])(t[s],e[s]));return s=>{for(const i in n)r[i]=n[i](s);return r}}function jve(t,e){var r;const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],l=t.indexes[a][s[a]],c=(r=t.values[l])!==null&&r!==void 0?r:0;n[i]=c,s[a]++}return n}const Tve=(t,e)=>{const r=Dc.createTransformer(e),n=Pg(t),s=Pg(e);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?gN.has(t)&&!s.values.length||gN.has(e)&&!n.values.length?Eve(t,e):vv(z9(jve(n,s),s.values),r):i_(t,e)};function U9(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Kr(t,e,r):yA(t)(t,e)}const Ave=5;function V9(t,e,r){const n=Math.max(e-Ave,0);return VV(r-t(n),e-n)}const Zr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},fI=.001;function Rve({duration:t=Zr.duration,bounce:e=Zr.bounce,velocity:r=Zr.velocity,mass:n=Zr.mass}){let s,i,a=1-e;a=fl(Zr.minDamping,Zr.maxDamping,a),t=fl(Zr.minDuration,Zr.maxDuration,nl(t)),a<1?(s=d=>{const f=d*a,p=f*t,m=f-r,g=vN(d,a),y=Math.exp(-p);return fI-m/g*y},i=d=>{const p=d*a*t,m=p*r+r,g=Math.pow(a,2)*Math.pow(d,2)*t,y=Math.exp(-p),x=vN(Math.pow(d,2),a);return(-s(d)+fI>0?-1:1)*((m-g)*y)/x}):(s=d=>{const f=Math.exp(-d*t),p=(d-r)*t+1;return-.001+f*p},i=d=>{const f=Math.exp(-d*t),p=(r-d)*(t*t);return f*p});const l=5/t,c=Ove(s,i,l);if(t=rl(t),isNaN(c))return{stiffness:Zr.stiffness,damping:Zr.damping,duration:t};{const d=Math.pow(c,2)*n;return{stiffness:d,damping:a*2*Math.sqrt(n*d),duration:t}}}const Dve=12;function Ove(t,e,r){let n=r;for(let s=1;s<Dve;s++)n=n-t(n)/e(n);return n}function vN(t,e){return t*Math.sqrt(1-e*e)}const Pve=["duration","bounce"],Mve=["stiffness","damping","mass"];function pI(t,e){return e.some(r=>t[r]!==void 0)}function Ive(t){let e={velocity:Zr.velocity,stiffness:Zr.stiffness,damping:Zr.damping,mass:Zr.mass,isResolvedFromDuration:!1,...t};if(!pI(t,Mve)&&pI(t,Pve))if(t.visualDuration){const r=t.visualDuration,n=2*Math.PI/(r*1.2),s=n*n,i=2*fl(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Zr.mass,stiffness:s,damping:i}}else{const r=Rve(t);e={...e,...r,mass:Zr.mass},e.isResolvedFromDuration=!0}return e}function H9(t=Zr.visualDuration,e=Zr.bounce){const r=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:s}=r;const i=r.keyframes[0],a=r.keyframes[r.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:d,mass:f,duration:p,velocity:m,isResolvedFromDuration:g}=Ive({...r,velocity:-nl(r.velocity||0)}),y=m||0,x=d/(2*Math.sqrt(c*f)),w=a-i,_=nl(Math.sqrt(c/f)),S=Math.abs(w)<5;n||(n=S?Zr.restSpeed.granular:Zr.restSpeed.default),s||(s=S?Zr.restDelta.granular:Zr.restDelta.default);let k;if(x<1){const j=vN(_,x);k=T=>{const D=Math.exp(-x*_*T);return a-D*((y+x*_*w)/j*Math.sin(j*T)+w*Math.cos(j*T))}}else if(x===1)k=j=>a-Math.exp(-_*j)*(w+(y+_*w)*j);else{const j=_*Math.sqrt(x*x-1);k=T=>{const D=Math.exp(-x*_*T),I=Math.min(j*T,300);return a-D*((y+x*_*w)*Math.sinh(I)+j*w*Math.cosh(I))/j}}const N={calculatedDuration:g&&p||null,next:j=>{const T=k(j);if(g)l.done=j>=p;else{let D=0;x<1&&(D=j===0?rl(y):V9(k,j,T));const I=Math.abs(D)<=n,L=Math.abs(a-T)<=s;l.done=I&&L}return l.value=l.done?a:T,l},toString:()=>{const j=Math.min(HV(N),iN),T=qV(D=>N.next(j*D).value,j,30);return j+"ms "+T}};return N}function mI({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:l,max:c,restDelta:d=.5,restSpeed:f}){const p=t[0],m={done:!1,value:p},g=I=>l!==void 0&&I<l||c!==void 0&&I>c,y=I=>l===void 0?c:c===void 0||Math.abs(l-I)<Math.abs(c-I)?l:c;let x=r*e;const w=p+x,_=a===void 0?w:a(w);_!==w&&(x=_-p);const S=I=>-x*Math.exp(-I/n),k=I=>_+S(I),N=I=>{const L=S(I),$=k(I);m.done=Math.abs(L)<=d,m.value=m.done?_:$};let j,T;const D=I=>{g(m.value)&&(j=I,T=H9({keyframes:[m.value,y(m.value)],velocity:V9(k,I,m.value),damping:s,stiffness:i,restDelta:d,restSpeed:f}))};return D(0),{calculatedDuration:null,next:I=>{let L=!1;return!T&&j===void 0&&(L=!0,N(I),D(I)),j!==void 0&&I>=j?T.next(I-j):(!L&&N(I),m)}}}const Lve=gv(.42,0,1,1),$ve=gv(0,0,.58,1),q9=gv(.42,0,.58,1),Bve=t=>Array.isArray(t)&&typeof t[0]!="number",Fve={linear:yi,easeIn:Lve,easeInOut:q9,easeOut:$ve,circIn:pA,circInOut:k9,circOut:S9,backIn:fA,backInOut:b9,backOut:_9,anticipate:w9},gI=t=>{if(XT(t)){UV(t.length===4);const[e,r,n,s]=t;return gv(e,r,n,s)}else if(typeof t=="string")return Fve[t];return t};function zve(t,e,r){const n=[],s=r||U9,i=t.length-1;for(let a=0;a<i;a++){let l=s(t[a],t[a+1]);if(e){const c=Array.isArray(e)?e[a]||yi:e;l=vv(c,l)}n.push(l)}return n}function Uve(t,e,{clamp:r=!0,ease:n,mixer:s}={}){const i=t.length;if(UV(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=zve(e,n,s),c=l.length,d=f=>{if(a&&f<t[0])return e[0];let p=0;if(c>1)for(;p<t.length-2&&!(f<t[p+1]);p++);const m=tf(t[p],t[p+1],f);return l[p](m)};return r?f=>d(fl(t[0],t[i-1],f)):d}function Vve(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const s=tf(0,e,n);t.push(Kr(r,1,s))}}function Hve(t){const e=[0];return Vve(e,t.length-1),e}function qve(t,e){return t.map(r=>r*e)}function Wve(t,e){return t.map(()=>e||q9).splice(0,t.length-1)}function a_({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const s=Bve(n)?n.map(gI):gI(n),i={done:!1,value:e[0]},a=qve(r&&r.length===e.length?r:Hve(e),t),l=Uve(a,e,{ease:Array.isArray(s)?s:Wve(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const Gve=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Cr.update(e,!0),stop:()=>Rc(e),now:()=>ns.isProcessing?ns.timestamp:uo.now()}},Kve={decay:mI,inertia:mI,tween:a_,keyframes:a_,spring:H9},Yve=t=>t/100;class xA extends F9{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:r,motionValue:n,element:s,keyframes:i}=this.options,a=(s==null?void 0:s.KeyframeResolver)||vA,l=(c,d)=>this.onKeyframesResolved(c,d);this.resolver=new a(i,l,r,n,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=this.options,l=QT(r)?r:Kve[r]||a_;let c,d;l!==a_&&typeof e[0]!="number"&&(c=vv(Yve,U9(e[0],e[1])),e=[0,100]);const f=l({...this.options,keyframes:e});i==="mirror"&&(d=l({...this.options,keyframes:[...e].reverse(),velocity:-a})),f.calculatedDuration===null&&(f.calculatedDuration=HV(f));const{calculatedDuration:p}=f,m=p+s,g=m*(n+1)-s;return{generator:f,mirroredGenerator:d,mapPercentToKeyframes:c,calculatedDuration:p,resolvedDuration:m,totalDuration:g}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:I}=this.options;return{done:!0,value:I[I.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:d,totalDuration:f,resolvedDuration:p}=n;if(this.startTime===null)return i.next(0);const{delay:m,repeat:g,repeatType:y,repeatDelay:x,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-f/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const _=this.currentTime-m*(this.speed>=0?1:-1),S=this.speed>=0?_<0:_>f;this.currentTime=Math.max(_,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=f);let k=this.currentTime,N=i;if(g){const I=Math.min(this.currentTime,f)/p;let L=Math.floor(I),$=I%1;!$&&I>=1&&($=1),$===1&&L--,L=Math.min(L,g+1),!!(L%2)&&(y==="reverse"?($=1-$,x&&($-=x/p)):y==="mirror"&&(N=a)),k=fl(0,1,$)*p}const j=S?{done:!1,value:c[0]}:N.next(k);l&&(j.value=l(j.value));let{done:T}=j;!S&&d!==null&&(T=this.speed>=0?this.currentTime>=f:this.currentTime<=0);const D=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return D&&s!==void 0&&(j.value=Db(c,this.options,s)),w&&w(j.value),D&&this.finish(),j}get duration(){const{resolved:e}=this;return e?nl(e.calculatedDuration):0}get time(){return nl(this.currentTime)}set time(e){e=rl(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=nl(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Gve,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),r&&r();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const Qve=new Set(["opacity","clipPath","filter","transform"]);function Xve(t,e,r,{delay:n=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const d={[e]:r};c&&(d.offset=c);const f=GV(l,s);return Array.isArray(f)&&(d.easing=f),t.animate(d,{delay:n,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}const Zve=GT(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),o_=10,Jve=2e4;function eye(t){return QT(t.type)||t.type==="spring"||!WV(t.ease)}function tye(t,e){const r=new xA({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const s=[];let i=0;for(;!n.done&&i<Jve;)n=r.sample(i),s.push(n.value),i+=o_;return{times:void 0,keyframes:s,duration:i-o_,ease:"linear"}}const W9={anticipate:w9,backInOut:b9,circInOut:k9};function rye(t){return t in W9}class vI extends F9{constructor(e){super(e);const{name:r,motionValue:n,element:s,keyframes:i}=this.options;this.resolver=new B9(i,(a,l)=>this.onKeyframesResolved(a,l),r,n,s),this.resolver.scheduleResolve()}initPlayback(e,r){let{duration:n=300,times:s,ease:i,type:a,motionValue:l,name:c,startTime:d}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&n_()&&rye(i)&&(i=W9[i]),eye(this.options)){const{onComplete:p,onUpdate:m,motionValue:g,element:y,...x}=this.options,w=tye(e,x);e=w.keyframes,e.length===1&&(e[1]=e[0]),n=w.duration,s=w.times,i=w.ease,a="keyframes"}const f=Xve(l.owner.current,c,e,{...this.options,duration:n,times:s,ease:i});return f.startTime=d??this.calcStartTime(),this.pendingTimeline?(H4(f,this.pendingTimeline),this.pendingTimeline=void 0):f.onfinish=()=>{const{onComplete:p}=this.options;l.set(Db(e,this.options,r)),p&&p(),this.cancel(),this.resolveFinishedPromise()},{animation:f,duration:n,times:s,type:a,ease:i,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return nl(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return nl(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=rl(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return yi;const{animation:n}=r;H4(n,e)}return yi}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:s,type:i,ease:a,times:l}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:d,onUpdate:f,onComplete:p,element:m,...g}=this.options,y=new xA({...g,keyframes:n,duration:s,type:i,ease:a,times:l,isGenerator:!0}),x=rl(this.time);d.setWithVelocity(y.sample(x-o_).value,y.sample(x).value,o_)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:s,repeatType:i,damping:a,type:l}=e;if(!r||!r.owner||!(r.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=r.owner.getProps();return Zve()&&n&&Qve.has(n)&&(n!=="transform"||!d)&&!c&&!s&&i!=="mirror"&&a!==0&&l!=="inertia"}}const nye={type:"spring",stiffness:500,damping:25,restSpeed:10},sye=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),iye={type:"keyframes",duration:.8},aye={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},oye=(t,{keyframes:e})=>e.length>2?iye:hd.has(t)?t.startsWith("scale")?sye(e[1]):nye:aye;function lye({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:l,from:c,elapsed:d,...f}){return!!Object.keys(f).length}const _A=(t,e,r,n={},s,i)=>a=>{const l=YT(n,t)||{},c=l.delay||n.delay||0;let{elapsed:d=0}=n;d=d-rl(c);let f={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-d,onUpdate:m=>{e.set(m),l.onUpdate&&l.onUpdate(m)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:s};lye(l)||(f={...f,...oye(t,f)}),f.duration&&(f.duration=rl(f.duration)),f.repeatDelay&&(f.repeatDelay=rl(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let p=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(f.duration=0,f.delay===0&&(p=!0)),f.allowFlatten=!l.type&&!l.ease,p&&!i&&e.get()!==void 0){const m=Db(f.keyframes,l);if(m!==void 0)return Cr.update(()=>{f.onUpdate(m),f.onComplete()}),new Dme([])}return!i&&vI.supports(f)?new vI(f):new xA(f)};function cye({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function G9(t,e,{delay:r=0,transitionOverride:n,type:s}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:l,...c}=e;n&&(a=n);const d=[],f=s&&t.animationState&&t.animationState.getState()[s];for(const p in c){const m=t.getValue(p,(i=t.latestValues[p])!==null&&i!==void 0?i:null),g=c[p];if(g===void 0||f&&cye(f,p))continue;const y={delay:r,...YT(a||{},p)};let x=!1;if(window.MotionHandoffAnimation){const _=g9(t);if(_){const S=window.MotionHandoffAnimation(_,p,Cr);S!==null&&(y.startTime=S,x=!0)}}lN(t,p),m.start(_A(p,m,g,t.shouldReduceMotion&&m9.has(p)?{type:!1}:y,t,x));const w=m.animation;w&&d.push(w)}return l&&Promise.all(d).then(()=>{Cr.update(()=>{l&&Lge(t,l)})}),d}function yN(t,e,r={}){var n;const s=Og(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};r.transitionOverride&&(i=r.transitionOverride);const a=s?()=>Promise.all(G9(t,s,r)):()=>Promise.resolve(),l=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:f=0,staggerChildren:p,staggerDirection:m}=i;return uye(t,e,f+d,p,m,r)}:()=>Promise.resolve(),{when:c}=i;if(c){const[d,f]=c==="beforeChildren"?[a,l]:[l,a];return d().then(()=>f())}else return Promise.all([a(),l(r.delay)])}function uye(t,e,r=0,n=0,s=1,i){const a=[],l=(t.variantChildren.size-1)*n,c=s===1?(d=0)=>d*n:(d=0)=>l-d*n;return Array.from(t.variantChildren).sort(dye).forEach((d,f)=>{d.notify("AnimationStart",e),a.push(yN(d,e,{...i,delay:r+c(f)}).then(()=>d.notify("AnimationComplete",e)))}),Promise.all(a)}function dye(t,e){return t.sortNodePosition(e)}function hye(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const s=e.map(i=>yN(t,i,r));n=Promise.all(s)}else if(typeof e=="string")n=yN(t,e,r);else{const s=typeof e=="function"?Og(t,e,r.custom):e;n=Promise.all(G9(t,s,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}function K9(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}const fye=tA.length;function Y9(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?Y9(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;r<fye;r++){const n=tA[r],s=t.props[n];(Ag(s)||s===!1)&&(e[n]=s)}return e}const pye=[...eA].reverse(),mye=eA.length;function gye(t){return e=>Promise.all(e.map(({animation:r,options:n})=>hye(t,r,n)))}function vye(t){let e=gye(t),r=yI(),n=!0;const s=c=>(d,f)=>{var p;const m=Og(t,f,c==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(m){const{transition:g,transitionEnd:y,...x}=m;d={...d,...x,...y}}return d};function i(c){e=c(t)}function a(c){const{props:d}=t,f=Y9(t.parent)||{},p=[],m=new Set;let g={},y=1/0;for(let w=0;w<mye;w++){const _=pye[w],S=r[_],k=d[_]!==void 0?d[_]:f[_],N=Ag(k),j=_===c?S.isActive:null;j===!1&&(y=w);let T=k===f[_]&&k!==d[_]&&N;if(T&&n&&t.manuallyAnimateOnMount&&(T=!1),S.protectedKeys={...g},!S.isActive&&j===null||!k&&!S.prevProp||Ab(k)||typeof k=="boolean")continue;const D=yye(S.prevProp,k);let I=D||_===c&&S.isActive&&!T&&N||w>y&&N,L=!1;const $=Array.isArray(k)?k:[k];let Q=$.reduce(s(_),{});j===!1&&(Q={});const{prevResolvedValues:M={}}=S,z={...M,...Q},R=F=>{I=!0,m.has(F)&&(L=!0,m.delete(F)),S.needsAnimating[F]=!0;const K=t.getValue(F);K&&(K.liveStyle=!1)};for(const F in z){const K=Q[F],Y=M[F];if(g.hasOwnProperty(F))continue;let O=!1;oN(K)&&oN(Y)?O=!K9(K,Y):O=K!==Y,O?K!=null?R(F):m.add(F):K!==void 0&&m.has(F)?R(F):S.protectedKeys[F]=!0}S.prevProp=k,S.prevResolvedValues=Q,S.isActive&&(g={...g,...Q}),n&&t.blockInitialAnimation&&(I=!1),I&&(!(T&&D)||L)&&p.push(...$.map(F=>({animation:F,options:{type:_}})))}if(m.size){const w={};if(typeof d.initial!="boolean"){const _=Og(t,Array.isArray(d.initial)?d.initial[0]:d.initial);_&&_.transition&&(w.transition=_.transition)}m.forEach(_=>{const S=t.getBaseTarget(_),k=t.getValue(_);k&&(k.liveStyle=!0),w[_]=S??null}),p.push({animation:w})}let x=!!p.length;return n&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(x=!1),n=!1,x?e(p):Promise.resolve()}function l(c,d){var f;if(r[c].isActive===d)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(m=>{var g;return(g=m.animationState)===null||g===void 0?void 0:g.setActive(c,d)}),r[c].isActive=d;const p=a(c);for(const m in r)r[m].protectedKeys={};return p}return{animateChanges:a,setActive:l,setAnimateFunction:i,getState:()=>r,reset:()=>{r=yI(),n=!0}}}function yye(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!K9(e,t):!1}function hu(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yI(){return{animate:hu(!0),whileInView:hu(),whileHover:hu(),whileTap:hu(),whileDrag:hu(),whileFocus:hu(),exit:hu()}}class Lc{constructor(e){this.isMounted=!1,this.node=e}update(){}}class xye extends Lc{constructor(e){super(e),e.animationState||(e.animationState=vye(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ab(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let _ye=0;class bye extends Lc{constructor(){super(...arguments),this.id=_ye++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const s=this.node.animationState.setActive("exit",!e);r&&!e&&s.then(()=>{r(this.id)})}mount(){const{register:e,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const wye={animation:{Feature:xye},exit:{Feature:bye}};function Mg(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function yv(t){return{point:{x:t.pageX,y:t.pageY}}}const Sye=t=>e=>JT(e)&&t(e,yv(e));function Qm(t,e,r,n){return Mg(t,e,Sye(r),n)}function Q9({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function kye({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Eye(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}const X9=1e-4,Cye=1-X9,Nye=1+X9,Z9=.01,jye=0-Z9,Tye=0+Z9;function Fs(t){return t.max-t.min}function Aye(t,e,r){return Math.abs(t-e)<=r}function xI(t,e,r,n=.5){t.origin=n,t.originPoint=Kr(e.min,e.max,t.origin),t.scale=Fs(r)/Fs(e),t.translate=Kr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=Cye&&t.scale<=Nye||isNaN(t.scale))&&(t.scale=1),(t.translate>=jye&&t.translate<=Tye||isNaN(t.translate))&&(t.translate=0)}function Xm(t,e,r,n){xI(t.x,e.x,r.x,n?n.originX:void 0),xI(t.y,e.y,r.y,n?n.originY:void 0)}function _I(t,e,r){t.min=r.min+e.min,t.max=t.min+Fs(e)}function Rye(t,e,r){_I(t.x,e.x,r.x),_I(t.y,e.y,r.y)}function bI(t,e,r){t.min=e.min-r.min,t.max=t.min+Fs(e)}function Zm(t,e,r){bI(t.x,e.x,r.x),bI(t.y,e.y,r.y)}const wI=()=>({translate:0,scale:1,origin:0,originPoint:0}),Eh=()=>({x:wI(),y:wI()}),SI=()=>({min:0,max:0}),on=()=>({x:SI(),y:SI()});function $i(t){return[t("x"),t("y")]}function ck(t){return t===void 0||t===1}function xN({scale:t,scaleX:e,scaleY:r}){return!ck(t)||!ck(e)||!ck(r)}function Su(t){return xN(t)||J9(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function J9(t){return kI(t.x)||kI(t.y)}function kI(t){return t&&t!=="0%"}function l_(t,e,r){const n=t-r,s=e*n;return r+s}function EI(t,e,r,n,s){return s!==void 0&&(t=l_(t,s,n)),l_(t,r,n)+e}function _N(t,e=0,r=1,n,s){t.min=EI(t.min,e,r,n,s),t.max=EI(t.max,e,r,n,s)}function e7(t,{x:e,y:r}){_N(t.x,e.translate,e.scale,e.originPoint),_N(t.y,r.translate,r.scale,r.originPoint)}const CI=.999999999999,NI=1.0000000000001;function Dye(t,e,r,n=!1){const s=r.length;if(!s)return;e.x=e.y=1;let i,a;for(let l=0;l<s;l++){i=r[l],a=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Nh(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,e7(t,a)),n&&Su(i.latestValues)&&Nh(t,i.latestValues))}e.x<NI&&e.x>CI&&(e.x=1),e.y<NI&&e.y>CI&&(e.y=1)}function Ch(t,e){t.min=t.min+e,t.max=t.max+e}function jI(t,e,r,n,s=.5){const i=Kr(t.min,t.max,s);_N(t,e,r,i,n)}function Nh(t,e){jI(t.x,e.x,e.scaleX,e.scale,e.originX),jI(t.y,e.y,e.scaleY,e.scale,e.originY)}function t7(t,e){return Q9(Eye(t.getBoundingClientRect(),e))}function Oye(t,e,r){const n=t7(t,r),{scroll:s}=e;return s&&(Ch(n.x,s.offset.x),Ch(n.y,s.offset.y)),n}const r7=({current:t})=>t?t.ownerDocument.defaultView:null,TI=(t,e)=>Math.abs(t-e);function Pye(t,e){const r=TI(t.x,e.x),n=TI(t.y,e.y);return Math.sqrt(r**2+n**2)}class n7{constructor(e,r,{transformPagePoint:n,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=dk(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,g=Pye(p.offset,{x:0,y:0})>=3;if(!m&&!g)return;const{point:y}=p,{timestamp:x}=ns;this.history.push({...y,timestamp:x});const{onStart:w,onMove:_}=this.handlers;m||(w&&w(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),_&&_(this.lastMoveEvent,p)},this.handlePointerMove=(p,m)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=uk(m,this.transformPagePoint),Cr.update(this.updatePoint,!0)},this.handlePointerUp=(p,m)=>{this.end();const{onEnd:g,onSessionEnd:y,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=dk(p.type==="pointercancel"?this.lastMoveEventInfo:uk(m,this.transformPagePoint),this.history);this.startEvent&&g&&g(p,w),y&&y(p,w)},!JT(e))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=n,this.contextWindow=s||window;const a=yv(e),l=uk(a,this.transformPagePoint),{point:c}=l,{timestamp:d}=ns;this.history=[{...c,timestamp:d}];const{onSessionStart:f}=r;f&&f(e,dk(l,this.history)),this.removeListeners=vv(Qm(this.contextWindow,"pointermove",this.handlePointerMove),Qm(this.contextWindow,"pointerup",this.handlePointerUp),Qm(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Rc(this.updatePoint)}}function uk(t,e){return e?{point:e(t.point)}:t}function AI(t,e){return{x:t.x-e.x,y:t.y-e.y}}function dk({point:t},e){return{point:t,delta:AI(t,s7(e)),offset:AI(t,Mye(e)),velocity:Iye(e,.1)}}function Mye(t){return t[0]}function s7(t){return t[t.length-1]}function Iye(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const s=s7(t);for(;r>=0&&(n=t[r],!(s.timestamp-n.timestamp>rl(e)));)r--;if(!n)return{x:0,y:0};const i=nl(s.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-n.x)/i,y:(s.y-n.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Lye(t,{min:e,max:r},n){return e!==void 0&&t<e?t=n?Kr(e,t,n.min):Math.max(t,e):r!==void 0&&t>r&&(t=n?Kr(r,t,n.max):Math.min(t,r)),t}function RI(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function $ye(t,{top:e,left:r,bottom:n,right:s}){return{x:RI(t.x,r,s),y:RI(t.y,e,n)}}function DI(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([r,n]=[n,r]),{min:r,max:n}}function Bye(t,e){return{x:DI(t.x,e.x),y:DI(t.y,e.y)}}function Fye(t,e){let r=.5;const n=Fs(t),s=Fs(e);return s>n?r=tf(e.min,e.max-n,t.min):n>s&&(r=tf(t.min,t.max-s,e.min)),fl(0,1,r)}function zye(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const bN=.35;function Uye(t=bN){return t===!1?t=0:t===!0&&(t=bN),{x:OI(t,"left","right"),y:OI(t,"top","bottom")}}function OI(t,e,r){return{min:PI(t,e),max:PI(t,r)}}function PI(t,e){return typeof t=="number"?t:t[e]||0}const Vye=new WeakMap;class Hye{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=on(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const s=f=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(yv(f).point)},i=(f,p)=>{const{drag:m,dragPropagation:g,onDragStart:y}=this.getProps();if(m&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=$me(m),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),$i(w=>{let _=this.getAxisMotionValue(w).get()||0;if(ho.test(_)){const{projection:S}=this.visualElement;if(S&&S.layout){const k=S.layout.layoutBox[w];k&&(_=Fs(k)*(parseFloat(_)/100))}}this.originPoint[w]=_}),y&&Cr.postRender(()=>y(f,p)),lN(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},a=(f,p)=>{const{dragPropagation:m,dragDirectionLock:g,onDirectionLock:y,onDrag:x}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:w}=p;if(g&&this.currentDirection===null){this.currentDirection=qye(w),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",p.point,w),this.updateAxis("y",p.point,w),this.visualElement.render(),x&&x(f,p)},l=(f,p)=>this.stop(f,p),c=()=>$i(f=>{var p;return this.getAnimationState(f)==="paused"&&((p=this.getAxisMotionValue(f).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new n7(e,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:r7(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Cr.postRender(()=>i(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:s}=this.getProps();if(!n||!vx(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Lye(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;r&&Sh(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&s?this.constraints=$ye(s.layoutBox,r):this.constraints=!1,this.elastic=Uye(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&$i(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=zye(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Sh(e))return!1;const n=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=Oye(n,s.root,this.visualElement.getTransformPagePoint());let a=Bye(s.layout.layoutBox,i);if(r){const l=r(kye(a));this.hasMutatedConstraints=!!l,l&&(a=Q9(l))}return a}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=$i(f=>{if(!vx(f,r,this.currentDirection))return;let p=c&&c[f]||{};a&&(p={min:0,max:0});const m=s?200:1e6,g=s?40:1e7,y={type:"inertia",velocity:n?e[f]:0,bounceStiffness:m,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...i,...p};return this.startAxisValueAnimation(f,y)});return Promise.all(d).then(l)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return lN(this.visualElement,e),n.start(_A(e,n,0,r,this.visualElement,!1))}stopAnimation(){$i(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){$i(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),s=n[r];return s||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){$i(r=>{const{drag:n}=this.getProps();if(!vx(r,n,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(r);if(s&&s.layout){const{min:a,max:l}=s.layout.layoutBox[r];i.set(e[r]-Kr(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Sh(r)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};$i(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();s[a]=Fye({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),$i(a=>{if(!vx(a,e,null))return;const l=this.getAxisMotionValue(a),{min:c,max:d}=this.constraints[a];l.set(Kr(c,d,s[a]))})}addListeners(){if(!this.visualElement.current)return;Vye.set(this.visualElement,this);const e=this.visualElement.current,r=Qm(e,"pointerdown",c=>{const{drag:d,dragListener:f=!0}=this.getProps();d&&f&&this.start(c)}),n=()=>{const{dragConstraints:c}=this.getProps();Sh(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Cr.read(n);const a=Mg(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&($i(f=>{const p=this.getAxisMotionValue(f);p&&(this.originPoint[f]+=c[f].translate,p.set(p.get()+c[f].translate))}),this.visualElement.render())});return()=>{a(),r(),i(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=bN,dragMomentum:l=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:l}}}function vx(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function qye(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class Wye extends Lc{constructor(e){super(e),this.removeGroupControls=yi,this.removeListeners=yi,this.controls=new Hye(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yi}unmount(){this.removeGroupControls(),this.removeListeners()}}const MI=t=>(e,r)=>{t&&Cr.postRender(()=>t(e,r))};class Gye extends Lc{constructor(){super(...arguments),this.removePointerDownListener=yi}onPointerDown(e){this.session=new n7(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:r7(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:MI(e),onStart:MI(r),onMove:n,onEnd:(i,a)=>{delete this.session,s&&Cr.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=Qm(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const v0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function II(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Yp={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(xt.test(t))t=parseFloat(t);else return t;const r=II(t,e.target.x),n=II(t,e.target.y);return`${r}% ${n}%`}},Kye={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,s=Dc.parse(t);if(s.length>5)return n;const i=Dc.createTransformer(t),a=typeof s[0]!="number"?1:0,l=r.x.scale*e.x,c=r.y.scale*e.y;s[0+a]/=l,s[1+a]/=c;const d=Kr(l,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=d),typeof s[3+a]=="number"&&(s[3+a]/=d),i(s)}};class Yye extends E.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:s}=this.props,{projection:i}=e;dge(Qye),i&&(r.group&&r.group.add(i),n&&n.register&&s&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),v0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:s,isPresent:i}=this.props,a=n.projection;return a&&(a.isPresent=i,s||e.layoutDependency!==r||r===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Cr.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ZT.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function i7(t){const[e,r]=jme(),n=E.useContext(FV);return o.jsx(Yye,{...t,layoutGroup:n,switchLayoutGroup:E.useContext(r9),isPresent:e,safeToRemove:r})}const Qye={borderRadius:{...Yp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Yp,borderTopRightRadius:Yp,borderBottomLeftRadius:Yp,borderBottomRightRadius:Yp,boxShadow:Kye};function Xye(t,e,r){const n=Cs(t)?t:Tg(t);return n.start(_A("",n,e,r)),n.animation}function Zye(t){return t instanceof SVGElement&&t.tagName!=="svg"}const Jye=(t,e)=>t.depth-e.depth;class exe{constructor(){this.children=[],this.isDirty=!1}add(e){qT(this.children,e),this.isDirty=!0}remove(e){WT(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Jye),this.isDirty=!1,this.children.forEach(e)}}function txe(t,e){const r=uo.now(),n=({timestamp:s})=>{const i=s-r;i>=e&&(Rc(n),t(i-e))};return Cr.read(n,!0),()=>Rc(n)}const a7=["TopLeft","TopRight","BottomLeft","BottomRight"],rxe=a7.length,LI=t=>typeof t=="string"?parseFloat(t):t,$I=t=>typeof t=="number"||xt.test(t);function nxe(t,e,r,n,s,i){s?(t.opacity=Kr(0,r.opacity!==void 0?r.opacity:1,sxe(n)),t.opacityExit=Kr(e.opacity!==void 0?e.opacity:1,0,ixe(n))):i&&(t.opacity=Kr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let a=0;a<rxe;a++){const l=`border${a7[a]}Radius`;let c=BI(e,l),d=BI(r,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||$I(c)===$I(d)?(t[l]=Math.max(Kr(LI(c),LI(d),n),0),(ho.test(d)||ho.test(c))&&(t[l]+="%")):t[l]=d}(e.rotate||r.rotate)&&(t.rotate=Kr(e.rotate||0,r.rotate||0,n))}function BI(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const sxe=o7(0,.5,S9),ixe=o7(.5,.95,yi);function o7(t,e,r){return n=>n<t?0:n>e?1:r(tf(t,e,n))}function FI(t,e){t.min=e.min,t.max=e.max}function Pi(t,e){FI(t.x,e.x),FI(t.y,e.y)}function zI(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function UI(t,e,r,n,s){return t-=e,t=l_(t,1/r,n),s!==void 0&&(t=l_(t,1/s,n)),t}function axe(t,e=0,r=1,n=.5,s,i=t,a=t){if(ho.test(e)&&(e=parseFloat(e),e=Kr(a.min,a.max,e/100)-a.min),typeof e!="number")return;let l=Kr(i.min,i.max,n);t===i&&(l-=e),t.min=UI(t.min,e,r,l,s),t.max=UI(t.max,e,r,l,s)}function VI(t,e,[r,n,s],i,a){axe(t,e[r],e[n],e[s],e.scale,i,a)}const oxe=["x","scaleX","originX"],lxe=["y","scaleY","originY"];function HI(t,e,r,n){VI(t.x,e,oxe,r?r.x:void 0,n?n.x:void 0),VI(t.y,e,lxe,r?r.y:void 0,n?n.y:void 0)}function qI(t){return t.translate===0&&t.scale===1}function l7(t){return qI(t.x)&&qI(t.y)}function WI(t,e){return t.min===e.min&&t.max===e.max}function cxe(t,e){return WI(t.x,e.x)&&WI(t.y,e.y)}function GI(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function c7(t,e){return GI(t.x,e.x)&&GI(t.y,e.y)}function KI(t){return Fs(t.x)/Fs(t.y)}function YI(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class uxe{constructor(){this.members=[]}add(e){qT(this.members,e),e.scheduleRender()}remove(e){if(WT(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(s=>e===s);if(r===0)return!1;let n;for(let s=r;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function dxe(t,e,r){let n="";const s=t.x.translate/e.x,i=t.y.translate/e.y,a=(r==null?void 0:r.z)||0;if((s||i||a)&&(n=`translate3d(${s}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:d,rotate:f,rotateX:p,rotateY:m,skewX:g,skewY:y}=r;d&&(n=`perspective(${d}px) ${n}`),f&&(n+=`rotate(${f}deg) `),p&&(n+=`rotateX(${p}deg) `),m&&(n+=`rotateY(${m}deg) `),g&&(n+=`skewX(${g}deg) `),y&&(n+=`skewY(${y}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(n+=`scale(${l}, ${c})`),n||"none"}const hk=["","X","Y","Z"],hxe={visibility:"hidden"},QI=1e3;let fxe=0;function fk(t,e,r,n){const{latestValues:s}=e;s[t]&&(r[t]=s[t],e.setStaticValue(t,0),n&&(n[t]=0))}function u7(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=g9(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Cr,!(s||i))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&u7(n)}function d7({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(a={},l=e==null?void 0:e()){this.id=fxe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(gxe),this.nodes.forEach(bxe),this.nodes.forEach(wxe),this.nodes.forEach(vxe)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new exe)}addEventListener(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new KT),this.eventHandlers.get(a).add(l)}notifyListeners(a,...l){const c=this.eventHandlers.get(a);c&&c.notify(...l)}hasListeners(a){return this.eventHandlers.has(a)}mount(a,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=Zye(a),this.instance=a;const{layoutId:c,layout:d,visualElement:f}=this.options;if(f&&!f.current&&f.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(d||c)&&(this.isLayoutDirty=!0),t){let p;const m=()=>this.root.updateBlockedByResize=!1;t(a,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=txe(m,250),v0.hasAnimatedSinceResize&&(v0.hasAnimatedSinceResize=!1,this.nodes.forEach(ZI))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&f&&(c||d)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:m,hasRelativeLayoutChanged:g,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||f.getDefaultTransition()||Nxe,{onLayoutAnimationStart:w,onLayoutAnimationComplete:_}=f.getProps(),S=!this.targetLayout||!c7(this.targetLayout,y),k=!m&&g;if(this.options.layoutRoot||this.resumeFrom||k||m&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,k);const N={...YT(x,"layout"),onPlay:w,onComplete:_};(f.shouldReduceMotion||this.options.layoutRoot)&&(N.delay=0,N.type=!1),this.startAnimation(N)}else m||ZI(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Rc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Sxe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&u7(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const p=this.path[f];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(XI);return}this.isUpdating||this.nodes.forEach(xxe),this.isUpdating=!1,this.nodes.forEach(_xe),this.nodes.forEach(pxe),this.nodes.forEach(mxe),this.clearAllSnapshots();const l=uo.now();ns.delta=fl(0,1e3/60,l-ns.timestamp),ns.timestamp=l,ns.isProcessing=!0,sk.update.process(ns),sk.preRender.process(ns),sk.render.process(ns),ns.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ZT.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(yxe),this.sharedNodes.forEach(kxe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Cr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Cr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Fs(this.snapshot.measuredBox.x)&&!Fs(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=on(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(l=!1),l){const c=n(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:c,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!l7(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;a&&(l||Su(this.latestValues)||f)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return a&&(c=this.removeTransform(c)),jxe(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var a;const{visualElement:l}=this.options;if(!l)return on();const c=l.measureViewportBox();if(!(((a=this.scroll)===null||a===void 0?void 0:a.wasRoot)||this.path.some(Txe))){const{scroll:f}=this.root;f&&(Ch(c.x,f.offset.x),Ch(c.y,f.offset.y))}return c}removeElementScroll(a){var l;const c=on();if(Pi(c,a),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let d=0;d<this.path.length;d++){const f=this.path[d],{scroll:p,options:m}=f;f!==this.root&&p&&m.layoutScroll&&(p.wasRoot&&Pi(c,a),Ch(c.x,p.offset.x),Ch(c.y,p.offset.y))}return c}applyTransform(a,l=!1){const c=on();Pi(c,a);for(let d=0;d<this.path.length;d++){const f=this.path[d];!l&&f.options.layoutScroll&&f.scroll&&f!==f.root&&Nh(c,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),Su(f.latestValues)&&Nh(c,f.latestValues)}return Su(this.latestValues)&&Nh(c,this.latestValues),c}removeTransform(a){const l=on();Pi(l,a);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!Su(d.latestValues))continue;xN(d.latestValues)&&d.updateSnapshot();const f=on(),p=d.measurePageBox();Pi(f,p),HI(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,f)}return Su(this.latestValues)&&HI(l,this.latestValues),l}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ns.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==c;if(!(a||d&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:m}=this.options;if(!(!this.layout||!(p||m))){if(this.resolvedRelativeTargetAt=ns.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=on(),this.relativeTargetOrigin=on(),Zm(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Pi(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=on(),this.targetWithTransforms=on()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Rye(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Pi(this.target,this.layout.layoutBox),e7(this.target,this.targetDelta)):Pi(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=on(),this.relativeTargetOrigin=on(),Zm(this.relativeTargetOrigin,this.target,g.target),Pi(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||xN(this.parent.latestValues)||J9(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var a;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty)&&(d=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===ns.timestamp&&(d=!1),d)return;const{layout:f,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(f||p))return;Pi(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,g=this.treeScale.y;Dye(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=on());const{target:y}=l;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(zI(this.prevProjectionDelta.x,this.projectionDelta.x),zI(this.prevProjectionDelta.y,this.projectionDelta.y)),Xm(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==g||!YI(this.projectionDelta.x,this.prevProjectionDelta.x)||!YI(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),a){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Eh(),this.projectionDelta=Eh(),this.projectionDeltaWithTransform=Eh()}setAnimationOrigin(a,l=!1){const c=this.snapshot,d=c?c.latestValues:{},f={...this.latestValues},p=Eh();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const m=on(),g=c?c.source:void 0,y=this.layout?this.layout.source:void 0,x=g!==y,w=this.getStack(),_=!w||w.members.length<=1,S=!!(x&&!_&&this.options.crossfade===!0&&!this.path.some(Cxe));this.animationProgress=0;let k;this.mixTargetDelta=N=>{const j=N/1e3;JI(p.x,a.x,j),JI(p.y,a.y,j),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Zm(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Exe(this.relativeTarget,this.relativeTargetOrigin,m,j),k&&cxe(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=on()),Pi(k,this.relativeTarget)),x&&(this.animationValues=f,nxe(f,d,this.latestValues,j,S,_)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Rc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Cr.update(()=>{v0.hasAnimatedSinceResize=!0,this.currentAnimation=Xye(0,QI,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(QI),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:f}=a;if(!(!l||!c||!d)){if(this!==a&&this.layout&&d&&h7(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||on();const p=Fs(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+p;const m=Fs(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+m}Pi(l,c),Nh(l,f),Xm(this.projectionDeltaWithTransform,this.layoutCorrected,l,f)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new uxe),this.sharedNodes.get(a).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&fk("z",a,d,this.animationValues);for(let f=0;f<hk.length;f++)fk(`rotate${hk[f]}`,a,d,this.animationValues),fk(`skew${hk[f]}`,a,d,this.animationValues);a.render();for(const f in d)a.setStaticValue(f,d[f]),this.animationValues&&(this.animationValues[f]=d[f]);a.scheduleRender()}getProjectionStyles(a){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hxe;const d={visibility:""},f=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=g0(a==null?void 0:a.pointerEvents)||"",d.transform=f?f(this.latestValues,""):"none",d;const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){const x={};return this.options.layoutId&&(x.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,x.pointerEvents=g0(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Su(this.latestValues)&&(x.transform=f?f({},""):"none",this.hasProjected=!1),x}const m=p.animationValues||p.latestValues;this.applyTransformsToTarget(),d.transform=dxe(this.projectionDeltaWithTransform,this.treeScale,m),f&&(d.transform=f(m,d.transform));const{x:g,y}=this.projectionDelta;d.transformOrigin=`${g.origin*100}% ${y.origin*100}% 0`,p.animationValues?d.opacity=p===this?(c=(l=m.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:m.opacityExit:d.opacity=p===this?m.opacity!==void 0?m.opacity:"":m.opacityExit!==void 0?m.opacityExit:0;for(const x in Rg){if(m[x]===void 0)continue;const{correct:w,applyTo:_,isCSSVariable:S}=Rg[x],k=d.transform==="none"?m[x]:w(m[x],p);if(_){const N=_.length;for(let j=0;j<N;j++)d[_[j]]=k}else S?this.options.visualElement.renderState.vars[x]=k:d[x]=k}return this.options.layoutId&&(d.pointerEvents=p===this?g0(a==null?void 0:a.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(XI),this.root.sharedNodes.clear()}}}function pxe(t){t.updateLayout()}function mxe(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=t.layout,{animationType:i}=t.options,a=r.source!==t.layout.source;i==="size"?$i(p=>{const m=a?r.measuredBox[p]:r.layoutBox[p],g=Fs(m);m.min=n[p].min,m.max=m.min+g}):h7(i,r.layoutBox,n)&&$i(p=>{const m=a?r.measuredBox[p]:r.layoutBox[p],g=Fs(n[p]);m.max=m.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+g)});const l=Eh();Xm(l,n,r.layoutBox);const c=Eh();a?Xm(c,t.applyTransform(s,!0),r.measuredBox):Xm(c,n,r.layoutBox);const d=!l7(l);let f=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:m,layout:g}=p;if(m&&g){const y=on();Zm(y,r.layoutBox,m.layoutBox);const x=on();Zm(x,n,g.layoutBox),c7(y,x)||(f=!0),p.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=y,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:f})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function gxe(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function vxe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function yxe(t){t.clearSnapshot()}function XI(t){t.clearMeasurements()}function xxe(t){t.isLayoutDirty=!1}function _xe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function ZI(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function bxe(t){t.resolveTargetDelta()}function wxe(t){t.calcProjection()}function Sxe(t){t.resetSkewAndRotation()}function kxe(t){t.removeLeadSnapshot()}function JI(t,e,r){t.translate=Kr(e.translate,0,r),t.scale=Kr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function e3(t,e,r,n){t.min=Kr(e.min,r.min,n),t.max=Kr(e.max,r.max,n)}function Exe(t,e,r,n){e3(t.x,e.x,r.x,n),e3(t.y,e.y,r.y,n)}function Cxe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Nxe={duration:.45,ease:[.4,0,.1,1]},t3=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),r3=t3("applewebkit/")&&!t3("chrome/")?Math.round:yi;function n3(t){t.min=r3(t.min),t.max=r3(t.max)}function jxe(t){n3(t.x),n3(t.y)}function h7(t,e,r){return t==="position"||t==="preserve-aspect"&&!Aye(KI(e),KI(r),.2)}function Txe(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const Axe=d7({attachResizeListener:(t,e)=>Mg(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),pk={current:void 0},f7=d7({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!pk.current){const t=new Axe({});t.mount(window),t.setOptions({layoutScroll:!0}),pk.current=t}return pk.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Rxe={pan:{Feature:Gye},drag:{Feature:Wye,ProjectionNode:f7,MeasureLayout:i7}};function s3(t,e,r){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover",r==="Start");const s="onHover"+r,i=n[s];i&&Cr.postRender(()=>i(e,yv(e)))}class Dxe extends Lc{mount(){const{current:e}=this.node;e&&(this.unmount=Fme(e,(r,n)=>(s3(this.node,n,"Start"),s=>s3(this.node,s,"End"))))}unmount(){}}class Oxe extends Lc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=vv(Mg(this.node.current,"focus",()=>this.onFocus()),Mg(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function i3(t,e,r){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap",r==="Start");const s="onTap"+(r==="End"?"":r),i=n[s];i&&Cr.postRender(()=>i(e,yv(e)))}class Pxe extends Lc{mount(){const{current:e}=this.node;e&&(this.unmount=Hme(e,(r,n)=>(i3(this.node,n,"Start"),(s,{success:i})=>i3(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const wN=new WeakMap,mk=new WeakMap,Mxe=t=>{const e=wN.get(t.target);e&&e(t)},Ixe=t=>{t.forEach(Mxe)};function Lxe({root:t,...e}){const r=t||document;mk.has(r)||mk.set(r,{});const n=mk.get(r),s=JSON.stringify(e);return n[s]||(n[s]=new IntersectionObserver(Ixe,{root:t,...e})),n[s]}function $xe(t,e,r){const n=Lxe(e);return wN.set(t,r),n.observe(t),()=>{wN.delete(t),n.unobserve(t)}}const Bxe={some:0,all:1};class Fxe extends Lc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:s="some",once:i}=e,a={root:r?r.current:void 0,rootMargin:n,threshold:typeof s=="number"?s:Bxe[s]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:f,onViewportLeave:p}=this.node.getProps(),m=d?f:p;m&&m(c)};return $xe(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(zxe(e,r))&&this.startObserver()}unmount(){}}function zxe({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const Uxe={inView:{Feature:Fxe},tap:{Feature:Pxe},focus:{Feature:Oxe},hover:{Feature:Dxe}},Vxe={layout:{ProjectionNode:f7,MeasureLayout:i7}},SN={current:null},p7={current:!1};function Hxe(){if(p7.current=!0,!!VT)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>SN.current=t.matches;t.addListener(e),e()}else SN.current=!1}const qxe=[...$9,bs,Dc],Wxe=t=>qxe.find(L9(t)),Gxe=new WeakMap;function Kxe(t,e,r){for(const n in e){const s=e[n],i=r[n];if(Cs(s))t.addValue(n,s);else if(Cs(i))t.addValue(n,Tg(s,{owner:t}));else if(i!==s)if(t.hasValue(n)){const a=t.getValue(n);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=t.getStaticValue(n);t.addValue(n,Tg(a!==void 0?a:s,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const a3=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Yxe{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=vA,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const g=uo.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,Cr.render(this.render,!1,!0))};const{latestValues:c,renderState:d,onUpdate:f}=a;this.onUpdate=f,this.latestValues=c,this.baseTarget={...c},this.initialValues=r.initial?{...c}:{},this.renderState=d,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=Rb(r),this.isVariantNode=e9(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:p,...m}=this.scrapeMotionValuesFromProps(r,{},this);for(const g in m){const y=m[g];c[g]!==void 0&&Cs(y)&&y.set(c[g],!1)}}mount(e){this.current=e,Gxe.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),p7.current||Hxe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:SN.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Rc(this.notifyUpdate),Rc(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=hd.has(e);n&&this.onBindTransform&&this.onBindTransform();const s=r.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&Cr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=r.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{s(),i(),a&&a(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in rf){const r=rf[e];if(!r)continue;const{isEnabled:n,Feature:s}=r;if(!this.features[e]&&s&&n(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):on()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<a3.length;n++){const s=a3[n];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,a=e[i];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=Kxe(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(e),()=>r.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=Tg(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(M9(s)||E9(s))?s=parseFloat(s):!Wxe(s)&&Dc.test(r)&&(s=D9(e,r)),this.setBaseTarget(e,Cs(s)?s.get():s)),Cs(s)?s.get():s}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const a=dA(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);a&&(s=a[e])}if(n&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Cs(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new KT),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class m7 extends Yxe{constructor(){super(...arguments),this.KeyframeResolver=B9}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Cs(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function Qxe(t){return window.getComputedStyle(t)}class Xxe extends m7{constructor(){super(...arguments),this.type="html",this.renderInstance=d9}readValueFromInstance(e,r){if(hd.has(r))return lve(e,r);{const n=Qxe(e),s=(nA(r)?n.getPropertyValue(r):n[r])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:r}){return t7(e,r)}build(e,r,n){aA(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return hA(e,r,n)}}class Zxe extends m7{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=on,this.updateDimensions=()=>{this.current&&!this.renderState.dimensions&&u9(this.current,this.renderState)}}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(hd.has(r)){const n=R9(r);return n&&n.default||0}return r=h9.has(r)?r:rA(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return p9(e,r,n)}onBindTransform(){this.current&&!this.renderState.dimensions&&Cr.postRender(this.updateDimensions)}build(e,r,n){cA(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,s){f9(e,r,n,s)}mount(e){this.isSVGTag=uA(e.tagName),super.mount(e)}}const Jxe=(t,e)=>lA(t)?new Zxe(e):new Xxe(e,{allowProjection:t!==E.Fragment}),e0e=Mge({...wye,...Uxe,...Rxe,...Vxe},Jxe),ws=Xme(e0e),$e=E.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,className:we("rounded-xl border bg-card text-card-foreground shadow",t),...e}));$e.displayName="Card";const ot=E.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,className:we("flex flex-col space-y-1.5 p-6",t),...e}));ot.displayName="CardHeader";const dt=E.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,className:we("font-semibold leading-none tracking-tight",t),...e}));dt.displayName="CardTitle";const rn=E.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,className:we("text-sm text-muted-foreground",t),...e}));rn.displayName="CardDescription";const Be=E.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,className:we("p-6 pt-0",t),...e}));Be.displayName="CardContent";const t0e=E.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,className:we("flex items-center p-6 pt-0",t),...e}));t0e.displayName="CardFooter";const tt=E.forwardRef(({className:t,type:e,...r},n)=>o.jsx("input",{type:e,className:we("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));tt.displayName="Input";var r0e="Label",g7=E.forwardRef((t,e)=>o.jsx(pt.label,{...t,ref:e,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));g7.displayName=r0e;var v7=g7;const n0e=_f("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Xe=E.forwardRef(({className:t,...e},r)=>o.jsx(v7,{ref:r,className:we(n0e(),t),...e}));Xe.displayName=v7.displayName;function bA(t){const e=E.useRef({value:t,previous:t});return E.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var wA="Checkbox",[s0e,O5e]=Us(wA),[i0e,a0e]=s0e(wA),y7=E.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:i,required:a,disabled:l,value:c="on",onCheckedChange:d,form:f,...p}=t,[m,g]=E.useState(null),y=Ht(e,N=>g(N)),x=E.useRef(!1),w=m?f||!!m.closest("form"):!0,[_=!1,S]=po({prop:s,defaultProp:i,onChange:d}),k=E.useRef(_);return E.useEffect(()=>{const N=m==null?void 0:m.form;if(N){const j=()=>S(k.current);return N.addEventListener("reset",j),()=>N.removeEventListener("reset",j)}},[m,S]),o.jsxs(i0e,{scope:r,state:_,disabled:l,children:[o.jsx(pt.button,{type:"button",role:"checkbox","aria-checked":_c(_)?"mixed":_,"aria-required":a,"data-state":b7(_),"data-disabled":l?"":void 0,disabled:l,value:c,...p,ref:y,onKeyDown:Ge(t.onKeyDown,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:Ge(t.onClick,N=>{S(j=>_c(j)?!0:!j),w&&(x.current=N.isPropagationStopped(),x.current||N.stopPropagation())})}),w&&o.jsx(o0e,{control:m,bubbles:!x.current,name:n,value:c,checked:_,required:a,disabled:l,form:f,style:{transform:"translateX(-100%)"},defaultChecked:_c(i)?!1:i})]})});y7.displayName=wA;var x7="CheckboxIndicator",_7=E.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...s}=t,i=a0e(x7,r);return o.jsx(_i,{present:n||_c(i.state)||i.state===!0,children:o.jsx(pt.span,{"data-state":b7(i.state),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});_7.displayName=x7;var o0e=t=>{const{control:e,checked:r,bubbles:n=!0,defaultChecked:s,...i}=t,a=E.useRef(null),l=bA(r),c=jT(e);E.useEffect(()=>{const f=a.current,p=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(p,"checked").set;if(l!==r&&g){const y=new Event("click",{bubbles:n});f.indeterminate=_c(r),g.call(f,_c(r)?!1:r),f.dispatchEvent(y)}},[l,r,n]);const d=E.useRef(_c(r)?!1:r);return o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s??d.current,...i,tabIndex:-1,ref:a,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function _c(t){return t==="indeterminate"}function b7(t){return _c(t)?"indeterminate":t?"checked":"unchecked"}var w7=y7,l0e=_7;const S7=E.forwardRef(({className:t,...e},r)=>o.jsx(w7,{ref:r,className:we("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:o.jsx(l0e,{className:we("flex items-center justify-center text-current"),children:o.jsx(Lr,{className:"h-4 w-4"})})}));S7.displayName=w7.displayName;function o3(t,[e,r]){return Math.min(r,Math.max(e,t))}var k7=E.forwardRef((t,e)=>{const{children:r,...n}=t,s=E.Children.toArray(r),i=s.find(u0e);if(i){const a=i.props.children,l=s.map(c=>c===i?E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null:c);return o.jsx(kN,{...n,ref:e,children:E.isValidElement(a)?E.cloneElement(a,void 0,l):null})}return o.jsx(kN,{...n,ref:e,children:r})});k7.displayName="Slot";var kN=E.forwardRef((t,e)=>{const{children:r,...n}=t;if(E.isValidElement(r)){const s=h0e(r),i=d0e(n,r.props);return r.type!==E.Fragment&&(i.ref=e?_o(e,s):s),E.cloneElement(r,i)}return E.Children.count(r)>1?E.Children.only(null):null});kN.displayName="SlotClone";var c0e=({children:t})=>o.jsx(o.Fragment,{children:t});function u0e(t){return E.isValidElement(t)&&t.type===c0e}function d0e(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{i(...l),s(...l)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function h0e(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var f0e=[" ","Enter","ArrowUp","ArrowDown"],p0e=[" ","Enter"],xv="Select",[Ob,Pb,m0e]=H_(xv),[Mf,P5e]=Us(xv,[m0e,Rf]),Mb=Rf(),[g0e,$c]=Mf(xv),[v0e,y0e]=Mf(xv),E7=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:s,onOpenChange:i,value:a,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:g,form:y}=t,x=Mb(e),[w,_]=E.useState(null),[S,k]=E.useState(null),[N,j]=E.useState(!1),T=_b(d),[D=!1,I]=po({prop:n,defaultProp:s,onChange:i}),[L,$]=po({prop:a,defaultProp:l,onChange:c}),Q=E.useRef(null),M=w?y||!!w.closest("form"):!0,[z,R]=E.useState(new Set),B=Array.from(z).map(V=>V.props.value).join(";");return o.jsx(RT,{...x,children:o.jsxs(g0e,{required:g,scope:e,trigger:w,onTriggerChange:_,valueNode:S,onValueNodeChange:k,valueNodeHasChildren:N,onValueNodeHasChildrenChange:j,contentId:ya(),value:L,onValueChange:$,open:D,onOpenChange:I,dir:T,triggerPointerDownPosRef:Q,disabled:m,children:[o.jsx(Ob.Provider,{scope:e,children:o.jsx(v0e,{scope:t.__scopeSelect,onNativeOptionAdd:E.useCallback(V=>{R(F=>new Set(F).add(V))},[]),onNativeOptionRemove:E.useCallback(V=>{R(F=>{const K=new Set(F);return K.delete(V),K})},[]),children:r})}),M?o.jsxs(Q7,{"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:p,value:L,onChange:V=>$(V.target.value),disabled:m,form:y,children:[L===void 0?o.jsx("option",{value:""}):null,Array.from(z)]},B):null]})})};E7.displayName=xv;var C7="SelectTrigger",N7=E.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...s}=t,i=Mb(r),a=$c(C7,r),l=a.disabled||n,c=Ht(e,a.onTriggerChange),d=Pb(r),f=E.useRef("touch"),[p,m,g]=X7(x=>{const w=d().filter(k=>!k.disabled),_=w.find(k=>k.value===a.value),S=Z7(w,x,_);S!==void 0&&a.onValueChange(S.value)}),y=x=>{l||(a.onOpenChange(!0),g()),x&&(a.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return o.jsx(DT,{asChild:!0,...i,children:o.jsx(pt.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":Y7(a.value)?"":void 0,...s,ref:c,onClick:Ge(s.onClick,x=>{x.currentTarget.focus(),f.current!=="mouse"&&y(x)}),onPointerDown:Ge(s.onPointerDown,x=>{f.current=x.pointerType;const w=x.target;w.hasPointerCapture(x.pointerId)&&w.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(y(x),x.preventDefault())}),onKeyDown:Ge(s.onKeyDown,x=>{const w=p.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&m(x.key),!(w&&x.key===" ")&&f0e.includes(x.key)&&(y(),x.preventDefault())})})})});N7.displayName=C7;var j7="SelectValue",T7=E.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,children:i,placeholder:a="",...l}=t,c=$c(j7,r),{onValueNodeHasChildrenChange:d}=c,f=i!==void 0,p=Ht(e,c.onValueNodeChange);return Kn(()=>{d(f)},[d,f]),o.jsx(pt.span,{...l,ref:p,style:{pointerEvents:"none"},children:Y7(c.value)?o.jsx(o.Fragment,{children:a}):i})});T7.displayName=j7;var x0e="SelectIcon",A7=E.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...s}=t;return o.jsx(pt.span,{"aria-hidden":!0,...s,ref:e,children:n||"▼"})});A7.displayName=x0e;var _0e="SelectPortal",R7=t=>o.jsx(xf,{asChild:!0,...t});R7.displayName=_0e;var rd="SelectContent",D7=E.forwardRef((t,e)=>{const r=$c(rd,t.__scopeSelect),[n,s]=E.useState();if(Kn(()=>{s(new DocumentFragment)},[]),!r.open){const i=n;return i?vf.createPortal(o.jsx(O7,{scope:t.__scopeSelect,children:o.jsx(Ob.Slot,{scope:t.__scopeSelect,children:o.jsx("div",{children:t.children})})}),i):null}return o.jsx(P7,{...t,ref:e})});D7.displayName=rd;var oa=10,[O7,Bc]=Mf(rd),b0e="SelectContentImpl",P7=E.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:a,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:y,hideWhenDetached:x,avoidCollisions:w,..._}=t,S=$c(rd,r),[k,N]=E.useState(null),[j,T]=E.useState(null),D=Ht(e,he=>N(he)),[I,L]=E.useState(null),[$,Q]=E.useState(null),M=Pb(r),[z,R]=E.useState(!1),B=E.useRef(!1);E.useEffect(()=>{if(k)return pT(k)},[k]),fT();const V=E.useCallback(he=>{const[xe,...ke]=M().map(Ye=>Ye.ref.current),[Oe]=ke.slice(-1),He=document.activeElement;for(const Ye of he)if(Ye===He||(Ye==null||Ye.scrollIntoView({block:"nearest"}),Ye===xe&&j&&(j.scrollTop=0),Ye===Oe&&j&&(j.scrollTop=j.scrollHeight),Ye==null||Ye.focus(),document.activeElement!==He))return},[M,j]),F=E.useCallback(()=>V([I,k]),[V,I,k]);E.useEffect(()=>{z&&F()},[z,F]);const{onOpenChange:K,triggerPointerDownPosRef:Y}=S;E.useEffect(()=>{if(k){let he={x:0,y:0};const xe=Oe=>{var He,Ye;he={x:Math.abs(Math.round(Oe.pageX)-(((He=Y.current)==null?void 0:He.x)??0)),y:Math.abs(Math.round(Oe.pageY)-(((Ye=Y.current)==null?void 0:Ye.y)??0))}},ke=Oe=>{he.x<=10&&he.y<=10?Oe.preventDefault():k.contains(Oe.target)||K(!1),document.removeEventListener("pointermove",xe),Y.current=null};return Y.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",ke,{capture:!0})}}},[k,K,Y]),E.useEffect(()=>{const he=()=>K(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[K]);const[O,H]=X7(he=>{const xe=M().filter(He=>!He.disabled),ke=xe.find(He=>He.ref.current===document.activeElement),Oe=Z7(xe,he,ke);Oe&&setTimeout(()=>Oe.ref.current.focus())}),G=E.useCallback((he,xe,ke)=>{const Oe=!B.current&&!ke;(S.value!==void 0&&S.value===xe||Oe)&&(L(he),Oe&&(B.current=!0))},[S.value]),q=E.useCallback(()=>k==null?void 0:k.focus(),[k]),J=E.useCallback((he,xe,ke)=>{const Oe=!B.current&&!ke;(S.value!==void 0&&S.value===xe||Oe)&&Q(he)},[S.value]),te=n==="popper"?EN:M7,ve=te===EN?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:y,hideWhenDetached:x,avoidCollisions:w}:{};return o.jsx(O7,{scope:r,content:k,viewport:j,onViewportChange:T,itemRefCallback:G,selectedItem:I,onItemLeave:q,itemTextRefCallback:J,focusSelectedItem:F,selectedItemText:$,position:n,isPositioned:z,searchRef:O,children:o.jsx(yb,{as:k7,allowPinchZoom:!0,children:o.jsx(gb,{asChild:!0,trapped:S.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:Ge(s,he=>{var xe;(xe=S.trigger)==null||xe.focus({preventScroll:!0}),he.preventDefault()}),children:o.jsx(yf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:o.jsx(te,{role:"listbox",id:S.contentId,"data-state":S.open?"open":"closed",dir:S.dir,onContextMenu:he=>he.preventDefault(),..._,...ve,onPlaced:()=>R(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:Ge(_.onKeyDown,he=>{const xe=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!xe&&he.key.length===1&&H(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let Oe=M().filter(He=>!He.disabled).map(He=>He.ref.current);if(["ArrowUp","End"].includes(he.key)&&(Oe=Oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const He=he.target,Ye=Oe.indexOf(He);Oe=Oe.slice(Ye+1)}setTimeout(()=>V(Oe)),he.preventDefault()}})})})})})})});P7.displayName=b0e;var w0e="SelectItemAlignedPosition",M7=E.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...s}=t,i=$c(rd,r),a=Bc(rd,r),[l,c]=E.useState(null),[d,f]=E.useState(null),p=Ht(e,D=>f(D)),m=Pb(r),g=E.useRef(!1),y=E.useRef(!0),{viewport:x,selectedItem:w,selectedItemText:_,focusSelectedItem:S}=a,k=E.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&x&&w&&_){const D=i.trigger.getBoundingClientRect(),I=d.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),$=_.getBoundingClientRect();if(i.dir!=="rtl"){const He=$.left-I.left,Ye=L.left-He,lt=D.left-Ye,P=D.width+lt,ne=Math.max(P,I.width),X=window.innerWidth-oa,W=o3(Ye,[oa,Math.max(oa,X-ne)]);l.style.minWidth=P+"px",l.style.left=W+"px"}else{const He=I.right-$.right,Ye=window.innerWidth-L.right-He,lt=window.innerWidth-D.right-Ye,P=D.width+lt,ne=Math.max(P,I.width),X=window.innerWidth-oa,W=o3(Ye,[oa,Math.max(oa,X-ne)]);l.style.minWidth=P+"px",l.style.right=W+"px"}const Q=m(),M=window.innerHeight-oa*2,z=x.scrollHeight,R=window.getComputedStyle(d),B=parseInt(R.borderTopWidth,10),V=parseInt(R.paddingTop,10),F=parseInt(R.borderBottomWidth,10),K=parseInt(R.paddingBottom,10),Y=B+V+z+K+F,O=Math.min(w.offsetHeight*5,Y),H=window.getComputedStyle(x),G=parseInt(H.paddingTop,10),q=parseInt(H.paddingBottom,10),J=D.top+D.height/2-oa,te=M-J,ve=w.offsetHeight/2,he=w.offsetTop+ve,xe=B+V+he,ke=Y-xe;if(xe<=J){const He=Q.length>0&&w===Q[Q.length-1].ref.current;l.style.bottom="0px";const Ye=d.clientHeight-x.offsetTop-x.offsetHeight,lt=Math.max(te,ve+(He?q:0)+Ye+F),P=xe+lt;l.style.height=P+"px"}else{const He=Q.length>0&&w===Q[0].ref.current;l.style.top="0px";const lt=Math.max(J,B+x.offsetTop+(He?G:0)+ve)+ke;l.style.height=lt+"px",x.scrollTop=xe-J+x.offsetTop}l.style.margin=`${oa}px 0`,l.style.minHeight=O+"px",l.style.maxHeight=M+"px",n==null||n(),requestAnimationFrame(()=>g.current=!0)}},[m,i.trigger,i.valueNode,l,d,x,w,_,i.dir,n]);Kn(()=>k(),[k]);const[N,j]=E.useState();Kn(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);const T=E.useCallback(D=>{D&&y.current===!0&&(k(),S==null||S(),y.current=!1)},[k,S]);return o.jsx(k0e,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:o.jsx(pt.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});M7.displayName=w0e;var S0e="SelectPopperPosition",EN=E.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=oa,...i}=t,a=Mb(r);return o.jsx(OT,{...a,...i,ref:e,align:n,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});EN.displayName=S0e;var[k0e,SA]=Mf(rd,{}),CN="SelectViewport",I7=E.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:n,...s}=t,i=Bc(CN,r),a=SA(CN,r),l=Ht(e,i.onViewportChange),c=E.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:n}),o.jsx(Ob.Slot,{scope:r,children:o.jsx(pt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ge(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=a;if(m!=null&&m.current&&p){const g=Math.abs(c.current-f.scrollTop);if(g>0){const y=window.innerHeight-oa*2,x=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),_=Math.max(x,w);if(_<y){const S=_+g,k=Math.min(y,S),N=S-k;p.style.height=k+"px",p.style.bottom==="0px"&&(f.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});I7.displayName=CN;var L7="SelectGroup",[E0e,C0e]=Mf(L7),N0e=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=ya();return o.jsx(E0e,{scope:r,id:s,children:o.jsx(pt.div,{role:"group","aria-labelledby":s,...n,ref:e})})});N0e.displayName=L7;var $7="SelectLabel",B7=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=C0e($7,r);return o.jsx(pt.div,{id:s.id,...n,ref:e})});B7.displayName=$7;var c_="SelectItem",[j0e,F7]=Mf(c_),z7=E.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:i,...a}=t,l=$c(c_,r),c=Bc(c_,r),d=l.value===n,[f,p]=E.useState(i??""),[m,g]=E.useState(!1),y=Ht(e,S=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,S,n,s)}),x=ya(),w=E.useRef("touch"),_=()=>{s||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(j0e,{scope:r,value:n,disabled:s,textId:x,isSelected:d,onItemTextChange:E.useCallback(S=>{p(k=>k||((S==null?void 0:S.textContent)??"").trim())},[]),children:o.jsx(Ob.ItemSlot,{scope:r,value:n,disabled:s,textValue:f,children:o.jsx(pt.div,{role:"option","aria-labelledby":x,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:y,onFocus:Ge(a.onFocus,()=>g(!0)),onBlur:Ge(a.onBlur,()=>g(!1)),onClick:Ge(a.onClick,()=>{w.current!=="mouse"&&_()}),onPointerUp:Ge(a.onPointerUp,()=>{w.current==="mouse"&&_()}),onPointerDown:Ge(a.onPointerDown,S=>{w.current=S.pointerType}),onPointerMove:Ge(a.onPointerMove,S=>{var k;w.current=S.pointerType,s?(k=c.onItemLeave)==null||k.call(c):w.current==="mouse"&&S.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ge(a.onPointerLeave,S=>{var k;S.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:Ge(a.onKeyDown,S=>{var N;((N=c.searchRef)==null?void 0:N.current)!==""&&S.key===" "||(p0e.includes(S.key)&&_(),S.key===" "&&S.preventDefault())})})})})});z7.displayName=c_;var Om="SelectItemText",U7=E.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,...i}=t,a=$c(Om,r),l=Bc(Om,r),c=F7(Om,r),d=y0e(Om,r),[f,p]=E.useState(null),m=Ht(e,_=>p(_),c.onItemTextChange,_=>{var S;return(S=l.itemTextRefCallback)==null?void 0:S.call(l,_,c.value,c.disabled)}),g=f==null?void 0:f.textContent,y=E.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:x,onNativeOptionRemove:w}=d;return Kn(()=>(x(y),()=>w(y)),[x,w,y]),o.jsxs(o.Fragment,{children:[o.jsx(pt.span,{id:c.textId,...i,ref:m}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?vf.createPortal(i.children,a.valueNode):null]})});U7.displayName=Om;var V7="SelectItemIndicator",H7=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return F7(V7,r).isSelected?o.jsx(pt.span,{"aria-hidden":!0,...n,ref:e}):null});H7.displayName=V7;var NN="SelectScrollUpButton",q7=E.forwardRef((t,e)=>{const r=Bc(NN,t.__scopeSelect),n=SA(NN,t.__scopeSelect),[s,i]=E.useState(!1),a=Ht(e,n.onScrollButtonChange);return Kn(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;i(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?o.jsx(G7,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});q7.displayName=NN;var jN="SelectScrollDownButton",W7=E.forwardRef((t,e)=>{const r=Bc(jN,t.__scopeSelect),n=SA(jN,t.__scopeSelect),[s,i]=E.useState(!1),a=Ht(e,n.onScrollButtonChange);return Kn(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;i(f)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?o.jsx(G7,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});W7.displayName=jN;var G7=E.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=t,i=Bc("SelectScrollButton",r),a=E.useRef(null),l=Pb(r),c=E.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return E.useEffect(()=>()=>c(),[c]),Kn(()=>{var f;const d=l().find(p=>p.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),o.jsx(pt.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:Ge(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Ge(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Ge(s.onPointerLeave,()=>{c()})})}),T0e="SelectSeparator",K7=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return o.jsx(pt.div,{"aria-hidden":!0,...n,ref:e})});K7.displayName=T0e;var TN="SelectArrow",A0e=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=Mb(r),i=$c(TN,r),a=Bc(TN,r);return i.open&&a.position==="popper"?o.jsx(PT,{...s,...n,ref:e}):null});A0e.displayName=TN;function Y7(t){return t===""||t===void 0}var Q7=E.forwardRef((t,e)=>{const{value:r,...n}=t,s=E.useRef(null),i=Ht(e,s),a=bA(r);return E.useEffect(()=>{const l=s.current,c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==r&&f){const p=new Event("change",{bubbles:!0});f.call(l,r),l.dispatchEvent(p)}},[a,r]),o.jsx(rv,{asChild:!0,children:o.jsx("select",{...n,ref:i,defaultValue:r})})});Q7.displayName="BubbleSelect";function X7(t){const e=us(t),r=E.useRef(""),n=E.useRef(0),s=E.useCallback(a=>{const l=r.current+a;e(l),function c(d){r.current=d,window.clearTimeout(n.current),d!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),i=E.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,i]}function Z7(t,e,r){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let a=R0e(t,Math.max(i,0));s.length===1&&(a=a.filter(d=>d!==r));const c=a.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function R0e(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var D0e=E7,J7=N7,O0e=T7,P0e=A7,M0e=R7,eH=D7,I0e=I7,tH=B7,rH=z7,L0e=U7,$0e=H7,nH=q7,sH=W7,iH=K7;const ja=D0e,Ta=O0e,Wi=E.forwardRef(({className:t,children:e,...r},n)=>o.jsxs(J7,{ref:n,className:we("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,o.jsx(P0e,{asChild:!0,children:o.jsx(G_,{className:"h-4 w-4 opacity-50"})})]}));Wi.displayName=J7.displayName;const aH=E.forwardRef(({className:t,...e},r)=>o.jsx(nH,{ref:r,className:we("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(wj,{className:"h-4 w-4"})}));aH.displayName=nH.displayName;const oH=E.forwardRef(({className:t,...e},r)=>o.jsx(sH,{ref:r,className:we("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(G_,{className:"h-4 w-4"})}));oH.displayName=sH.displayName;const Gi=E.forwardRef(({className:t,children:e,position:r="popper",...n},s)=>o.jsx(M0e,{children:o.jsxs(eH,{ref:s,className:we("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[o.jsx(aH,{}),o.jsx(I0e,{className:we("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(oH,{})]})}));Gi.displayName=eH.displayName;const B0e=E.forwardRef(({className:t,...e},r)=>o.jsx(tH,{ref:r,className:we("px-2 py-1.5 text-sm font-semibold",t),...e}));B0e.displayName=tH.displayName;const bn=E.forwardRef(({className:t,children:e,...r},n)=>o.jsxs(rH,{ref:n,className:we("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx($0e,{children:o.jsx(Lr,{className:"h-4 w-4"})})}),o.jsx(L0e,{children:e})]}));bn.displayName=rH.displayName;const F0e=E.forwardRef(({className:t,...e},r)=>o.jsx(iH,{ref:r,className:we("-mx-1 my-1 h-px bg-muted",t),...e}));F0e.displayName=iH.displayName;const l3={"invalid-email-password":"The email or password you entered is incorrect. Please double-check and try again.","email-already-in-use":"This email is already registered. Try signing in instead.","user-already-exists":"An account with this email already exists.","email-not-verified":"Please verify your email before signing in.","unverified-user":"Please verify your email before signing in.","invalid-password":"That password doesn't meet the requirements. Use at least 8 characters.","password-validation-failed":"That password is too weak. Use at least 8 characters with a mix of letters and numbers.","user-not-found":"No account was found with this email address.","rate-limit-exceeded":"Too many attempts. Please wait a moment and try again.","too-many-requests":"Too many requests. Please wait a moment and try again.","invalid-refresh-token":"Your session has expired. Please sign in again.","invalid-email":"Please enter a valid email address.",forbidden:"You don't have permission to perform this action.","network-request-failed":"We couldn't reach the server. Check your connection and try again.",network:"We couldn't reach the server. Check your connection and try again.","session-expired":"Your session has expired. Please sign in again."};function lH(t){if(typeof t=="string"&&t.trim())return t.trim();if(Array.isArray(t)){const e=t[0];if(e&&typeof e=="string")return e;if(e&&typeof e=="object"&&e!==null){const r=e.message;return lH(r)}}return""}function Ib(t){if(!t)return"Something went wrong. Please try again.";const e=typeof t.error=="string"?t.error:"";if(e&&l3[e])return l3[e];const r=lH(t.message);return r&&r!=="undefined"?r:"Something went wrong. Please try again."}const z0e=["Web application","API / Backend service","AI / Machine learning","Mobile app backend","Static website","Just exploring"],U0e=["Friend or colleague","Social media","Search engine","Community / Discord","Blog or article","Other"],V0e=[{icon:$r,title:"Deploy in minutes"},{icon:Zs,title:"Managed databases & storage"},{icon:cne,title:"Scale as you grow"}],gk=[{label:"Too short",color:"bg-destructive",text:"text-destructive"},{label:"Weak",color:"bg-orange-500",text:"text-orange-500"},{label:"Fair",color:"bg-amber-500",text:"text-amber-500"},{label:"Good",color:"bg-emerald-500",text:"text-emerald-500"},{label:"Strong",color:"bg-emerald-600",text:"text-emerald-600"}];function H0e(t){if(!t)return 0;if(t.length<8)return 1;let e=1;return t.length>=12&&e++,/[A-Z]/.test(t)&&e++,/[0-9]/.test(t)&&e++,/[^A-Za-z0-9]/.test(t)&&e++,Math.min(e,4)}function cH({isLogin:t=!0}){const[e,r]=E.useState(""),[n,s]=E.useState(""),[i,a]=E.useState(""),[l,c]=E.useState(""),[d,f]=E.useState(void 0),[p,m]=E.useState(void 0),[g,y]=E.useState(!1),[x,w]=E.useState(!1),[_,S]=E.useState(!1),[k,N]=E.useState(!1),[j,T]=E.useState(!1),D=Yn(),{toast:I}=br(),{ref_by:L}=Hh(),{signInEmailPassword:$,isLoading:Q,error:M}=vue(),{signUpEmailPassword:z,isLoading:R,error:B}=yue(),V=t?Q:R,F=t?M:B,K=H0e(n),Y=async O=>{if(O.preventDefault(),!t){if(!l.trim()){I({title:"Please enter your name",description:"We'll use it to personalize your account.",variant:"destructive"});return}if(n!==i){I({title:"Passwords don't match",description:"Please re-enter both passwords.",variant:"destructive"});return}if(!g){I({title:"Accept the terms",description:"Please accept the Terms of Service to continue.",variant:"destructive"});return}}let H;t?H=await $(e,n):H=await z(e,n,{displayName:l.trim(),metadata:{ref_by:L,what_building:d??null,referral_source:p??null}}),H.needsEmailVerification&&(D("/verify-email",{state:{email:e}}),I({title:"Check your inbox",description:"We sent you a link to verify your email.",variant:"default"})),H.isSuccess?(D(t?"/dashboard":"/dashboard/onboarding"),I({title:t?"Welcome back":"Account created",description:t?"You're signed in.":"Welcome to Ghaymah Cloud — let's build."})):F&&I({title:t?"Couldn't sign you in":"Couldn't create your account",description:Ib(F),variant:"destructive"})};return o.jsxs("div",{className:"min-h-screen lg:grid lg:grid-cols-2",children:[o.jsxs("div",{className:"relative hidden flex-col justify-between overflow-hidden border-r border-border/60 p-12 lg:flex xl:p-16",children:[o.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse 80% 60% at 0% 0%, hsl(var(--primary) / 0.08), transparent 60%)"}}),o.jsxs("div",{className:"relative flex items-center gap-2.5",children:[o.jsx("img",{src:"/Logo.png",alt:"Ghaymah",className:"h-10 w-10 rounded-xl object-contain shadow-sm ring-1 ring-border/70"}),o.jsx("span",{className:"text-xl font-bold tracking-tight",children:"غيمة"})]}),o.jsxs("div",{className:"relative max-w-md",children:[o.jsxs("h1",{className:"text-4xl font-bold leading-tight tracking-tight xl:text-5xl",children:["Ship faster.",o.jsx("br",{}),o.jsx("span",{className:"text-shimmer",children:"We'll handle the cloud."})]}),o.jsx("p",{className:"mt-4 text-muted-foreground",children:"Deploy apps, databases, and storage — in minutes."}),o.jsx("div",{className:"mt-10 space-y-4",children:V0e.map(O=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(O.icon,{className:"h-4 w-4 text-primary"})}),o.jsx("p",{className:"text-sm font-medium",children:O.title})]},O.title))})]}),o.jsxs("figure",{className:"relative max-w-md",children:[o.jsx(Ore,{className:"h-5 w-5 text-primary/40"}),o.jsx("blockquote",{className:"mt-2 text-sm text-foreground/80",children:"“غيمة made shipping my first product effortless.”"}),o.jsxs("figcaption",{className:"mt-3 flex items-center gap-2.5",children:[o.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary",children:"أ"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Ahmed · Founder"})]})]})]}),o.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden px-4 py-12 sm:px-8",children:[o.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse 50% 40% at 90% 110%, hsl(var(--primary) / 0.05), transparent)"}}),o.jsxs(ws.div,{className:"relative z-10 w-full max-w-sm",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.5,ease:"easeOut"},children:[o.jsxs("div",{className:"mb-8 flex items-center justify-center gap-2.5 lg:hidden",children:[o.jsx("img",{src:"/Logo.png",alt:"Ghaymah",className:"h-10 w-10 rounded-xl object-contain shadow-sm ring-1 ring-border/70"}),o.jsx("span",{className:"text-xl font-bold tracking-tight",children:"غيمة"})]}),o.jsxs("div",{className:"mb-6 text-center lg:text-left",children:[o.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:t?"Welcome back":"Create your account"}),o.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:t?"Sign in to your account.":"Start building in minutes — free."})]}),o.jsx($e,{className:"rounded-2xl border bg-card/80 shadow-xl shadow-primary/5 backdrop-blur",children:o.jsx(Be,{className:"p-6",children:o.jsxs("form",{onSubmit:Y,className:"space-y-4",children:[!t&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"fullName",className:"text-sm font-medium",children:"Full name"}),o.jsxs("div",{className:"relative",children:[o.jsx(B0,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{id:"fullName",type:"text",placeholder:"Ahmed Khalid",value:l,onChange:O=>c(O.target.value),required:!0,className:"h-11 pl-10 border-border/70 focus-visible:ring-primary/20"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"email",className:"text-sm font-medium",children:"Email"}),o.jsxs("div",{className:"relative",children:[o.jsx(Sc,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{id:"email",type:"email",placeholder:"you@example.com",value:e,onChange:O=>r(O.target.value),required:!0,className:"h-11 pl-10 border-border/70 focus-visible:ring-primary/20"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Xe,{htmlFor:"password",className:"text-sm font-medium",children:"Password"}),t&&o.jsx(ba,{to:"/forgot-password",className:"text-xs font-medium text-primary hover:underline",children:"Forgot password?"})]}),o.jsxs("div",{className:"relative",children:[o.jsx(Gn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{id:"password",type:k?"text":"password",placeholder:t?"Enter your password":"Create a password",value:n,onChange:O=>s(O.target.value),required:!0,minLength:8,className:"h-11 pl-10 pr-10 border-border/70 focus-visible:ring-primary/20"}),o.jsx("button",{type:"button",onClick:()=>N(O=>!O),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground","aria-label":k?"Hide password":"Show password",children:k?o.jsx(ol,{className:"h-4 w-4"}):o.jsx(ll,{className:"h-4 w-4"})})]}),!t&&n.length>0&&o.jsxs("div",{className:"space-y-1.5 pt-1",children:[o.jsx("div",{className:"flex gap-1.5",children:[0,1,2,3].map(O=>o.jsx("span",{className:we("h-1 flex-1 rounded-full transition-colors",O<K?gk[K].color:"bg-muted")},O))}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:o.jsx("span",{className:gk[K].text,children:gk[K].label})})]})]}),!t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"confirmPassword",className:"text-sm font-medium",children:"Confirm password"}),o.jsxs("div",{className:"relative",children:[o.jsx(Gn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{id:"confirmPassword",type:j?"text":"password",placeholder:"Re-enter your password",value:i,onChange:O=>a(O.target.value),required:!0,className:"h-11 pl-10 pr-10 border-border/70 focus-visible:ring-primary/20"}),o.jsx("button",{type:"button",onClick:()=>T(O=>!O),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground","aria-label":j?"Hide password":"Show password",children:j?o.jsx(ol,{className:"h-4 w-4"}):o.jsx(ll,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"space-y-3 rounded-xl border border-border/60 bg-muted/30 p-3.5",children:[o.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["A bit about you"," ",o.jsx("span",{className:"font-normal text-muted-foreground/70",children:"(optional)"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"whatBuilding",className:"text-sm font-medium",children:"What are you building?"}),o.jsxs(ja,{value:d,onValueChange:f,children:[o.jsx(Wi,{id:"whatBuilding",className:"w-full border-border/70 focus:ring-primary/20",children:o.jsx(Ta,{placeholder:"Select…"})}),o.jsx(Gi,{children:z0e.map(O=>o.jsx(bn,{value:O,children:O},O))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"referralSource",className:"text-sm font-medium",children:"How did you hear about us?"}),o.jsxs(ja,{value:p,onValueChange:m,children:[o.jsx(Wi,{id:"referralSource",className:"w-full border-border/70 focus:ring-primary/20",children:o.jsx(Ta,{placeholder:"Select…"})}),o.jsx(Gi,{children:U0e.map(O=>o.jsx(bn,{value:O,children:O},O))})]})]})]}),o.jsxs("div",{className:"flex items-start gap-2.5",children:[o.jsx(S7,{id:"terms","aria-label":"I agree to the Terms of Service and Privacy Policy",checked:g,onCheckedChange:O=>y(!!O),className:"mt-0.5"}),o.jsxs("p",{className:"text-sm leading-snug text-muted-foreground",children:["I agree to the"," ",o.jsx("button",{type:"button",className:"font-medium text-primary hover:underline",onClick:()=>w(!0),children:"Terms of Service"})," ","and"," ",o.jsx("button",{type:"button",className:"font-medium text-primary hover:underline",onClick:()=>S(!0),children:"Privacy Policy"}),"."]})]})]}),o.jsxs(le,{type:"submit",className:"group h-11 w-full bg-gradient-to-r from-primary to-primary/90 shadow-md hover:shadow-lg transition-shadow",disabled:V,children:[V?o.jsx(kt,{className:"h-4 w-4 animate-spin mr-2"}):null,t?"Sign in":"Create account",!V&&o.jsx(ei,{className:"h-4 w-4 transition-transform group-hover:translate-x-1"})]})]})})}),o.jsxs("p",{className:"mt-6 text-center text-sm text-muted-foreground",children:[t?"New to غيمة?":"Already have an account?"," ",o.jsx(ba,{to:t?"/signup":"/login",className:"font-medium text-primary hover:underline",children:t?"Create an account":"Sign in"})]})]})]}),_&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:o.jsxs(ws.div,{className:"max-h-[80vh] w-full max-w-2xl overflow-y-auto rounded-lg border border-primary/10 bg-background p-6 shadow-xl",initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsxs("h2",{className:"flex items-center gap-2 text-2xl font-bold",children:[o.jsx(TM,{className:"h-6 w-6 text-primary"}),"Privacy Policy"]}),o.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-primary",children:"✕"})]}),o.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[o.jsx("h3",{children:"Privacy Policy"}),o.jsx("p",{children:o.jsx("em",{children:"Last Updated: 27-07-2025"})}),o.jsx("h4",{children:"1. Minimal Data Collection"}),o.jsx("p",{children:"Ghaymah Cloud collects only essential data:"}),o.jsxs("ul",{children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Account Data:"})," Email, username, and encrypted password (for authentication)."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Service Metadata:"})," Timestamps, IP addresses (for security and abuse prevention)."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"No Content Scanning:"})," We do not monitor or store your deployed application data unless reported for violations."]})]}),o.jsx("h4",{children:"2. Purpose of Data"}),o.jsx("p",{children:"Data is used solely for:"}),o.jsxs("ul",{children:[o.jsx("li",{children:"Providing and maintaining services."}),o.jsx("li",{children:"Complying with legal obligations (e.g., fraud prevention)."})]}),o.jsx("h4",{children:"3. Data Sharing"}),o.jsxs("p",{children:["We ",o.jsx("strong",{children:"do not sell or share"})," your data with third parties except:"]}),o.jsxs("ul",{children:[o.jsx("li",{children:"When required by law or legitimate government authorities."}),o.jsx("li",{children:"For essential service providers (e.g., payment processors) under confidentiality agreements."})]}),o.jsx("h4",{children:"4. Data Retention"}),o.jsx("p",{children:"Data is deleted when:"}),o.jsxs("ul",{children:[o.jsx("li",{children:"You close your account (within 30 days)."}),o.jsx("li",{children:"It is no longer needed for legal or operational purposes."})]}),o.jsx("h4",{children:"5. Security"}),o.jsxs("p",{children:["We implement ",o.jsx("strong",{children:"technical safeguards"})," (encryption, access controls) but cannot guarantee absolute security—users must protect their credentials."]}),o.jsx("h4",{children:"6. Your Rights"}),o.jsx("p",{children:"You may:"}),o.jsxs("ul",{children:[o.jsx("li",{children:"Request access to or deletion of your data (unless legally required to retain)."}),o.jsx("li",{children:"Opt out of non-essential communications."})]}),o.jsx("h4",{children:"7. Changes to Policy"}),o.jsx("p",{children:"Updates will be posted here. Continued use constitutes acceptance."}),o.jsx("h4",{children:"8. Contact"}),o.jsxs("p",{children:["For privacy concerns or compliance inquiries: ",o.jsx("br",{}),o.jsx("strong",{children:"Email:"})," mohamad@ghaymah.systems"]})]}),o.jsx("div",{className:"mt-6 flex justify-end",children:o.jsx(le,{onClick:()=>{y(!0),S(!1)},children:"I Accept"})})]})}),x&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:o.jsxs(ws.div,{className:"max-h-[80vh] w-full max-w-2xl overflow-y-auto rounded-lg border border-primary/10 bg-background p-6 shadow-xl",initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsxs("h2",{className:"flex items-center gap-2 text-2xl font-bold",children:[o.jsx(TM,{className:"h-6 w-6 text-primary"}),"Terms and Conditions"]}),o.jsx("button",{onClick:()=>w(!1),className:"text-muted-foreground hover:text-primary",children:"✕"})]}),o.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[o.jsx("h3",{children:"1. Acceptance of Terms"}),o.jsx("p",{children:'By accessing or using the غيمة ("Ghaymah") cloud platform, you agree to be bound by these Terms and Conditions. If you do not agree with any part of these terms, you must not use our services.'}),o.jsx("h3",{children:"2. Service Description"}),o.jsx("p",{children:'Ghaymah provides container deployment and cloud computing services as the first Arabic cloud provider in the region. All services are provided on an "as-is" and "as-available" basis without warranties of any kind. We reserve the right to modify or discontinue any service at any time without notice.'}),o.jsx("h3",{children:"3. Compliance"}),o.jsx("p",{children:"All applications deployed on Ghaymah must comply with the following Laws. Prohibited content includes but is not limited to:"}),o.jsxs("ul",{children:[o.jsx("li",{children:"Gambling or interest-based transactions (riba)"}),o.jsx("li",{children:"Pornography or immoral content"}),o.jsx("li",{children:"Content promoting unlawful (haram) activities"})]}),o.jsx("p",{children:"We reserve the right to immediately suspend or terminate any violating applications without notice."}),o.jsx("h3",{children:"4. Data Responsibility"}),o.jsx("p",{children:"You are solely responsible for maintaining backups of your data. Ghaymah shall not be liable for any data loss, corruption, or deletion under any circumstances, including technical failures or human error."}),o.jsx("h3",{children:"5. Security & Liability"}),o.jsx("p",{children:"While we implement security measures, we do not guarantee protection against hacking or unauthorized access. Ghaymah shall not be responsible for any damages resulting from security breaches or data compromises."}),o.jsx("h3",{children:"6. Service Availability"}),o.jsx("p",{children:"Ghaymah does not currently provide a Service Level Agreement (SLA). Uptime and performance are not guaranteed, and service interruptions may occur without notice or compensation."}),o.jsx("h3",{children:"7. User Responsibilities"}),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 immediately notify us of any unauthorized use of your account."}),o.jsx("h3",{children:"8. Limitation of Liability"}),o.jsx("p",{children:"Ghaymah shall not be liable for any indirect, incidental, special, consequential, or punitive damages resulting from your use of or inability to use our services, including data loss or business interruption. Our total liability, if any, shall not exceed the amount you paid for services in the last 3 months."}),o.jsx("h3",{children:"9. Indemnification"}),o.jsx("p",{children:"You agree to indemnify and hold Ghaymah harmless from any claims or damages arising from your violation of these terms, including compliance requirements or misuse of our services."}),o.jsx("h3",{children:"10. Changes to Terms"}),o.jsx("p",{children:"We reserve the right to modify these terms at any time. Your continued use of our services after such changes constitutes your acceptance of the new terms."}),o.jsx("h3",{children:"11. Governing Law"}),o.jsx("p",{children:"These terms shall be governed by and construed in accordance with the laws of Canada."})]}),o.jsx("div",{className:"mt-6 flex justify-end",children:o.jsx(le,{onClick:()=>{y(!0),w(!1)},children:"I Accept"})})]})})]})}function q0e(){return o.jsx(cH,{isLogin:!0})}function W0e(){return o.jsx(cH,{isLogin:!1})}function c3({children:t}){const{isAuthenticated:e,isLoading:r}=pb();return r?o.jsx("div",{className:"flex items-center justify-center min-h-screen",children:o.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-b-transparent"})}):e?o.jsx(o.Fragment,{children:t}):o.jsx(pj,{to:"/login"})}const hs=xT,G0e=_T,uH=E.forwardRef(({className:t,...e},r)=>o.jsx(lv,{ref:r,className:we("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));uH.displayName=lv.displayName;const un=E.forwardRef(({className:t,children:e,...r},n)=>o.jsxs(G0e,{children:[o.jsx(uH,{}),o.jsxs(cv,{ref:n,className:we("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r,children:[e,o.jsxs(xb,{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(yc,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));un.displayName=cv.displayName;const Dn=({className:t,...e})=>o.jsx("div",{className:we("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Dn.displayName="DialogHeader";const Ki=({className:t,...e})=>o.jsx("div",{className:we("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ki.displayName="DialogFooter";const On=E.forwardRef(({className:t,...e},r)=>o.jsx(uv,{ref:r,className:we("text-lg font-semibold leading-none tracking-tight",t),...e}));On.displayName=uv.displayName;const fs=E.forwardRef(({className:t,...e},r)=>o.jsx(dv,{ref:r,className:we("text-sm text-muted-foreground",t),...e}));fs.displayName=dv.displayName;var K0e=E.forwardRef((t,e)=>{const{children:r,...n}=t,s=E.Children.toArray(r),i=s.find(Y0e);if(i){const a=i.props.children,l=s.map(c=>c===i?E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null:c);return o.jsx(AN,{...n,ref:e,children:E.isValidElement(a)?E.cloneElement(a,void 0,l):null})}return o.jsx(AN,{...n,ref:e,children:r})});K0e.displayName="Slot";var AN=E.forwardRef((t,e)=>{const{children:r,...n}=t;if(E.isValidElement(r)){const s=X0e(r),i=Q0e(n,r.props);return r.type!==E.Fragment&&(i.ref=e?_o(e,s):s),E.cloneElement(r,i)}return E.Children.count(r)>1?E.Children.only(null):null});AN.displayName="SlotClone";var dH=({children:t})=>o.jsx(o.Fragment,{children:t});function Y0e(t){return E.isValidElement(t)&&t.type===dH}function Q0e(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{i(...l),s(...l)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function X0e(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var hH="AlertDialog",[Z0e,M5e]=Us(hH,[X8]),xl=X8(),fH=t=>{const{__scopeAlertDialog:e,...r}=t,n=xl(e);return o.jsx(xT,{...n,...r,modal:!0})};fH.displayName=hH;var J0e="AlertDialogTrigger",e_e=E.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=xl(r);return o.jsx(fU,{...s,...n,ref:e})});e_e.displayName=J0e;var t_e="AlertDialogPortal",pH=t=>{const{__scopeAlertDialog:e,...r}=t,n=xl(e);return o.jsx(_T,{...n,...r})};pH.displayName=t_e;var r_e="AlertDialogOverlay",mH=E.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=xl(r);return o.jsx(lv,{...s,...n,ref:e})});mH.displayName=r_e;var Fh="AlertDialogContent",[n_e,s_e]=Z0e(Fh),gH=E.forwardRef((t,e)=>{const{__scopeAlertDialog:r,children:n,...s}=t,i=xl(r),a=E.useRef(null),l=Ht(e,a),c=E.useRef(null);return o.jsx(Nhe,{contentName:Fh,titleName:vH,docsSlug:"alert-dialog",children:o.jsx(n_e,{scope:r,cancelRef:c,children:o.jsxs(cv,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Ge(s.onOpenAutoFocus,d=>{var f;d.preventDefault(),(f=c.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[o.jsx(dH,{children:n}),o.jsx(a_e,{contentRef:a})]})})})});gH.displayName=Fh;var vH="AlertDialogTitle",yH=E.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=xl(r);return o.jsx(uv,{...s,...n,ref:e})});yH.displayName=vH;var xH="AlertDialogDescription",_H=E.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=xl(r);return o.jsx(dv,{...s,...n,ref:e})});_H.displayName=xH;var i_e="AlertDialogAction",bH=E.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=xl(r);return o.jsx(xb,{...s,...n,ref:e})});bH.displayName=i_e;var wH="AlertDialogCancel",SH=E.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,{cancelRef:s}=s_e(wH,r),i=xl(r),a=Ht(e,s);return o.jsx(xb,{...i,...n,ref:a})});SH.displayName=wH;var a_e=({contentRef:t})=>{const e=`\`${Fh}\` requires a description for the component to be accessible for screen reader users.
|
||
|
||
You can add a description to the \`${Fh}\` by passing a \`${xH}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
||
|
||
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Fh}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
||
|
||
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return E.useEffect(()=>{var n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},o_e=fH,l_e=pH,kH=mH,EH=gH,CH=bH,NH=SH,jH=yH,TH=_H;const So=o_e,c_e=l_e,AH=E.forwardRef(({className:t,...e},r)=>o.jsx(kH,{className:we("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));AH.displayName=kH.displayName;const Oa=E.forwardRef(({className:t,...e},r)=>o.jsxs(c_e,{children:[o.jsx(AH,{}),o.jsx(EH,{ref:r,className:we("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Oa.displayName=EH.displayName;const Pa=({className:t,...e})=>o.jsx("div",{className:we("flex flex-col space-y-2 text-center sm:text-left",t),...e});Pa.displayName="AlertDialogHeader";const Ma=({className:t,...e})=>o.jsx("div",{className:we("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ma.displayName="AlertDialogFooter";const Ia=E.forwardRef(({className:t,...e},r)=>o.jsx(jH,{ref:r,className:we("text-lg font-semibold",t),...e}));Ia.displayName=jH.displayName;const La=E.forwardRef(({className:t,...e},r)=>o.jsx(TH,{ref:r,className:we("text-sm text-muted-foreground",t),...e}));La.displayName=TH.displayName;const $a=E.forwardRef(({className:t,...e},r)=>o.jsx(CH,{ref:r,className:we(lT(),t),...e}));$a.displayName=CH.displayName;const Ba=E.forwardRef(({className:t,...e},r)=>o.jsx(NH,{ref:r,className:we(lT({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Ba.displayName=NH.displayName;function Rn({title:t,description:e,backTo:r,backIcon:n=o.jsx(mo,{className:"h-4 w-4"}),actions:s,metadata:i,className:a,children:l}){const c=Yn();return o.jsx("div",{className:we("relative overflow-hidden rounded-xl border border-primary/10 bg-gradient-to-r from-background/80 via-primary/5 to-background/80 p-6",a),children:o.jsxs("div",{className:"flex flex-col md:flex-row justify-between gap-6",children:[o.jsxs("div",{className:"flex items-start gap-4",children:[r&&o.jsx(le,{variant:"outline",size:"icon",onClick:()=>c(r),className:"rounded-full border-primary/10 h-10 w-10 transition-all hover:bg-primary/5 hover:border-primary/20",children:n}),o.jsxs("div",{className:"space-y-2 w-full",children:[o.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-foreground to-foreground/70 bg-clip-text text-transparent",children:t}),e&&o.jsx("p",{className:"text-muted-foreground",children:e}),l&&o.jsx("div",{className:"pt-2",children:l}),i&&o.jsx("div",{className:"flex items-center gap-3 pt-1",children:i})]})]}),s&&o.jsx("div",{className:"flex gap-3 self-start",children:s})]})})}function u_e({icon:t,text:e,className:r}){return o.jsxs("div",{className:we("flex items-center gap-1 text-sm text-muted-foreground",r),children:[o.jsx(t,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:e})]})}function Wu({icon:t,title:e,description:r,actionLabel:n,actionIcon:s,onAction:i,className:a}){return o.jsxs($e,{className:we("rounded-xl border border-dashed border-primary/20 bg-background/60 p-12 text-center",a),children:[o.jsxs("div",{className:"relative mx-auto h-20 w-20",children:[o.jsx("div",{className:"absolute inset-0 bg-primary/5 rounded-full blur-xl animate-pulse"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx(t,{className:"h-10 w-10 text-primary/40"})})]}),o.jsx("h3",{className:"mt-6 text-xl font-medium",children:e}),o.jsx("p",{className:"mt-2 text-muted-foreground max-w-md mx-auto",children:r}),n&&i&&o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90 shadow-md hover:shadow-lg transition-shadow",onClick:i,children:[s&&o.jsx(s,{className:"mr-2 h-4 w-4"}),n]})]})}function RH({label:t,description:e,onClick:r,className:n}){return o.jsxs("div",{className:we("flex flex-col items-center justify-center h-full min-h-52 rounded-xl border border-dashed border-primary/20 bg-background/50 hover:bg-background hover:border-primary/30 transition-all cursor-pointer",n),onClick:r,children:[o.jsxs("div",{className:"relative w-16 h-16 mb-4",children:[o.jsx("div",{className:"absolute inset-0 bg-primary/5 rounded-full blur-xl"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx(nr,{className:"h-8 w-8 text-primary/60"})})]}),o.jsx("p",{className:"font-medium text-primary/70",children:t}),e&&o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:e})]})}function Gr({className:t,...e}){return o.jsx("div",{className:we("animate-pulse rounded-md bg-primary/10",t),...e})}function d_e({count:t=3}){return o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Array.from({length:t}).map((e,r)=>o.jsxs("div",{className:"border border-primary/10 rounded-xl p-6 space-y-4",children:[o.jsxs("div",{className:"flex items-center space-x-3",children:[o.jsx(Gr,{className:"h-10 w-10 rounded-lg"}),o.jsx(Gr,{className:"h-6 w-48"})]}),o.jsx(Gr,{className:"h-4 w-full"}),o.jsx(Gr,{className:"h-4 w-2/3"}),o.jsx("div",{className:"pt-4 border-t border-primary/5",children:o.jsx(Gr,{className:"h-8 w-full"})})]},r))})}const yx=43200,u3=1440,d3=Symbol.for("constructDateFrom");function kA(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&d3 in t?t[d3](e):t instanceof Date?new t.constructor(e):new Date(e)}function Oc(t,e){return kA(t,t)}let h_e={};function f_e(){return h_e}function h3(t){const e=Oc(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function EA(t,...e){const r=kA.bind(null,t||e.find(n=>typeof n=="object"));return e.map(r)}function y0(t,e){const r=+Oc(t)-+Oc(e);return r<0?-1:r>0?1:r}function p_e(t){return kA(t,Date.now())}function m_e(t,e,r){const[n,s]=EA(r==null?void 0:r.in,t,e),i=n.getFullYear()-s.getFullYear(),a=n.getMonth()-s.getMonth();return i*12+a}function g_e(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function v_e(t,e){return+Oc(t)-+Oc(e)}function y_e(t,e){const r=Oc(t);return r.setHours(23,59,59,999),r}function x_e(t,e){const r=Oc(t),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function __e(t,e){const r=Oc(t);return+y_e(r)==+x_e(r)}function b_e(t,e,r){const[n,s,i]=EA(r==null?void 0:r.in,t,t,e),a=y0(s,i),l=Math.abs(m_e(s,i));if(l<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-a*l);let c=y0(s,i)===-a;__e(n)&&l===1&&y0(n,i)===1&&(c=!1);const d=a*(l-+c);return d===0?0:d}function w_e(t,e,r){const n=v_e(t,e)/1e3;return g_e(r==null?void 0:r.roundingMethod)(n)}const S_e={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"}},k_e=(t,e,r)=>{let n;const s=S_e[t];return typeof s=="string"?n=s:e===1?n=s.one:n=s.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function vk(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const E_e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},C_e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},N_e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},j_e={date:vk({formats:E_e,defaultWidth:"full"}),time:vk({formats:C_e,defaultWidth:"full"}),dateTime:vk({formats:N_e,defaultWidth:"full"})},T_e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},A_e=(t,e,r,n)=>T_e[t];function Qp(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,l=r!=null&&r.width?String(r.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=r!=null&&r.width?String(r.width):t.defaultWidth;s=t.values[l]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const R_e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},D_e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},O_e={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"]},P_e={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},M_e={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"}},I_e={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"}},L_e=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},$_e={ordinalNumber:L_e,era:Qp({values:R_e,defaultWidth:"wide"}),quarter:Qp({values:D_e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Qp({values:O_e,defaultWidth:"wide"}),day:Qp({values:P_e,defaultWidth:"wide"}),dayPeriod:Qp({values:M_e,defaultWidth:"wide",formattingValues:I_e,defaultFormattingWidth:"wide"})};function Xp(t){return(e,r={})=>{const n=r.width,s=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],l=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?F_e(l,p=>p.test(a)):B_e(l,p=>p.test(a));let d;d=t.valueCallback?t.valueCallback(c):c,d=r.valueCallback?r.valueCallback(d):d;const f=e.slice(a.length);return{value:d,rest:f}}}function B_e(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function F_e(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function z_e(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const s=n[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=r.valueCallback?r.valueCallback(a):a;const l=e.slice(s.length);return{value:a,rest:l}}}const U_e=/^(\d+)(th|st|nd|rd)?/i,V_e=/\d+/i,H_e={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},q_e={any:[/^b/i,/^(a|c)/i]},W_e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},G_e={any:[/1/i,/2/i,/3/i,/4/i]},K_e={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},Y_e={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]},Q_e={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},X_e={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]},Z_e={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},J_e={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}},ebe={ordinalNumber:z_e({matchPattern:U_e,parsePattern:V_e,valueCallback:t=>parseInt(t,10)}),era:Xp({matchPatterns:H_e,defaultMatchWidth:"wide",parsePatterns:q_e,defaultParseWidth:"any"}),quarter:Xp({matchPatterns:W_e,defaultMatchWidth:"wide",parsePatterns:G_e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Xp({matchPatterns:K_e,defaultMatchWidth:"wide",parsePatterns:Y_e,defaultParseWidth:"any"}),day:Xp({matchPatterns:Q_e,defaultMatchWidth:"wide",parsePatterns:X_e,defaultParseWidth:"any"}),dayPeriod:Xp({matchPatterns:Z_e,defaultMatchWidth:"any",parsePatterns:J_e,defaultParseWidth:"any"})},tbe={code:"en-US",formatDistance:k_e,formatLong:j_e,formatRelative:A_e,localize:$_e,match:ebe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function rbe(t,e,r){const n=f_e(),s=(r==null?void 0:r.locale)??n.locale??tbe,i=2520,a=y0(t,e);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=EA(r==null?void 0:r.in,...a>0?[e,t]:[t,e]),f=w_e(d,c),p=(h3(d)-h3(c))/1e3,m=Math.round((f-p)/60);let g;if(m<2)return r!=null&&r.includeSeconds?f<5?s.formatDistance("lessThanXSeconds",5,l):f<10?s.formatDistance("lessThanXSeconds",10,l):f<20?s.formatDistance("lessThanXSeconds",20,l):f<40?s.formatDistance("halfAMinute",0,l):f<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):m===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",m,l);if(m<45)return s.formatDistance("xMinutes",m,l);if(m<90)return s.formatDistance("aboutXHours",1,l);if(m<u3){const y=Math.round(m/60);return s.formatDistance("aboutXHours",y,l)}else{if(m<i)return s.formatDistance("xDays",1,l);if(m<yx){const y=Math.round(m/u3);return s.formatDistance("xDays",y,l)}else if(m<yx*2)return g=Math.round(m/yx),s.formatDistance("aboutXMonths",g,l)}if(g=b_e(d,c),g<12){const y=Math.round(m/yx);return s.formatDistance("xMonths",y,l)}else{const y=g%12,x=Math.trunc(g/12);return y<3?s.formatDistance("aboutXYears",x,l):y<9?s.formatDistance("overXYears",x,l):s.formatDistance("almostXYears",x+1,l)}}function Ig(t,e){return rbe(t,p_e(t),e)}const nbe=_f("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Lt({className:t,variant:e,...r}){return o.jsx("div",{className:we(nbe({variant:e}),t),...r})}function Lg(t){const e=(t??"").trim().toLowerCase();if(!e)return null;switch(e){case"healthy":case"running":case"active":case"live":case"ready":case"synced":case"complete":case"completed":return"healthy";case"hibernated":case"sleeping":case"idle":return"hibernated";case"removed":case"deleted":return"removed";case"degraded":return"degraded";case"failed":case"error":case"backoff":case"dead":return"failed";case"deploying":case"pending":case"building":case"queued":case"processing":case"starting":case"initializing":case"recovering":case"syncing":return"deploying";default:return null}}function DH(t){const e=Lg(t.status);return e||(t.hibernated||(t.instances??1)===0?"hibernated":"healthy")}function OH(t){return t==="deploying"||t==="removed"}const fu=t=>{switch(Lg(t)){case"healthy":return"Healthy";case"deploying":return"Deploying";case"failed":return"Failed";case"degraded":return"Degraded";case"hibernated":return"Hibernated";case"removed":return"Removed";default:return"Unknown"}},sbe=(t,e)=>{if(!e)return"";const r=e.replace(/reconciled/gi,"deployed").replace(/reconciling/gi,"deploying").replace(/reconciliation/gi,"deployment");if(Lg(t)==="failed"){if(e.toLowerCase().includes("image")&&e.toLowerCase().includes("backoff"))return"Failed to pull image, does it exist?";if(e.toLowerCase().includes("build")&&e.toLowerCase().includes("job"))return"Failed to build from source, check logs for details"}return r};function CA({status:t,message:e,instances:r,className:n="",showIcon:s=!0}){const i=r===0?"hibernated":Lg(t)??t,a=e?sbe(i,e):void 0,[l,c]=E.useState(!1),d=E.useRef(null),f=E.useRef(null);E.useEffect(()=>{if(l&&d.current&&f.current){const y=()=>{var _;const x=(_=d.current)==null?void 0:_.getBoundingClientRect();if(!x||!f.current)return;f.current.style.position="fixed",f.current.style.left=`${x.left+x.width/2}px`,f.current.style.top=`${x.bottom+8}px`,f.current.style.transform="translateX(-50%)";const w=f.current.getBoundingClientRect();w.right>window.innerWidth&&(f.current.style.left=`${window.innerWidth-w.width-10}px`,f.current.style.transform="none"),w.left<0&&(f.current.style.left="10px",f.current.style.transform="none"),w.bottom>window.innerHeight&&(f.current.style.top=`${x.top-w.height-8}px`)};return y(),window.addEventListener("resize",y),window.addEventListener("scroll",y),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y)}}},[l]),E.useEffect(()=>{const y=x=>{l&&d.current&&!d.current.contains(x.target)&&f.current&&!f.current.contains(x.target)&&c(!1)};return document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[l]);const m=(y=>{switch(Lg(y)){case"healthy":return{icon:is,bgClass:"bg-green-100 dark:bg-green-900/30",className:"text-green-700 dark:text-green-400",label:fu(y)};case"deploying":return{icon:wn,bgClass:"bg-yellow-100 dark:bg-yellow-900/30",className:"text-yellow-700 dark:text-yellow-400",label:fu(y),animate:!0};case"failed":return{icon:os,bgClass:"bg-red-100 dark:bg-red-900/30",className:"text-red-700 dark:text-red-400",label:fu(y)};case"degraded":return{icon:Ej,bgClass:"bg-orange-100 dark:bg-orange-900/30",className:"text-orange-700 dark:text-orange-400",label:fu(y)};case"hibernated":return{icon:cl,bgClass:"bg-blue-100 dark:bg-blue-900/30",className:"text-blue-700 dark:text-blue-400",label:fu(y)};case"removed":return{icon:ds,bgClass:"bg-gray-100 dark:bg-gray-900/30",className:"text-gray-500 dark:text-gray-400",label:fu(y)};default:return{icon:GB,bgClass:"bg-gray-100 dark:bg-gray-900/30",className:"text-gray-700 dark:text-gray-400",label:fu(y)}}})(i),g=m.icon;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"inline-block",ref:d,children:o.jsxs(Lt,{variant:"outline",className:we("font-medium text-xs flex items-center gap-1.5 px-2.5 py-1 rounded-full border-0 cursor-pointer",m.bgClass,m.className,n),onMouseEnter:()=>a&&c(!0),onMouseLeave:()=>c(!1),onClick:()=>a&&c(!l),children:[s&&o.jsx(g,{className:we("h-3.5 w-3.5",m.animate&&"animate-spin")}),o.jsxs("span",{className:"flex items-center",children:[m.label,a&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"mx-1",children:"•"}),o.jsx("span",{className:"truncate max-w-40",children:a})]})]})]})}),l&&a&&o.jsx("div",{ref:f,className:"fixed z-50 bg-transparent backdrop-blur-xl text-gray-900 dark:text-white py-2 px-3 rounded-md shadow-lg border max-w-xs w-max",children:a})]})}function _v({resource:t,name:e,icon:r,onClick:n,onDelete:s,additionalContent:i,className:a}){const{mutationLoading:l}=Nr(),[c,d]=E.useState(!1);return o.jsxs("div",{className:we("group relative flex flex-col overflow-hidden rounded-2xl border border-border/80 bg-card shadow-sm transition-all duration-200","hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-lg hover:shadow-primary/5",n&&"cursor-pointer",a),onClick:n,children:[o.jsx("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-primary/40 to-transparent opacity-0 transition-opacity duration-300 group-hover:opacity-100"}),o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[r&&o.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-border/60 bg-gradient-to-br from-primary/10 to-primary/5 text-primary shadow-inner transition-transform duration-200 group-hover:scale-105",children:o.jsx(r,{className:"h-5 w-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"truncate text-base font-semibold tracking-tight",children:e}),t.created_at&&o.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:[o.jsx(bj,{className:"h-3 w-3"}),o.jsxs("span",{children:["Created ",Ig(new Date(t.created_at),{addSuffix:!0})]})]})]})]}),o.jsx(CA,{status:t.status,instances:t.values.instances})]}),o.jsxs("div",{className:"relative mt-4",children:[i,s&&n&&o.jsx("div",{className:"absolute -right-1 -top-1 opacity-0 transition-opacity duration-200 group-hover:opacity-100",onClick:f=>{f.stopPropagation(),d(!0)},children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-lg text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:o.jsx($0,{className:"h-4 w-4"})})}),s&&!n&&o.jsx("div",{className:"absolute -bottom-2 right-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:f=>{f.stopPropagation(),d(!0)},children:o.jsx(le,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive",children:o.jsx($0,{className:"h-4 w-4"})})})]})]}),s&&o.jsx(So,{open:c,onOpenChange:d,children:o.jsxs(Oa,{className:"border border-destructive/20 shadow-lg",children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete Resource"}),o.jsxs(La,{children:['Are you sure you want to delete "',e,'"? This action cannot be undone.']})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{className:"border-primary/20",children:"Cancel"}),o.jsx($a,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{s(),d(!1)},disabled:l,children:l?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}function bv({resourceType:t,title:e,description:r,emptyTitle:n,emptyDescription:s,instances:i,addLabel:a,addDescription:l,icon:c,basePath:d,name:f,resourceId:p,filter:m,renderCard:g,renderDetail:y,createDialogContent:x,additionalActions:w,canCreate:_=!0,canDelete:S=()=>!0,deleteMessage:k=()=>"Are you sure you want to delete this resource? This action cannot be undone.",onDelete:N}){const j=Yn(),{toast:T}=br(),{resources:D,loading:I,mutationLoading:L,deleteResource:$,getResourceById:Q}=Nr(),[M,z]=E.useState(""),[R,B]=E.useState("grid"),[V,F]=E.useState(!1),[K,Y]=E.useState(!1),O=!!p,H=O?Q(p):void 0,G=O?()=>o.jsx(CA,{instances:i,status:H.status,message:H.message??""}):void 0,q=O?[]:D.filter(te=>{var ve,he,xe;if(m&&!m(te))return!1;if(M.trim()){const ke=M.trim().toLowerCase();if(!`${((ve=te.values)==null?void 0:ve.name)??""} ${((he=te.values)==null?void 0:he.account_name)??""} ${((xe=te.values)==null?void 0:xe.account_id)??""} ${te.message??""} ${te.chart_name??""}`.toLowerCase().includes(ke))return!1}return!0}),J=async te=>{if(O&&H&&!S(H))return T({title:"Cannot delete resource",description:"Please check dependencies first.",variant:"destructive"}),Y(!1),!1;try{return(N?await N(te):await $(te))?(O&&j(d),!0):(T({title:"Failed to delete resource",description:"Something went wrong",variant:"destructive"}),!1)}catch(ve){return T({title:"Error deleting resource",description:ve instanceof Error?ve.message:"An unknown error occurred",variant:"destructive"}),!1}};return I?o.jsx(d_e,{count:O?1:3}):O&&!H?o.jsx(Wu,{icon:$r,title:`${t} not found`,description:`The ${t.toLowerCase()} you're looking for doesn't exist or has been deleted`,actionLabel:`Back to ${t}s`,actionIcon:mo,onAction:()=>j(d)}):O&&H?o.jsxs("div",{className:"space-y-8",children:[o.jsx(Rn,{title:f??"",backTo:d,backIcon:o.jsx(mo,{className:"h-4 w-4"}),children:G&&G(),metadata:o.jsx(u_e,{icon:bj,text:`Created ${Ig(new Date(H.created_at),{addSuffix:!0})}`}),actions:o.jsxs(o.Fragment,{children:[w,S(H)&&o.jsxs(le,{variant:"outline",className:"bg-background border border-destructive/30 text-destructive hover:bg-destructive/10 hover:text-destructive-foreground hover:border-destructive transition-colors",onClick:()=>Y(!0),children:[o.jsx($0,{className:"mr-2 h-4 w-4"}),"Delete ",t]})]})}),y?y(H):o.jsxs("div",{className:"rounded-xl border border-primary/20 bg-card p-6 shadow-sm",children:[o.jsx("h3",{className:"text-lg font-medium mb-4",children:"Details"}),o.jsx("pre",{className:"bg-muted p-4 rounded-md overflow-auto",children:JSON.stringify(H.values,null,2)})]}),o.jsx(So,{open:K,onOpenChange:Y,children:o.jsxs(Oa,{className:"border border-destructive/20 shadow-lg",children:[o.jsxs(Pa,{children:[o.jsxs(Ia,{children:["Delete ",t]}),o.jsx(La,{children:k(H)})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{className:"border-primary/20",children:"Cancel"}),S(H)&&o.jsx($a,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>J(H.id),disabled:L,children:L?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):`Delete ${t}`})]})]})})]}):o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:e,description:r,actions:_?o.jsxs(le,{className:"bg-gradient-to-r from-primary to-primary/90 shadow-md hover:shadow-lg transition-shadow",onClick:()=>F(!0),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),`New ${t}`]}):void 0}),q.length>0&&o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"relative w-full sm:max-w-xs",children:[o.jsx(sv,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx("input",{value:M,onChange:te=>z(te.target.value),placeholder:`Search ${t.toLowerCase()}s…`,className:"h-9 w-full rounded-lg border border-border/60 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground transition-colors focus:border-primary/40 focus:outline-none focus:ring-2 focus:ring-primary/15"})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("span",{className:"hidden text-sm text-muted-foreground sm:inline",children:[q.length," ",q.length===1?t.toLowerCase():`${t.toLowerCase()}s`]}),o.jsxs("div",{className:"flex rounded-lg border border-border/60 bg-background p-0.5",children:[o.jsx("button",{onClick:()=>B("grid"),title:"Grid view",className:we("flex h-7 w-7 items-center justify-center rounded-md transition-colors",R==="grid"?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground"),children:o.jsx(YB,{className:"h-4 w-4"})}),o.jsx("button",{onClick:()=>B("list"),title:"List view",className:we("flex h-7 w-7 items-center justify-center rounded-md transition-colors",R==="list"?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground"),children:o.jsx(kj,{className:"h-4 w-4"})})]})]})]}),q.length===0?o.jsx(Wu,{icon:c||$r,title:n,description:M?`No ${t.toLowerCase()}s match “${M}”. Try a different search.`:s,actionLabel:!M&&_?`Create Your First ${t}`:void 0,actionIcon:_?nr:void 0,onAction:_?()=>F(!0):void 0}):o.jsxs("div",{className:we(R==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5":"space-y-3"),children:[q.map(te=>{var ve;return g?o.jsx("div",{children:g(te,()=>J(te.id))},te.id):o.jsx(_v,{resource:te,name:f||String(((ve=te.values)==null?void 0:ve.name)??te.id),icon:c,onClick:()=>j(`${d}/${te.id}`),onDelete:()=>J(te.id)},te.id)}),_&&R==="grid"&&o.jsx(RH,{label:a,description:l,onClick:()=>F(!0)})]}),o.jsx(hs,{open:V,onOpenChange:F,children:x?x(()=>F(!1)):o.jsx(un,{children:"Simple create form placeholder"})})]})}function ibe({onClose:t}){const{toast:e}=br(),{createProject:r,mutationLoading:n}=Nr(),[s,i]=E.useState(""),a=j8(),l=async()=>{if(!s.trim()||!a){e({title:"Invalid input",description:s.trim()?"User ID missing, please sign in again":"Please enter a valid project name",variant:"destructive"});return}try{await r({values:{userId:a,name:s}}),t()}catch(c){e({title:"Failed to create project",description:c instanceof Error?c.message:"An unknown error occurred",variant:"destructive"})}};return o.jsxs(un,{className:"border border-primary/20 shadow-lg sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Create New Project"}),o.jsx(fs,{children:"Add a new project to organize your cloud applications"})]}),o.jsx("div",{className:"grid gap-4 py-4",children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Xe,{htmlFor:"project-name",children:"Project Name"}),o.jsx(tt,{id:"project-name",placeholder:"My New Project",value:s,onChange:c=>i(c.target.value),className:"border-primary/20 focus-visible:ring-primary/30"})]})}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:t,className:"border-primary/20",children:"Cancel"}),o.jsx(le,{onClick:l,disabled:n,className:"bg-gradient-to-r from-primary to-primary/90",children:n?"Creating...":"Create Project"})]})]})}function abe(){const{resources:t}=Nr(),e=Yn(),r=(n,s)=>{const i=t.filter(a=>T8(a)&&a.values&&a.values.projectId===n.id);return o.jsx(_v,{resource:n,name:n.values.name,icon:$r,onClick:()=>e(`/dashboard/projects/${n.id}`),onDelete:s,additionalContent:o.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx($r,{className:"h-4 w-4 text-primary"}),o.jsxs("span",{className:"text-sm",children:[i.length," ",i.length===1?"application":"applications"]})]})})},n.id)};return o.jsx(bv,{resourceType:"Project",title:"Your Projects",description:"Deploy and manage your cloud applications in one place.",emptyTitle:"No projects found",emptyDescription:"Create your first project to start deploying cloud applications.",addLabel:"Create New Project",addDescription:"Start deploying your applications",icon:$r,basePath:"/dashboard/projects",filter:n=>n.chart_name===ks.PROJECT,renderCard:r,createDialogContent:n=>o.jsx(ibe,{onClose:n})})}const obe={hidden:{opacity:0,y:20},visible:t=>({opacity:1,y:0,transition:{delay:t*.05,duration:.3}})};function lbe({children:t,className:e}){return o.jsx(ws.div,{className:we("grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",e),initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},children:Ss.Children.map(t,(r,n)=>o.jsx(ws.div,{custom:n,initial:"hidden",animate:"visible",variants:obe,children:r},n))})}const xx="deploy_form_data",yk={selectedIntegration:null,isManualMode:!1,deploymentType:"ssh",selectedRepository:null,appName:"",containerImage:"",sourceUrl:"",sourceRef:"main",sourceSecretName:"",containerPullSecretName:"",port:"80",exposePort:!0,useCustomDomain:!1,customDomain:"",envVars:[{key:"",value:"",id:Date.now()}],storageVolumes:[],containerTag:"",resourceTier:"t1"},PH=E.createContext(void 0);function MH({children:t,mode:e="create",existingApp:r}){const{getAppById:n,volumes:s}=Nr(),[i,a]=E.useState(0),[l,c]=E.useState(()=>{if(typeof window<"u"){const N=localStorage.getItem(xx);if(N)try{return JSON.parse(N)}catch(j){console.error("Error parsing saved form data:",j)}}return yk}),[d,f]=E.useState({}),[p,m]=E.useState(!1),g=e==="update",y=E.useCallback(()=>{c(yk),a(0),f({}),m(!1),typeof window<"u"&&localStorage.removeItem(xx)},[]),x=y;E.useEffect(()=>{var N,j;if(g&&r)try{const T=r.id?n(r.id):r,D=T==null?void 0:T.values;if(!D)return;const I={...yk};if(I.appName=D.name||"",D.source&&D.source.enabled)I.deploymentType="ssh",I.sourceUrl=D.source.url||"",I.sourceRef=D.source.ref||"main",I.sourceSecretName=D.source.secretName||"",I.isManualMode=!0;else if((N=D.container)!=null&&N.image){I.deploymentType="docker",I.containerImage=D.container.image||"",I.containerPullSecretName=D.container.pullSecretName||"",I.isManualMode=!0;const L=D.container.image.split(":");L.length>1&&(I.containerTag=L[1])}D.env&&Object.keys(D.env).length>0&&(I.envVars=Object.entries(D.env).map(([L,$],Q)=>({key:L,value:String($),id:Date.now()+Q}))),D.ports&&D.ports.length>0&&(I.port=String(D.ports[0].number),I.exposePort=D.ports[0].expose),D.publicAccess&&(I.exposePort=D.publicAccess.enabled,D.publicAccess.domain&&D.publicAccess.domain!=="auto"&&(I.useCustomDomain=!0,I.customDomain=D.publicAccess.domain)),D.resourceTier&&(I.resourceTier=D.resourceTier),(j=D.storage)!=null&&j.volumes&&D.storage.volumes.length>0&&(I.storageVolumes=D.storage.volumes.map((L,$)=>({volumeResourceId:L.name,mountPath:L.mountPath,id:Date.now()+$}))),c(I),localStorage.setItem(xx,JSON.stringify(I)),a(2)}catch(T){console.error("Error parsing app values:",T)}},[r,g,n]),E.useEffect(()=>{if(g&&r&&l.storageVolumes.length>0&&s.length>0){const N=[...l.storageVolumes];let j=!1;for(let T=0;T<N.length;T++){const D=N[T];if(D.volumeResourceId&&!s.find(I=>I.id===D.volumeResourceId)){const I=s.find(L=>L.uniqueName===D.volumeResourceId);I&&(N[T]={...D,volumeResourceId:I.id},j=!0)}}j&&c(T=>({...T,storageVolumes:N}))}},[g,r,l.storageVolumes,s]);const w=N=>{a(N)},_=()=>{a(N=>N+1)},S=()=>{a(N=>Math.max(0,N-1))},k=N=>{const j={...l,...N};c(j),typeof window<"u"&&localStorage.setItem(xx,JSON.stringify(j))};return o.jsx(PH.Provider,{value:{currentStep:i,goToStep:w,goToNextStep:_,goToPrevStep:S,formData:l,updateFormData:k,clearFormData:x,resetForm:y,formErrors:d,setFormErrors:f,isLoading:p,setIsLoading:m,mode:e,isUpdateMode:g},children:t})}function IH(){const t=E.useContext(PH);if(t===void 0)throw new Error("useDeployForm must be used within a DeployFormProvider");return t}const Wa="https://integrations.ghaymah.systems/api",Gl={OAUTH:{GITLAB_LOGIN:`${Wa}/oauth/gitlab/login`,GITLAB_CALLBACK:`${Wa}/oauth/public/gitlab/callback`},AUTH:{DOCKERHUB:`${Wa}/auth/dockerhub`},INTEGRATIONS:{BASE:`${Wa}/integrations`,DELETE:t=>`${Wa}/integrations/${t}`},REPOSITORIES:{LIST:t=>`${Wa}/integrations/${t}/repositories`,VALIDATE:t=>`${Wa}/integrations/${t}/validate-repository`,BRANCHES:(t,e)=>`${Wa}/integrations/${t}/repositories/${encodeURIComponent(e)}/branches`,REFS:(t,e,r)=>`${Wa}/integrations/${t}/repositories/${encodeURIComponent(e)}/branches/${encodeURIComponent(r)}/refs`,TAGS:(t,e)=>`${Wa}/integrations/${t}/repositories/${encodeURIComponent(e)}/tags`}};function NA(){const t=bo(),e=async(f,p={})=>{if(!t)throw new Error("No access token available");const m={...p.headers,Authorization:`Bearer ${t}`,"Content-Type":"application/json","ngrok-skip-browser-warning":"true",Origin:window.location.origin,"X-Requested-With":"XMLHttpRequest"},g=await fetch(f,{...p,headers:m});if(!g.ok){const y=await g.text();throw new Error(`API error (${g.status}): ${y}`)}return g.status===204?null:g.json()};return{initiateGitLabOAuth:()=>{jt("Integrations","Initiating GitLab OAuth flow"),window.location.href=Gl.OAUTH.GITLAB_LOGIN+`?token=${t}`},authenticateDockerHub:async f=>{jt("Integrations","Authenticating with Docker Hub");try{const p=await e(Gl.AUTH.DOCKERHUB,{method:"POST",body:JSON.stringify(f)});return jt("Integrations","Docker Hub authentication successful",p),p}catch(p){throw jt("Integrations","Docker Hub authentication failed",p),p}},deleteIntegration:async f=>{jt("Integrations",`Deleting integration: ${f}`);try{return await e(Gl.INTEGRATIONS.DELETE(f),{method:"DELETE"}),jt("Integrations",`Integration deleted: ${f}`),!0}catch(p){throw jt("Integrations",`Error deleting integration: ${f}`,p),p}},listRepositories:async f=>{jt("Integrations",`Listing repositories for integration: ${f}`);try{const p=await e(Gl.REPOSITORIES.LIST(f));return jt("Integrations",`Retrieved ${p.length} repositories`,p),p}catch(p){throw jt("Integrations",`Error listing repositories: ${f}`,p),p}},validateRepository:async(f,p)=>{jt("Integrations",`Validating repository: ${p}`);try{const m=await e(Gl.REPOSITORIES.VALIDATE(f),{method:"POST",body:JSON.stringify({repo_name:p})});return jt("Integrations","Repository validation result",m),m}catch(m){throw jt("Integrations",`Error validating repository: ${p}`,m),m}},listBranches:async(f,p)=>{jt("Integrations",`Listing branches for repository: ${p}`);try{const m=await e(Gl.REPOSITORIES.BRANCHES(f,p));return jt("Integrations",`Retrieved ${m.length} branches`,m),m}catch(m){throw jt("Integrations",`Error listing branches: ${p}`,m),m}},listRefs:async(f,p,m)=>{jt("Integrations",`Listing refs for branch: ${m} in repository: ${p}`);try{const g=await e(Gl.REPOSITORIES.REFS(f,p,m));return jt("Integrations",`Retrieved ${g.length} refs`,g),g}catch(g){throw jt("Integrations",`Error listing refs: ${p}/${m}`,g),g}},getRepositoryTags:async(f,p)=>{jt("Integrations",`Getting tags for repository: ${p}`);try{const m=await e(Gl.REPOSITORIES.TAGS(f,p));return jt("Integrations",`Retrieved ${m.length} tags`,m),m}catch(m){throw jt("Integrations",`Error getting tags: ${p}`,m),m}}}}function wv(){var d;const t=bo(),[e,r]=E.useState(null),[n,s]=E.useState(null),[i,a]=E.useState(!0),l=E.useCallback(async()=>{if(!t){a(!1);return}try{const[f,p]=await Promise.all([$V(t),BV(t)]);r(f),s(p)}catch{}finally{a(!1)}},[t]);E.useEffect(()=>{l()},[l]);const c=((d=e==null?void 0:e.account)==null?void 0:d.payment_method)!=null&&e.account.payment_method!=="";return{loading:i,hasCard:c,status:e,usage:n,freeOnly:!c}}const cbe={github:{label:"GitHub",icon:Zx,iconClass:"text-slate-900 dark:text-white"},gitlab:{label:"GitLab",icon:K_,iconClass:"text-orange-500"},dockerhub:{label:"Docker Hub",icon:nv,iconClass:"text-sky-500"}};function ube({integrations:t,onIntegrationSelect:e,onManualModeSelect:r}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold",children:"Import from a Git provider"}),o.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Connect a repository to deploy straight from source."})]}),o.jsx("div",{className:"grid max-h-[320px] gap-2 overflow-y-auto pr-1",children:t.map(n=>{const s=n.values.provider,i=cbe[s]??{label:s.charAt(0).toUpperCase()+s.slice(1),icon:nv,iconClass:"text-blue-400"},a=i.icon;return o.jsxs("button",{type:"button",onClick:()=>e(n),className:"group flex items-center gap-3 rounded-xl border border-border/80 bg-card px-4 py-3.5 text-left shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md",children:[o.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-muted/40",children:o.jsx(a,{className:we("h-5 w-5",i.iconClass)})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-semibold",children:i.label}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:n.values.account_name||n.values.account_id||"Connected account"})]}),o.jsx(_s,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary"})]},n.id)})}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"h-px flex-1 bg-border"}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"or deploy manually"}),o.jsx("div",{className:"h-px flex-1 bg-border"})]}),o.jsxs("button",{type:"button",onClick:r,className:"group flex w-full items-center gap-3 rounded-xl border border-dashed border-border bg-background/50 px-4 py-3.5 text-left transition-all duration-200 hover:border-primary/30 hover:bg-primary/5",children:[o.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-muted/40",children:o.jsx(qh,{className:"h-5 w-5 text-purple-500"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Manual deployment"}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:"Enter a repository URL or container image by hand"})]}),o.jsx(_s,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary"})]})]})}function dbe({repositories:t,searchQuery:e,onSearchChange:r,onRepositorySelect:n,isLoading:s}){const i=e?t.filter(a=>a.name.toLowerCase().includes(e.toLowerCase())||a.description&&a.description.toLowerCase().includes(e.toLowerCase())):t;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold",children:"Choose a repository"}),o.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"We'll configure your app from this source."})]}),o.jsxs("div",{className:"relative",children:[o.jsx(sv,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{placeholder:"Search repositories…",value:e,onChange:a=>r(a.target.value),className:"h-10 pl-10"})]}),o.jsx("div",{className:"grid max-h-[320px] gap-1.5 overflow-y-auto pr-1",children:s?o.jsxs("div",{className:"rounded-xl border border-dashed border-border p-10 text-center",children:[o.jsx(wn,{className:"mx-auto h-7 w-7 animate-spin text-muted-foreground"}),o.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Loading repositories…"})]}):i.length>0?i.map((a,l)=>o.jsxs("button",{type:"button",onClick:()=>n(a),className:"group flex items-center gap-3 rounded-xl border border-border/80 bg-card px-4 py-3 text-left shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md",children:[o.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-muted/40",children:o.jsx(L0,{className:"h-4 w-4 text-primary/70"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-semibold",children:a.full_name||a.name}),a.description&&o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.description})]}),o.jsx(_s,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary"})]},a.id||`${a.name}-${l}`)):o.jsxs("div",{className:"rounded-xl border border-dashed border-border p-10 text-center",children:[o.jsx(L0,{className:"mx-auto h-7 w-7 text-muted-foreground"}),o.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"No repositories found"})]})})]})}var jA="Tabs",[hbe,I5e]=Us(jA,[Eb]),LH=Eb(),[fbe,TA]=hbe(jA),$H=E.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...d}=t,f=_b(l),[p,m]=po({prop:n,onChange:s,defaultProp:i});return o.jsx(fbe,{scope:r,baseId:ya(),value:p,onValueChange:m,orientation:a,dir:f,activationMode:c,children:o.jsx(pt.div,{dir:f,"data-orientation":a,...d,ref:e})})});$H.displayName=jA;var BH="TabsList",FH=E.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...s}=t,i=TA(BH,r),a=LH(r);return o.jsx(zU,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:n,children:o.jsx(pt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});FH.displayName=BH;var zH="TabsTrigger",UH=E.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...i}=t,a=TA(zH,r),l=LH(r),c=qH(a.baseId,n),d=WH(a.baseId,n),f=n===a.value;return o.jsx(UU,{asChild:!0,...l,focusable:!s,active:f,children:o.jsx(pt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:Ge(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?a.onValueChange(n):p.preventDefault()}),onKeyDown:Ge(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&a.onValueChange(n)}),onFocus:Ge(t.onFocus,()=>{const p=a.activationMode!=="manual";!f&&!s&&p&&a.onValueChange(n)})})})});UH.displayName=zH;var VH="TabsContent",HH=E.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:s,children:i,...a}=t,l=TA(VH,r),c=qH(l.baseId,n),d=WH(l.baseId,n),f=n===l.value,p=E.useRef(f);return E.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),o.jsx(_i,{present:s||f,children:({present:m})=>o.jsx(pt.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:m&&i})})});HH.displayName=VH;function qH(t,e){return`${t}-trigger-${e}`}function WH(t,e){return`${t}-content-${e}`}var pbe=$H,GH=FH,KH=UH,YH=HH;const QH=pbe,AA=E.forwardRef(({className:t,...e},r)=>o.jsx(GH,{ref:r,className:we("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));AA.displayName=GH.displayName;const Bu=E.forwardRef(({className:t,...e},r)=>o.jsx(KH,{ref:r,className:we("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 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",t),...e}));Bu.displayName=KH.displayName;const Fu=E.forwardRef(({className:t,...e},r)=>o.jsx(YH,{ref:r,className:we("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Fu.displayName=YH.displayName;function mbe({envVars:t,onEnvVarAdd:e,onEnvVarRemove:r,onEnvVarUpdate:n,formErrors:s}){return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("h4",{className:"text-sm font-medium flex items-center gap-1",children:[o.jsx(gg,{className:"h-4 w-4"}),"Environment Variables"]}),t.map(i=>o.jsxs("div",{className:"flex gap-3 items-start",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx(Xe,{htmlFor:`env-key-${i.id}`,className:"text-xs",children:"Key"}),s.envVars&&s.envVars[i.id]&&s.envVars[i.id].key&&o.jsxs("span",{className:"text-xs text-red-500 flex items-center gap-1",children:[o.jsx(os,{className:"h-3 w-3"}),s.envVars[i.id].key]})]}),o.jsx(tt,{id:`env-key-${i.id}`,placeholder:"MY_VARIABLE",value:i.key,onChange:a=>n(i.id,"key",a.target.value),className:s.envVars&&s.envVars[i.id]&&s.envVars[i.id].key?"border-red-500":""})]}),o.jsxs("div",{className:"flex-1",children:[o.jsx(Xe,{htmlFor:`env-value-${i.id}`,className:"text-xs mb-1 block",children:"Value"}),o.jsx(tt,{id:`env-value-${i.id}`,placeholder:"value",value:i.value,onChange:a=>n(i.id,"value",a.target.value)})]}),o.jsx(le,{type:"button",variant:"ghost",size:"icon",onClick:()=>r(i.id),disabled:t.length===1,className:"self-end mb-0.5",children:o.jsx($0,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})]},i.id)),o.jsxs(le,{type:"button",variant:"outline",size:"sm",onClick:e,className:"mt-2 border-dashed",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"Add Environment Variable"]})]})}var RA="Switch",[gbe,L5e]=Us(RA),[vbe,ybe]=gbe(RA),XH=E.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:a,disabled:l,value:c="on",onCheckedChange:d,form:f,...p}=t,[m,g]=E.useState(null),y=Ht(e,k=>g(k)),x=E.useRef(!1),w=m?f||!!m.closest("form"):!0,[_=!1,S]=po({prop:s,defaultProp:i,onChange:d});return o.jsxs(vbe,{scope:r,checked:_,disabled:l,children:[o.jsx(pt.button,{type:"button",role:"switch","aria-checked":_,"aria-required":a,"data-state":eq(_),"data-disabled":l?"":void 0,disabled:l,value:c,...p,ref:y,onClick:Ge(t.onClick,k=>{S(N=>!N),w&&(x.current=k.isPropagationStopped(),x.current||k.stopPropagation())})}),w&&o.jsx(xbe,{control:m,bubbles:!x.current,name:n,value:c,checked:_,required:a,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});XH.displayName=RA;var ZH="SwitchThumb",JH=E.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,s=ybe(ZH,r);return o.jsx(pt.span,{"data-state":eq(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:e})});JH.displayName=ZH;var xbe=t=>{const{control:e,checked:r,bubbles:n=!0,...s}=t,i=E.useRef(null),a=bA(r),l=jT(e);return E.useEffect(()=>{const c=i.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==r&&p){const m=new Event("click",{bubbles:n});p.call(c,r),c.dispatchEvent(m)}},[a,r,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:i,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function eq(t){return t?"checked":"unchecked"}var tq=XH,_be=JH;const Pc=E.forwardRef(({className:t,...e},r)=>o.jsx(tq,{className:we("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:r,children:o.jsx(_be,{className:we("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Pc.displayName=tq.displayName;function bbe({exposePort:t,onExposePortChange:e,useCustomDomain:r,onUseCustomDomainChange:n,customDomain:s,onCustomDomainChange:i,formErrors:a}){const l=c=>{const d=c.replace(/^(https?:\/\/)?(www\.)?/,"");i(d)};return o.jsx($e,{className:"shadow-sm",children:o.jsxs(Be,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(Xe,{htmlFor:"public-access",className:"font-medium",children:"Public Access"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Make your application accessible from the internet"})]}),o.jsx(Pc,{id:"public-access",checked:t,onCheckedChange:e})]}),t&&o.jsxs("div",{className:"mt-4 pt-4 border-t",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{children:[o.jsx(Xe,{htmlFor:"custom-domain-toggle",className:"font-medium",children:"Use Custom Domain"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"By default, a domain will be auto-generated"})]}),o.jsx(Pc,{id:"custom-domain-toggle",checked:r,onCheckedChange:n})]}),r&&o.jsxs("div",{className:"mt-3",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs(Xe,{htmlFor:"custom-domain",children:["Custom Domain ",o.jsx("span",{className:"text-red-500",children:"*"})]}),a.domain&&o.jsxs("span",{className:"text-xs text-red-500 flex items-center gap-1",children:[o.jsx(os,{className:"h-3 w-3"}),a.domain]})]}),o.jsx(tt,{id:"custom-domain",placeholder:"app.example.com",value:s,onChange:c=>l(c.target.value),className:a.domain?"border-red-500":""}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Enter domain without http:// or https://"})]})]})]})})}function DA(){const{apps:t,volumes:e}=Nr(),[r,n]=E.useState({}),[s,i]=E.useState(!0);E.useEffect(()=>{(()=>{var p;i(!0);const f={};e.forEach(m=>{f[m.id]={isInUse:!1,appNames:[]}});for(const m of t)if((p=m.values.storage)!=null&&p.volumes)for(const g of m.values.storage.volumes){const y=e.find(x=>x.uniqueName===g.name);if(y){const x=y.id;f[x].isInUse||(f[x].isInUse=!0),f[x].appNames.push(m.values.name)}}console.log("useVolumeUsage - volumeUsageMap:",f),n(f),i(!1)})()},[t,e]);const a=d=>{var f;return((f=r[d])==null?void 0:f.isInUse)||!1};return{volumeUsageMap:r,loading:s,isVolumeInUse:a,getAppsUsingVolume:d=>{var f;return((f=r[d])==null?void 0:f.appNames)||[]},getAvailableVolumes:()=>e.filter(d=>!a(d.id))}}function wbe({exposePort:t,onExposePortChange:e,useCustomDomain:r,onUseCustomDomainChange:n,customDomain:s,onCustomDomainChange:i,envVars:a,onEnvVarAdd:l,onEnvVarRemove:c,onEnvVarUpdate:d,storageVolumes:f,onStorageVolumeAdd:p,onStorageVolumeRemove:m,onStorageVolumeUpdate:g,formErrors:y,isExpanded:x,onExpandToggle:w,deploymentType:_,sourceRef:S,onSourceRefChange:k,containerTag:N,onContainerTagChange:j}){const{getAvailableVolumes:T}=DA(),D=T();console.log("AdvancedOptionsSection - availableVolumes:",D.length);const{volumes:I}=Nr();return o.jsxs("div",{className:"mt-6",children:[o.jsxs("div",{className:"flex items-center justify-between cursor-pointer py-2 mb-2 border-t pt-4",onClick:w,children:[o.jsx("h4",{className:"font-light flex items-center gap-2",children:o.jsx("span",{children:"Advanced Options"})}),o.jsx("div",{children:x?o.jsx(wj,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(G_,{className:"h-4 w-4 text-muted-foreground"})})]}),x&&o.jsxs("div",{className:"space-y-5 animate-in fade-in-50 duration-100",children:[_==="git"&&o.jsxs("div",{children:[o.jsx(Xe,{htmlFor:"source-ref-advanced",className:"mb-1 block",children:"Branch/Tag"}),o.jsx(tt,{id:"source-ref-advanced",placeholder:"main",value:S,onChange:L=>k(L.target.value)}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Git branch or tag to deploy"})]}),_==="image"&&o.jsxs("div",{children:[o.jsx(Xe,{htmlFor:"container-tag",className:"mb-1 block",children:"Container Tag"}),o.jsx(tt,{id:"container-tag",placeholder:"latest",value:N,onChange:L=>j(L.target.value)}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Tag for the container image (e.g., "latest", "v1.0")'})]}),o.jsx(bbe,{exposePort:t,onExposePortChange:e,useCustomDomain:r,onUseCustomDomainChange:n,customDomain:s,onCustomDomainChange:i,formErrors:y}),o.jsx(mbe,{envVars:a,onEnvVarAdd:l,onEnvVarRemove:c,onEnvVarUpdate:d,formErrors:y}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Xe,{className:"mb-1 block",children:"Storage Volumes"}),o.jsxs(le,{type:"button",variant:"outline",size:"sm",onClick:p,className:"h-8 px-2",children:[o.jsx(nr,{className:"h-4 w-4 mr-1"}),"Add Volume"]})]}),f.map((L,$)=>{const Q=L.mountPath&&f.some((B,V)=>V!==$&&B.mountPath===L.mountPath&&B.mountPath!==""),M=!L.mountPath||L.mountPath.startsWith("/")&&L.mountPath.length>1,z=L.volumeResourceId?I.find(B=>B.id===L.volumeResourceId):null,R=z?z.values.name:"";return o.jsxs("div",{className:"flex gap-2 items-end",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx(Xe,{htmlFor:`volume-name-${L.id}`,className:"text-xs",children:"Volume Name"}),o.jsxs(ja,{value:L.volumeResourceId||"none",onValueChange:B=>{B==="none"?g(L.id,"volumeResourceId",void 0):g(L.id,"volumeResourceId",B)},children:[o.jsx(Wi,{children:o.jsx(Ta,{placeholder:"Select a volume",children:R&&`${R} (${z==null?void 0:z.values.size})`})}),o.jsxs(Gi,{children:[o.jsx(bn,{value:"none",children:"None"}),D.map(B=>o.jsxs(bn,{value:B.id,children:[B.values.name," (",B.values.size,")"]},B.id))]})]})]}),o.jsxs("div",{className:"flex-1",children:[o.jsx(Xe,{htmlFor:`volume-mount-${L.id}`,className:"text-xs",children:"Mount Path"}),o.jsx(tt,{id:`volume-mount-${L.id}`,placeholder:"/data",value:L.mountPath,onChange:B=>g(L.id,"mountPath",B.target.value),className:`text-sm ${Q?"border-red-500":""} ${M?"":"border-red-500"}`}),Q&&o.jsx("p",{className:"text-xs text-red-500 mt-1",children:"Mount path already used"}),!M&&L.mountPath&&o.jsx("p",{className:"text-xs text-red-500 mt-1",children:"Must be a valid path starting with /"})]}),o.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:()=>m(L.id),className:"h-8 w-8 p-0",children:o.jsx(ds,{className:"h-4 w-4"})})]},L.id)}),f.length===0&&o.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No storage volumes configured"})]})]})]})}const Sbe=[{value:"t1",name:"g1.nano",cpu:"50m",memory:"128Mi",free:!0},{value:"t2",name:"g2.micro",cpu:"100m",memory:"256Mi",free:!0},{value:"t3",name:"g3.small",cpu:"250m",memory:"512Mi",free:!0},{value:"t4",name:"g4.medium",cpu:"400m",memory:"1Gi",free:!1},{value:"t5",name:"g5.large",cpu:"700m",memory:"2Gi",free:!1},{value:"t6",name:"g6.xlarge",cpu:"1400m",memory:"4Gi",free:!1},{value:"t7",name:"g7.2xlarge",cpu:"2100m",memory:"6Gi",free:!1}];function kbe({isManualMode:t,deploymentType:e,onDeploymentTypeChange:r,sourceUrl:n,onSourceUrlChange:s,sourceRef:i,onSourceRefChange:a,sourceSecretName:l,onSourceSecretNameChange:c,containerImage:d,onContainerImageChange:f,containerPullSecretName:p,onContainerPullSecretNameChange:m,onAppNameChange:g,port:y,appName:x,onPortChange:w,exposePort:_,onExposePortChange:S,useCustomDomain:k,onUseCustomDomainChange:N,customDomain:j,onCustomDomainChange:T,envVars:D,onEnvVarAdd:I,onEnvVarRemove:L,onEnvVarUpdate:$,storageVolumes:Q,onStorageVolumeAdd:M,onStorageVolumeRemove:z,onStorageVolumeUpdate:R,formErrors:B,availableSecrets:V=[],containerTag:F,onContainerTagChange:K,resourceTier:Y,onResourceTierChange:O,isOnFreeLimit:H}){const[G,q]=E.useState(!1),J=E.useMemo(()=>V.filter(he=>he.type==="ssh"),[V]),te=E.useMemo(()=>V.filter(he=>he.type==="docker"),[V]),ve=E.useMemo(()=>y!=="80"||!_||k||D.length>1||D.length===1&&(D[0].key||D[0].value),[y,_,k,D]);return E.useEffect(()=>{ve&&!G&&q(!0)},[ve,G]),o.jsxs("div",{className:"space-y-5 max-h-[420px] overflow-y-auto pr-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs(Xe,{children:["Instance Size ",o.jsx("span",{className:"text-red-500",children:"*"})]}),B.resourceTier&&o.jsxs("span",{className:"text-xs text-red-500 flex items-center gap-1",children:[o.jsx(os,{className:"h-3 w-3"}),B.resourceTier]})]}),o.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:Sbe.map(he=>{const xe=H&&!he.free,ke=Y===he.value;return o.jsxs("button",{type:"button",disabled:xe,onClick:()=>O(he.value),className:we("rounded-xl border p-3 text-left transition-all",ke?"border-primary bg-primary/5 ring-1 ring-primary/40":"border-border hover:border-primary/30",xe&&"cursor-not-allowed opacity-50"),children:[o.jsx("p",{className:"text-sm font-semibold",children:he.name}),o.jsxs("p",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:[he.cpu," · ",he.memory]}),xe?o.jsx("span",{className:"mt-1 block text-[10px] font-medium text-amber-600",children:"Upgrade required"}):ke?o.jsx("span",{className:"mt-1 block text-[10px] font-medium text-primary",children:"Selected"}):o.jsx("span",{className:"mt-1 block text-[10px] text-muted-foreground",children:"Available"})]},he.value)})}),H&&o.jsxs("div",{className:"text-sm text-amber-600 bg-amber-50 border border-amber-200 rounded-md p-3 mt-2",children:[o.jsx("strong",{children:"Free Tier Limit:"})," You can use up to g3.small (t3) on the free plan. Upgrade to access larger instances."]})]}),t&&o.jsxs("div",{className:"space-y-4 mb-5",children:[o.jsxs(QH,{value:e==="ssh"?"git":"image",onValueChange:he=>r(he==="git"?"ssh":"docker"),className:"w-full",children:[o.jsxs(AA,{className:"grid w-full grid-cols-2",children:[o.jsxs(Bu,{value:"git",className:"flex items-center gap-2",children:[o.jsx(K_,{className:"h-4 w-4"}),"Git Repository"]}),o.jsxs(Bu,{value:"image",className:"flex items-center gap-2",children:[o.jsx(nv,{className:"h-4 w-4"}),"Container Image"]})]}),o.jsxs(Fu,{value:"git",className:"space-y-3 mt-3",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs(Xe,{htmlFor:"source-url",className:"flex items-center",children:["Git Repository URL ",o.jsx("span",{className:"text-red-500",children:"*"}),o.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"(use clone URL format)"})]}),B.sourceUrl&&o.jsxs("span",{className:"text-xs text-red-500 flex items-center gap-1",children:[o.jsx(os,{className:"h-3 w-3"}),B.sourceUrl]})]}),o.jsx(tt,{id:"source-url",placeholder:"https://github.com/username/repo.git",value:n,onChange:he=>s(he.target.value),className:B.sourceUrl?"border-red-500":""})]}),o.jsxs("div",{children:[o.jsx(Xe,{htmlFor:"source-ref",className:"mb-1 block",children:"Branch/Tag/CommitId"}),o.jsx(tt,{id:"source-ref",placeholder:"main",value:i,onChange:he=>a(he.target.value)})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(gg,{className:"h-4 w-4"}),o.jsx(Xe,{htmlFor:"source-secret",children:"SSH Authentication Secret"})]}),o.jsxs(ja,{value:l||"none",onValueChange:he=>c(he==="none"?"":he),children:[o.jsx(Wi,{id:"source-secret",children:o.jsx(Ta,{placeholder:"Select SSH secret (optional)"})}),o.jsxs(Gi,{children:[o.jsx(bn,{value:"none",children:"None"}),J.map(he=>o.jsx(bn,{value:he.name,children:he.displayName||he.name},he.name))]})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"For private repositories that require SSH authentication"})]})]}),o.jsxs(Fu,{value:"image",className:"space-y-3 mt-3",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs(Xe,{htmlFor:"container-image",children:["Container Image URL ",o.jsx("span",{className:"text-red-500",children:"*"})]}),B.containerImage&&o.jsxs("span",{className:"text-xs text-red-500 flex items-center gap-1",children:[o.jsx(os,{className:"h-3 w-3"}),B.containerImage]})]}),o.jsx(tt,{id:"container-image",placeholder:"nginx:latest",value:d,onChange:he=>f(he.target.value.toLowerCase()),className:B.containerImage?"border-red-500":""})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(gg,{className:"h-4 w-4"}),o.jsx(Xe,{htmlFor:"pull-secret",children:"Registry Pull Secret"})]}),o.jsxs(ja,{value:p||"none",onValueChange:he=>m(he==="none"?"":he),children:[o.jsx(Wi,{id:"pull-secret",children:o.jsx(Ta,{placeholder:"Select registry secret (optional)"})}),o.jsxs(Gi,{children:[o.jsx(bn,{value:"none",children:"None"}),te.map(he=>o.jsx(bn,{value:he.name,children:he.displayName||he.name},he.name))]})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"For private container registries that require authentication"})]})]})]}),o.jsx("div",{className:"border-b border-border my-2"})]}),o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs(Xe,{htmlFor:"app-name",children:["Application Name ",o.jsx("span",{className:"text-red-500",children:"*"})]}),B.appName&&o.jsxs("span",{className:"text-xs text-red-500 flex items-center gap-1",children:[o.jsx(os,{className:"h-3 w-3"}),B.appName]})]}),o.jsx(tt,{id:"app-name",placeholder:"my-application",value:x,onChange:he=>g(he.target.value),className:B.appName?"border-red-500":""}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Must be lowercase a-z, 0-9, and - (no spaces or uppercase)"})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs(Xe,{htmlFor:"port-number",children:["Port Number ",o.jsx("span",{className:"text-red-500",children:"*"})]}),B.port&&o.jsxs("span",{className:"text-xs text-red-500 flex items-center gap-1",children:[o.jsx(os,{className:"h-3 w-3"}),B.port]})]}),o.jsx(tt,{id:"port-number",placeholder:"80",type:"number",value:y,onChange:he=>w(he.target.value),className:B.port?"border-red-500":""}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The port your application listens on"})]}),o.jsx(wbe,{exposePort:_,onExposePortChange:S,useCustomDomain:k,onUseCustomDomainChange:N,customDomain:j,onCustomDomainChange:T,envVars:D,onEnvVarAdd:I,onEnvVarRemove:L,onEnvVarUpdate:$,storageVolumes:Q,onStorageVolumeAdd:M,onStorageVolumeRemove:z,onStorageVolumeUpdate:R,formErrors:B,isExpanded:G,onExpandToggle:()=>q(!G),deploymentType:e,sourceRef:i,onSourceRefChange:a,containerTag:F,onContainerTagChange:K})]})]})}const f3=1,p3=65535,Ebe=/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,Cbe=/^[a-zA-Z][a-zA-Z0-9_]*$/,Nbe=(t,e)=>{const r=e.full_name||e.name;switch(t){case"gitlab":return`git@gitlab.com:${r}.git`;case"github":return`git@github.com:${r}.git`;default:return`git@${t}.com:${r}.git`}};function rq({onOpenChange:t}){const{projectId:e}=Hh(),{appId:r}=Hh(),n=Yn(),{toast:s}=br(),{createApp:i,updateApp:a,integrations:l,volumes:c}=Nr(),d=NA(),{freeOnly:f}=wv(),[p,m]=E.useState([]),[g,y]=E.useState(""),[x,w]=E.useState(!1),[_,S]=E.useState(null),k=E.useRef(!1),{currentStep:N,goToStep:j,goToPrevStep:T,formData:D,updateFormData:I,clearFormData:L,formErrors:$,setFormErrors:Q,isLoading:M,setIsLoading:z,mode:R,isUpdateMode:B}=IH(),F=l.map(X=>({id:X.id,type:X.values.type,name:X.values.account_name||X.id})).map(X=>({name:X.id,type:X.type,displayName:X.name})),K=X=>l.filter(W=>W.values.provider===X);E.useEffect(()=>{(async()=>{if(D.selectedIntegration&&!D.isManualMode&&D.selectedIntegration.id!==_&&!k.current){k.current=!0,w(!0);try{const W=await d.listRepositories(D.selectedIntegration.id);m(W),S(D.selectedIntegration.id)}catch(W){console.error("Error loading repositories:",W),s({title:"Failed to load repositories",description:"Could not retrieve repositories",variant:"destructive"})}finally{w(!1),k.current=!1}}})()},[D.selectedIntegration,D.isManualMode,d,s,_]);const Y=()=>{const X=K("gitlab"),W=K("github"),Z=K("dockerhub");return[...X,...W,...Z]},O=()=>{const X=[...D.envVars,{key:"",value:"",id:Date.now()}];I({envVars:X})},H=X=>{if(D.envVars.length>1){const W=D.envVars.filter(Z=>Z.id!==X);I({envVars:W})}},G=(X,W,Z)=>{const re=D.envVars.map(ae=>ae.id===X?{...ae,[W]:Z??""}:ae);I({envVars:re})},q=()=>{const X=[...D.storageVolumes,{volumeResourceId:void 0,mountPath:"",id:Date.now()}];I({storageVolumes:X})},J=X=>{const W=D.storageVolumes.filter(Z=>Z.id!==X);I({storageVolumes:W})},te=(X,W,Z)=>{const re=D.storageVolumes.map(ae=>ae.id===X?{...ae,[W]:Z}:ae);I({storageVolumes:re})},ve=X=>{I({selectedIntegration:X,isManualMode:!1,deploymentType:X.values.type}),j(1)},he=()=>{I({isManualMode:!0,selectedIntegration:null,selectedRepository:null}),j(2)},xe=X=>{var Z;let W=D.appName;R==="create"&&X.name&&(W=X.name.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/^[^a-z0-9]+/,"").replace(/[^a-z0-9]+$/,"")),((Z=D.selectedIntegration)==null?void 0:Z.values.provider)==="dockerhub"?I({selectedRepository:X,appName:W,containerImage:X.full_name||X.name,containerPullSecretName:D.selectedIntegration.id||""}):I({selectedRepository:X,appName:W}),j(2)},ke=()=>{N===2&&D.isManualMode?j(0):N===2?j(1):T()},Oe=()=>{const X={};if(D.appName.trim()?Ebe.test(D.appName)||(X.appName="Must be lowercase a-z, 0-9, and - (no spaces or uppercase)"):X.appName="Application name is required",D.deploymentType==="docker"&&!D.containerImage.trim()&&(X.containerImage="Container image is required"),D.deploymentType==="ssh"&&D.isManualMode&&!D.sourceUrl.trim()&&(X.sourceUrl="Source URL is required"),D.deploymentType==="ssh"&&!D.isManualMode&&!D.selectedRepository&&(X.repository="Please select a repository"),!D.port)X.port="Port number is required";else{const Ne=parseInt(D.port);(isNaN(Ne)||Ne<f3||Ne>p3)&&(X.port=`Port must be a number between ${f3} and ${p3}`)}D.exposePort&&D.useCustomDomain&&!D.customDomain.trim()&&(X.domain="Custom domain is required");const W=["t1","t2","t3"];f&&D.resourceTier&&!W.includes(D.resourceTier)&&(X.resourceTier="Free tier users can only use up to g3.small (t3) instance sizes");const Z={};let re=!1;D.envVars.forEach(Ne=>{Ne.key&&!Cbe.test(Ne.key)&&(Z[Ne.id]={key:"Must start with a letter and contain only alphanumeric characters and underscores"},re=!0)}),re&&(X.envVars=Z);const ae={};let fe=!1;const oe=D.storageVolumes.map(Ne=>Ne.mountPath).filter(Ne=>Ne!==""),Ae=oe.filter((Ne,Le)=>oe.indexOf(Ne)!==Le);return D.storageVolumes.forEach(Ne=>{Ne.volumeResourceId&&!Ne.mountPath?(ae[Ne.id]={mountPath:"Mount path is required when volume is selected"},fe=!0):!Ne.volumeResourceId&&Ne.mountPath?(ae[Ne.id]={mountPath:"Volume must be selected when mount path is provided"},fe=!0):Ne.mountPath&&Ae.includes(Ne.mountPath)?(ae[Ne.id]={mountPath:"Mount path is already used by another volume"},fe=!0):Ne.mountPath&&(!Ne.mountPath.startsWith("/")||Ne.mountPath.length<=1)&&(ae[Ne.id]={mountPath:"Must be a valid path starting with /"},fe=!0)}),fe&&(X.storageVolumes=ae),Q(X),Object.keys(X).length===0},He=async()=>{var ae,fe;const X=D.envVars.filter(oe=>oe.key&&oe.value),W={};X.forEach(oe=>{W[oe.key]=oe.value});const Z={image:"nginx:latest"},re={name:D.appName,projectId:e||"",resourceTier:D.resourceTier||"t1",ports:[{number:parseInt(D.port),expose:D.exposePort}],publicAccess:{enabled:D.exposePort,domain:D.useCustomDomain?D.customDomain:"auto",baseDomain:"hosted.ghaymah.systems"},container:Z};if(Object.keys(W).length>0&&(re.env=W),D.deploymentType==="ssh")re.source={enabled:!0,url:D.isManualMode?D.sourceUrl:Nbe(((ae=D.selectedIntegration)==null?void 0:ae.values.provider)||"",D.selectedRepository),ref:D.sourceRef,secretName:D.isManualMode?D.sourceSecretName:((fe=D.selectedIntegration)==null?void 0:fe.id)||""};else if(D.deploymentType==="docker"){let oe=D.containerImage;D.containerTag&&!oe.includes(":")&&(oe=`${oe}:${D.containerTag}`),re.container={image:oe,pullSecretName:D.containerPullSecretName}}if(D.storageVolumes&&D.storageVolumes.length>0){const oe=D.storageVolumes.filter(Ae=>Ae.volumeResourceId&&Ae.mountPath);if(oe.length>0){const Ae=oe.map(Ne=>{if(Ne.volumeResourceId){const Le=c.find(De=>De.id===Ne.volumeResourceId);return{name:Le?Le.uniqueName:"unknown",mountPath:Ne.mountPath}}else return{name:"unknown",mountPath:Ne.mountPath}});re.storage={volumes:Ae}}}return re},Ye=async()=>{if(!Oe()){s({title:"Validation Error",description:"Please fix the errors in the form",variant:"destructive"});return}z(!0);try{const X=await He();if(R==="create"&&e){const W=await i({values:X});if(W)n(`/dashboard/projects/${e}/apps/${W}`),L();else throw new Error("Failed to create application")}else if(R==="update"&&r){const W=await a(r,X);if(t(!1),L(),n(`/dashboard/projects/${e}`),!W)throw new Error("Failed to update application")}}catch(X){console.error(X),s({title:R==="create"?"Deployment failed":"Update failed",description:X instanceof Error?X.message:"An unknown error occurred",variant:"destructive"})}finally{z(!1)}},lt=()=>{switch(N){case 0:return o.jsx(ube,{integrations:Y(),onIntegrationSelect:ve,onManualModeSelect:he});case 1:return o.jsx(dbe,{repositories:p,searchQuery:g,onSearchChange:y,onRepositorySelect:xe,isLoading:x});case 2:return o.jsx(kbe,{isManualMode:D.isManualMode,deploymentType:D.deploymentType,onDeploymentTypeChange:X=>I({deploymentType:X}),sourceUrl:D.sourceUrl,onSourceUrlChange:X=>I({sourceUrl:X}),sourceRef:D.sourceRef,onSourceRefChange:X=>I({sourceRef:X}),sourceSecretName:D.sourceSecretName,onSourceSecretNameChange:X=>I({sourceSecretName:X}),containerImage:D.containerImage,onContainerImageChange:X=>I({containerImage:X}),containerPullSecretName:D.containerPullSecretName,onContainerPullSecretNameChange:X=>I({containerPullSecretName:X}),containerTag:D.containerTag,onContainerTagChange:X=>I({containerTag:X}),appName:D.appName,onAppNameChange:X=>I({appName:X}),port:D.port,onPortChange:X=>I({port:X}),exposePort:D.exposePort,onExposePortChange:X=>I({exposePort:X}),useCustomDomain:D.useCustomDomain,onUseCustomDomainChange:X=>I({useCustomDomain:X}),customDomain:D.customDomain,onCustomDomainChange:X=>I({customDomain:X}),envVars:D.envVars,onEnvVarAdd:O,onEnvVarRemove:H,onEnvVarUpdate:G,storageVolumes:D.storageVolumes,onStorageVolumeAdd:q,onStorageVolumeRemove:J,onStorageVolumeUpdate:te,formErrors:$,isUpdateMode:B,availableSecrets:F,resourceTier:D.resourceTier,onResourceTierChange:X=>I({resourceTier:X}),isOnFreeLimit:f},`config-form-${D.deploymentType}`);default:return null}},P=D.isManualMode?[{label:"Source",icon:L0},{label:"Configure",icon:PM}]:[{label:"Source",icon:L0},{label:"Repository",icon:K_},{label:"Configure",icon:PM}],ne=D.isManualMode?N===0?0:1:N;return o.jsx(o.Fragment,{children:o.jsxs("div",{className:"w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm",children:[o.jsx("div",{className:"border-b border-border/60 bg-muted/20 px-6 pb-4 pt-5",children:o.jsx("div",{className:"flex items-center",children:P.map((X,W)=>{const Z=W<ne,re=W===ne;return o.jsxs("div",{className:we("flex items-center",W<P.length-1&&"flex-1"),children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[o.jsx("div",{className:we("flex h-7 w-7 items-center justify-center rounded-full border text-xs font-semibold transition-colors",re?"border-primary bg-primary text-primary-foreground shadow-sm":Z?"border-primary/40 bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"),children:Z?o.jsx(Lr,{className:"h-3.5 w-3.5"}):o.jsx(X.icon,{className:"h-3.5 w-3.5"})}),o.jsx("span",{className:we("text-xs font-medium",re?"text-foreground":"text-muted-foreground"),children:X.label})]}),W<P.length-1&&o.jsx("div",{className:we("mx-3 h-px flex-1 transition-colors",W<ne?"bg-primary/50":"bg-border")})]},X.label)})})}),o.jsx("div",{className:"p-6",children:lt()}),N>0?o.jsxs("div",{className:"flex items-center justify-between border-t border-border/60 bg-muted/20 px-6 py-4",children:[o.jsxs(le,{variant:"outline",onClick:ke,className:"flex items-center",children:[o.jsx(mo,{className:"mr-2 h-4 w-4"}),"Back"]}),N===2&&o.jsx(le,{onClick:Ye,disabled:M,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:M?o.jsxs(o.Fragment,{children:[o.jsx(wn,{className:"mr-2 h-4 w-4 animate-spin"}),R==="create"?"Deploying...":"Updating..."]}):o.jsxs(o.Fragment,{children:[R==="create"?o.jsx($r,{className:"mr-2 h-4 w-4"}):o.jsx(ZB,{className:"mr-2 h-4 w-4"}),R==="create"?"Deploy Now":"Update Configuration"]})})]}):null]})})}function nq({open:t=!1,onOpenChange:e=()=>{},mode:r="create",display:n="dialog",existingApp:s}){return n==="dialog"?o.jsx(hs,{open:t,onOpenChange:e,children:o.jsx(jbe,{mode:r,existingApp:s,open:t,onOpenChange:e})}):o.jsx(MH,{mode:r,existingApp:s,children:o.jsx(rq,{onOpenChange:e})})}function jbe({mode:t,existingApp:e,open:r,onOpenChange:n}){return o.jsx(MH,{mode:t,existingApp:e,children:o.jsx(Tbe,{open:r,onOpenChange:n,mode:t})})}function Tbe({open:t,onOpenChange:e,mode:r}){const{resetForm:n}=IH();E.useEffect(()=>{t||n()},[t,n]);const s=i=>{i||n(),e(i)};return o.jsxs(un,{className:"max-w-2xl overflow-hidden p-0",onInteractOutside:()=>s(!1),children:[o.jsx(Dn,{className:"p-6 pb-2",children:o.jsx(On,{className:"text-xl",children:r==="create"?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx($r,{className:"h-5 w-5"}),"Deploy New Application"]}):o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(ZB,{className:"h-5 w-5"}),"Update Application"]})})}),o.jsx(rq,{onOpenChange:s})]})}function Abe(){const{projectId:t}=Hh(),e=Yn(),{apps:r}=Nr(),{toast:n}=br(),{deleteResource:s,getProjectById:i}=Nr(),[a,l]=E.useState(!1);if(!t)return o.jsx(Wu,{icon:$r,title:"Project ID not found",description:"This is unexpected.",actionLabel:"Back to Projects",actionIcon:$r,onAction:()=>e("/dashboard/projects")});const c=i(t);if(!c)return o.jsx(Wu,{icon:$r,title:"Project not found by ID",description:"Invalid project ID",actionLabel:"Back to Projects",actionIcon:$r,onAction:()=>e("/dashboard/projects")});const d=r.filter(p=>p.values&&p.values.projectId===t),f=()=>{const p=async m=>{try{return await s(m)}catch(g){return n({title:"Error deleting application",description:g instanceof Error?g.message:"An unknown error occurred",variant:"destructive"}),!1}};return d.length===0?o.jsx(Wu,{icon:$r,title:"No applications yet",description:"Deploy your first application to this project",actionLabel:"Deploy Application",actionIcon:nr,onAction:()=>l(!0)}):o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[o.jsx($r,{className:"h-4 w-4 text-primary"}),o.jsxs("h2",{className:"font-medium text-lg",children:[d.length," ",d.length===1?"Application":"Applications"]})]}),o.jsxs(lbe,{children:[d.map(m=>{var g,y,x,w;return o.jsx(_v,{resource:m,name:m.values.name,onClick:()=>e(`/dashboard/projects/${t}/apps/${m.id}`),onDelete:m.status==="synced"||m.status==="backoff"?()=>p(m.id):void 0,additionalContent:o.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:o.jsxs("div",{className:"flex justify-between items-center",children:[((y=(g=m.values)==null?void 0:g.container)==null?void 0:y.image)&&o.jsx("span",{className:"text-sm text-muted-foreground",children:m.values.container.image}),((w=(x=m.values)==null?void 0:x.publicAccess)==null?void 0:w.enabled)&&o.jsx("div",{className:"px-2 py-1 rounded-full bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-400 text-xs font-medium",children:"Public"})]})})},m.id)}),o.jsx(RH,{label:"Deploy New App",description:"Add to this project",onClick:()=>l(!0)})]})]})};return o.jsxs(o.Fragment,{children:[o.jsx(bv,{name:c.values.name,resourceType:"Project",title:"Project Details",description:"Manage your project and applications",emptyTitle:"Project not found",emptyDescription:"The project you're looking for doesn't exist or has been deleted",addLabel:"Edit Project",addDescription:"Modify project settings",basePath:"/dashboard/projects",resourceId:t,filter:p=>p.chart_name===ks.PROJECT,renderDetail:f,additionalActions:o.jsxs(le,{className:"bg-gradient-to-r from-primary to-primary/90 shadow-md hover:shadow-lg transition-shadow",onClick:()=>l(!0),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"Deploy App"]}),canDelete:p=>p.status==="synced"||p.status==="backoff",deleteMessage:p=>{const m=r.filter(g=>g.values&&g.values.projectId===p.id).length;return m>0?`This project contains ${m} application(s). Deleting this project will also delete all associated applications.`:"Are you sure you want to delete this project? This action cannot be undone."},onDelete:async p=>{if(!i(p))return!1;const g=r.filter(y=>y.values&&y.values.projectId===p);if(g.length>0)for(const y of g)try{await s(y.id)}catch(x){return n({title:"Error deleting application",description:x instanceof Error?x.message:"Failed to delete dependent application",variant:"destructive"}),!1}return await s(p)}}),o.jsx(nq,{open:a,onOpenChange:l,mode:"create"})]})}function Rbe(t,e,r){const n=mb(),{toast:s}=br(),[i,a]=E.useState([]),[l,c]=E.useState(null),[d,f]=E.useState(!1),p=E.useRef(null),m=async()=>{try{const y=await n.auth.getAccessToken();if(!y){jt("Logs","No auth token available"),s({title:"Authentication Error",description:"Could not retrieve authentication token",variant:"destructive"});return}l&&l.abort();const x=new AbortController;c(x),jt("Logs","Starting log stream",{appId:t,projectId:e}),f(!0),a([]);const w=await fetch("https://logs.ghaymah.systems/logs",{method:"POST",headers:{Authorization:`Bearer ${y}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({projectId:e,appId:t,follow:!0,previous:!1,tailLines:100}),signal:x.signal});if(!w.ok)throw new Error(`Failed to fetch logs: ${w.status} ${w.statusText}`);if(!w.body)throw new Error("Stream not available");const _=w.body.getReader(),S=new TextDecoder;for(;;){const{value:k,done:N}=await _.read();if(N)break;const T=S.decode(k,{stream:!0}).split(`
|
||
`).filter(D=>D.trim());a(D=>[...D,...T]),p.current&&p.current.scrollIntoView({behavior:"smooth"})}}catch(y){y.name!=="AbortError"&&(jt("Logs","Error streaming logs",{error:y.message}),f(!1))}},g=()=>{l&&(jt("Logs","Stopping log stream"),l.abort(),c(null),f(!1))};return E.useEffect(()=>(r?m():g(),()=>{g()}),[r,t,e]),E.useEffect(()=>{r&&p.current&&i.length>0&&p.current.scrollIntoView({behavior:"smooth"})},[i,r]),{logs:i,isStreaming:d,logEndRef:p,stopLogStream:g}}function Dbe({logs:t,isStreaming:e,logEndRef:r,collapsible:n=!1}){const[s,i]=E.useState(!0),[a,l]=E.useState("all"),{hasMultipleTypes:c,logTypes:d,parsedLogs:f,hasLogs:p}=E.useMemo(()=>{const y=/^\[([\w-]+)\]:\s*(.*)/,x=[],w=new Set;return t.forEach(_=>{const S=_.match(y);if(S){const k=S[1],N=S[2],j=k.split("-")[0],T=k.includes("-build-")?"build":"app";w.add(T),x.push({type:T,id:j,content:N,rawLog:_})}else x.push({type:"unknown",id:null,content:_,rawLog:_})}),{hasMultipleTypes:w.size>1,logTypes:Array.from(w),parsedLogs:x,hasLogs:t.length>0}},[t]),m=E.useMemo(()=>a==="all"?t:f.filter(y=>y.type===a).map(y=>y.content||y.rawLog),[f,a,t]),g=()=>{n&&i(y=>!y)};return o.jsxs($e,{className:"border-primary/10 overflow-hidden",children:[o.jsxs(ot,{className:`bg-gradient-to-r from-primary/5 to-transparent flex flex-row items-center justify-between ${n?"cursor-pointer":""}`,onClick:g,children:[o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(Bs,{className:"h-5 w-5 text-primary"}),"Application Logs"]}),n&&o.jsx("div",{children:s?o.jsx(G_,{className:"h-5 w-5 text-primary"}):o.jsx(wj,{className:"h-5 w-5 text-primary"})})]}),!s&&o.jsx(Be,{className:"p-0",children:o.jsxs("div",{className:"rounded-b-lg overflow-hidden",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between px-4 py-2 bg-background/60 border-y border-primary/10",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500 animate-pulse":"bg-gray-400"}`}),o.jsx("span",{className:"text-xs font-medium",children:e?"Live streaming enabled":"Connecting to logs..."})]}),p&&c&&o.jsxs("div",{className:"flex flex-wrap gap-2 text-xs mt-2 md:mt-0",children:[o.jsx("button",{onClick:()=>l("all"),className:`px-2 py-1 rounded ${a==="all"?"bg-primary text-primary-foreground":"bg-primary/10"}`,children:"All Logs"}),d.includes("app")&&o.jsx("button",{onClick:()=>l("app"),className:`px-2 py-1 rounded ${a==="app"?"bg-primary text-primary-foreground":"bg-primary/10"}`,children:"App"}),d.includes("build")&&o.jsx("button",{onClick:()=>l("build"),className:`px-2 py-1 rounded ${a==="build"?"bg-primary text-primary-foreground":"bg-primary/10"}`,children:"Build"})]})]}),o.jsxs("div",{className:"bg-black text-green-400 font-mono text-sm p-4 rounded-b-lg h-96 overflow-auto",children:[m.length>0?o.jsxs("pre",{children:[m.join(`
|
||
`),e&&o.jsx("div",{className:"animate-pulse inline-block ml-1",children:"▌"})]}):o.jsx("div",{className:"flex h-full items-center justify-center text-center",children:o.jsx("div",{children:e?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"h-8 w-8 animate-spin mx-auto mb-4 opacity-50"}),o.jsx("p",{children:"Fetching application logs..."})]}):o.jsx("p",{children:"No logs available. Trying to connect..."})})}),r&&o.jsx("div",{ref:r})]})]})})]})}const Obe="Every service on Ghaymah gets a stable hostname on your project's private network. Your apps and databases can reach each other through it directly — securely, with no public IP and nothing exposed to the internet.";function OA({hostname:t,description:e=Obe,example:r,className:n}){const[s,i]=E.useState(null),a=async(l,c)=>{try{await navigator.clipboard.writeText(l),i(c),setTimeout(()=>i(null),1500)}catch{}};return o.jsx($e,{className:we("overflow-hidden border-indigo-500/20 bg-gradient-to-br from-indigo-500/[0.05] via-transparent to-transparent",n),children:o.jsxs(Be,{className:"space-y-3 p-5",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-indigo-500/10 ring-1 ring-indigo-500/20",children:o.jsx(bre,{className:"h-4 w-4 text-indigo-500"})}),o.jsx("div",{className:"min-w-0",children:o.jsxs("h3",{className:"flex items-center gap-2 font-semibold",children:["Private networking",o.jsx(Lt,{variant:"secondary",className:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-300",children:"Internal only"})]})})]}),o.jsxs("p",{className:"flex items-start gap-1.5 text-sm leading-relaxed text-muted-foreground",children:[o.jsx(Bi,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-indigo-400"}),o.jsx("span",{children:e})]}),o.jsxs("div",{className:"rounded-lg border border-indigo-500/20 bg-background/80 p-3",children:[o.jsx("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Internal hostname"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-sm text-foreground",children:t}),o.jsxs(le,{size:"sm",variant:"outline",className:"shrink-0",onClick:()=>void a(t,"host"),children:[s==="host"?o.jsx(Lr,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500"}):o.jsx(cn,{className:"mr-1.5 h-3.5 w-3.5"}),s==="host"?"Copied":"Copy"]})]})]}),r&&o.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 p-3",children:[o.jsx("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Use it from another service"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:r}),o.jsx(le,{size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:()=>void a(r,"example"),"aria-label":"Copy example",children:s==="example"?o.jsx(Lr,{className:"h-3.5 w-3.5 text-emerald-500"}):o.jsx(cn,{className:"h-3.5 w-3.5"})})]})]})]})})}function Pbe(){const{projectId:t,appId:e}=Hh(),{toast:r}=br(),{getAppById:n,updateApp:s,mutationLoading:i}=Nr(),[a,l]=E.useState(!1),[c,d]=E.useState(""),[f,p]=E.useState(""),[m,g]=E.useState({copied:!1,error:!1}),[y,x]=E.useState(!1),[w,_]=E.useState(!1),[S,k]=E.useState(!1),N=e?n(e):void 0,j=()=>{var K;return y?0:w?1:((K=N==null?void 0:N.values)==null?void 0:K.instances)??1},T=()=>j()===0,D=()=>(N==null?void 0:N.status)==="syncing",I=()=>y||w||S,L=()=>D()||i||I(),$=()=>I()?"Processing request...":L()?"Application is currently updating":"",Q=()=>!D()&&!T();E.useEffect(()=>{(N==null?void 0:N.status)==="syncing"&&(x(!1),_(!1),k(!1))},[N==null?void 0:N.status]);const{logs:M,isStreaming:z,logEndRef:R}=Rbe(e||"",t||"",Q());E.useEffect(()=>{var K,Y,O,H;if(N)if(console.log("App publicAccess:",(Y=(K=N.values)==null?void 0:K.publicAccess)==null?void 0:Y.enabled),p(N.uniqueName),(H=(O=N.values)==null?void 0:O.publicAccess)!=null&&H.enabled)if(N.values.publicAccess.domain==="auto"&&N.values.publicAccess.baseDomain){const G=`${N.uniqueName}.${N.values.publicAccess.baseDomain}`;d(G)}else N.values.publicAccess.domain&&d(N.values.publicAccess.domain);else d("")},[N]);const B=()=>{var H;if(!N||!e)return;const Y=(((H=N.values)==null?void 0:H.instances)??1)===0?1:0,O=Y===0?"hibernating":"waking up";Y===0?x(!0):_(!0),s(e,{...N.values,instances:Y}).then(G=>{G||(x(!1),_(!1),r({title:`Failed to ${O.replace("ing","")} application`,description:`There was an error ${O} the application`,variant:"destructive"}))})},V=K=>{!K||!e||(k(!0),s(e,K.values).then(Y=>{Y||(k(!1),r({title:"Update failed",description:"There was an error updating the application configuration",variant:"destructive"}))}))},F=K=>{var q,J,te,ve,he,xe;const Y=L(),O=T(),H=D(),G=$();return o.jsxs("div",{className:"space-y-6",children:[H&&!O&&o.jsxs("div",{className:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300 px-4 py-3 rounded-lg flex items-center gap-3",children:[o.jsx(os,{className:"h-5 w-5 flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Application is currently updating"}),o.jsx("p",{className:"text-sm mt-1",children:"Updating the application is disabled until this process completes."}),i&&o.jsxs("p",{className:"text-sm mt-1",children:[o.jsx(wn,{className:"h-3 w-3 inline mr-1 animate-spin"}),"Operation in progress..."]})]})]}),(c||!((J=(q=K==null?void 0:K.values)==null?void 0:q.publicAccess)!=null&&J.enabled))&&K.status==="synced"&&o.jsxs($e,{className:`border-primary/10 overflow-hidden ${O?"opacity-60":""}`,children:[o.jsx(ot,{className:"bg-gradient-to-r from-primary/5 to-transparent",children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(An,{className:"h-5 w-5 text-primary"}),(ve=(te=K==null?void 0:K.values)==null?void 0:te.publicAccess)!=null&&ve.enabled?"Public Access":"Internal Access",O&&o.jsx("span",{className:"text-sm text-muted-foreground font-normal",children:"(Unavailable - Hibernated)"})]})}),o.jsx(Be,{className:"p-6",children:(xe=(he=K==null?void 0:K.values)==null?void 0:he.publicAccess)!=null&&xe.enabled?c.includes(".hosted.ghaymah")?o.jsx("div",{className:"flex flex-col sm:flex-row items-start justify-between gap-4",children:o.jsxs("div",{className:"w-full",children:[o.jsx("h3",{className:"font-medium mb-1",children:"Your application is accessible at:"}),o.jsxs("div",{className:"flex items-center justify-between w-full gap-3 p-3 bg-background/80 rounded border border-primary/10",children:[o.jsxs("a",{href:O?void 0:`https://${c}`,target:"_blank",rel:"noreferrer",className:`text-primary text-sm font-mono flex items-center truncate ${O?"cursor-not-allowed opacity-50":"hover:underline"}`,onClick:O?ke=>ke.preventDefault():void 0,children:["https://",c,!O&&o.jsx(_s,{className:"ml-1 h-4 w-4 flex-shrink-0"})]}),o.jsx(le,{onClick:async()=>{try{await navigator.clipboard.writeText(`https://${c}`),g({copied:!0,error:!1}),setTimeout(()=>{g({copied:!1,error:!1})},1e3)}catch(ke){g({copied:!1,error:!0}),console.error("Failed to copy:",ke)}},size:"sm",className:"bg-gradient-to-r from-primary to-primary/90 shadow-md flex-shrink-0",disabled:O,children:m.copied?o.jsxs(o.Fragment,{children:[o.jsx(Lr,{className:"mr-2 h-4 w-4"}),"Copied!"]}):m.error?o.jsxs(o.Fragment,{children:[o.jsx(os,{className:"mr-2 h-4 w-4"}),"Failed"]}):o.jsxs(o.Fragment,{children:[o.jsx(cn,{className:"mr-2 h-4 w-4"}),"Copy URL"]})})]})]})}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"font-medium",children:"Custom Domain Setup Required"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["To use your custom domain (",o.jsx("span",{className:"font-mono text-primary",children:c}),"), add the following CNAME record to your DNS provider:"]})]}),o.jsx("div",{className:"bg-background/80 rounded border border-primary/10 p-4",children:o.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-muted-foreground",children:"Type"}),o.jsx("p",{className:"font-mono",children:"CNAME"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-muted-foreground",children:"Name"}),o.jsx("p",{className:"font-mono",children:c.split(".")[0]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-muted-foreground",children:"Value"}),o.jsx("p",{className:"font-mono",children:"acme.ghaymah.systems"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-muted-foreground",children:"TTL"}),o.jsx("p",{className:"font-mono",children:"Auto"})]})]})}),o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:o.jsx("p",{children:"DNS changes may take up to 24 hours to propagate"})})]}):o.jsx("div",{className:"flex flex-col sm:flex-row items-start justify-between gap-4",children:o.jsxs("div",{className:"w-full",children:[o.jsx("div",{className:"p-3 bg-amber-50 rounded border border-amber-200 text-amber-800 text-sm mb-3",children:"Public access is disabled — this app isn't reachable from the internet, but it can still be reached over your project's private network."}),o.jsx(OA,{hostname:f,description:"Other apps and services in this project can reach this app directly through this hostname — no public IP and no internet exposure."})]})})})]}),Q()?o.jsx(Dbe,{logs:M,isStreaming:z,logEndRef:R,collapsible:!0}):O?o.jsx($e,{className:"border-muted/50",children:o.jsxs(Be,{className:"p-6 text-center text-muted-foreground",children:[o.jsx(cl,{className:"h-8 w-8 mx-auto mb-2"}),o.jsx("p",{className:"font-medium",children:"Logs Unavailable"}),o.jsx("p",{className:"text-sm mt-1",children:"Application logs are not available while hibernated"})]})}):null,o.jsx(hs,{open:a,onOpenChange:l,children:o.jsx(un,{className:"border border-primary/20 shadow-lg max-w-3xl max-h-[90vh] overflow-hidden flex flex-col",children:o.jsx("div",{className:"overflow-y-auto flex-grow pr-1",children:Y?o.jsxs("div",{className:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300 px-4 py-3 rounded-lg mb-6 flex items-center gap-3",children:[o.jsx(os,{className:"h-5 w-5 flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:G}),o.jsx("p",{className:"text-sm mt-1",children:"Configuration updates are disabled until this process completes."}),i&&o.jsxs("p",{className:"text-sm mt-1",children:[o.jsx(wn,{className:"h-3 w-3 inline mr-1 animate-spin"}),"Operation in progress..."]})]})]}):o.jsx(nq,{mode:"update",display:"inline",existingApp:K,onSuccess:V})})})})]})};return o.jsx(o.Fragment,{children:o.jsx(bv,{resourceType:"App",instances:N==null?void 0:N.values.instances,title:"Application Details",description:"Manage and monitor your application",emptyTitle:"Application not found",emptyDescription:"The application you're looking for doesn't exist or has been deleted",addLabel:"Edit App",addDescription:"Modify app settings",icon:$r,basePath:`/dashboard/projects/${t}`,name:(N==null?void 0:N.values.name)||"",resourceId:e,filter:K=>{var Y;return K.chart_name==="ghaymah-app"&&((Y=K.values)==null?void 0:Y.projectId)===t},renderDetail:F,additionalActions:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(le,{variant:"outline",onClick:B,disabled:L(),title:L()?$():T()?"Wake up application":"Hibernate application",className:`${T()?"border-amber-500/30 text-amber-600 hover:bg-amber-500/10 hover:border-amber-500/50":"border-muted-foreground/30 text-muted-foreground hover:bg-muted hover:border-muted-foreground/50"}`,children:T()?o.jsxs(o.Fragment,{children:[o.jsx(eF,{className:"mr-2 h-4 w-4"}),"Wake Up"]}):o.jsxs(o.Fragment,{children:[o.jsx(cl,{className:"mr-2 h-4 w-4"}),"Hibernate"]})}),o.jsxs(le,{variant:"outline",onClick:()=>l(!0),disabled:L(),title:L()?$():"Edit App",className:"border-primary/30 text-primary hover:bg-primary/10",children:[o.jsx(Y_,{className:"mr-2 h-4 w-4"}),"Edit App"]})]}),canDelete:K=>K.status==="synced"||K.status==="backoff",deleteMessage:()=>"Are you sure you want to delete this application? This action cannot be undone."})})}const Mbe=_f("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ua=E.forwardRef(({className:t,variant:e,...r},n)=>o.jsx("div",{ref:n,role:"alert",className:we(Mbe({variant:e}),t),...r}));ua.displayName="Alert";const Lb=E.forwardRef(({className:t,...e},r)=>o.jsx("h5",{ref:r,className:we("mb-1 font-medium leading-none tracking-tight",t),...e}));Lb.displayName="AlertTitle";const da=E.forwardRef(({className:t,...e},r)=>o.jsx("div",{ref:r,className:we("text-sm [&_p]:leading-relaxed",t),...e}));da.displayName="AlertDescription";function Ibe({onSubmit:t,isLoading:e}){const[r,n]=E.useState(""),[s,i]=E.useState(""),[a,l]=E.useState(null),c=d=>{if(d.preventDefault(),l(null),!r.trim()||!s.trim()){l("Please enter both username and password");return}t(r,s)};return o.jsxs("form",{onSubmit:c,className:"space-y-4",children:[a&&o.jsxs(ua,{variant:"destructive",children:[o.jsx(os,{className:"h-4 w-4"}),o.jsx(Lb,{children:"Error"}),o.jsx(da,{children:a})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"docker-username",children:"Docker Hub Username"}),o.jsx(tt,{id:"docker-username",value:r,onChange:d=>n(d.target.value),placeholder:"your-username",className:"border-primary/20 focus-visible:ring-primary/30"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"docker-password",children:"Docker Hub Password or Access Token"}),o.jsx(tt,{id:"docker-password",type:"password",value:s,onChange:d=>i(d.target.value),placeholder:"••••••••",className:"border-primary/20 focus-visible:ring-primary/30"})]}),o.jsx(le,{type:"submit",disabled:e,className:"w-full bg-gradient-to-r from-blue-500 to-blue-600",children:e?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]}):o.jsxs(o.Fragment,{children:[o.jsx(JB,{className:"mr-2 h-4 w-4"}),"Connect to Docker Hub"]})})]})}function Lbe({onClose:t}){const e=NA(),{toast:r}=br(),[n,s]=E.useState(null),[i,a]=E.useState(!1),l=async(c,d)=>{a(!0),s(null);try{await e.authenticateDockerHub({username:c,password:d}),t(),r({title:"Docker Hub connected",description:"Your Docker Hub integration has been successfully added."})}catch(f){console.error("Docker Hub authentication error:",f),s(f instanceof Error?f.message:"Authentication failed. Please check your credentials.")}finally{a(!1)}};return o.jsxs(un,{className:"border border-primary/20 shadow-lg sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Connect to Docker Hub"}),o.jsx(fs,{children:"Add Docker Hub integration to access repositories and authenticate with the service"})]}),n&&o.jsxs(ua,{variant:"destructive",className:"mb-4",children:[o.jsx(os,{className:"h-4 w-4"}),o.jsx(Lb,{children:"Error"}),o.jsx(da,{children:n})]}),o.jsx("div",{className:"mt-4 space-y-4",children:o.jsx(Ibe,{onSubmit:l,isLoading:i})})]})}function $be(){const{apps:t,integrations:e}=Nr(),[r,n]=E.useState({}),[s,i]=E.useState(!0);E.useEffect(()=>{(()=>{var p,m;i(!0);const f={};e.forEach(g=>{f[g.id]={isInUse:!1,appNames:[]}});for(const g of t){if((p=g.values.source)!=null&&p.secretName){const y=g.values.source.secretName;f[y]&&(f[y].isInUse||(f[y].isInUse=!0),f[y].appNames.push(g.values.name))}if((m=g.values.container)!=null&&m.pullSecretName){const y=g.values.container.pullSecretName;f[y]&&(f[y].isInUse||(f[y].isInUse=!0),f[y].appNames.push(g.values.name))}}n(f),i(!1)})()},[t,e]);const a=d=>{var f;return((f=r[d])==null?void 0:f.isInUse)||!1};return{integrationUsageMap:r,loading:s,isIntegrationInUse:a,getAppsUsingIntegration:d=>{var f;return((f=r[d])==null?void 0:f.appNames)||[]},getAvailableIntegrations:()=>e.filter(d=>!a(d.id))}}const xk=t=>{switch(t){case Y0.GITLAB:return"GitLab";case Y0.DOCKERHUB:return"Docker Hub";default:return t.charAt(0).toUpperCase()+t.slice(1)}};function Bbe(){const{deleteIntegration:t}=NA(),{integrationUsageMap:e}=$be(),r=async l=>{try{return await t(l),!0}catch(c){throw new Error(c instanceof Error?c.message:"Failed to delete integration")}},n=(l,c)=>{const d=l.values.provider,f=l.values.account_name||l.values.account_id||xk(d),p=e[l.id]||{isInUse:!1,appNames:[]},{isInUse:m,appNames:g}=p,y=d===Y0.GITLAB?K_:d===Y0.DOCKERHUB?JB:od,x=s(l),w=o.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:o.jsxs("div",{children:["Provider: ",xk(d)]})}),m&&o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"text-muted-foreground",children:"Used by:"}),o.jsx("span",{className:"font-medium text-primary",children:g.length>1?`${g.length} apps`:g[0]})]})]})});return o.jsx(_v,{resource:l,name:f,icon:y,onDelete:x?c:void 0,additionalContent:w},l.id)},s=l=>{const c=e[l.id]||{isInUse:!1},d=l.status==="synced"||l.status==="backoff";return!c.isInUse&&d},i=l=>(e[l.id]||{isInUse:!1}).isInUse?"This integration is currently being used by one or more applications and cannot be deleted. Please remove the integration references from the applications first.":`Are you sure you want to remove this ${xk(l.values.provider)} integration?`,a=l=>o.jsx(Lbe,{onClose:l});return o.jsx(bv,{resourceType:"Integration",title:"External Integrations",description:"Connect to external services like Docker Hub",emptyTitle:"No integrations found",emptyDescription:"Connect to external services like Docker Hub to deploy your applications directly from source.",addLabel:"Add New Integration",addDescription:"Connect to external services",icon:io,basePath:"/dashboard/integrations",filter:l=>GC(l),renderCard:n,onDelete:r,createDialogContent:a,canCreate:!1,canDelete:s,deleteMessage:i})}function Fbe({onClose:t}){const{toast:e}=br(),{createVolume:r,mutationLoading:n}=Nr(),[s,i]=E.useState(""),[a,l]=E.useState("50"),[c,d]=E.useState("Mi"),f=j8(),p=()=>`${a}${c}`,m=async()=>{if(!s.trim()||!f||!a){e({title:"Invalid input",description:"Please fill in all required fields",variant:"destructive"});return}const g=parseInt(a);if(isNaN(g)){e({title:"Invalid size",description:"Please enter a valid number",variant:"destructive"});return}if(c==="Mi"&&(g<50||g>10240)){e({title:"Invalid size",description:"Size must be between 50Mi and 10240Mi (10Gi)",variant:"destructive"});return}if(c==="Gi"&&(g<1||g>10)){e({title:"Invalid size",description:"Size must be between 1Gi and 10Gi",variant:"destructive"});return}try{await r({values:{userId:f,name:s,size:p()}}),t()}catch(y){e({title:"Failed to create volume",description:y instanceof Error?y.message:"An unknown error occurred",variant:"destructive"})}};return o.jsxs(un,{className:"border border-primary/20 shadow-lg sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Create New Volume"}),o.jsx(fs,{children:"Create a persistent volume for your applications"})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Xe,{htmlFor:"volume-name",children:"Volume Name"}),o.jsx(tt,{id:"volume-name",placeholder:"my-data-volume",value:s,onChange:g=>i(g.target.value),className:"border-primary/20 focus-visible:ring-primary/30"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Xe,{htmlFor:"size",children:"Size"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(tt,{id:"size-value",type:"number",min:c==="Mi"?"50":"1",max:c==="Mi"?"10240":"10",value:a,onChange:g=>l(g.target.value),className:"border-primary/20 focus-visible:ring-primary/30 flex-1",placeholder:c==="Mi"?"50":"1"}),o.jsxs(ja,{value:c,onValueChange:d,children:[o.jsx(Wi,{className:"border-primary/20 w-24",children:o.jsx(Ta,{})}),o.jsxs(Gi,{children:[o.jsx(bn,{value:"Mi",children:"Mi"}),o.jsx(bn,{value:"Gi",children:"Gi"})]})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Minimum 50Mi, Maximum 10Gi"})]})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:t,className:"border-primary/20",children:"Cancel"}),o.jsx(le,{onClick:m,disabled:n,className:"bg-gradient-to-r from-primary to-primary/90",children:n?"Creating...":"Create Volume"})]})]})}function zbe(){const{volumes:t,deleteResource:e}=Nr(),{toast:r}=br(),{volumeUsageMap:n}=DA(),s=(c,d)=>{const f=n[c.id]||{isInUse:!1,appNames:[]},{isInUse:p,appNames:m}=f,g=a(c);return o.jsx(_v,{resource:c,name:c.values.name,icon:Es,onDelete:g?d:void 0,additionalContent:o.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zs,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm font-medium",children:c.values.size})]}),p&&o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"text-muted-foreground",children:"Used by:"}),o.jsx("span",{className:"font-medium text-primary",children:m.length>1?`${m.length} apps`:m[0]})]})]})})},c.id)},i=async c=>{const d=t.find(f=>f.id===c);if(!d)return!1;try{const f=await e(c);return f&&r({title:"Success",description:`Volume "${d.values.name}" deleted successfully`}),f}catch(f){return r({title:"Error deleting volume",description:f instanceof Error?f.message:"An unknown error occurred",variant:"destructive"}),!1}},a=c=>{const d=n[c.id]||{isInUse:!1},f=c.status==="synced"||c.status==="backoff";return!d.isInUse&&f},l=c=>n[c.id]?"This volume is currently being used by one or more applications and cannot be deleted. Please remove the volume references from the applications first.":`Are you sure you want to delete "${c.values.name}"? This action cannot be undone.`;return o.jsx(bv,{resourceType:"Volume",title:"Your Volumes",description:"Manage persistent storage volumes for your applications.",emptyTitle:"No volumes found",emptyDescription:"Create your first volume to provide persistent storage for your applications.",addLabel:"Create New Volume",addDescription:"Add persistent storage",icon:Es,basePath:"/dashboard/volumes",filter:c=>c.chart_name===ks.VOLUME,renderCard:s,createDialogContent:c=>o.jsx(Fbe,{onClose:c}),onDelete:i,canDelete:a,deleteMessage:l})}const _k=[{label:"Too short",color:"bg-destructive",text:"text-destructive"},{label:"Weak",color:"bg-orange-500",text:"text-orange-500"},{label:"Fair",color:"bg-amber-500",text:"text-amber-500"},{label:"Good",color:"bg-emerald-500",text:"text-emerald-500"},{label:"Strong",color:"bg-emerald-600",text:"text-emerald-600"}];function Ube(t){if(!t)return 0;if(t.length<8)return 1;let e=1;return t.length>=12&&e++,/[A-Z]/.test(t)&&e++,/[0-9]/.test(t)&&e++,/[^A-Za-z0-9]/.test(t)&&e++,Math.min(e,4)}function Vbe({onClose:t}){const{toast:e}=br(),[r,n]=E.useState(""),[s,i]=E.useState(""),[a,l]=E.useState(!1),[c,d]=E.useState(!1),{changePassword:f,isLoading:p,isSuccess:m,isError:g,error:y}=C8(),x=Ube(r),w=async _=>{if(_.preventDefault(),r.length<8){e({title:"Password is too short",description:"Use at least 8 characters to keep your account secure.",variant:"destructive"});return}if(r!==s){e({title:"Passwords don't match",description:"Please re-enter both passwords.",variant:"destructive"});return}await f(r)};return E.useEffect(()=>{m&&(e({title:"Password updated",description:"Your password has been changed successfully."}),n(""),i(""),t())},[m,t,e]),o.jsxs(un,{className:"border border-primary/20 shadow-lg sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Change password"}),o.jsx(fs,{children:"Pick a strong password you don't use anywhere else."})]}),o.jsxs("form",{onSubmit:w,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"newPassword",children:"New password"}),o.jsxs("div",{className:"relative",children:[o.jsx(tt,{id:"newPassword",type:a?"text":"password",value:r,onChange:_=>n(_.target.value),placeholder:"At least 8 characters",className:"border-primary/20 pr-10 focus-visible:ring-primary/30",required:!0,autoFocus:!0}),o.jsx("button",{type:"button",onClick:()=>l(_=>!_),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground","aria-label":a?"Hide password":"Show password",children:a?o.jsx(ol,{className:"h-4 w-4"}):o.jsx(ll,{className:"h-4 w-4"})})]}),r.length>0&&o.jsxs("div",{className:"space-y-1.5 pt-1",children:[o.jsx("div",{className:"flex gap-1.5",children:[0,1,2,3].map(_=>o.jsx("span",{className:we("h-1 flex-1 rounded-full transition-colors",_<x?_k[x].color:"bg-muted")},_))}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:o.jsx("span",{className:_k[x].text,children:_k[x].label})})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"confirmPassword",children:"Confirm new password"}),o.jsxs("div",{className:"relative",children:[o.jsx(tt,{id:"confirmPassword",type:c?"text":"password",value:s,onChange:_=>i(_.target.value),placeholder:"Re-enter your new password",className:"border-primary/20 pr-10 focus-visible:ring-primary/30",required:!0}),o.jsx("button",{type:"button",onClick:()=>d(_=>!_),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground","aria-label":c?"Hide password":"Show password",children:c?o.jsx(ol,{className:"h-4 w-4"}):o.jsx(ll,{className:"h-4 w-4"})})]})]}),g&&o.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-sm text-destructive",children:[o.jsx(os,{className:"mt-0.5 h-4 w-4 shrink-0"}),o.jsx("span",{children:Ib(y)})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:t,className:"border-primary/20",children:"Cancel"}),o.jsx(le,{type:"submit",disabled:p,className:"bg-gradient-to-r from-primary to-primary/90",children:p?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Updating…"]}):"Update password"})]})]})]})}function bk({icon:t,label:e,value:r,mono:n}){return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(t,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:e}),o.jsx("p",{className:we("truncate text-sm font-medium",n&&"font-mono"),children:r})]})]})}function Hbe(){const t=yl(),[e,r]=E.useState(!1),n=()=>{var c,d,f;if(!t)return"U";const a=(c=t.displayName)==null?void 0:c.trim();if(!a)return((f=(d=t.email)==null?void 0:d[0])==null?void 0:f.toUpperCase())??"U";const l=a.split(/\s+/);return`${l[0].charAt(0)}${l.length>1?l[l.length-1].charAt(0):""}`.toUpperCase()},s=()=>{const a=["bg-emerald-600","bg-blue-600","bg-amber-600","bg-rose-600","bg-indigo-600"];if(!t)return a[0];const l=t.id.split("").reduce((c,d)=>c+d.charCodeAt(0),0);return a[l%a.length]};if(!t)return o.jsxs("div",{className:"space-y-8",children:[o.jsx(Gr,{className:"h-24 w-full rounded-xl"}),o.jsx("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-3",children:[...Array(3)].map((a,l)=>o.jsxs("div",{className:"space-y-4 rounded-xl border border-primary/10 p-6",children:[o.jsx(Gr,{className:"h-5 w-32"}),o.jsx(Gr,{className:"h-4 w-full"}),o.jsx(Gr,{className:"h-4 w-2/3"})]},l))})]});const i=new Date(t.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return o.jsxs("div",{className:"space-y-8",children:[o.jsx(Rn,{title:"Profile",description:"Manage your account, security, and preferences."}),o.jsx("div",{className:"rounded-xl border border-primary/10 bg-card p-6 shadow-sm",children:o.jsxs("div",{className:"flex flex-col gap-6 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"flex items-center gap-5",children:[o.jsxs("div",{className:"relative",children:[o.jsx(uT,{className:"h-20 w-20 border-2 border-primary/20",children:o.jsx(dT,{className:`text-xl font-bold text-white ${s()}`,children:n()})}),o.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 rounded-full border-2 border-background bg-green-500 p-1",children:o.jsx("div",{className:"h-2 w-2 rounded-full"})})]}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"truncate text-2xl font-semibold",children:t.displayName||"User"}),o.jsxs("p",{className:"mt-0.5 flex items-center gap-1.5 text-sm text-muted-foreground",children:[o.jsx(Sc,{className:"h-3.5 w-3.5"}),o.jsx("span",{className:"truncate",children:t.email})]}),o.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[o.jsxs(Lt,{variant:"outline",className:"gap-1 border-emerald-500/30 bg-emerald-500/5 text-emerald-600 dark:text-emerald-400",children:[o.jsx(Wee,{className:"h-3 w-3"}),t.isAnonymous?"Guest account":"Registered account"]}),t.roles.map(a=>o.jsx(Lt,{variant:"outline",className:"text-xs",children:a},a))]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 text-sm text-muted-foreground sm:items-end",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(bj,{className:"h-4 w-4"}),"Member since ",i]}),o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(An,{className:"h-4 w-4"}),t.locale||"Language not set"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-3",children:[o.jsxs("div",{className:"rounded-xl border border-primary/10 bg-card p-6 shadow-sm transition-shadow hover:shadow-md",children:[o.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[o.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-primary/10",children:o.jsx(B0,{className:"h-4 w-4 text-primary"})}),o.jsx("h3",{className:"text-base font-semibold",children:"Account details"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx(bk,{icon:Sc,label:"Email address",value:t.email??"—"}),o.jsx(bk,{icon:B0,label:"Account type",value:t.isAnonymous?"Guest":"Registered"}),o.jsx(bk,{icon:wa,label:"Default role",value:t.defaultRole||"user"})]})]}),o.jsxs("div",{className:"rounded-xl border border-primary/10 bg-card p-6 shadow-sm transition-shadow hover:shadow-md",children:[o.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[o.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-primary/10",children:o.jsx(od,{className:"h-4 w-4 text-primary"})}),o.jsx("h3",{className:"text-base font-semibold",children:"Security"})]}),o.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Update your password to keep your account protected."}),o.jsxs(le,{variant:"outline",className:"w-full justify-start border-primary/20",onClick:()=>r(!0),children:[o.jsx(Gn,{className:"mr-2 h-4 w-4"}),"Change password"]})]}),o.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-card/60 p-6",children:[o.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",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-full bg-muted",children:o.jsx(gi,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx("h3",{className:"text-base font-semibold",children:"Personal access tokens"})]}),o.jsx(Lt,{variant:"outline",className:"border-amber-500/30 bg-amber-500/5 text-amber-600 dark:text-amber-400",children:"Coming soon"})]}),o.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Programmatic access tokens aren't available yet. They'll let you automate workflows securely from the CLI or CI."}),o.jsxs(le,{variant:"outline",className:"w-full justify-start",disabled:!0,children:[o.jsx(Gn,{className:"mr-2 h-4 w-4"}),"Generate token"]})]})]}),o.jsx(hs,{open:e,onOpenChange:r,children:o.jsx(Vbe,{onClose:()=>r(!1)})})]})}async function _l(t,e,r){const n=await fetch(`${Df}${t}`,{...r,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...(r==null?void 0:r.headers)||{}}}),s=await n.json().catch(()=>({}));if(!n.ok)throw new Error((s==null?void 0:s.error)||`Request failed (${n.status})`);return s.data}function sq(t){return _l("/v1/teams",t)}function qbe(t,e){return _l(`/v1/teams/${e}`,t)}function Wbe(t,e){return _l("/v1/teams",t,{method:"POST",body:JSON.stringify({name:e})})}function Gbe(t,e,r){return _l(`/v1/teams/${e}/members`,t,{method:"POST",body:JSON.stringify(r)})}function Kbe(t){return _l("/v1/invites",t)}function Ybe(t,e){return _l(`/v1/invites/${e}/accept`,t,{method:"POST"})}function Qbe(t,e){return _l(`/v1/invites/${e}/decline`,t,{method:"POST"})}function Xbe(t,e,r){return _l(`/v1/teams/${e}/members/${r}`,t,{method:"DELETE"})}function Zbe(t,e){return _l(`/v1/teams/${e}`,t,{method:"DELETE"})}const Jbe={free:{label:"Free plan",className:"border-blue-500/30 bg-blue-500/5 text-blue-600 dark:text-blue-400"},active:{label:"Active",className:"border-emerald-500/30 bg-emerald-500/5 text-emerald-600 dark:text-emerald-400"},past_due:{label:"Payment failed",className:"border-red-500/30 bg-red-500/5 text-red-600 dark:text-red-400"}};function wk(t){if(!t||t===0)return"$0.00";if(t>=.01)return t.toLocaleString("en-US",{style:"currency",currency:"USD"});const e=t>=1e-4?4:6;return"$"+t.toFixed(e).replace(/0+$/,"").replace(/\.$/,"")}const ewe={app:"Server",database:"Database",bucket:"S3 bucket",volume:"Block storage"};function twe(){const t=bo(),{toast:e}=br(),[r,n]=E.useState(null),[s,i]=E.useState(null),[a,l]=E.useState(!0),[c,d]=E.useState(null),[f,p]=E.useState(null),m=typeof window<"u"?window.location.origin+"/dashboard/billing":"",g=E.useCallback(async()=>{if(t)try{const[k,N]=await Promise.all([$V(t),BV(t)]);n(k),i(N)}catch(k){console.error("billing load error",k),e({title:"Couldn't load billing",description:k instanceof Error?k.message:"Unknown error",variant:"destructive"})}finally{l(!1)}},[t,e]);E.useEffect(()=>{g()},[g]),E.useEffect(()=>{if(!t)return;let k=!1;return sq(t).then(N=>{k||p(N.find(j=>j.role==="member")??null)}).catch(()=>{k||p(null)}),()=>{k=!0}},[t]);const y=async()=>{if(t){d("card");try{const{url:k}=await mme(t,m,m);window.location.href=k}catch(k){e({title:"Couldn't start card setup",description:k instanceof Error?k.message:"Unknown error",variant:"destructive"}),d(null)}}},x=async()=>{if(t){d("portal");try{const{url:k}=await gme(t,m);window.location.href=k}catch(k){e({title:"Couldn't open billing portal",description:k instanceof Error?k.message:"Unknown error",variant:"destructive"}),d(null)}}},w=r==null?void 0:r.account,_=w?Jbe[w.status]:void 0,S=r==null?void 0:r.free_tier;return a?o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Billing & Usage",description:"Pay-as-you-go pricing, metered by the hour."}),o.jsx(Gr,{className:"h-40 w-full rounded-xl"}),o.jsx(Gr,{className:"h-64 w-full rounded-xl"})]}):o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Billing & Usage",description:"Pay-as-you-go — metered by the hour across all your resources."}),f&&o.jsx($e,{className:"border-primary/20 bg-gradient-to-r from-primary/5 via-background to-background",children:o.jsxs(Be,{className:"flex items-start gap-3 p-4",children:[o.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(dc,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{className:"min-w-0 flex-1 text-sm",children:[o.jsxs("p",{className:"font-medium",children:["You're a member of ",o.jsx("span",{className:"font-semibold",children:f.name})]}),o.jsx("p",{className:"text-muted-foreground",children:"This team's resources are billed to the team owner, not to this account — you won't be charged for the shared project."})]}),o.jsx(le,{variant:"outline",size:"sm",className:"shrink-0",asChild:!0,children:o.jsxs(ba,{to:"/dashboard/teams",children:["View teams ",o.jsx(ei,{className:"ml-1.5 h-3.5 w-3.5"})]})})]})}),o.jsx($e,{children:o.jsxs(Be,{className:"p-6",children:[o.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-full bg-primary/10",children:o.jsx(od,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Account status"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("p",{className:"text-xl font-semibold",children:(_==null?void 0:_.label)??"—"}),_&&o.jsx(Lt,{variant:"outline",className:_.className,children:_.label})]})]})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Payment method"}),o.jsx("p",{className:"font-medium",children:(w==null?void 0:w.payment_method)||"No card on file"})]}),S&&o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Free allowance"}),o.jsxs("p",{className:"font-medium",children:[S.app_count,"× ",S.app_tier]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[o.jsxs(le,{onClick:y,disabled:c!==null,className:"bg-gradient-to-r from-primary to-primary/90",children:[c==="card"?o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(KB,{className:"mr-2 h-4 w-4"}),w!=null&&w.payment_method?"Update payment method":"Add payment method"]}),(w==null?void 0:w.stripe_customer_id)&&o.jsxs(le,{variant:"outline",onClick:x,disabled:c!==null,children:[c==="portal"?o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(al,{className:"mr-2 h-4 w-4"}),"Manage billing"]})]})]}),((w==null?void 0:w.status)==="past_due"||(w==null?void 0:w.status)==="free"&&!(w!=null&&w.payment_method))&&o.jsxs("div",{className:"mt-4 flex items-start gap-2 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-sm text-amber-600 dark:text-amber-400",children:[o.jsx(Ej,{className:"mt-0.5 h-4 w-4 shrink-0"}),(w==null?void 0:w.status)==="past_due"?o.jsx("span",{children:"Your servers are paused until the outstanding invoice is settled."}):o.jsxs("span",{children:["You can run ",(S==null?void 0:S.app_count)??1," free server. Add a payment method to deploy more servers, databases, and S3 buckets."]})]})]})}),o.jsxs($e,{children:[o.jsx(ot,{children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(MM,{className:"h-5 w-5 text-primary"}),"Local payment methods"]})}),o.jsxs(Be,{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(qre,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),o.jsxs("div",{className:"text-sm",children:[o.jsx("p",{className:"font-medium",children:"Vodafone Cash"}),o.jsxs("p",{className:"text-muted-foreground",children:["Send your payment to"," ",o.jsx("a",{href:"tel:+201012350680",className:"font-medium text-primary underline-offset-4 hover:underline",children:"+201012350680"})]})]})]}),o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(XB,{className:"mt-0.5 h-5 w-5 shrink-0 text-emerald-600 dark:text-emerald-400"}),o.jsxs("div",{className:"text-sm",children:[o.jsx("p",{className:"font-medium",children:"Confirm your payment"}),o.jsxs("p",{className:"text-muted-foreground",children:["Send a screenshot of your payment to our WhatsApp"," ",o.jsx("a",{href:"https://wa.me/15145064526?text=Hello%2C%20I%20made%20a%20payment%20and%20would%20like%20to%20activate%20my%20plan.",target:"_blank",rel:"noreferrer",className:"font-medium text-primary underline-offset-4 hover:underline",children:"+15145064526"})," ","and we'll activate your plan."]})]})]}),o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(MM,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),o.jsxs("div",{className:"text-sm",children:[o.jsx("p",{className:"font-medium",children:"Other local methods"}),o.jsxs("p",{className:"text-muted-foreground",children:["We also support other local methods — contact us on"," ",o.jsx("a",{href:"https://wa.me/15145064526?text=Hello%2C%20I%20would%20like%20to%20ask%20about%20local%20payment%20methods.",target:"_blank",rel:"noreferrer",className:"font-medium text-primary underline-offset-4 hover:underline",children:"WhatsApp"})," ","to see what's available, inshAllah."]})]})]})]})]}),o.jsxs($e,{children:[o.jsx(ot,{children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(hc,{className:"h-5 w-5 text-primary"}),"Ongoing usage"]})}),o.jsxs(Be,{children:[o.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4 md:grid-cols-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Current run-rate"}),o.jsxs("p",{className:"text-2xl font-bold",children:[wk((s==null?void 0:s.hourly_rate_usd)??0),o.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/hour"})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Accrued this month"}),o.jsx("p",{className:"text-2xl font-bold",children:wk((s==null?void 0:s.accrued_usd)??0)})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Billing period"}),o.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.period)??"—"})]})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[o.jsx("th",{className:"py-2 pr-4 font-medium",children:"Resource"}),o.jsx("th",{className:"py-2 pr-4 font-medium",children:"Tier"}),o.jsx("th",{className:"py-2 pr-4 font-medium",children:"Count"}),o.jsx("th",{className:"py-2 pr-4 font-medium",children:"Rate"})]})}),o.jsx("tbody",{children:((s==null?void 0:s.live)??[]).length>0?((s==null?void 0:s.live)??[]).map(k=>o.jsxs("tr",{className:"border-b border-muted",children:[o.jsx("td",{className:"py-2 pr-4",children:ewe[k.type]??k.type}),o.jsx("td",{className:"py-2 pr-4",children:k.type==="volume"?"per GB":k.tier}),o.jsx("td",{className:"py-2 pr-4",children:k.type==="volume"?`${k.count} GB`:k.count}),o.jsxs("td",{className:"py-2 pr-4",children:[wk(k.hourly_usd),"/hr"]})]},`${k.type}-${k.tier}`)):o.jsx("tr",{children:o.jsx("td",{colSpan:4,className:"py-6 text-center text-muted-foreground",children:"No running resources detected."})})})]})})]})]})]})}const rwe=Et`
|
||
subscription GetGenaiApikeysStreamingSubscription($userId: String) {
|
||
ghaymah_cloud_genai_apikeys(
|
||
where: {
|
||
user_id: { _eq: $userId }
|
||
}
|
||
) {
|
||
key_id
|
||
key_name
|
||
key_value
|
||
litellm_user_id
|
||
max_budget
|
||
user_id
|
||
}
|
||
}
|
||
`,iq=E.createContext(void 0);function nwe({children:t}){const e=yl(),r=bo(),n=e==null?void 0:e.id,[s,i]=E.useState([]),{data:a,loading:l,error:c}=wg(rwe,{variables:{userId:n},skip:!n||!r});E.useEffect(()=>{c&&console.error("GenAI keys subscription error:",c)},[c]),E.useEffect(()=>{a!=null&&a.ghaymah_cloud_genai_apikeys&&(jt("GenAI",`Received ${a.ghaymah_cloud_genai_apikeys.length} GenAI keys`,a.ghaymah_cloud_genai_apikeys),i(a.ghaymah_cloud_genai_apikeys))},[a]),E.useEffect(()=>{r||(jt("Auth","Access token removed, clearing GenAI data"),i([]))},[r]);const d={genAIKeys:s,loading:l,error:c};return o.jsx(iq.Provider,{value:d,children:t})}function swe(){const t=E.useContext(iq);if(t===void 0)throw new Error("useGenAI must be used within a GenAIProvider");return t}const no="https://genai.ghaymah.systems",Sk=[{id:"Kimi",name:"Kimi-K3",apiModel:"Kimi-K3",description:"Moonshot AI's flagship model with a 1M-token context window. Excels at long-context understanding, reasoning, and multimodal (image) input.",contextWindow:"1M tokens",multimodal:!0,color:"text-blue-500 bg-blue-50 dark:bg-blue-950/30"},{id:"deepseekv4",name:"DeepSeek-V4-Flash",apiModel:"DeepSeek-V4-Flash",description:"A fast, efficient Mixture-of-Experts (MoE) model optimized for low-latency text inference with a 1M-token context window.",contextWindow:"1M tokens",multimodal:!1,color:"text-orange-500 bg-orange-50 dark:bg-orange-950/30"},{id:"GLM53",name:"GLM-5.3-Flash",apiModel:"GLM-5.3-Flash",description:"Zhipu AI's flash reasoning model — frontier-level intelligence at flash speed with strong logic and math.",contextWindow:"1M tokens",multimodal:!1,color:"text-purple-500 bg-purple-50 dark:bg-purple-950/30"},{id:"gemma4",name:"gemma-4-31B-it",apiModel:"gemma-4-31B-it",description:"Google's lightweight open model with a 256K context window. Supports both text and multimodal (image) input.",contextWindow:"256K tokens",multimodal:!0,color:"text-green-500 bg-green-50 dark:bg-green-950/30"}];function iwe(t,e,r){return t==="python"?r==="multimodal"?`import os
|
||
import base64
|
||
from openai import OpenAI
|
||
|
||
client = OpenAI(
|
||
api_key=os.environ.get("GHAYMAH_API_KEY", "PASTE_YOUR_KEY_HERE"),
|
||
base_url="${no}",
|
||
)
|
||
|
||
# Read the local image and embed it as a base64 data URI
|
||
with open("red_panda.jpg", "rb") as f:
|
||
b64 = base64.b64encode(f.read()).decode()
|
||
|
||
response = client.chat.completions.create(
|
||
model="${e}",
|
||
messages=[
|
||
{
|
||
"role": "user",
|
||
"content": [
|
||
{"type": "text", "text": "What's in this image?"},
|
||
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}},
|
||
],
|
||
}
|
||
],
|
||
)
|
||
|
||
print(response.choices[0].message.content)
|
||
`:`import os
|
||
from openai import OpenAI
|
||
|
||
client = OpenAI(
|
||
api_key=os.environ.get("GHAYMAH_API_KEY", "PASTE_YOUR_KEY_HERE"),
|
||
base_url="${no}",
|
||
)
|
||
|
||
response = client.chat.completions.create(
|
||
model="${e}",
|
||
messages=[
|
||
{"role": "user", "content": "Explain AI in simple terms"}
|
||
],
|
||
)
|
||
|
||
print(response.choices[0].message.content)
|
||
`:t==="javascript"?r==="multimodal"?`import OpenAI from "openai";
|
||
import fs from "fs";
|
||
|
||
const openai = new OpenAI({
|
||
apiKey: process.env.GHAYMAH_API_KEY || "PASTE_YOUR_KEY_HERE",
|
||
baseURL: "${no}",
|
||
});
|
||
|
||
// Read the local image and embed it as a base64 data URI
|
||
const b64 = fs.readFileSync("red_panda.jpg").toString("base64");
|
||
|
||
const response = await openai.chat.completions.create({
|
||
model: "${e}",
|
||
messages: [
|
||
{
|
||
role: "user",
|
||
content: [
|
||
{ type: "text", text: "What's in this image?" },
|
||
{ type: "image_url", image_url: { url: \`data:image/jpeg;base64,\${b64}\` } },
|
||
],
|
||
},
|
||
],
|
||
});
|
||
|
||
console.log(response.choices[0].message.content);
|
||
`:`import OpenAI from "openai";
|
||
|
||
const openai = new OpenAI({
|
||
apiKey: process.env.GHAYMAH_API_KEY || "PASTE_YOUR_KEY_HERE",
|
||
baseURL: "${no}",
|
||
});
|
||
|
||
const response = await openai.chat.completions.create({
|
||
model: "${e}",
|
||
messages: [
|
||
{ role: "user", content: "Explain AI in simple terms" },
|
||
],
|
||
});
|
||
|
||
console.log(response.choices[0].message.content);
|
||
`:r==="multimodal"?`# Encode a local image to base64 first:
|
||
# B64=$(base64 -w 0 red_panda.jpg)
|
||
|
||
curl ${no}/v1/chat/completions \\
|
||
-H "Authorization: Bearer $GHAYMAH_API_KEY" \\
|
||
-H "Content-Type: application/json" \\
|
||
-d '{
|
||
"model": "${e}",
|
||
"messages": [
|
||
{
|
||
"role": "user",
|
||
"content": [
|
||
{"type": "text", "text": "What's in this image?"},
|
||
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,'"$B64"'"}}
|
||
]
|
||
}
|
||
]
|
||
}'
|
||
`:`curl ${no}/v1/chat/completions \\
|
||
-H "Authorization: Bearer $GHAYMAH_API_KEY" \\
|
||
-H "Content-Type: application/json" \\
|
||
-d '{
|
||
"model": "${e}",
|
||
"messages": [
|
||
{"role": "user", "content": "Explain AI in simple terms"}
|
||
]
|
||
}'
|
||
`}function awe({code:t}){const[e,r]=E.useState(!1),n=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch{}};return o.jsxs("div",{className:"overflow-hidden rounded-lg border border-border bg-zinc-950",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-4 py-2",children:[o.jsxs("span",{className:"flex items-center gap-2 text-xs text-zinc-400",children:[o.jsx(Bs,{className:"h-3.5 w-3.5"}),"example"]}),o.jsxs(le,{variant:"ghost",size:"sm",className:"h-7 px-2 text-zinc-300 hover:bg-zinc-800 hover:text-white",onClick:n,children:[e?o.jsx(Lr,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-400"}):o.jsx(cn,{className:"mr-1.5 h-3.5 w-3.5"}),e?"Copied":"Copy"]})]}),o.jsx("pre",{className:"overflow-x-auto p-4 text-xs leading-relaxed text-zinc-100",children:o.jsx("code",{children:t})})]})}function owe({model:t}){return o.jsxs($e,{className:"flex h-full flex-col border-primary/10 bg-card shadow-sm transition-shadow hover:shadow-md",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:we("flex h-9 w-9 items-center justify-center rounded-lg",t.color),children:o.jsx(il,{className:"h-5 w-5"})}),o.jsx(dt,{className:"text-base font-semibold",children:t.name})]}),o.jsxs("div",{className:"flex flex-wrap gap-1.5 pt-1",children:[t.multimodal&&o.jsxs(Lt,{variant:"secondary",className:"gap-1 text-xs",children:[o.jsx(Jx,{className:"h-3 w-3"})," Multimodal"]}),o.jsx(Lt,{variant:"outline",className:"font-mono text-xs",children:t.apiModel})]})]}),o.jsxs(Be,{className:"flex flex-1 flex-col",children:[o.jsx(rn,{className:"text-sm text-muted-foreground",children:t.description}),o.jsx("div",{className:"mt-auto flex items-center justify-between pt-3 text-xs text-muted-foreground",children:o.jsxs("span",{children:["Context: ",t.contextWindow]})})]})]})}function lwe(){var M,z,R,B;const{genAIKeys:t,loading:e,error:r}=swe(),[n,s]=E.useState("apiKeys"),[i,a]=E.useState(Sk[0]),[l,c]=E.useState("python"),[d,f]=E.useState("text"),[p,m]=E.useState(!1),[g,y]=E.useState(!1),[x,w]=E.useState({userInfo:null,keys:[],loading:!1,error:null});E.useEffect(()=>{(async()=>{if(!(!t||t.length===0||n!=="usage")){w(F=>({...F,loading:!0,error:null}));try{const F=await fetch(`${no}/api/v1/user/info?user_id=${t[0].litellm_user_id}`,{headers:{Authorization:`Bearer ${t[0].key_value}`}});if(!F.ok)throw new Error("Failed to fetch usage data");const K=await F.json();w({userInfo:K.user_info??null,keys:K.keys??[],loading:!1,error:null})}catch(F){w(K=>({...K,loading:!1,error:F instanceof Error?F.message:"Unknown error occurred"}))}}})()},[t,n]);const _=async V=>{await navigator.clipboard.writeText(V),m(!0),setTimeout(()=>m(!1),2e3)},S=async V=>{await navigator.clipboard.writeText(V),y(!0),setTimeout(()=>y(!1),2e3)};if(e)return o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(kt,{className:"h-8 w-8 animate-spin text-primary"})});if(r)return o.jsx("div",{className:"p-8 text-center",children:o.jsxs("p",{className:"text-red-500",children:["Error: ",r.message]})});const k=((M=x.userInfo)==null?void 0:M.spend)??0,N=((z=x.userInfo)==null?void 0:z.max_budget)??1,j=Math.min(k/N*100,100),T=((R=x.userInfo)==null?void 0:R.rpm_limit)??"Unlimited",D=Object.entries(((B=x.userInfo)==null?void 0:B.model_spend)??{}).map(([V,F])=>({model:V,spend:Number(F)})).sort((V,F)=>F.spend-V.spend),I=V=>V?new Date(V).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"N/A",L=i,$=L.multimodal,Q=$?d:"text";return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Ghaymah GenAI",description:"One OpenAI-compatible API for every model — chat, reasoning, and image input."}),o.jsx($e,{className:"border-primary/20 bg-gradient-to-r from-primary/5 via-background to-background",children:o.jsxs(Be,{className:"flex flex-col gap-4 p-5 md:flex-row md:items-center md:justify-between",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(tF,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Switch models in one line"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Every model uses the same endpoint. Just change the"," ",o.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-xs",children:"model"})," field in your request — no new SDK or URL needed."]})]})]}),o.jsxs(le,{variant:"outline",className:"shrink-0 border-primary/20",onClick:()=>s("code"),children:["View examples ",o.jsx(ei,{className:"ml-2 h-4 w-4"})]})]})}),o.jsxs(QH,{value:n,onValueChange:s,children:[o.jsxs(AA,{className:"grid grid-cols-4 w-full mb-6",children:[o.jsxs(Bu,{value:"apiKeys",className:"flex items-center gap-1",children:[o.jsx(gg,{className:"h-4 w-4"}),o.jsx("span",{children:"API Keys"})]}),o.jsxs(Bu,{value:"models",className:"flex items-center gap-1",children:[o.jsx(Wh,{className:"h-4 w-4"}),o.jsx("span",{children:"Models"})]}),o.jsxs(Bu,{value:"code",className:"flex items-center gap-1",children:[o.jsx(JE,{className:"h-4 w-4"}),o.jsx("span",{children:"Code Examples"})]}),o.jsxs(Bu,{value:"usage",className:"flex items-center gap-1",children:[o.jsx(Vte,{className:"h-4 w-4"}),o.jsx("span",{children:"Usage"})]})]}),o.jsxs(Fu,{value:"apiKeys",className:"space-y-6",children:[o.jsxs($e,{className:"border-primary/10",children:[o.jsxs(ot,{children:[o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(Bs,{className:"h-5 w-5 text-primary"}),"Connection Information"]}),o.jsx(rn,{children:"Use this base URL for every model. The base URL never changes when you switch models."})]}),o.jsx(Be,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-full overflow-x-auto rounded-md border bg-muted px-3 py-2 font-mono text-sm",children:no}),o.jsx(le,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>S(no),children:g?o.jsx(Lr,{className:"h-4 w-4 text-green-500"}):o.jsx(cn,{className:"h-4 w-4"})})]})})]}),t.length>0?o.jsx("div",{className:"space-y-4",children:t.map((V,F)=>o.jsx($e,{className:"border-primary/20",children:o.jsxs(Be,{className:"space-y-2 p-5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"API Key"}),V.key_name&&o.jsx(Lt,{variant:"secondary",children:V.key_name})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-full overflow-x-auto rounded-md border bg-muted/50 px-3 py-2 font-mono text-sm",children:V.key_value}),o.jsx(le,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>_(V.key_value),children:p?o.jsx(Lr,{className:"h-4 w-4 text-green-500"}):o.jsx(cn,{className:"h-4 w-4"})})]})]})},`${V.key_id}-${F}`))}):o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-14 text-center",children:[o.jsx(gg,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),o.jsx("p",{className:"font-medium",children:"No API keys yet"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Create an API key to start calling the GenAI API."})]})}),o.jsxs($e,{className:"border-primary/10",children:[o.jsx(ot,{children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(od,{className:"h-5 w-5 text-emerald-500"}),"API Key Security"]})}),o.jsx(Be,{children:o.jsxs("ul",{className:"space-y-2 list-disc pl-5 text-sm",children:[o.jsx("li",{children:"Keep your API keys secret and never commit them to source control."}),o.jsx("li",{children:"Store keys in environment variables in production."}),o.jsxs("li",{children:["All traffic uses the single ",o.jsx("span",{className:"font-mono",children:no})," endpoint."]})]})})]})]}),o.jsxs(Fu,{value:"models",className:"space-y-6",children:[o.jsx($e,{className:"border-primary/20 bg-primary/5",children:o.jsxs(Be,{className:"flex items-start gap-3 p-4",children:[o.jsx(ti,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"How to use a different model"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Copy the ",o.jsx("span",{className:"font-mono text-xs",children:"model"})," name from a card below and set it in the ",o.jsx("span",{className:"font-mono text-xs",children:"model"})," field of your request. Models marked"," ",o.jsxs(Lt,{variant:"secondary",className:"gap-1 text-xs",children:[o.jsx(Jx,{className:"h-3 w-3"})," Multimodal"]})," ","also accept images."]})]})]})}),o.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Sk.map(V=>o.jsx(owe,{model:V},V.id))})]}),o.jsxs(Fu,{value:"code",className:"space-y-6",children:[o.jsx($e,{className:"border-primary/20 bg-primary/5",children:o.jsxs(Be,{className:"flex items-start gap-3 p-4",children:[o.jsx(JE,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Pick a model below to generate ready-to-use code. The only thing that changes between models is the ",o.jsx("span",{className:"font-mono text-xs",children:"model"})," field."]})]})}),o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium",children:"Model"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:Sk.map(V=>o.jsxs(le,{variant:i.id===V.id?"default":"outline",size:"sm",className:"border-primary/20",onClick:()=>{a(V),f("text")},children:[V.name,V.multimodal&&o.jsx(Jx,{className:"ml-1.5 h-3.5 w-3.5"})]},V.id))})]}),o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium",children:"Language"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:["python","javascript","curl"].map(V=>o.jsx(le,{variant:l===V?"default":"outline",size:"sm",className:"border-primary/20",onClick:()=>c(V),children:V==="python"?"Python":V==="javascript"?"JavaScript":"cURL"},V))})]}),$&&o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium",children:"Input type"}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs(le,{variant:d==="text"?"default":"outline",size:"sm",className:"border-primary/20",onClick:()=>f("text"),children:[o.jsx(il,{className:"mr-1.5 h-3.5 w-3.5"})," Text only"]}),o.jsxs(le,{variant:d==="multimodal"?"default":"outline",size:"sm",className:"border-primary/20",onClick:()=>f("multimodal"),children:[o.jsx(Jx,{className:"mr-1.5 h-3.5 w-3.5"})," Text + image"]})]})]}),o.jsx(awe,{code:iwe(l,L.apiModel,Q)}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Set ",o.jsx("span",{className:"font-mono",children:"GHAYMAH_API_KEY"})," in your environment, or paste your key in place of ",o.jsx("span",{className:"font-mono",children:"PASTE_YOUR_KEY_HERE"}),". Grab a key from the"," ",o.jsx("button",{className:"text-primary underline underline-offset-2",onClick:()=>s("apiKeys"),children:"API Keys"})," ","tab."]})]}),o.jsx(Fu,{value:"usage",className:"space-y-6",children:t.length===0?o.jsx($e,{className:"border-primary/10",children:o.jsx(Be,{className:"p-6 text-center text-muted-foreground",children:"You need an API key to view usage statistics."})}):x.loading?o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(kt,{className:"h-8 w-8 animate-spin text-primary"})}):x.error?o.jsx($e,{className:"border-primary/10",children:o.jsxs(Be,{className:"p-6 text-center text-muted-foreground",children:["Error: ",x.error]})}):o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[o.jsxs($e,{className:"border-primary/10",children:[o.jsx(ot,{children:o.jsx(dt,{className:"text-sm font-medium",children:"Budget used"})}),o.jsx(Be,{children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"h-2.5 w-full rounded-full bg-muted",children:o.jsx("div",{className:"h-2.5 rounded-full bg-primary",style:{width:`${j}%`}})}),o.jsxs("span",{className:"text-2xl font-bold",children:[Math.round(j),"%"]})]})})]}),o.jsxs($e,{className:"border-primary/10",children:[o.jsx(ot,{children:o.jsx(dt,{className:"text-sm font-medium",children:"Spend"})}),o.jsx(Be,{children:o.jsxs("p",{className:"text-2xl font-bold",children:["$",k.toFixed(6)]})})]}),o.jsxs($e,{className:"border-primary/10",children:[o.jsx(ot,{children:o.jsx(dt,{className:"text-sm font-medium",children:"Requests / min"})}),o.jsx(Be,{children:o.jsx("p",{className:"text-2xl font-bold",children:T})})]})]}),D.length>0&&o.jsxs($e,{className:"border-primary/10",children:[o.jsx(ot,{children:o.jsx(dt,{children:"Model usage breakdown"})}),o.jsx(Be,{className:"space-y-2",children:D.map(V=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium",children:V.model}),o.jsxs("span",{className:"font-mono text-sm",children:["$",V.spend.toFixed(6)]})]},V.model))})]}),x.keys.length>0&&o.jsxs($e,{className:"border-primary/10",children:[o.jsx(ot,{children:o.jsx(dt,{children:"API Keys"})}),o.jsx(Be,{className:"space-y-4",children:x.keys.map((V,F)=>o.jsx("div",{className:"border-b border-primary/10 pb-4 last:border-0 last:pb-0",children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"font-medium",children:V.key_name||"Unnamed Key"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Created: ",I(V.created_at)]})]}),o.jsxs("p",{className:"text-sm",children:["RPM: ",V.rpm_limit||"Unlimited"]})]})},`${V.token}-${F}`))})]})]})})]})]})}function cwe(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const uwe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dwe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hwe={};function m3(t,e){return(hwe.jsx?dwe:uwe).test(t)}const fwe=/[ \t\n\f\r]/g;function pwe(t){return typeof t=="object"?t.type==="text"?g3(t.value):!1:g3(t)}function g3(t){return t.replace(fwe,"")===""}class Sv{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Sv.prototype.normal={};Sv.prototype.property={};Sv.prototype.space=void 0;function aq(t,e){const r={},n={};for(const s of t)Object.assign(r,s.property),Object.assign(n,s.normal);return new Sv(r,n,e)}function RN(t){return t.toLowerCase()}class ni{constructor(e,r){this.attribute=r,this.property=e}}ni.prototype.attribute="";ni.prototype.booleanish=!1;ni.prototype.boolean=!1;ni.prototype.commaOrSpaceSeparated=!1;ni.prototype.commaSeparated=!1;ni.prototype.defined=!1;ni.prototype.mustUseProperty=!1;ni.prototype.number=!1;ni.prototype.overloadedBoolean=!1;ni.prototype.property="";ni.prototype.spaceSeparated=!1;ni.prototype.space=void 0;let mwe=0;const bt=fd(),vn=fd(),DN=fd(),Ve=fd(),yr=fd(),Gu=fd(),fi=fd();function fd(){return 2**++mwe}const ON=Object.freeze(Object.defineProperty({__proto__:null,boolean:bt,booleanish:vn,commaOrSpaceSeparated:fi,commaSeparated:Gu,number:Ve,overloadedBoolean:DN,spaceSeparated:yr},Symbol.toStringTag,{value:"Module"})),kk=Object.keys(ON);class PA extends ni{constructor(e,r,n,s){let i=-1;if(super(e,r),v3(this,"space",s),typeof n=="number")for(;++i<kk.length;){const a=kk[i];v3(this,kk[i],(n&ON[a])===ON[a])}}}PA.prototype.defined=!0;function v3(t,e,r){r&&(t[e]=r)}function If(t){const e={},r={};for(const[n,s]of Object.entries(t.properties)){const i=new PA(n,t.transform(t.attributes||{},n),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),e[n]=i,r[RN(n)]=n,r[RN(i.attribute)]=n}return new Sv(e,r,t.space)}const oq=If({properties:{ariaActiveDescendant:null,ariaAtomic:vn,ariaAutoComplete:null,ariaBusy:vn,ariaChecked:vn,ariaColCount:Ve,ariaColIndex:Ve,ariaColSpan:Ve,ariaControls:yr,ariaCurrent:null,ariaDescribedBy:yr,ariaDetails:null,ariaDisabled:vn,ariaDropEffect:yr,ariaErrorMessage:null,ariaExpanded:vn,ariaFlowTo:yr,ariaGrabbed:vn,ariaHasPopup:null,ariaHidden:vn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yr,ariaLevel:Ve,ariaLive:null,ariaModal:vn,ariaMultiLine:vn,ariaMultiSelectable:vn,ariaOrientation:null,ariaOwns:yr,ariaPlaceholder:null,ariaPosInSet:Ve,ariaPressed:vn,ariaReadOnly:vn,ariaRelevant:null,ariaRequired:vn,ariaRoleDescription:yr,ariaRowCount:Ve,ariaRowIndex:Ve,ariaRowSpan:Ve,ariaSelected:vn,ariaSetSize:Ve,ariaSort:null,ariaValueMax:Ve,ariaValueMin:Ve,ariaValueNow:Ve,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function lq(t,e){return e in t?t[e]:e}function cq(t,e){return lq(t,e.toLowerCase())}const gwe=If({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Gu,acceptCharset:yr,accessKey:yr,action:null,allow:null,allowFullScreen:bt,allowPaymentRequest:bt,allowUserMedia:bt,alpha:bt,alt:null,as:null,async:bt,autoCapitalize:null,autoComplete:yr,autoFocus:bt,autoPlay:bt,blocking:yr,capture:null,charSet:null,checked:bt,cite:null,className:yr,closedBy:null,colorSpace:null,cols:Ve,colSpan:Ve,command:null,commandFor:null,content:null,contentEditable:vn,controls:bt,controlsList:yr,coords:Ve|Gu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:bt,defer:bt,dir:null,dirName:null,disabled:bt,download:DN,draggable:vn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:bt,formTarget:null,headers:yr,height:Ve,hidden:DN,high:Ve,href:null,hrefLang:null,htmlFor:yr,httpEquiv:yr,id:null,imageSizes:null,imageSrcSet:null,inert:bt,inputMode:null,integrity:null,is:null,isMap:bt,itemId:null,itemProp:yr,itemRef:yr,itemScope:bt,itemType:yr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:bt,low:Ve,manifest:null,max:null,maxLength:Ve,media:null,method:null,min:null,minLength:Ve,multiple:bt,muted:bt,name:null,nonce:null,noModule:bt,noValidate:bt,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:bt,optimum:Ve,pattern:null,ping:yr,placeholder:null,playsInline:bt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:bt,referrerPolicy:null,rel:yr,required:bt,reversed:bt,rows:Ve,rowSpan:Ve,sandbox:yr,scope:null,scoped:bt,seamless:bt,selected:bt,shadowRootClonable:bt,shadowRootCustomElementRegistry:bt,shadowRootDelegatesFocus:bt,shadowRootMode:null,shadowRootSerializable:bt,shape:null,size:Ve,sizes:null,slot:null,span:Ve,spellCheck:vn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ve,step:null,style:null,tabIndex:Ve,target:null,title:null,translate:null,type:null,typeMustMatch:bt,useMap:null,value:vn,width:Ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yr,axis:null,background:null,bgColor:null,border:Ve,borderColor:null,bottomMargin:Ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:bt,declare:bt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ve,leftMargin:Ve,link:null,longDesc:null,lowSrc:null,marginHeight:Ve,marginWidth:Ve,noResize:bt,noHref:bt,noShade:bt,noWrap:bt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ve,rules:null,scheme:null,scrolling:vn,standby:null,summary:null,text:null,topMargin:Ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:bt,disablePictureInPicture:bt,disableRemotePlayback:bt,exportParts:Gu,part:yr,prefix:null,property:null,results:Ve,security:null,unselectable:null},space:"html",transform:cq}),vwe=If({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",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:fi,accentHeight:Ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ve,amplitude:Ve,arabicForm:null,ascent:Ve,attributeName:null,attributeType:null,azimuth:Ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ve,by:null,calcMode:null,capHeight:Ve,className:yr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ve,diffuseConstant:Ve,direction:null,display:null,dur:null,divisor:Ve,dominantBaseline:null,download:bt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ve,enableBackground:null,end:null,event:null,exponent:Ve,externalResourcesRequired:null,fill:null,fillOpacity:Ve,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:Gu,g2:Gu,glyphName:Gu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ve,horizOriginX:Ve,horizOriginY:Ve,id:null,ideographic:Ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ve,k:Ve,k1:Ve,k2:Ve,k3:Ve,k4:Ve,kernelMatrix:fi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ve,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:Ve,overlineThickness:Ve,paintOrder:null,panose1:null,path:null,pathLength:Ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ve,pointsAtY:Ve,pointsAtZ:Ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fi,rev:fi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fi,requiredFeatures:fi,requiredFonts:fi,requiredFormats:fi,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:Ve,specularExponent:Ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ve,strikethroughThickness:Ve,string:null,stroke:null,strokeDashArray:fi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ve,strokeOpacity:Ve,strokeWidth:null,style:null,surfaceScale:Ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fi,tabIndex:Ve,tableValues:null,target:null,targetX:Ve,targetY:Ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ve,underlineThickness:Ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ve,values:null,vAlphabetic:Ve,vMathematical:Ve,vectorEffect:null,vHanging:Ve,vIdeographic:Ve,version:null,vertAdvY:Ve,vertOriginX:Ve,vertOriginY:Ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lq}),uq=If({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),dq=If({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:cq}),hq=If({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),ywe={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"},xwe=/[A-Z]/g,y3=/-[a-z]/g,_we=/^data[-\w.:]+$/i;function bwe(t,e){const r=RN(e);let n=e,s=ni;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&_we.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(y3,Swe);n="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!y3.test(i)){let a=i.replace(xwe,wwe);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=PA}return new s(n,e)}function wwe(t){return"-"+t.toLowerCase()}function Swe(t){return t.charAt(1).toUpperCase()}const kwe=aq([oq,gwe,uq,dq,hq],"html"),MA=aq([oq,vwe,uq,dq,hq],"svg");function Ewe(t){return t.join(" ").trim()}var nh={},Ek,x3;function Cwe(){if(x3)return Ek;x3=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
|
||
`,d="/",f="*",p="",m="comment",g="declaration";function y(w,_){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];_=_||{};var S=1,k=1;function N(R){var B=R.match(e);B&&(S+=B.length);var V=R.lastIndexOf(c);k=~V?R.length-V:k+R.length}function j(){var R={line:S,column:k};return function(B){return B.position=new T(R),L(),B}}function T(R){this.start=R,this.end={line:S,column:k},this.source=_.source}T.prototype.content=w;function D(R){var B=new Error(_.source+":"+S+":"+k+": "+R);if(B.reason=R,B.filename=_.source,B.line=S,B.column=k,B.source=w,!_.silent)throw B}function I(R){var B=R.exec(w);if(B){var V=B[0];return N(V),w=w.slice(V.length),B}}function L(){I(r)}function $(R){var B;for(R=R||[];B=Q();)B!==!1&&R.push(B);return R}function Q(){var R=j();if(!(d!=w.charAt(0)||f!=w.charAt(1))){for(var B=2;p!=w.charAt(B)&&(f!=w.charAt(B)||d!=w.charAt(B+1));)++B;if(B+=2,p===w.charAt(B-1))return D("End of comment missing");var V=w.slice(2,B-2);return k+=2,N(V),w=w.slice(B),k+=2,R({type:m,comment:V})}}function M(){var R=j(),B=I(n);if(B){if(Q(),!I(s))return D("property missing ':'");var V=I(i),F=R({type:g,property:x(B[0].replace(t,p)),value:V?x(V[0].replace(t,p)):p});return I(a),F}}function z(){var R=[];$(R);for(var B;B=M();)B!==!1&&(R.push(B),$(R));return R}return L(),z()}function x(w){return w?w.replace(l,p):p}return Ek=y,Ek}var _3;function Nwe(){if(_3)return nh;_3=1;var t=nh&&nh.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(nh,"__esModule",{value:!0}),nh.default=r;const e=t(Cwe());function r(n,s){let i=null;if(!n||typeof n!="string")return i;const a=(0,e.default)(n),l=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:f}=c;l?s(d,f,c):f&&(i=i||{},i[d]=f)}),i}return nh}var Zp={},b3;function jwe(){if(b3)return Zp;b3=1,Object.defineProperty(Zp,"__esModule",{value:!0}),Zp.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(d){return!d||r.test(d)||t.test(d)},a=function(d,f){return f.toUpperCase()},l=function(d,f){return"".concat(f,"-")},c=function(d,f){return f===void 0&&(f={}),i(d)?d:(d=d.toLowerCase(),f.reactCompat?d=d.replace(s,l):d=d.replace(n,l),d.replace(e,a))};return Zp.camelCase=c,Zp}var Jp,w3;function Twe(){if(w3)return Jp;w3=1;var t=Jp&&Jp.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(Nwe()),r=jwe();function n(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(l,c){l&&c&&(a[(0,r.camelCase)(l,i)]=c)}),a}return n.default=n,Jp=n,Jp}var Awe=Twe();const Rwe=ml(Awe),fq=pq("end"),IA=pq("start");function pq(t){return e;function e(r){const n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Dwe(t){const e=IA(t),r=fq(t);if(e&&r)return{start:e,end:r}}function Jm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?S3(t.position):"start"in t||"end"in t?S3(t):"line"in t||"column"in t?PN(t):""}function PN(t){return k3(t&&t.line)+":"+k3(t&&t.column)}function S3(t){return PN(t&&t.start)+"-"+PN(t&&t.end)}function k3(t){return t&&typeof t=="number"?t:1}class Ts extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let s="",i={},a=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n=="string"){const c=n.indexOf(":");c===-1?i.ruleId=n:(i.source=n.slice(0,c),i.ruleId=n.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Jm(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ts.prototype.file="";Ts.prototype.name="";Ts.prototype.reason="";Ts.prototype.message="";Ts.prototype.stack="";Ts.prototype.column=void 0;Ts.prototype.line=void 0;Ts.prototype.ancestors=void 0;Ts.prototype.cause=void 0;Ts.prototype.fatal=void 0;Ts.prototype.place=void 0;Ts.prototype.ruleId=void 0;Ts.prototype.source=void 0;const LA={}.hasOwnProperty,Owe=new Map,Pwe=/[A-Z]/g,Mwe=new Set(["table","tbody","thead","tfoot","tr"]),Iwe=new Set(["td","th"]),mq="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Lwe(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=qwe(r,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=Hwe(r,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?MA:kwe,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=gq(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function gq(t,e,r){if(e.type==="element")return $we(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Bwe(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return zwe(t,e,r);if(e.type==="mdxjsEsm")return Fwe(t,e);if(e.type==="root")return Uwe(t,e,r);if(e.type==="text")return Vwe(t,e)}function $we(t,e,r){const n=t.schema;let s=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(s=MA,t.schema=s),t.ancestors.push(e);const i=yq(t,e.tagName,!1),a=Wwe(t,e);let l=BA(t,e);return Mwe.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!pwe(c):!0})),vq(t,a,i,e),$A(a,l),t.ancestors.pop(),t.schema=n,t.create(e,i,a,r)}function Bwe(t,e){if(e.data&&e.data.estree&&t.evaluater){const n=e.data.estree.body[0];return n.type,t.evaluater.evaluateExpression(n.expression)}$g(t,e.position)}function Fwe(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);$g(t,e.position)}function zwe(t,e,r){const n=t.schema;let s=n;e.name==="svg"&&n.space==="html"&&(s=MA,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:yq(t,e.name,!0),a=Gwe(t,e),l=BA(t,e);return vq(t,a,i,e),$A(a,l),t.ancestors.pop(),t.schema=n,t.create(e,i,a,r)}function Uwe(t,e,r){const n={};return $A(n,BA(t,e)),t.create(e,t.Fragment,n,r)}function Vwe(t,e){return e.value}function vq(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function $A(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function Hwe(t,e,r){return n;function n(s,i,a,l){const d=Array.isArray(a.children)?r:e;return l?d(i,a,l):d(i,a)}}function qwe(t,e){return r;function r(n,s,i,a){const l=Array.isArray(i.children),c=IA(n);return e(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function Wwe(t,e){const r={};let n,s;for(s in e.properties)if(s!=="children"&&LA.call(e.properties,s)){const i=Kwe(t,s,e.properties[s]);if(i){const[a,l]=i;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Iwe.has(e.tagName)?n=l:r[a]=l}}if(n){const i=r.style||(r.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function Gwe(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const i=n.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(r,t.evaluater.evaluateExpression(l.argument))}else $g(t,e.position);else{const s=n.name;let i;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const l=n.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else $g(t,e.position);else i=n.value===null?!0:n.value;r[s]=i}return r}function BA(t,e){const r=[];let n=-1;const s=t.passKeys?new Map:Owe;for(;++n<e.children.length;){const i=e.children[n];let a;if(t.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=s.get(c)||0;a=c+"-"+d,s.set(c,d+1)}}const l=gq(t,i,a);l!==void 0&&r.push(l)}return r}function Kwe(t,e,r){const n=bwe(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?cwe(r):Ewe(r)),n.property==="style"){let s=typeof r=="object"?r:Ywe(t,String(r));return t.stylePropertyNameCase==="css"&&(s=Qwe(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&n.space?ywe[n.property]||n.property:n.attribute,r]}}function Ywe(t,e){try{return Rwe(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,s=new Ts("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=mq+"#cannot-parse-style-attribute",s}}function yq(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,a;for(;++i<s.length;){const l=m3(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}n=a}else n=m3(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const s=n.value;return LA.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(n);$g(t)}function $g(t,e){const r=new Ts("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=mq+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Qwe(t){const e={};let r;for(r in t)LA.call(t,r)&&(e[Xwe(r)]=t[r]);return e}function Xwe(t){let e=t.replace(Pwe,Zwe);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Zwe(t){return"-"+t.toLowerCase()}const Ck={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"]},Jwe={};function FA(t,e){const r=Jwe,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return xq(t,n,s)}function xq(t,e,r){if(e1e(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return E3(t.children,e,r)}return Array.isArray(t)?E3(t,e,r):""}function E3(t,e,r){const n=[];let s=-1;for(;++s<t.length;)n[s]=xq(t[s],e,r);return n.join("")}function e1e(t){return!!(t&&typeof t=="object")}const C3=document.createElement("i");function zA(t){const e="&"+t+";";C3.innerHTML=e;const r=C3.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function xi(t,e,r,n){const s=t.length;let i=0,a;if(e<0?e=-e>s?0:s+e:e=e>s?s:e,r=r>0?r:0,n.length<1e4)a=Array.from(n),a.unshift(e,r),t.splice(...a);else for(r&&t.splice(e,r);i<n.length;)a=n.slice(i,i+1e4),a.unshift(e,0),t.splice(...a),i+=1e4,e+=1e4}function Ui(t,e){return t.length>0?(xi(t,t.length,0,e),t):e}const N3={}.hasOwnProperty;function _q(t){const e={};let r=-1;for(;++r<t.length;)t1e(e,t[r]);return e}function t1e(t,e){let r;for(r in e){const s=(N3.call(t,r)?t[r]:void 0)||(t[r]={}),i=e[r];let a;if(i)for(a in i){N3.call(s,a)||(s[a]=[]);const l=i[a];r1e(s[a],Array.isArray(l)?l:l?[l]:[])}}}function r1e(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);xi(t,0,0,n)}function bq(t,e){const r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function xa(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ls=Fc(/[A-Za-z]/),Ns=Fc(/[\dA-Za-z]/),n1e=Fc(/[#-'*+\--9=?A-Z^-~]/);function u_(t){return t!==null&&(t<32||t===127)}const MN=Fc(/\d/),s1e=Fc(/[\dA-Fa-f]/),i1e=Fc(/[!-/:-@[-`{-~]/);function gt(t){return t!==null&&t<-2}function _r(t){return t!==null&&(t<0||t===32)}function $t(t){return t===-2||t===-1||t===32}const $b=Fc(new RegExp("\\p{P}|\\p{S}","u")),nd=Fc(/\s/);function Fc(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Lf(t){const e=[];let r=-1,n=0,s=0;for(;++r<t.length;){const i=t.charCodeAt(r);let a="";if(i===37&&Ns(t.charCodeAt(r+1))&&Ns(t.charCodeAt(r+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=t.charCodeAt(r+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(n,r),encodeURIComponent(a)),n=r+s+1,a=""),s&&(r+=s,s=0)}return e.join("")+t.slice(n)}function Kt(t,e,r,n){const s=n?n-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return $t(c)?(t.enter(r),l(c)):e(c)}function l(c){return $t(c)&&i++<s?(t.consume(c),l):(t.exit(r),e(c))}}const a1e={tokenize:o1e};function o1e(t){const e=t.attempt(this.parser.constructs.contentInitial,n,s);let r;return e;function n(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Kt(t,e,"linePrefix")}function s(l){return t.enter("paragraph"),i(l)}function i(l){const c=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=c),r=c,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"),i):(t.consume(l),a)}}const l1e={tokenize:c1e},j3={tokenize:u1e};function c1e(t){const e=this,r=[];let n=0,s,i,a;return l;function l(k){if(n<r.length){const N=r[n];return e.containerState=N[1],t.attempt(N[0].continuation,c,d)(k)}return d(k)}function c(k){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&S();const N=e.events.length;let j=N,T;for(;j--;)if(e.events[j][0]==="exit"&&e.events[j][1].type==="chunkFlow"){T=e.events[j][1].end;break}_(n);let D=N;for(;D<e.events.length;)e.events[D][1].end={...T},D++;return xi(e.events,j+1,0,e.events.slice(N)),e.events.length=D,d(k)}return l(k)}function d(k){if(n===r.length){if(!s)return m(k);if(s.currentConstruct&&s.currentConstruct.concrete)return y(k);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(j3,f,p)(k)}function f(k){return s&&S(),_(n),m(k)}function p(k){return e.parser.lazy[e.now().line]=n!==r.length,a=e.now().offset,y(k)}function m(k){return e.containerState={},t.attempt(j3,g,y)(k)}function g(k){return n++,r.push([e.currentConstruct,e.containerState]),m(k)}function y(k){if(k===null){s&&S(),_(0),t.consume(k);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),x(k)}function x(k){if(k===null){w(t.exit("chunkFlow"),!0),_(0),t.consume(k);return}return gt(k)?(t.consume(k),w(t.exit("chunkFlow")),n=0,e.interrupt=void 0,l):(t.consume(k),x)}function w(k,N){const j=e.sliceStream(k);if(N&&j.push(null),k.previous=i,i&&(i.next=k),i=k,s.defineSkip(k.start),s.write(j),e.parser.lazy[k.start.line]){let T=s.events.length;for(;T--;)if(s.events[T][1].start.offset<a&&(!s.events[T][1].end||s.events[T][1].end.offset>a))return;const D=e.events.length;let I=D,L,$;for(;I--;)if(e.events[I][0]==="exit"&&e.events[I][1].type==="chunkFlow"){if(L){$=e.events[I][1].end;break}L=!0}for(_(n),T=D;T<e.events.length;)e.events[T][1].end={...$},T++;xi(e.events,I+1,0,e.events.slice(D)),e.events.length=T}}function _(k){let N=r.length;for(;N-- >k;){const j=r[N];e.containerState=j[1],j[0].exit.call(e,t)}r.length=k}function S(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function u1e(t,e,r){return Kt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function sf(t){if(t===null||_r(t)||nd(t))return 1;if($b(t))return 2}function Bb(t,e,r){const n=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!n.includes(i)&&(e=i(e,r),n.push(i))}return e}const IN={name:"attention",resolveAll:d1e,tokenize:h1e};function d1e(t,e){let r=-1,n,s,i,a,l,c,d,f;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;c=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const p={...t[n][1].end},m={...t[r][1].start};T3(p,-c),T3(m,c),a={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...t[n][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[n][1].end={...a.start},t[r][1].start={...l.end},d=[],t[n][1].end.offset-t[n][1].start.offset&&(d=Ui(d,[["enter",t[n][1],e],["exit",t[n][1],e]])),d=Ui(d,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),d=Ui(d,Bb(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),d=Ui(d,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[r][1].end.offset-t[r][1].start.offset?(f=2,d=Ui(d,[["enter",t[r][1],e],["exit",t[r][1],e]])):f=0,xi(t,n-1,r-n+3,d),r=n+d.length-f-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function h1e(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,s=sf(n);let i;return a;function a(c){return i=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===i)return t.consume(c),l;const d=t.exit("attentionSequence"),f=sf(c),p=!f||f===2&&s||r.includes(c),m=!s||s===2&&f||r.includes(n);return d._open=!!(i===42?p:p&&(s||!m)),d._close=!!(i===42?m:m&&(f||!p)),e(c)}}function T3(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const f1e={name:"autolink",tokenize:p1e};function p1e(t,e,r){let n=0;return s;function s(g){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(g),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(g){return Ls(g)?(t.consume(g),a):g===64?r(g):d(g)}function a(g){return g===43||g===45||g===46||Ns(g)?(n=1,l(g)):d(g)}function l(g){return g===58?(t.consume(g),n=0,c):(g===43||g===45||g===46||Ns(g))&&n++<32?(t.consume(g),l):(n=0,d(g))}function c(g){return g===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(g),t.exit("autolinkMarker"),t.exit("autolink"),e):g===null||g===32||g===60||u_(g)?r(g):(t.consume(g),c)}function d(g){return g===64?(t.consume(g),f):n1e(g)?(t.consume(g),d):r(g)}function f(g){return Ns(g)?p(g):r(g)}function p(g){return g===46?(t.consume(g),n=0,f):g===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(g),t.exit("autolinkMarker"),t.exit("autolink"),e):m(g)}function m(g){if((g===45||Ns(g))&&n++<63){const y=g===45?m:p;return t.consume(g),y}return r(g)}}const kv={partial:!0,tokenize:m1e};function m1e(t,e,r){return n;function n(i){return $t(i)?Kt(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||gt(i)?e(i):r(i)}}const wq={continuation:{tokenize:v1e},exit:y1e,name:"blockQuote",tokenize:g1e};function g1e(t,e,r){const n=this;return s;function s(a){if(a===62){const l=n.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),i}return r(a)}function i(a){return $t(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function v1e(t,e,r){const n=this;return s;function s(a){return $t(a)?Kt(t,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return t.attempt(wq,e,r)(a)}}function y1e(t){t.exit("blockQuote")}const Sq={name:"characterEscape",tokenize:x1e};function x1e(t,e,r){return n;function n(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return i1e(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(i)}}const kq={name:"characterReference",tokenize:_1e};function _1e(t,e,r){const n=this;let s=0,i,a;return l;function l(p){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(p),t.exit("characterReferenceMarker"),c}function c(p){return p===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(p),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),i=31,a=Ns,f(p))}function d(p){return p===88||p===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(p),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,a=s1e,f):(t.enter("characterReferenceValue"),i=7,a=MN,f(p))}function f(p){if(p===59&&s){const m=t.exit("characterReferenceValue");return a===Ns&&!zA(n.sliceSerialize(m))?r(p):(t.enter("characterReferenceMarker"),t.consume(p),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(p)&&s++<i?(t.consume(p),f):r(p)}}const A3={partial:!0,tokenize:w1e},R3={concrete:!0,name:"codeFenced",tokenize:b1e};function b1e(t,e,r){const n=this,s={partial:!0,tokenize:j};let i=0,a=0,l;return c;function c(T){return d(T)}function d(T){const D=n.events[n.events.length-1];return i=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,l=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),f(T)}function f(T){return T===l?(a++,t.consume(T),f):a<3?r(T):(t.exit("codeFencedFenceSequence"),$t(T)?Kt(t,p,"whitespace")(T):p(T))}function p(T){return T===null||gt(T)?(t.exit("codeFencedFence"),n.interrupt?e(T):t.check(A3,x,N)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||gt(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),p(T)):$t(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Kt(t,g,"whitespace")(T)):T===96&&T===l?r(T):(t.consume(T),m)}function g(T){return T===null||gt(T)?p(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),y(T))}function y(T){return T===null||gt(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),p(T)):T===96&&T===l?r(T):(t.consume(T),y)}function x(T){return t.attempt(s,N,w)(T)}function w(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),_}function _(T){return i>0&&$t(T)?Kt(t,S,"linePrefix",i+1)(T):S(T)}function S(T){return T===null||gt(T)?t.check(A3,x,N)(T):(t.enter("codeFlowValue"),k(T))}function k(T){return T===null||gt(T)?(t.exit("codeFlowValue"),S(T)):(t.consume(T),k)}function N(T){return t.exit("codeFenced"),e(T)}function j(T,D,I){let L=0;return $;function $(B){return T.enter("lineEnding"),T.consume(B),T.exit("lineEnding"),Q}function Q(B){return T.enter("codeFencedFence"),$t(B)?Kt(T,M,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):M(B)}function M(B){return B===l?(T.enter("codeFencedFenceSequence"),z(B)):I(B)}function z(B){return B===l?(L++,T.consume(B),z):L>=a?(T.exit("codeFencedFenceSequence"),$t(B)?Kt(T,R,"whitespace")(B):R(B)):I(B)}function R(B){return B===null||gt(B)?(T.exit("codeFencedFence"),D(B)):I(B)}}}function w1e(t,e,r){const n=this;return s;function s(a){return a===null?r(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return n.parser.lazy[n.now().line]?r(a):e(a)}}const Nk={name:"codeIndented",tokenize:k1e},S1e={partial:!0,tokenize:E1e};function k1e(t,e,r){const n=this;return s;function s(d){return t.enter("codeIndented"),Kt(t,i,"linePrefix",5)(d)}function i(d){const f=n.events[n.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(d):r(d)}function a(d){return d===null?c(d):gt(d)?t.attempt(S1e,a,c)(d):(t.enter("codeFlowValue"),l(d))}function l(d){return d===null||gt(d)?(t.exit("codeFlowValue"),a(d)):(t.consume(d),l)}function c(d){return t.exit("codeIndented"),e(d)}}function E1e(t,e,r){const n=this;return s;function s(a){return n.parser.lazy[n.now().line]?r(a):gt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):Kt(t,i,"linePrefix",5)(a)}function i(a){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):gt(a)?s(a):r(a)}}const C1e={name:"codeText",previous:j1e,resolve:N1e,tokenize:T1e};function N1e(t){let e=t.length-4,r=3,n,s;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)s===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(s=n):(n===e||t[n][1].type==="lineEnding")&&(t[s][1].type="codeTextData",n!==s+2&&(t[s][1].end=t[n-1][1].end,t.splice(s+2,n-s-2),e-=n-s-2,n=s+2),s=void 0);return t}function j1e(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function T1e(t,e,r){let n=0,s,i;return a;function a(p){return t.enter("codeText"),t.enter("codeTextSequence"),l(p)}function l(p){return p===96?(t.consume(p),n++,l):(t.exit("codeTextSequence"),c(p))}function c(p){return p===null?r(p):p===32?(t.enter("space"),t.consume(p),t.exit("space"),c):p===96?(i=t.enter("codeTextSequence"),s=0,f(p)):gt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),c):(t.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||gt(p)?(t.exit("codeTextData"),c(p)):(t.consume(p),d)}function f(p){return p===96?(t.consume(p),s++,f):s===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(p)):(i.type="codeTextData",d(p))}}class A1e{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){const s=r||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return n&&em(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),em(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),em(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const r=this.left.splice(e,Number.POSITIVE_INFINITY);em(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);em(this.left,r.reverse())}}}function em(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function Eq(t){const e={};let r=-1,n,s,i,a,l,c,d;const f=new A1e(t);for(;++r<f.length;){for(;r in e;)r=e[r];if(n=f.get(r),r&&n[1].type==="chunkFlow"&&f.get(r-1)[1].type==="listItemPrefix"&&(c=n[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,R1e(f,r)),r=e[r],d=!0);else if(n[1]._container){for(i=r,s=void 0;i--;)if(a=f.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(f.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(n[1].end={...f.get(s)[1].start},l=f.slice(s,r),l.unshift(n),f.splice(s,r-s+1,l))}}return xi(t,0,Number.POSITIVE_INFINITY,f.slice(0)),!d}function R1e(t,e){const r=t.get(e)[1],n=t.get(e)[2];let s=e-1;const i=[];let a=r._tokenizer;a||(a=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],d={};let f,p,m=-1,g=r,y=0,x=0;const w=[x];for(;g;){for(;t.get(++s)[1]!==g;);i.push(s),g._tokenizer||(f=n.sliceStream(g),g.next||f.push(null),p&&a.defineSkip(g.start),g._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(f),g._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),p=g,g=g.next}for(g=r;++m<l.length;)l[m][0]==="exit"&&l[m-1][0]==="enter"&&l[m][1].type===l[m-1][1].type&&l[m][1].start.line!==l[m][1].end.line&&(x=m+1,w.push(x),g._tokenizer=void 0,g.previous=void 0,g=g.next);for(a.events=[],g?(g._tokenizer=void 0,g.previous=void 0):w.pop(),m=w.length;m--;){const _=l.slice(w[m],w[m+1]),S=i.pop();c.push([S,S+_.length-1]),t.splice(S,2,_)}for(c.reverse(),m=-1;++m<c.length;)d[y+c[m][0]]=y+c[m][1],y+=c[m][1]-c[m][0]-1;return d}const D1e={resolve:P1e,tokenize:M1e},O1e={partial:!0,tokenize:I1e};function P1e(t){return Eq(t),t}function M1e(t,e){let r;return n;function n(l){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):gt(l)?t.check(O1e,a,i)(l):(t.consume(l),s)}function i(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function a(l){return t.consume(l),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function I1e(t,e,r){const n=this;return s;function s(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Kt(t,i,"linePrefix")}function i(a){if(a===null||gt(a))return r(a);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):t.interrupt(n.parser.constructs.flow,r,e)(a)}}function Cq(t,e,r,n,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let f=0;return p;function p(_){return _===60?(t.enter(n),t.enter(s),t.enter(i),t.consume(_),t.exit(i),m):_===null||_===32||_===41||u_(_)?r(_):(t.enter(n),t.enter(a),t.enter(l),t.enter("chunkString",{contentType:"string"}),x(_))}function m(_){return _===62?(t.enter(i),t.consume(_),t.exit(i),t.exit(s),t.exit(n),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===62?(t.exit("chunkString"),t.exit(l),m(_)):_===null||_===60||gt(_)?r(_):(t.consume(_),_===92?y:g)}function y(_){return _===60||_===62||_===92?(t.consume(_),g):g(_)}function x(_){return!f&&(_===null||_===41||_r(_))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(n),e(_)):f<d&&_===40?(t.consume(_),f++,x):_===41?(t.consume(_),f--,x):_===null||_===32||_===40||u_(_)?r(_):(t.consume(_),_===92?w:x)}function w(_){return _===40||_===41||_===92?(t.consume(_),x):x(_)}}function Nq(t,e,r,n,s,i){const a=this;let l=0,c;return d;function d(g){return t.enter(n),t.enter(s),t.consume(g),t.exit(s),t.enter(i),f}function f(g){return l>999||g===null||g===91||g===93&&!c||g===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?r(g):g===93?(t.exit(i),t.enter(s),t.consume(g),t.exit(s),t.exit(n),e):gt(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===null||g===91||g===93||gt(g)||l++>999?(t.exit("chunkString"),f(g)):(t.consume(g),c||(c=!$t(g)),g===92?m:p)}function m(g){return g===91||g===92||g===93?(t.consume(g),l++,p):p(g)}}function jq(t,e,r,n,s,i){let a;return l;function l(m){return m===34||m===39||m===40?(t.enter(n),t.enter(s),t.consume(m),t.exit(s),a=m===40?41:m,c):r(m)}function c(m){return m===a?(t.enter(s),t.consume(m),t.exit(s),t.exit(n),e):(t.enter(i),d(m))}function d(m){return m===a?(t.exit(i),c(a)):m===null?r(m):gt(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),Kt(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===a||m===null||gt(m)?(t.exit("chunkString"),d(m)):(t.consume(m),m===92?p:f)}function p(m){return m===a||m===92?(t.consume(m),f):f(m)}}function eg(t,e){let r;return n;function n(s){return gt(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r=!0,n):$t(s)?Kt(t,n,r?"linePrefix":"lineSuffix")(s):e(s)}}const L1e={name:"definition",tokenize:B1e},$1e={partial:!0,tokenize:F1e};function B1e(t,e,r){const n=this;let s;return i;function i(g){return t.enter("definition"),a(g)}function a(g){return Nq.call(n,t,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function l(g){return s=xa(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),c):r(g)}function c(g){return _r(g)?eg(t,d)(g):d(g)}function d(g){return Cq(t,f,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function f(g){return t.attempt($1e,p,p)(g)}function p(g){return $t(g)?Kt(t,m,"whitespace")(g):m(g)}function m(g){return g===null||gt(g)?(t.exit("definition"),n.parser.defined.push(s),e(g)):r(g)}}function F1e(t,e,r){return n;function n(l){return _r(l)?eg(t,s)(l):r(l)}function s(l){return jq(t,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return $t(l)?Kt(t,a,"whitespace")(l):a(l)}function a(l){return l===null||gt(l)?e(l):r(l)}}const z1e={name:"hardBreakEscape",tokenize:U1e};function U1e(t,e,r){return n;function n(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return gt(i)?(t.exit("hardBreakEscape"),e(i)):r(i)}}const V1e={name:"headingAtx",resolve:H1e,tokenize:q1e};function H1e(t,e){let r=t.length-2,n=3,s,i;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(s={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},i={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},xi(t,n,r-n+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function q1e(t,e,r){let n=0;return s;function s(f){return t.enter("atxHeading"),i(f)}function i(f){return t.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&n++<6?(t.consume(f),a):f===null||_r(f)?(t.exit("atxHeadingSequence"),l(f)):r(f)}function l(f){return f===35?(t.enter("atxHeadingSequence"),c(f)):f===null||gt(f)?(t.exit("atxHeading"),e(f)):$t(f)?Kt(t,l,"whitespace")(f):(t.enter("atxHeadingText"),d(f))}function c(f){return f===35?(t.consume(f),c):(t.exit("atxHeadingSequence"),l(f))}function d(f){return f===null||f===35||_r(f)?(t.exit("atxHeadingText"),l(f)):(t.consume(f),d)}}const W1e=["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"],D3=["pre","script","style","textarea"],G1e={concrete:!0,name:"htmlFlow",resolveTo:Q1e,tokenize:X1e},K1e={partial:!0,tokenize:J1e},Y1e={partial:!0,tokenize:Z1e};function Q1e(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 X1e(t,e,r){const n=this;let s,i,a,l,c;return d;function d(q){return f(q)}function f(q){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(q),p}function p(q){return q===33?(t.consume(q),m):q===47?(t.consume(q),i=!0,x):q===63?(t.consume(q),s=3,n.interrupt?e:O):Ls(q)?(t.consume(q),a=String.fromCharCode(q),w):r(q)}function m(q){return q===45?(t.consume(q),s=2,g):q===91?(t.consume(q),s=5,l=0,y):Ls(q)?(t.consume(q),s=4,n.interrupt?e:O):r(q)}function g(q){return q===45?(t.consume(q),n.interrupt?e:O):r(q)}function y(q){const J="CDATA[";return q===J.charCodeAt(l++)?(t.consume(q),l===J.length?n.interrupt?e:M:y):r(q)}function x(q){return Ls(q)?(t.consume(q),a=String.fromCharCode(q),w):r(q)}function w(q){if(q===null||q===47||q===62||_r(q)){const J=q===47,te=a.toLowerCase();return!J&&!i&&D3.includes(te)?(s=1,n.interrupt?e(q):M(q)):W1e.includes(a.toLowerCase())?(s=6,J?(t.consume(q),_):n.interrupt?e(q):M(q)):(s=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(q):i?S(q):k(q))}return q===45||Ns(q)?(t.consume(q),a+=String.fromCharCode(q),w):r(q)}function _(q){return q===62?(t.consume(q),n.interrupt?e:M):r(q)}function S(q){return $t(q)?(t.consume(q),S):$(q)}function k(q){return q===47?(t.consume(q),$):q===58||q===95||Ls(q)?(t.consume(q),N):$t(q)?(t.consume(q),k):$(q)}function N(q){return q===45||q===46||q===58||q===95||Ns(q)?(t.consume(q),N):j(q)}function j(q){return q===61?(t.consume(q),T):$t(q)?(t.consume(q),j):k(q)}function T(q){return q===null||q===60||q===61||q===62||q===96?r(q):q===34||q===39?(t.consume(q),c=q,D):$t(q)?(t.consume(q),T):I(q)}function D(q){return q===c?(t.consume(q),c=null,L):q===null||gt(q)?r(q):(t.consume(q),D)}function I(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||_r(q)?j(q):(t.consume(q),I)}function L(q){return q===47||q===62||$t(q)?k(q):r(q)}function $(q){return q===62?(t.consume(q),Q):r(q)}function Q(q){return q===null||gt(q)?M(q):$t(q)?(t.consume(q),Q):r(q)}function M(q){return q===45&&s===2?(t.consume(q),V):q===60&&s===1?(t.consume(q),F):q===62&&s===4?(t.consume(q),H):q===63&&s===3?(t.consume(q),O):q===93&&s===5?(t.consume(q),Y):gt(q)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(K1e,G,z)(q)):q===null||gt(q)?(t.exit("htmlFlowData"),z(q)):(t.consume(q),M)}function z(q){return t.check(Y1e,R,G)(q)}function R(q){return t.enter("lineEnding"),t.consume(q),t.exit("lineEnding"),B}function B(q){return q===null||gt(q)?z(q):(t.enter("htmlFlowData"),M(q))}function V(q){return q===45?(t.consume(q),O):M(q)}function F(q){return q===47?(t.consume(q),a="",K):M(q)}function K(q){if(q===62){const J=a.toLowerCase();return D3.includes(J)?(t.consume(q),H):M(q)}return Ls(q)&&a.length<8?(t.consume(q),a+=String.fromCharCode(q),K):M(q)}function Y(q){return q===93?(t.consume(q),O):M(q)}function O(q){return q===62?(t.consume(q),H):q===45&&s===2?(t.consume(q),O):M(q)}function H(q){return q===null||gt(q)?(t.exit("htmlFlowData"),G(q)):(t.consume(q),H)}function G(q){return t.exit("htmlFlow"),e(q)}}function Z1e(t,e,r){const n=this;return s;function s(a){return gt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):r(a)}function i(a){return n.parser.lazy[n.now().line]?r(a):e(a)}}function J1e(t,e,r){return n;function n(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(kv,e,r)}}const eSe={name:"htmlText",tokenize:tSe};function tSe(t,e,r){const n=this;let s,i,a;return l;function l(O){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(O),c}function c(O){return O===33?(t.consume(O),d):O===47?(t.consume(O),j):O===63?(t.consume(O),k):Ls(O)?(t.consume(O),I):r(O)}function d(O){return O===45?(t.consume(O),f):O===91?(t.consume(O),i=0,y):Ls(O)?(t.consume(O),S):r(O)}function f(O){return O===45?(t.consume(O),g):r(O)}function p(O){return O===null?r(O):O===45?(t.consume(O),m):gt(O)?(a=p,F(O)):(t.consume(O),p)}function m(O){return O===45?(t.consume(O),g):p(O)}function g(O){return O===62?V(O):O===45?m(O):p(O)}function y(O){const H="CDATA[";return O===H.charCodeAt(i++)?(t.consume(O),i===H.length?x:y):r(O)}function x(O){return O===null?r(O):O===93?(t.consume(O),w):gt(O)?(a=x,F(O)):(t.consume(O),x)}function w(O){return O===93?(t.consume(O),_):x(O)}function _(O){return O===62?V(O):O===93?(t.consume(O),_):x(O)}function S(O){return O===null||O===62?V(O):gt(O)?(a=S,F(O)):(t.consume(O),S)}function k(O){return O===null?r(O):O===63?(t.consume(O),N):gt(O)?(a=k,F(O)):(t.consume(O),k)}function N(O){return O===62?V(O):k(O)}function j(O){return Ls(O)?(t.consume(O),T):r(O)}function T(O){return O===45||Ns(O)?(t.consume(O),T):D(O)}function D(O){return gt(O)?(a=D,F(O)):$t(O)?(t.consume(O),D):V(O)}function I(O){return O===45||Ns(O)?(t.consume(O),I):O===47||O===62||_r(O)?L(O):r(O)}function L(O){return O===47?(t.consume(O),V):O===58||O===95||Ls(O)?(t.consume(O),$):gt(O)?(a=L,F(O)):$t(O)?(t.consume(O),L):V(O)}function $(O){return O===45||O===46||O===58||O===95||Ns(O)?(t.consume(O),$):Q(O)}function Q(O){return O===61?(t.consume(O),M):gt(O)?(a=Q,F(O)):$t(O)?(t.consume(O),Q):L(O)}function M(O){return O===null||O===60||O===61||O===62||O===96?r(O):O===34||O===39?(t.consume(O),s=O,z):gt(O)?(a=M,F(O)):$t(O)?(t.consume(O),M):(t.consume(O),R)}function z(O){return O===s?(t.consume(O),s=void 0,B):O===null?r(O):gt(O)?(a=z,F(O)):(t.consume(O),z)}function R(O){return O===null||O===34||O===39||O===60||O===61||O===96?r(O):O===47||O===62||_r(O)?L(O):(t.consume(O),R)}function B(O){return O===47||O===62||_r(O)?L(O):r(O)}function V(O){return O===62?(t.consume(O),t.exit("htmlTextData"),t.exit("htmlText"),e):r(O)}function F(O){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),K}function K(O){return $t(O)?Kt(t,Y,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):Y(O)}function Y(O){return t.enter("htmlTextData"),a(O)}}const UA={name:"labelEnd",resolveAll:iSe,resolveTo:aSe,tokenize:oSe},rSe={tokenize:lSe},nSe={tokenize:cSe},sSe={tokenize:uSe};function iSe(t){let e=-1;const r=[];for(;++e<t.length;){const n=t[e][1];if(r.push(t[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const s=n.type==="labelImage"?4:2;n.type="data",e+=s}}return t.length!==r.length&&xi(t,0,t.length,r),t}function aSe(t,e){let r=t.length,n=0,s,i,a,l;for(;r--;)if(s=t[r][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(t[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=r,s.type!=="labelLink")){n=2;break}}else s.type==="labelEnd"&&(a=r);const c={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[i][1].start},end:{...t[a][1].end}},f={type:"labelText",start:{...t[i+n+2][1].end},end:{...t[a-2][1].start}};return l=[["enter",c,e],["enter",d,e]],l=Ui(l,t.slice(i+1,i+n+3)),l=Ui(l,[["enter",f,e]]),l=Ui(l,Bb(e.parser.constructs.insideSpan.null,t.slice(i+n+4,a-3),e)),l=Ui(l,[["exit",f,e],t[a-2],t[a-1],["exit",d,e]]),l=Ui(l,t.slice(a+1)),l=Ui(l,[["exit",c,e]]),xi(t,i,t.length,l),t}function oSe(t,e,r){const n=this;let s=n.events.length,i,a;for(;s--;)if((n.events[s][1].type==="labelImage"||n.events[s][1].type==="labelLink")&&!n.events[s][1]._balanced){i=n.events[s][1];break}return l;function l(m){return i?i._inactive?p(m):(a=n.parser.defined.includes(xa(n.sliceSerialize({start:i.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelEnd"),c):r(m)}function c(m){return m===40?t.attempt(rSe,f,a?f:p)(m):m===91?t.attempt(nSe,f,a?d:p)(m):a?f(m):p(m)}function d(m){return t.attempt(sSe,f,p)(m)}function f(m){return e(m)}function p(m){return i._balanced=!0,r(m)}}function lSe(t,e,r){return n;function n(p){return t.enter("resource"),t.enter("resourceMarker"),t.consume(p),t.exit("resourceMarker"),s}function s(p){return _r(p)?eg(t,i)(p):i(p)}function i(p){return p===41?f(p):Cq(t,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function a(p){return _r(p)?eg(t,c)(p):f(p)}function l(p){return r(p)}function c(p){return p===34||p===39||p===40?jq(t,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):f(p)}function d(p){return _r(p)?eg(t,f)(p):f(p)}function f(p){return p===41?(t.enter("resourceMarker"),t.consume(p),t.exit("resourceMarker"),t.exit("resource"),e):r(p)}}function cSe(t,e,r){const n=this;return s;function s(l){return Nq.call(n,t,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return n.parser.defined.includes(xa(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(l):r(l)}function a(l){return r(l)}}function uSe(t,e,r){return n;function n(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):r(i)}}const dSe={name:"labelStartImage",resolveAll:UA.resolveAll,tokenize:hSe};function hSe(t,e,r){const n=this;return s;function s(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),i}function i(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),a):r(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):e(l)}}const fSe={name:"labelStartLink",resolveAll:UA.resolveAll,tokenize:pSe};function pSe(t,e,r){const n=this;return s;function s(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):e(a)}}const jk={name:"lineEnding",tokenize:mSe};function mSe(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Kt(t,e,"linePrefix")}}const x0={name:"thematicBreak",tokenize:gSe};function gSe(t,e,r){let n=0,s;return i;function i(d){return t.enter("thematicBreak"),a(d)}function a(d){return s=d,l(d)}function l(d){return d===s?(t.enter("thematicBreakSequence"),c(d)):n>=3&&(d===null||gt(d))?(t.exit("thematicBreak"),e(d)):r(d)}function c(d){return d===s?(t.consume(d),n++,c):(t.exit("thematicBreakSequence"),$t(d)?Kt(t,l,"whitespace")(d):l(d))}}const Qs={continuation:{tokenize:_Se},exit:wSe,name:"list",tokenize:xSe},vSe={partial:!0,tokenize:SSe},ySe={partial:!0,tokenize:bSe};function xSe(t,e,r){const n=this,s=n.events[n.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(g){const y=n.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!n.containerState.marker||g===n.containerState.marker:MN(g)){if(n.containerState.type||(n.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),g===42||g===45?t.check(x0,r,d)(g):d(g);if(!n.interrupt||g===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(g)}return r(g)}function c(g){return MN(g)&&++a<10?(t.consume(g),c):(!n.interrupt||a<2)&&(n.containerState.marker?g===n.containerState.marker:g===41||g===46)?(t.exit("listItemValue"),d(g)):r(g)}function d(g){return t.enter("listItemMarker"),t.consume(g),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||g,t.check(kv,n.interrupt?r:f,t.attempt(vSe,m,p))}function f(g){return n.containerState.initialBlankLine=!0,i++,m(g)}function p(g){return $t(g)?(t.enter("listItemPrefixWhitespace"),t.consume(g),t.exit("listItemPrefixWhitespace"),m):r(g)}function m(g){return n.containerState.size=i+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(g)}}function _Se(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(kv,s,i);function s(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Kt(t,e,"listItemIndent",n.containerState.size+1)(l)}function i(l){return n.containerState.furtherBlankLines||!$t(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,a(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(ySe,e,a)(l))}function a(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Kt(t,t.attempt(Qs,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function bSe(t,e,r){const n=this;return Kt(t,s,"listItemIndent",n.containerState.size+1);function s(i){const a=n.events[n.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?e(i):r(i)}}function wSe(t){t.exit(this.containerState.type)}function SSe(t,e,r){const n=this;return Kt(t,s,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=n.events[n.events.length-1];return!$t(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):r(i)}}const O3={name:"setextUnderline",resolveTo:kSe,tokenize:ESe};function kSe(t,e){let r=t.length,n,s,i;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(s=r)}else t[r][1].type==="content"&&t.splice(r,1),!i&&t[r][1].type==="definition"&&(i=r);const a={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[n][1],e]),t[n][1].end={...t[i][1].end}):t[n][1]=a,t.push(["exit",a,e]),t}function ESe(t,e,r){const n=this;let s;return i;function i(d){let f=n.events.length,p;for(;f--;)if(n.events[f][1].type!=="lineEnding"&&n.events[f][1].type!=="linePrefix"&&n.events[f][1].type!=="content"){p=n.events[f][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||p)?(t.enter("setextHeadingLine"),s=d,a(d)):r(d)}function a(d){return t.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(t.consume(d),l):(t.exit("setextHeadingLineSequence"),$t(d)?Kt(t,c,"lineSuffix")(d):c(d))}function c(d){return d===null||gt(d)?(t.exit("setextHeadingLine"),e(d)):r(d)}}const CSe={tokenize:NSe};function NSe(t){const e=this,r=t.attempt(kv,n,t.attempt(this.parser.constructs.flowInitial,s,Kt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(D1e,s)),"linePrefix")));return r;function n(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const jSe={resolveAll:Aq()},TSe=Tq("string"),ASe=Tq("text");function Tq(t){return{resolveAll:Aq(t==="text"?RSe:void 0),tokenize:e};function e(r){const n=this,s=this.parser.constructs[t],i=r.attempt(s,a,l);return a;function a(f){return d(f)?i(f):l(f)}function l(f){if(f===null){r.consume(f);return}return r.enter("data"),r.consume(f),c}function c(f){return d(f)?(r.exit("data"),i(f)):(r.consume(f),c)}function d(f){if(f===null)return!0;const p=s[f];let m=-1;if(p)for(;++m<p.length;){const g=p[m];if(!g.previous||g.previous.call(n,n.previous))return!0}return!1}}}function Aq(t){return e;function e(r,n){let s=-1,i;for(;++s<=r.length;)i===void 0?r[s]&&r[s][1].type==="data"&&(i=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==i+2&&(r[i][1].end=r[s-1][1].end,r.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(r,n):r}}function RSe(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const n=t[r-1][1],s=e.sliceStream(n);let i=s.length,a=-1,l=0,c;for(;i--;){const d=s[i];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(l=0),l){const d={type:r===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:n.start._bufferIndex+a,_index:n.start._index+i,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...d.start},n.start.offset===n.end.offset?Object.assign(n,d):(t.splice(r,0,["enter",d,e],["exit",d,e]),r+=2)}r++}return t}const DSe={42:Qs,43:Qs,45:Qs,48:Qs,49:Qs,50:Qs,51:Qs,52:Qs,53:Qs,54:Qs,55:Qs,56:Qs,57:Qs,62:wq},OSe={91:L1e},PSe={[-2]:Nk,[-1]:Nk,32:Nk},MSe={35:V1e,42:x0,45:[O3,x0],60:G1e,61:O3,95:x0,96:R3,126:R3},ISe={38:kq,92:Sq},LSe={[-5]:jk,[-4]:jk,[-3]:jk,33:dSe,38:kq,42:IN,60:[f1e,eSe],91:fSe,92:[z1e,Sq],93:UA,95:IN,96:C1e},$Se={null:[IN,jSe]},BSe={null:[42,95]},FSe={null:[]},zSe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:BSe,contentInitial:OSe,disable:FSe,document:DSe,flow:MSe,flowInitial:PSe,insideSpan:$Se,string:ISe,text:LSe},Symbol.toStringTag,{value:"Module"}));function USe(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:D(j),check:D(T),consume:S,enter:k,exit:N,interrupt:D(T,{interrupt:!0})},d={code:null,containerState:{},defineSkip:x,events:[],now:y,parser:t,previous:null,sliceSerialize:m,sliceStream:g,write:p};let f=e.tokenize.call(d,c);return e.resolveAll&&i.push(e),d;function p(Q){return a=Ui(a,Q),w(),a[a.length-1]!==null?[]:(I(e,0),d.events=Bb(i,d.events,d),d.events)}function m(Q,M){return HSe(g(Q),M)}function g(Q){return VSe(a,Q)}function y(){const{_bufferIndex:Q,_index:M,line:z,column:R,offset:B}=n;return{_bufferIndex:Q,_index:M,line:z,column:R,offset:B}}function x(Q){s[Q.line]=Q.column,$()}function w(){let Q;for(;n._index<a.length;){const M=a[n._index];if(typeof M=="string")for(Q=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===Q&&n._bufferIndex<M.length;)_(M.charCodeAt(n._bufferIndex));else _(M)}}function _(Q){f=f(Q)}function S(Q){gt(Q)?(n.line++,n.column=1,n.offset+=Q===-3?2:1,$()):Q!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===a[n._index].length&&(n._bufferIndex=-1,n._index++)),d.previous=Q}function k(Q,M){const z=M||{};return z.type=Q,z.start=y(),d.events.push(["enter",z,d]),l.push(z),z}function N(Q){const M=l.pop();return M.end=y(),d.events.push(["exit",M,d]),M}function j(Q,M){I(Q,M.from)}function T(Q,M){M.restore()}function D(Q,M){return z;function z(R,B,V){let F,K,Y,O;return Array.isArray(R)?G(R):"tokenize"in R?G([R]):H(R);function H(ve){return he;function he(xe){const ke=xe!==null&&ve[xe],Oe=xe!==null&&ve.null,He=[...Array.isArray(ke)?ke:ke?[ke]:[],...Array.isArray(Oe)?Oe:Oe?[Oe]:[]];return G(He)(xe)}}function G(ve){return F=ve,K=0,ve.length===0?V:q(ve[K])}function q(ve){return he;function he(xe){return O=L(),Y=ve,ve.partial||(d.currentConstruct=ve),ve.name&&d.parser.constructs.disable.null.includes(ve.name)?te():ve.tokenize.call(M?Object.assign(Object.create(d),M):d,c,J,te)(xe)}}function J(ve){return Q(Y,O),B}function te(ve){return O.restore(),++K<F.length?q(F[K]):V}}}function I(Q,M){Q.resolveAll&&!i.includes(Q)&&i.push(Q),Q.resolve&&xi(d.events,M,d.events.length-M,Q.resolve(d.events.slice(M),d)),Q.resolveTo&&(d.events=Q.resolveTo(d.events,d))}function L(){const Q=y(),M=d.previous,z=d.currentConstruct,R=d.events.length,B=Array.from(l);return{from:R,restore:V};function V(){n=Q,d.previous=M,d.currentConstruct=z,d.events.length=R,l=B,$()}}function $(){n.line in s&&n.column<2&&(n.column=s[n.line],n.offset+=s[n.line]-1)}}function VSe(t,e){const r=e.start._index,n=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let a;if(r===s)a=[t[r].slice(n,i)];else{if(a=t.slice(r,s),n>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(n):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function HSe(t,e){let r=-1;const n=[];let s;for(;++r<t.length;){const i=t[r];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
||
`;break}case-3:{a=`\r
|
||
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,n.push(a)}return n.join("")}function qSe(t){const n={constructs:_q([zSe,...(t||{}).extensions||[]]),content:s(a1e),defined:[],document:s(l1e),flow:s(CSe),lazy:{},string:s(TSe),text:s(ASe)};return n;function s(i){return a;function a(l){return USe(n,i,l)}}}function WSe(t){for(;!Eq(t););return t}const P3=/[\0\t\n\r]/g;function GSe(){let t=1,e="",r=!0,n;return s;function s(i,a,l){const c=[];let d,f,p,m,g;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),p=0,e="",r&&(i.charCodeAt(0)===65279&&p++,r=void 0);p<i.length;){if(P3.lastIndex=p,d=P3.exec(i),m=d&&d.index!==void 0?d.index:i.length,g=i.charCodeAt(m),!d){e=i.slice(p);break}if(g===10&&p===m&&n)c.push(-3),n=void 0;else switch(n&&(c.push(-5),n=void 0),p<m&&(c.push(i.slice(p,m)),t+=m-p),g){case 0:{c.push(65533),t++;break}case 9:{for(f=Math.ceil(t/4)*4,c.push(-2);t++<f;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:n=!0,t=1}p=m+1}return l&&(n&&c.push(-5),e&&c.push(e),c.push(null)),c}}const KSe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function YSe(t){return t.replace(KSe,QSe)}function QSe(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),i=s===120||s===88;return bq(r.slice(i?2:1),i?16:10)}return zA(r)||t}const Rq={}.hasOwnProperty;function XSe(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),ZSe(r)(WSe(qSe(r).document().write(GSe()(t,e,!0))))}function ZSe(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(re),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(ne),blockQuote:i(Oe),characterEscape:L,characterReference:L,codeFenced:i(He),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(He,a),codeText:i(Ye,a),codeTextData:L,data:L,codeFlowValue:L,definition:i(lt),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(P),hardBreakEscape:i(X),hardBreakTrailing:i(X),htmlFlow:i(W,a),htmlFlowData:L,htmlText:i(W,a),htmlTextData:L,image:i(Z),label:a,link:i(re),listItem:i(fe),listItemValue:m,listOrdered:i(ae,p),listUnordered:i(ae),paragraph:i(oe),reference:q,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(ne),strong:i(Ae),thematicBreak:i(Le)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:ke,autolinkProtocol:xe,blockQuote:c(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:ve,characterReference:he,codeFenced:c(w),codeFencedFence:x,codeFencedFenceInfo:g,codeFencedFenceMeta:y,codeFlowValue:$,codeIndented:c(_),codeText:c(B),codeTextData:$,data:$,definition:c(),definitionDestinationString:N,definitionLabelString:S,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(M),hardBreakTrailing:c(M),htmlFlow:c(z),htmlFlowData:$,htmlText:c(R),htmlTextData:$,image:c(F),label:Y,labelText:K,lineEnding:Q,link:c(V),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:J,resourceDestinationString:O,resourceTitleString:H,resource:G,setextHeading:c(I),setextHeadingLineSequence:D,setextHeadingText:T,strong:c(),thematicBreak:c()}};Dq(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(pe){let De={type:"root",children:[]};const qe={stack:[De],tokenStack:[],config:e,enter:l,exit:d,buffer:a,resume:f,data:r},mt=[];let Ot=-1;for(;++Ot<pe.length;)if(pe[Ot][1].type==="listOrdered"||pe[Ot][1].type==="listUnordered")if(pe[Ot][0]==="enter")mt.push(Ot);else{const wr=mt.pop();Ot=s(pe,wr,Ot)}for(Ot=-1;++Ot<pe.length;){const wr=e[pe[Ot][0]];Rq.call(wr,pe[Ot][1].type)&&wr[pe[Ot][1].type].call(Object.assign({sliceSerialize:pe[Ot][2].sliceSerialize},qe),pe[Ot][1])}if(qe.tokenStack.length>0){const wr=qe.tokenStack[qe.tokenStack.length-1];(wr[1]||M3).call(qe,void 0,wr[0])}for(De.position={start:Kl(pe.length>0?pe[0][1].start:{line:1,column:1,offset:0}),end:Kl(pe.length>0?pe[pe.length-2][1].end:{line:1,column:1,offset:0})},Ot=-1;++Ot<e.transforms.length;)De=e.transforms[Ot](De)||De;return De}function s(pe,De,qe){let mt=De-1,Ot=-1,wr=!1,Xn,Tt,Sr,si;for(;++mt<=qe;){const qt=pe[mt];switch(qt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{qt[0]==="enter"?Ot++:Ot--,si=void 0;break}case"lineEndingBlank":{qt[0]==="enter"&&(Xn&&!si&&!Ot&&!Sr&&(Sr=mt),si=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:si=void 0}if(!Ot&&qt[0]==="enter"&&qt[1].type==="listItemPrefix"||Ot===-1&&qt[0]==="exit"&&(qt[1].type==="listUnordered"||qt[1].type==="listOrdered")){if(Xn){let jr=mt;for(Tt=void 0;jr--;){const As=pe[jr];if(As[1].type==="lineEnding"||As[1].type==="lineEndingBlank"){if(As[0]==="exit")continue;Tt&&(pe[Tt][1].type="lineEndingBlank",wr=!0),As[1].type="lineEnding",Tt=jr}else if(!(As[1].type==="linePrefix"||As[1].type==="blockQuotePrefix"||As[1].type==="blockQuotePrefixWhitespace"||As[1].type==="blockQuoteMarker"||As[1].type==="listItemIndent"))break}Sr&&(!Tt||Sr<Tt)&&(Xn._spread=!0),Xn.end=Object.assign({},Tt?pe[Tt][1].start:qt[1].end),pe.splice(Tt||mt,0,["exit",Xn,qt[2]]),mt++,qe++}if(qt[1].type==="listItemPrefix"){const jr={type:"listItem",_spread:!1,start:Object.assign({},qt[1].start),end:void 0};Xn=jr,pe.splice(mt,0,["enter",jr,qt[2]]),mt++,qe++,Sr=void 0,si=!0}}}return pe[De][1]._spread=wr,qe}function i(pe,De){return qe;function qe(mt){l.call(this,pe(mt),mt),De&&De.call(this,mt)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(pe,De,qe){this.stack[this.stack.length-1].children.push(pe),this.stack.push(pe),this.tokenStack.push([De,qe||void 0]),pe.position={start:Kl(De.start),end:void 0}}function c(pe){return De;function De(qe){pe&&pe.call(this,qe),d.call(this,qe)}}function d(pe,De){const qe=this.stack.pop(),mt=this.tokenStack.pop();if(mt)mt[0].type!==pe.type&&(De?De.call(this,pe,mt[0]):(mt[1]||M3).call(this,pe,mt[0]));else throw new Error("Cannot close `"+pe.type+"` ("+Jm({start:pe.start,end:pe.end})+"): it’s not open");qe.position.end=Kl(pe.end)}function f(){return FA(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(pe){if(this.data.expectingFirstListItemValue){const De=this.stack[this.stack.length-2];De.start=Number.parseInt(this.sliceSerialize(pe),10),this.data.expectingFirstListItemValue=void 0}}function g(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.lang=pe}function y(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.meta=pe}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.value=pe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.value=pe.replace(/(\r?\n|\r)$/g,"")}function S(pe){const De=this.resume(),qe=this.stack[this.stack.length-1];qe.label=De,qe.identifier=xa(this.sliceSerialize(pe)).toLowerCase()}function k(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.title=pe}function N(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.url=pe}function j(pe){const De=this.stack[this.stack.length-1];if(!De.depth){const qe=this.sliceSerialize(pe).length;De.depth=qe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function D(pe){const De=this.stack[this.stack.length-1];De.depth=this.sliceSerialize(pe).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function L(pe){const qe=this.stack[this.stack.length-1].children;let mt=qe[qe.length-1];(!mt||mt.type!=="text")&&(mt=Ne(),mt.position={start:Kl(pe.start),end:void 0},qe.push(mt)),this.stack.push(mt)}function $(pe){const De=this.stack.pop();De.value+=this.sliceSerialize(pe),De.position.end=Kl(pe.end)}function Q(pe){const De=this.stack[this.stack.length-1];if(this.data.atHardBreak){const qe=De.children[De.children.length-1];qe.position.end=Kl(pe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(De.type)&&(L.call(this,pe),$.call(this,pe))}function M(){this.data.atHardBreak=!0}function z(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.value=pe}function R(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.value=pe}function B(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.value=pe}function V(){const pe=this.stack[this.stack.length-1];if(this.data.inReference){const De=this.data.referenceType||"shortcut";pe.type+="Reference",pe.referenceType=De,delete pe.url,delete pe.title}else delete pe.identifier,delete pe.label;this.data.referenceType=void 0}function F(){const pe=this.stack[this.stack.length-1];if(this.data.inReference){const De=this.data.referenceType||"shortcut";pe.type+="Reference",pe.referenceType=De,delete pe.url,delete pe.title}else delete pe.identifier,delete pe.label;this.data.referenceType=void 0}function K(pe){const De=this.sliceSerialize(pe),qe=this.stack[this.stack.length-2];qe.label=YSe(De),qe.identifier=xa(De).toLowerCase()}function Y(){const pe=this.stack[this.stack.length-1],De=this.resume(),qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,qe.type==="link"){const mt=pe.children;qe.children=mt}else qe.alt=De}function O(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.url=pe}function H(){const pe=this.resume(),De=this.stack[this.stack.length-1];De.title=pe}function G(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function J(pe){const De=this.resume(),qe=this.stack[this.stack.length-1];qe.label=De,qe.identifier=xa(this.sliceSerialize(pe)).toLowerCase(),this.data.referenceType="full"}function te(pe){this.data.characterReferenceType=pe.type}function ve(pe){const De=this.sliceSerialize(pe),qe=this.data.characterReferenceType;let mt;qe?(mt=bq(De,qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):mt=zA(De);const Ot=this.stack[this.stack.length-1];Ot.value+=mt}function he(pe){const De=this.stack.pop();De.position.end=Kl(pe.end)}function xe(pe){$.call(this,pe);const De=this.stack[this.stack.length-1];De.url=this.sliceSerialize(pe)}function ke(pe){$.call(this,pe);const De=this.stack[this.stack.length-1];De.url="mailto:"+this.sliceSerialize(pe)}function Oe(){return{type:"blockquote",children:[]}}function He(){return{type:"code",lang:null,meta:null,value:""}}function Ye(){return{type:"inlineCode",value:""}}function lt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function P(){return{type:"emphasis",children:[]}}function ne(){return{type:"heading",depth:0,children:[]}}function X(){return{type:"break"}}function W(){return{type:"html",value:""}}function Z(){return{type:"image",title:null,url:"",alt:null}}function re(){return{type:"link",title:null,url:"",children:[]}}function ae(pe){return{type:"list",ordered:pe.type==="listOrdered",start:null,spread:pe._spread,children:[]}}function fe(pe){return{type:"listItem",spread:pe._spread,checked:null,children:[]}}function oe(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function Ne(){return{type:"text",value:""}}function Le(){return{type:"thematicBreak"}}}function Kl(t){return{line:t.line,column:t.column,offset:t.offset}}function Dq(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?Dq(t,n):JSe(t,n)}}function JSe(t,e){let r;for(r in e)if(Rq.call(e,r))switch(r){case"canContainEols":{const n=e[r];n&&t[r].push(...n);break}case"transforms":{const n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{const n=e[r];n&&Object.assign(t[r],n);break}}}function M3(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Jm({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Jm({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Jm({start:e.start,end:e.end})+") is still open")}function eke(t){const e=this;e.parser=r;function r(n){return XSe(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function tke(t,e){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function rke(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
||
`}]}function nke(t,e){const r=e.value?e.value+`
|
||
`:"",n={},s=e.lang?e.lang.split(/\s+/):[];s.length>0&&(n.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function ske(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function ike(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function ake(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),s=Lf(n.toLowerCase()),i=t.footnoteOrder.indexOf(n);let a,l=t.footnoteCounts.get(n);l===void 0?(l=0,t.footnoteOrder.push(n),a=t.footnoteOrder.length):a=i+1,l+=1,t.footnoteCounts.set(n,l);const c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,d),t.applyData(e,d)}function oke(t,e){const r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function lke(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function Oq(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=n:s.push({type:"text",value:n}),s}function cke(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return Oq(t,e);const s={src:Lf(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function uke(t,e){const r={src:Lf(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function dke(t,e){const r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function hke(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return Oq(t,e);const s={href:Lf(n.url||"")};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function fke(t,e){const r={href:Lf(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function pke(t,e,r){const n=t.all(e),s=r?mke(r):Pq(e),i={},a=[];if(typeof e.checked=="boolean"){const f=n[0];let p;f&&f.type==="element"&&f.tagName==="p"?p=f:(p={type:"element",tagName:"p",properties:{},children:[]},n.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const f=n[l];(s||l!==0||f.type!=="element"||f.tagName!=="p")&&a.push({type:"text",value:`
|
||
`}),f.type==="element"&&f.tagName==="p"&&!s?a.push(...f.children):a.push(f)}const c=n[n.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
||
`});const d={type:"element",tagName:"li",properties:i,children:a};return t.patch(e,d),t.applyData(e,d)}function mke(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const r=t.children;let n=-1;for(;!e&&++n<r.length;)e=Pq(r[n])}return e}function Pq(t){const e=t.spread;return e??t.children.length>1}function gke(t,e){const r={},n=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++s<n.length;){const a=n[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,i),t.applyData(e,i)}function vke(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function yke(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function xke(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function _ke(t,e){const r=t.all(e),n=r.shift(),s=[];if(n){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],a),s.push(a)}if(r.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},l=IA(e.children[1]),c=fq(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function bke(t,e,r){const n=r?r.children:void 0,i=(n?n.indexOf(e):1)===0?"th":"td",a=r&&r.type==="table"?r.align:void 0,l=a?a.length:e.children.length;let c=-1;const d=[];for(;++c<l;){const p=e.children[c],m={},g=a?a[c]:void 0;g&&(m.align=g);let y={type:"element",tagName:i,properties:m,children:[]};p&&(y.children=t.all(p),t.patch(p,y),y=t.applyData(p,y)),d.push(y)}const f={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(e,f),t.applyData(e,f)}function wke(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const I3=9,L3=32;function Ske(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),s=0;const i=[];for(;n;)i.push($3(e.slice(s,n.index),s>0,!0),n[0]),s=n.index+n[0].length,n=r.exec(e);return i.push($3(e.slice(s),s>0,!1)),i.join("")}function $3(t,e,r){let n=0,s=t.length;if(e){let i=t.codePointAt(n);for(;i===I3||i===L3;)n++,i=t.codePointAt(n)}if(r){let i=t.codePointAt(s-1);for(;i===I3||i===L3;)s--,i=t.codePointAt(s-1)}return s>n?t.slice(n,s):""}function kke(t,e){const r={type:"text",value:Ske(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function Eke(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const Cke={blockquote:tke,break:rke,code:nke,delete:ske,emphasis:ike,footnoteReference:ake,heading:oke,html:lke,imageReference:cke,image:uke,inlineCode:dke,linkReference:hke,link:fke,listItem:pke,list:gke,paragraph:vke,root:yke,strong:xke,table:_ke,tableCell:wke,tableRow:bke,text:kke,thematicBreak:Eke,toml:_x,yaml:_x,definition:_x,footnoteDefinition:_x};function _x(){}const Mq=-1,Fb=0,tg=1,d_=2,VA=3,HA=4,qA=5,WA=6,Iq=7,Lq=8,{defineProperty:Nke}=Object,$q=typeof self=="object"?self:globalThis,B3=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new $q[t](e)},jke=(t,e)=>{const r=(s,i)=>(t.set(i,s),s),n=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case Fb:case Mq:return r(a,s);case tg:{const l=r([],s);for(const c of a)l.push(n(c));return l}case d_:{const l=r({},s);for(const[c,d]of a){const f=n(c),p=n(d);f==="__proto__"?Nke(l,f,{value:p,configurable:!0,enumerable:!0,writable:!0}):l[f]=p}return l}case VA:return r(new Date(a),s);case HA:{const{source:l,flags:c}=a;return r(new RegExp(l,c),s)}case qA:{const l=r(new Map,s);for(const[c,d]of a)l.set(n(c),n(d));return l}case WA:{const l=r(new Set,s);for(const c of a)l.add(n(c));return l}case Iq:{const{name:l,message:c}=a;return r(typeof $q[l]=="function"?B3(l,c):new Error(c),s)}case Lq:return r(BigInt(a),s);case"BigInt":return r(Object(BigInt(a)),s);case"ArrayBuffer":return r(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return r(new DataView(l),a)}case"-0":return-0}return r(B3(i,a),s)};return n},F3=t=>jke(new Map,t)(0),ku="",{toString:Tke}={},{keys:Ake,is:Rke}=Object,tm=t=>{const e=typeof t;if(e!=="object"||!t)return[Fb,e];const r=Tke.call(t).slice(8,-1);switch(r){case"Array":return[tg,ku];case"Object":return[d_,ku];case"Date":return[VA,ku];case"RegExp":return[HA,ku];case"Map":return[qA,ku];case"Set":return[WA,ku];case"DataView":return[tg,r]}return r.includes("Array")?[tg,r]:t instanceof Error?[Iq,t.name||"Error"]:[d_,r]},bx=([t,e])=>t===Fb&&(e==="function"||e==="symbol"),Dke=(t,e,r,n)=>{const s=(a,l)=>{const c=n.push(a)-1;return r.set(l,c),c},i=a=>{if(r.has(a))return r.get(a);let[l,c]=tm(a);switch(l){case Fb:{let f=a;switch(c){case"bigint":l=Lq,f=a.toString();break;case"number":if(!a&&Rke(a,-0))return n.push(["-0"])-1;break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([Mq],a)}return s([l,f],a)}case tg:{if(c){let m=a;return c==="DataView"?m=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(a)),s([c,[...m]],a)}const f=[],p=s([l,f],a);for(const m of a)f.push(i(m));return p}case d_:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const f=[],p=s([l,f],a);for(const m of Ake(a))(t||!bx(tm(a[m])))&&f.push([i(m),i(a[m])]);return p}case VA:return s([l,isNaN(a.getTime())?ku:a.toISOString()],a);case HA:{const{source:f,flags:p}=a;return s([l,{source:f,flags:p}],a)}case qA:{const f=[],p=s([l,f],a);for(const[m,g]of a)(t||!(bx(tm(m))||bx(tm(g))))&&f.push([i(m),i(g)]);return p}case WA:{const f=[],p=s([l,f],a);for(const m of a)(t||!bx(tm(m)))&&f.push(i(m));return p}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},z3=(t,{json:e,lossy:r}={})=>{const n=[];return Dke(!(e||r),!!e,new Map,n)(t),n},h_=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?F3(z3(t,e)):structuredClone(t):(t,e)=>F3(z3(t,e));function Oke(t,e){const r=[{type:"text",value:"↩"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function Pke(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Mke(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||Oke,n=t.options.footnoteBackLabel||Pke,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[c]);if(!d)continue;const f=t.all(d),p=String(d.identifier).toUpperCase(),m=Lf(p.toLowerCase());let g=0;const y=[],x=t.footnoteCounts.get(p);for(;x!==void 0&&++g<=x;){y.length>0&&y.push({type:"text",value:" "});let S=typeof r=="string"?r:r(c,g);typeof S=="string"&&(S={type:"text",value:S}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(c,g),className:["data-footnote-backref"]},children:Array.isArray(S)?S:[S]})}const w=f[f.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const S=w.children[w.children.length-1];S&&S.type==="text"?S.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...y)}else f.push(...y);const _={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(f,!0)};t.patch(d,_),l.push(_)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...h_(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
||
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
|
||
`}]}}const zb=function(t){if(t==null)return Bke;if(typeof t=="function")return Ub(t);if(typeof t=="object")return Array.isArray(t)?Ike(t):Lke(t);if(typeof t=="string")return $ke(t);throw new Error("Expected function, string, or object as test")};function Ike(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=zb(t[r]);return Ub(n);function n(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function Lke(t){const e=t;return Ub(r);function r(n){const s=n;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function $ke(t){return Ub(e);function e(r){return r&&r.type===t}}function Ub(t){return e;function e(r,n,s){return!!(Fke(r)&&t.call(this,r,typeof n=="number"?n:void 0,s||void 0))}}function Bke(){return!0}function Fke(t){return t!==null&&typeof t=="object"&&"type"in t}const Bq=[],zke=!0,LN=!1,Uke="skip";function Fq(t,e,r,n){let s;typeof e=="function"&&typeof r!="function"?(n=r,r=e):s=e;const i=zb(s),a=n?-1:1;l(t,void 0,[])();function l(c,d,f){const p=c&&typeof c=="object"?c:{};if(typeof p.type=="string"){const g=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(g?"<"+g+">":""))+")"})}return m;function m(){let g=Bq,y,x,w;if((!e||i(c,d,f[f.length-1]||void 0))&&(g=Vke(r(c,f)),g[0]===LN))return g;if("children"in c&&c.children){const _=c;if(_.children&&g[0]!==Uke)for(x=(n?_.children.length:-1)+a,w=f.concat(_);x>-1&&x<_.children.length;){const S=_.children[x];if(y=l(S,x,w)(),y[0]===LN)return y;x=typeof y[1]=="number"?y[1]:x+a}}return g}}}function Vke(t){return Array.isArray(t)?t:typeof t=="number"?[zke,t]:t==null?Bq:[t]}function GA(t,e,r,n){let s,i,a;typeof e=="function"?(i=void 0,a=e,s=r):(i=e,a=r,s=n),Fq(t,i,l,s);function l(c,d){const f=d[d.length-1],p=f?f.children.indexOf(c):void 0;return a(c,p,f)}}const $N={}.hasOwnProperty,Hke={};function qke(t,e){const r=e||Hke,n=new Map,s=new Map,i=new Map,a={...Cke,...r.handlers},l={all:d,applyData:Gke,definitionById:n,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:r,patch:Wke,wrap:Yke};return GA(t,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const p=f.type==="definition"?n:s,m=String(f.identifier).toUpperCase();p.has(m)||p.set(m,f)}}),l;function c(f,p){const m=f.type,g=l.handlers[m];if($N.call(l.handlers,m)&&g)return g(l,f,p);if(l.options.passThrough&&l.options.passThrough.includes(m)){if("children"in f){const{children:x,...w}=f,_=h_(w);return _.children=l.all(f),_}return h_(f)}return(l.options.unknownHandler||Kke)(l,f,p)}function d(f){const p=[];if("children"in f){const m=f.children;let g=-1;for(;++g<m.length;){const y=l.one(m[g],f);if(y){if(g&&m[g-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=U3(y.value)),!Array.isArray(y)&&y.type==="element")){const x=y.children[0];x&&x.type==="text"&&(x.value=U3(x.value))}Array.isArray(y)?p.push(...y):p.push(y)}}}return p}}function Wke(t,e){t.position&&(e.position=Dwe(t))}function Gke(t,e){let r=e;if(t&&t.data){const n=t.data.hName,s=t.data.hChildren,i=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const a="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:a}}r.type==="element"&&i&&Object.assign(r.properties,h_(i)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function Kke(t,e){const r=e.data||{},n="value"in e&&!($N.call(r,"hProperties")||$N.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Yke(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
|
||
`});++n<t.length;)n&&r.push({type:"text",value:`
|
||
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
||
`}),r}function U3(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function V3(t,e){const r=qke(t,e),n=r.one(t,void 0),s=Mke(r),i=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
||
`},s),i}function Qke(t,e){return t&&"run"in t?async function(r,n){const s=V3(r,{file:n,...e});await t.run(s,n)}:function(r,n){return V3(r,{file:n,...t||e})}}function H3(t){if(t)throw t}var Tk,q3;function Xke(){if(q3)return Tk;q3=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},i=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var f=t.call(d,"constructor"),p=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!f&&!p)return!1;var m;for(m in d);return typeof m>"u"||t.call(d,m)},a=function(d,f){r&&f.name==="__proto__"?r(d,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):d[f.name]=f.newValue},l=function(d,f){if(f==="__proto__")if(t.call(d,f)){if(n)return n(d,f).value}else return;return d[f]};return Tk=function c(){var d,f,p,m,g,y,x=arguments[0],w=1,_=arguments.length,S=!1;for(typeof x=="boolean"&&(S=x,x=arguments[1]||{},w=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});w<_;++w)if(d=arguments[w],d!=null)for(f in d)p=l(x,f),m=l(d,f),x!==m&&(S&&m&&(i(m)||(g=s(m)))?(g?(g=!1,y=p&&s(p)?p:[]):y=p&&i(p)?p:{},a(x,{name:f,newValue:c(S,y,m)})):typeof m<"u"&&a(x,{name:f,newValue:m}));return x},Tk}var Zke=Xke();const Ak=ml(Zke);function BN(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 Jke(){const t=[],e={run:r,use:n};return e;function r(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...d){const f=t[++i];let p=-1;if(c){a(c);return}for(;++p<s.length;)(d[p]===null||d[p]===void 0)&&(d[p]=s[p]);s=d,f?eEe(f,l)(...d):a(null,...d)}}function n(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function eEe(t,e){let r;return n;function n(...a){const l=t.length>a.length;let c;l&&a.push(s);try{c=t.apply(this,a)}catch(d){const f=d;if(l&&r)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){r||(r=!0,e(a,...l))}function i(a){s(null,a)}}const Ja={basename:tEe,dirname:rEe,extname:nEe,join:sEe,sep:"/"};function tEe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ev(t);let r=0,n=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){r=s+1;break}}else n<0&&(i=!0,n=s+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let a=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){r=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(n=s):(l=-1,n=a));return r===n?n=a:n<0&&(n=t.length),t.slice(r,n)}function rEe(t){if(Ev(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function nEe(t){Ev(t);let e=t.length,r=-1,n=0,s=-1,i=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){n=e+1;break}continue}r<0&&(a=!0,r=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||r<0||i===0||i===1&&s===r-1&&s===n+1?"":t.slice(s,r)}function sEe(...t){let e=-1,r;for(;++e<t.length;)Ev(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":iEe(r)}function iEe(t){Ev(t);const e=t.codePointAt(0)===47;let r=aEe(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function aEe(t,e){let r="",n=0,s=-1,i=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(!(s===a-1||i===1))if(s!==a-1&&i===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),s=a,i=0;continue}}else if(r.length>0){r="",n=0,s=a,i=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(s+1,a):r=t.slice(s+1,a),n=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return r}function Ev(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const oEe={cwd:lEe};function lEe(){return"/"}function FN(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function cEe(t){if(typeof t=="string")t=new URL(t);else if(!FN(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 uEe(t)}function uEe(t){if(t.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=t.pathname;let r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){const n=e.codePointAt(r+2);if(n===70||n===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const Rk=["history","path","basename","stem","extname","dirname"];class zq{constructor(e){let r;e?FN(e)?r={path:e}:typeof e=="string"||dEe(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":oEe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Rk.length;){const i=Rk[n];i in r&&r[i]!==void 0&&r[i]!==null&&(this[i]=i==="history"?[...r[i]]:r[i])}let s;for(s in r)Rk.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Ja.basename(this.path):void 0}set basename(e){Ok(e,"basename"),Dk(e,"basename"),this.path=Ja.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ja.dirname(this.path):void 0}set dirname(e){W3(this.basename,"dirname"),this.path=Ja.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ja.extname(this.path):void 0}set extname(e){if(Dk(e,"extname"),W3(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=Ja.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){FN(e)&&(e=cEe(e)),Ok(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ja.basename(this.path,this.extname):void 0}set stem(e){Ok(e,"stem"),Dk(e,"stem"),this.path=Ja.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){const s=this.message(e,r,n);throw s.fatal=!0,s}info(e,r,n){const s=this.message(e,r,n);return s.fatal=void 0,s}message(e,r,n){const s=new Ts(e,r,n);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Dk(t,e){if(t&&t.includes(Ja.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ja.sep+"`")}function Ok(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function W3(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function dEe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const hEe=function(t){const n=this.constructor.prototype,s=n[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,n),i},fEe={}.hasOwnProperty;class KA extends hEe{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=Jke()}copy(){const e=new KA;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Ak(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Ik("data",this.frozen),this.namespace[e]=r,this):fEe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ik("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const s=r.call(e,...n);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=wx(e),n=this.parser||this.Parser;return Pk("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Pk("process",this.parser||this.Parser),Mk("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(i,a){const l=wx(e),c=n.parse(l);n.run(c,l,function(f,p,m){if(f||!p||!m)return d(f);const g=p,y=n.stringify(g,m);gEe(y)?m.value=y:m.result=y,d(f,m)});function d(f,p){f||!p?a(f):i?i(p):r(void 0,p)}}}processSync(e){let r=!1,n;return this.freeze(),Pk("processSync",this.parser||this.Parser),Mk("processSync",this.compiler||this.Compiler),this.process(e,s),K3("processSync","process",r),n;function s(i,a){r=!0,H3(i),n=a}}run(e,r,n){G3(e),this.freeze();const s=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?i(void 0,n):new Promise(i);function i(a,l){const c=wx(r);s.run(e,c,d);function d(f,p,m){const g=p||e;f?l(f):a?a(g):n(void 0,g,m)}}}runSync(e,r){let n=!1,s;return this.run(e,r,i),K3("runSync","run",n),s;function i(a,l){H3(a),s=l,n=!0}}stringify(e,r){this.freeze();const n=wx(r),s=this.compiler||this.Compiler;return Mk("stringify",s),G3(e),s(e,n)}use(e,...r){const n=this.attachers,s=this.namespace;if(Ik("use",this.frozen),e!=null)if(typeof e=="function")c(e,r);else if(typeof e=="object")Array.isArray(e)?l(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[f,...p]=d;c(f,p)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))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(d.plugins),d.settings&&(s.settings=Ak(!0,s.settings,d.settings))}function l(d){let f=-1;if(d!=null)if(Array.isArray(d))for(;++f<d.length;){const p=d[f];i(p)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,f){let p=-1,m=-1;for(;++p<n.length;)if(n[p][0]===d){m=p;break}if(m===-1)n.push([d,...f]);else if(f.length>0){let[g,...y]=f;const x=n[m][1];BN(x)&&BN(g)&&(g=Ak(!0,x,g)),n[m]=[d,g,...y]}}}}const pEe=new KA().freeze();function Pk(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Mk(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ik(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 G3(t){if(!BN(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function K3(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function wx(t){return mEe(t)?t:new zq(t)}function mEe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function gEe(t){return typeof t=="string"||vEe(t)}function vEe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const yEe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Y3=[],Q3={allowDangerousHtml:!0},xEe=/^(https?|ircs?|mailto|xmpp)$/i,_Ee=[{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 bEe(t){const e=wEe(t),r=SEe(t);return kEe(e.runSync(e.parse(r),r),t)}function wEe(t){const e=t.rehypePlugins||Y3,r=t.remarkPlugins||Y3,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Q3}:Q3;return pEe().use(eke).use(r).use(Qke,n).use(e)}function SEe(t){const e=t.children||"",r=new zq;return typeof e=="string"&&(r.value=e),r}function kEe(t,e){const r=e.allowedElements,n=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||EEe;for(const f of _Ee)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+yEe+f.id,void 0);return GA(t,d),Lwe(t,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(f,p,m){if(f.type==="raw"&&m&&typeof p=="number")return a?m.children.splice(p,1):m.children[p]={type:"text",value:f.value},p;if(f.type==="element"){let g;for(g in Ck)if(Object.hasOwn(Ck,g)&&Object.hasOwn(f.properties,g)){const y=f.properties[g],x=Ck[g];(x===null||x.includes(f.tagName))&&(f.properties[g]=c(String(y||""),g,f))}}if(f.type==="element"){let g=r?!r.includes(f.tagName):i?i.includes(f.tagName):!1;if(!g&&n&&typeof p=="number"&&(g=!n(f,p,m)),g&&m&&typeof p=="number")return l&&f.children?m.children.splice(p,1,...f.children):m.children.splice(p,1),p}}}function EEe(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||r!==-1&&e>r||n!==-1&&e>n||xEe.test(t.slice(0,e))?t:""}function X3(t,e){const r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,s=r.indexOf(e);for(;s!==-1;)n++,s=r.indexOf(e,s+e.length);return n}function CEe(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function NEe(t,e,r){const s=zb((r||{}).ignore||[]),i=jEe(e);let a=-1;for(;++a<i.length;)Fq(t,"text",l);function l(d,f){let p=-1,m;for(;++p<f.length;){const g=f[p],y=m?m.children:void 0;if(s(g,y?y.indexOf(g):void 0,m))return;m=g}if(m)return c(d,f)}function c(d,f){const p=f[f.length-1],m=i[a][0],g=i[a][1];let y=0;const w=p.children.indexOf(d);let _=!1,S=[];m.lastIndex=0;let k=m.exec(d.value);for(;k;){const N=k.index,j={index:k.index,input:k.input,stack:[...f,d]};let T=g(...k,j);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?m.lastIndex=N+1:(y!==N&&S.push({type:"text",value:d.value.slice(y,N)}),Array.isArray(T)?S.push(...T):T&&S.push(T),y=N+k[0].length,_=!0),!m.global)break;k=m.exec(d.value)}return _?(y<d.value.length&&S.push({type:"text",value:d.value.slice(y)}),p.children.splice(w,1,...S)):S=[d],w+S.length}}function jEe(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let n=-1;for(;++n<r.length;){const s=r[n];e.push([TEe(s[0]),AEe(s[1])])}return e}function TEe(t){return typeof t=="string"?new RegExp(CEe(t),"g"):t}function AEe(t){return typeof t=="function"?t:function(){return t}}const Lk="phrasing",$k=["autolink","link","image","label"];function REe(){return{transforms:[$Ee],enter:{literalAutolink:OEe,literalAutolinkEmail:Bk,literalAutolinkHttp:Bk,literalAutolinkWww:Bk},exit:{literalAutolink:LEe,literalAutolinkEmail:IEe,literalAutolinkHttp:PEe,literalAutolinkWww:MEe}}}function DEe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Lk,notInConstruct:$k},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Lk,notInConstruct:$k},{character:":",before:"[ps]",after:"\\/",inConstruct:Lk,notInConstruct:$k}]}}function OEe(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Bk(t){this.config.enter.autolinkProtocol.call(this,t)}function PEe(t){this.config.exit.autolinkProtocol.call(this,t)}function MEe(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 IEe(t){this.config.exit.autolinkEmail.call(this,t)}function LEe(t){this.exit(t)}function $Ee(t){NEe(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,BEe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),FEe]],{ignore:["link","linkReference"]})}function BEe(t,e,r,n,s){let i="";if(!Uq(s)||(/^w/i.test(e)&&(r=e+r,e="",i="http://"),!zEe(r)))return!1;const a=UEe(r+n);if(!a[0])return!1;const l={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function FEe(t,e,r,n){return!Uq(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function zEe(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 UEe(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],n=r.indexOf(")");const s=X3(t,"(");let i=X3(t,")");for(;n!==-1&&s>i;)t+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),i++;return[t,r]}function Uq(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||nd(r)||$b(r))&&(!e||r!==47)}Vq.peek=XEe;function VEe(){this.buffer()}function HEe(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function qEe(){this.buffer()}function WEe(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function GEe(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=xa(this.sliceSerialize(t)).toLowerCase(),r.label=e}function KEe(t){this.exit(t)}function YEe(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=xa(this.sliceSerialize(t)).toLowerCase(),r.label=e}function QEe(t){this.exit(t)}function XEe(){return"["}function Vq(t,e,r,n){const s=r.createTracker(n);let i=s.move("[^");const a=r.enter("footnoteReference"),l=r.enter("reference");return i+=s.move(r.safe(r.associationId(t),{after:"]",before:i})),l(),a(),i+=s.move("]"),i}function ZEe(){return{enter:{gfmFootnoteCallString:VEe,gfmFootnoteCall:HEe,gfmFootnoteDefinitionLabelString:qEe,gfmFootnoteDefinition:WEe},exit:{gfmFootnoteCallString:GEe,gfmFootnoteCall:KEe,gfmFootnoteDefinitionLabelString:YEe,gfmFootnoteDefinition:QEe}}}function JEe(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:Vq},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,s,i,a){const l=i.createTracker(a);let c=l.move("[^");const d=i.enter("footnoteDefinition"),f=i.enter("label");return c+=l.move(i.safe(i.associationId(n),{before:c,after:"]"})),f(),c+=l.move("]:"),n.children&&n.children.length>0&&(l.shift(4),c+=l.move((e?`
|
||
`:" ")+i.indentLines(i.containerFlow(n,l.current()),e?Hq:eCe))),d(),c}}function eCe(t,e,r){return e===0?t:Hq(t,e,r)}function Hq(t,e,r){return(r?"":" ")+t}const tCe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];qq.peek=aCe;function rCe(){return{canContainEols:["delete"],enter:{strikethrough:sCe},exit:{strikethrough:iCe}}}function nCe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:tCe}],handlers:{delete:qq}}}function sCe(t){this.enter({type:"delete",children:[]},t)}function iCe(t){this.exit(t)}function qq(t,e,r,n){const s=r.createTracker(n),i=r.enter("strikethrough");let a=s.move("~~");return a+=r.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function aCe(){return"~"}function oCe(t){return t.length}function lCe(t,e){const r=e||{},n=(r.align||[]).concat(),s=r.stringLength||oCe,i=[],a=[],l=[],c=[];let d=0,f=-1;for(;++f<t.length;){const x=[],w=[];let _=-1;for(t[f].length>d&&(d=t[f].length);++_<t[f].length;){const S=cCe(t[f][_]);if(r.alignDelimiters!==!1){const k=s(S);w[_]=k,(c[_]===void 0||k>c[_])&&(c[_]=k)}x.push(S)}a[f]=x,l[f]=w}let p=-1;if(typeof n=="object"&&"length"in n)for(;++p<d;)i[p]=Z3(n[p]);else{const x=Z3(n);for(;++p<d;)i[p]=x}p=-1;const m=[],g=[];for(;++p<d;){const x=i[p];let w="",_="";x===99?(w=":",_=":"):x===108?w=":":x===114&&(_=":");let S=r.alignDelimiters===!1?1:Math.max(1,c[p]-w.length-_.length);const k=w+"-".repeat(S)+_;r.alignDelimiters!==!1&&(S=w.length+S+_.length,S>c[p]&&(c[p]=S),g[p]=S),m[p]=k}a.splice(1,0,m),l.splice(1,0,g),f=-1;const y=[];for(;++f<a.length;){const x=a[f],w=l[f];p=-1;const _=[];for(;++p<d;){const S=x[p]||"";let k="",N="";if(r.alignDelimiters!==!1){const j=c[p]-(w[p]||0),T=i[p];T===114?k=" ".repeat(j):T===99?j%2?(k=" ".repeat(j/2+.5),N=" ".repeat(j/2-.5)):(k=" ".repeat(j/2),N=k):N=" ".repeat(j)}r.delimiterStart!==!1&&!p&&_.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&S==="")&&(r.delimiterStart!==!1||p)&&_.push(" "),r.alignDelimiters!==!1&&_.push(k),_.push(S),r.alignDelimiters!==!1&&_.push(N),r.padding!==!1&&_.push(" "),(r.delimiterEnd!==!1||p!==d-1)&&_.push("|")}y.push(r.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return y.join(`
|
||
`)}function cCe(t){return t==null?"":String(t)}function Z3(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 uCe(t,e,r,n){const s=r.enter("blockquote"),i=r.createTracker(n);i.move("> "),i.shift(2);const a=r.indentLines(r.containerFlow(t,i.current()),dCe);return s(),a}function dCe(t,e,r){return">"+(r?"":" ")+t}function hCe(t,e){return J3(t,e.inConstruct,!0)&&!J3(t,e.notInConstruct,!1)}function J3(t,e,r){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return r;let n=-1;for(;++n<e.length;)if(t.includes(e[n]))return!0;return!1}function eL(t,e,r,n){let s=-1;for(;++s<r.unsafe.length;)if(r.unsafe[s].character===`
|
||
`&&hCe(r.stack,r.unsafe[s]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
||
`}function fCe(t,e){const r=String(t);let n=r.indexOf(e),s=n,i=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===s?++i>a&&(a=i):i=1,s=n+e.length,n=r.indexOf(e,s);return a}function pCe(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 mCe(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 gCe(t,e,r,n){const s=mCe(r),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(pCe(t,r)){const p=r.enter("codeIndented"),m=r.indentLines(i,vCe);return p(),m}const l=r.createTracker(n),c=s.repeat(Math.max(fCe(i,s)+1,3)),d=r.enter("codeFenced");let f=l.move(c);if(t.lang){const p=r.enter(`codeFencedLang${a}`);f+=l.move(r.safe(t.lang,{before:f,after:" ",encode:["`"],...l.current()})),p()}if(t.lang&&t.meta){const p=r.enter(`codeFencedMeta${a}`);f+=l.move(" "),f+=l.move(r.safe(t.meta,{before:f,after:`
|
||
`,encode:["`"],...l.current()})),p()}return f+=l.move(`
|
||
`),i&&(f+=l.move(i+`
|
||
`)),f+=l.move(c),d(),f}function vCe(t,e,r){return(r?"":" ")+t}function YA(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 yCe(t,e,r,n){const s=YA(r),i=s==='"'?"Quote":"Apostrophe",a=r.enter("definition");let l=r.enter("label");const c=r.createTracker(n);let d=c.move("[");return d+=c.move(r.safe(r.associationId(t),{before:d,after:"]",...c.current()})),d+=c.move("]: "),l(),!t.url||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(r.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=r.enter("destinationRaw"),d+=c.move(r.safe(t.url,{before:d,after:t.title?" ":`
|
||
`,...c.current()}))),l(),t.title&&(l=r.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(r.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),a(),d}function xCe(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 Bg(t){return"&#x"+t.toString(16).toUpperCase()+";"}function f_(t,e,r){const n=sf(t),s=sf(e);return n===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Wq.peek=_Ce;function Wq(t,e,r,n){const s=xCe(r),i=r.enter("emphasis"),a=r.createTracker(n),l=a.move(s);let c=a.move(r.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),f=f_(n.before.charCodeAt(n.before.length-1),d,s);f.inside&&(c=Bg(d)+c.slice(1));const p=c.charCodeAt(c.length-1),m=f_(n.after.charCodeAt(0),p,s);m.inside&&(c=c.slice(0,-1)+Bg(p));const g=a.move(s);return i(),r.attentionEncodeSurroundingInfo={after:m.outside,before:f.outside},l+c+g}function _Ce(t,e,r){return r.options.emphasis||"*"}function bCe(t,e){let r=!1;return GA(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,LN}),!!((!t.depth||t.depth<3)&&FA(t)&&(e.options.setext||r))}function wCe(t,e,r,n){const s=Math.max(Math.min(6,t.depth||1),1),i=r.createTracker(n);if(bCe(t,r)){const f=r.enter("headingSetext"),p=r.enter("phrasing"),m=r.containerPhrasing(t,{...i.current(),before:`
|
||
`,after:`
|
||
`});return p(),f(),m+`
|
||
`+(s===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
|
||
`))+1))}const a="#".repeat(s),l=r.enter("headingAtx"),c=r.enter("phrasing");i.move(a+" ");let d=r.containerPhrasing(t,{before:"# ",after:`
|
||
`,...i.current()});return/^[\t ]/.test(d)&&(d=Bg(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,r.options.closeAtx&&(d+=" "+a),c(),l(),d}Gq.peek=SCe;function Gq(t){return t.value||""}function SCe(){return"<"}Kq.peek=kCe;function Kq(t,e,r,n){const s=YA(r),i=s==='"'?"Quote":"Apostrophe",a=r.enter("image");let l=r.enter("label");const c=r.createTracker(n);let d=c.move("![");return d+=c.move(r.safe(t.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(r.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=r.enter("destinationRaw"),d+=c.move(r.safe(t.url,{before:d,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=r.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(r.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),d+=c.move(")"),a(),d}function kCe(){return"!"}Yq.peek=ECe;function Yq(t,e,r,n){const s=t.referenceType,i=r.enter("imageReference");let a=r.enter("label");const l=r.createTracker(n);let c=l.move("![");const d=r.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const f=r.stack;r.stack=[],a=r.enter("reference");const p=r.safe(r.associationId(t),{before:c,after:"]",...l.current()});return a(),r.stack=f,i(),s==="full"||!d||d!==p?c+=l.move(p+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function ECe(){return"!"}Qq.peek=CCe;function Qq(t,e,r){let n=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(n);)s+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++i<r.unsafe.length;){const a=r.unsafe[i],l=r.compilePattern(a);let c;if(a.atBreak)for(;c=l.exec(n);){let d=c.index;n.charCodeAt(d)===10&&n.charCodeAt(d-1)===13&&d--,n=n.slice(0,d)+" "+n.slice(c.index+1)}}return s+n+s}function CCe(){return"`"}function Xq(t,e){const r=FA(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Zq.peek=NCe;function Zq(t,e,r,n){const s=YA(r),i=s==='"'?"Quote":"Apostrophe",a=r.createTracker(n);let l,c;if(Xq(t,r)){const f=r.stack;r.stack=[],l=r.enter("autolink");let p=a.move("<");return p+=a.move(r.containerPhrasing(t,{before:p,after:">",...a.current()})),p+=a.move(">"),l(),r.stack=f,p}l=r.enter("link"),c=r.enter("label");let d=a.move("[");return d+=a.move(r.containerPhrasing(t,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=r.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(r.safe(t.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=r.enter("destinationRaw"),d+=a.move(r.safe(t.url,{before:d,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=r.enter(`title${i}`),d+=a.move(" "+s),d+=a.move(r.safe(t.title,{before:d,after:s,...a.current()})),d+=a.move(s),c()),d+=a.move(")"),l(),d}function NCe(t,e,r){return Xq(t,r)?"<":"["}Jq.peek=jCe;function Jq(t,e,r,n){const s=t.referenceType,i=r.enter("linkReference");let a=r.enter("label");const l=r.createTracker(n);let c=l.move("[");const d=r.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const f=r.stack;r.stack=[],a=r.enter("reference");const p=r.safe(r.associationId(t),{before:c,after:"]",...l.current()});return a(),r.stack=f,i(),s==="full"||!d||d!==p?c+=l.move(p+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function jCe(){return"["}function QA(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 TCe(t){const e=QA(t),r=t.options.bulletOther;if(!r)return e==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+r+"`) to be different");return r}function ACe(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 eW(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 RCe(t,e,r,n){const s=r.enter("list"),i=r.bulletCurrent;let a=t.ordered?ACe(r):QA(r);const l=t.ordered?a==="."?")":".":TCe(r);let c=e&&r.bulletLastUsed?a===r.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&f&&(!f.children||!f.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(c=!0),eW(r)===a&&f){let p=-1;for(;++p<t.children.length;){const m=t.children[p];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=l),r.bulletCurrent=a;const d=r.containerFlow(t,n);return r.bulletLastUsed=a,r.bulletCurrent=i,s(),d}function DCe(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 OCe(t,e,r,n){const s=DCe(r);let i=r.bulletCurrent||QA(r);e&&e.type==="list"&&e.ordered&&(i=(typeof e.start=="number"&&e.start>-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const l=r.createTracker(n);l.move(i+" ".repeat(a-i.length)),l.shift(a);const c=r.enter("listItem"),d=r.indentLines(r.containerFlow(t,l.current()),f);return c(),d;function f(p,m,g){return m?(g?"":" ".repeat(a))+p:(g?i:i+" ".repeat(a-i.length))+p}}function PCe(t,e,r,n){const s=r.enter("paragraph"),i=r.enter("phrasing"),a=r.containerPhrasing(t,n);return i(),s(),a}const MCe=zb(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ICe(t,e,r,n){return(t.children.some(function(a){return MCe(a)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function LCe(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}tW.peek=$Ce;function tW(t,e,r,n){const s=LCe(r),i=r.enter("strong"),a=r.createTracker(n),l=a.move(s+s);let c=a.move(r.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),f=f_(n.before.charCodeAt(n.before.length-1),d,s);f.inside&&(c=Bg(d)+c.slice(1));const p=c.charCodeAt(c.length-1),m=f_(n.after.charCodeAt(0),p,s);m.inside&&(c=c.slice(0,-1)+Bg(p));const g=a.move(s+s);return i(),r.attentionEncodeSurroundingInfo={after:m.outside,before:f.outside},l+c+g}function $Ce(t,e,r){return r.options.strong||"*"}function BCe(t,e,r,n){return r.safe(t.value,n)}function FCe(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 zCe(t,e,r){const n=(eW(r)+(r.options.ruleSpaces?" ":"")).repeat(FCe(r));return r.options.ruleSpaces?n.slice(0,-1):n}const rW={blockquote:uCe,break:eL,code:gCe,definition:yCe,emphasis:Wq,hardBreak:eL,heading:wCe,html:Gq,image:Kq,imageReference:Yq,inlineCode:Qq,link:Zq,linkReference:Jq,list:RCe,listItem:OCe,paragraph:PCe,root:ICe,strong:tW,text:BCe,thematicBreak:zCe};function UCe(){return{enter:{table:VCe,tableData:tL,tableHeader:tL,tableRow:qCe},exit:{codeText:WCe,table:HCe,tableData:Fk,tableHeader:Fk,tableRow:Fk}}}function VCe(t){const e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function HCe(t){this.exit(t),this.data.inTable=void 0}function qCe(t){this.enter({type:"tableRow",children:[]},t)}function Fk(t){this.exit(t)}function tL(t){this.enter({type:"tableCell",children:[]},t)}function WCe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,GCe));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function GCe(t,e){return e==="|"?e:t}function KCe(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,s=e.stringLength,i=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
||
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:a,tableCell:c,tableRow:l}};function a(g,y,x,w){return d(f(g,x,w),g.align)}function l(g,y,x,w){const _=p(g,x,w),S=d([_]);return S.slice(0,S.indexOf(`
|
||
`))}function c(g,y,x,w){const _=x.enter("tableCell"),S=x.enter("phrasing"),k=x.containerPhrasing(g,{...w,before:i,after:i});return S(),_(),k}function d(g,y){return lCe(g,{align:y,alignDelimiters:n,padding:r,stringLength:s})}function f(g,y,x){const w=g.children;let _=-1;const S=[],k=y.enter("table");for(;++_<w.length;)S[_]=p(w[_],y,x);return k(),S}function p(g,y,x){const w=g.children;let _=-1;const S=[],k=y.enter("tableRow");for(;++_<w.length;)S[_]=c(w[_],g,y,x);return k(),S}function m(g,y,x){let w=rW.inlineCode(g,y,x);return x.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function YCe(){return{exit:{taskListCheckValueChecked:rL,taskListCheckValueUnchecked:rL,paragraph:XCe}}}function QCe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ZCe}}}function rL(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function XCe(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const s=e.children;let i=-1,a;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){a=l;break}}a===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(t)}function ZCe(t,e,r,n){const s=t.children[0],i=typeof t.checked=="boolean"&&s&&s.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",l=r.createTracker(n);i&&l.move(a);let c=rW.listItem(t,e,r,{...n,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(f){return f+a}}function JCe(){return[REe(),ZEe(),rCe(),UCe(),YCe()]}function eNe(t){return{extensions:[DEe(),JEe(t),nCe(),KCe(t),QCe()]}}const tNe={tokenize:oNe,partial:!0},nW={tokenize:lNe,partial:!0},sW={tokenize:cNe,partial:!0},iW={tokenize:uNe,partial:!0},rNe={tokenize:dNe,partial:!0},aW={name:"wwwAutolink",tokenize:iNe,previous:lW},oW={name:"protocolAutolink",tokenize:aNe,previous:cW},bl={name:"emailAutolink",tokenize:sNe,previous:uW},ko={};function nNe(){return{text:ko}}let pu=48;for(;pu<123;)ko[pu]=bl,pu++,pu===58?pu=65:pu===91&&(pu=97);ko[43]=bl;ko[45]=bl;ko[46]=bl;ko[95]=bl;ko[72]=[bl,oW];ko[104]=[bl,oW];ko[87]=[bl,aW];ko[119]=[bl,aW];function sNe(t,e,r){const n=this;let s,i;return a;function a(p){return!zN(p)||!uW.call(n,n.previous)||XA(n.events)?r(p):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),l(p))}function l(p){return zN(p)?(t.consume(p),l):p===64?(t.consume(p),c):r(p)}function c(p){return p===46?t.check(rNe,f,d)(p):p===45||p===95||Ns(p)?(i=!0,t.consume(p),c):f(p)}function d(p){return t.consume(p),s=!0,c}function f(p){return i&&s&&Ls(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(p)):r(p)}}function iNe(t,e,r){const n=this;return s;function s(a){return a!==87&&a!==119||!lW.call(n,n.previous)||XA(n.events)?r(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(tNe,t.attempt(nW,t.attempt(sW,i),r),r)(a))}function i(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function aNe(t,e,r){const n=this;let s="",i=!1;return a;function a(p){return(p===72||p===104)&&cW.call(n,n.previous)&&!XA(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),t.consume(p),l):r(p)}function l(p){if(Ls(p)&&s.length<5)return s+=String.fromCodePoint(p),t.consume(p),l;if(p===58){const m=s.toLowerCase();if(m==="http"||m==="https")return t.consume(p),c}return r(p)}function c(p){return p===47?(t.consume(p),i?d:(i=!0,c)):r(p)}function d(p){return p===null||u_(p)||_r(p)||nd(p)||$b(p)?r(p):t.attempt(nW,t.attempt(sW,f),r)(p)}function f(p){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(p)}}function oNe(t,e,r){let n=0;return s;function s(a){return(a===87||a===119)&&n<3?(n++,t.consume(a),s):a===46&&n===3?(t.consume(a),i):r(a)}function i(a){return a===null?r(a):e(a)}}function lNe(t,e,r){let n,s,i;return a;function a(d){return d===46||d===95?t.check(iW,c,l)(d):d===null||_r(d)||nd(d)||d!==45&&$b(d)?c(d):(i=!0,t.consume(d),a)}function l(d){return d===95?n=!0:(s=n,n=void 0),t.consume(d),a}function c(d){return s||n||!i?r(d):e(d)}}function cNe(t,e){let r=0,n=0;return s;function s(a){return a===40?(r++,t.consume(a),s):a===41&&n<r?i(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(iW,e,i)(a):a===null||_r(a)||nd(a)?e(a):(t.consume(a),s)}function i(a){return a===41&&n++,t.consume(a),s}}function uNe(t,e,r){return n;function n(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),n):l===38?(t.consume(l),i):l===93?(t.consume(l),s):l===60||l===null||_r(l)||nd(l)?e(l):r(l)}function s(l){return l===null||l===40||l===91||_r(l)||nd(l)?e(l):n(l)}function i(l){return Ls(l)?a(l):r(l)}function a(l){return l===59?(t.consume(l),n):Ls(l)?(t.consume(l),a):r(l)}}function dNe(t,e,r){return n;function n(i){return t.consume(i),s}function s(i){return Ns(i)?r(i):e(i)}}function lW(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||_r(t)}function cW(t){return!Ls(t)}function uW(t){return!(t===47||zN(t))}function zN(t){return t===43||t===45||t===46||t===95||Ns(t)}function XA(t){let e=t.length,r=!1;for(;e--;){const n=t[e][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const hNe={tokenize:_Ne,partial:!0};function fNe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:vNe,continuation:{tokenize:yNe},exit:xNe}},text:{91:{name:"gfmFootnoteCall",tokenize:gNe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:pNe,resolveTo:mNe}}}}function pNe(t,e,r){const n=this;let s=n.events.length;const i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a;for(;s--;){const c=n.events[s][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 r(c);const d=xa(n.sliceSerialize({start:a.end,end:n.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?r(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function mNe(t,e){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...l),t}function gNe(t,e,r){const n=this,s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let i=0,a;return l;function l(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),c}function c(p){return p!==94?r(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(p){if(i>999||p===93&&!a||p===null||p===91||_r(p))return r(p);if(p===93){t.exit("chunkString");const m=t.exit("gfmFootnoteCallString");return s.includes(xa(n.sliceSerialize(m)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(p)}return _r(p)||(a=!0),i++,t.consume(p),p===92?f:d}function f(p){return p===91||p===92||p===93?(t.consume(p),i++,d):d(p)}}function vNe(t,e,r){const n=this,s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let i,a=0,l;return c;function c(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):r(y)}function f(y){if(a>999||y===93&&!l||y===null||y===91||_r(y))return r(y);if(y===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return i=xa(n.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),m}return _r(y)||(l=!0),a++,t.consume(y),y===92?p:f}function p(y){return y===91||y===92||y===93?(t.consume(y),a++,f):f(y)}function m(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),Kt(t,g,"gfmFootnoteDefinitionWhitespace")):r(y)}function g(y){return e(y)}}function yNe(t,e,r){return t.check(kv,e,t.attempt(hNe,e,r))}function xNe(t){t.exit("gfmFootnoteDefinition")}function _Ne(t,e,r){const n=this;return Kt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=n.events[n.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):r(i)}}function bNe(t){let r=(t||{}).singleTilde;const n={name:"strikethrough",tokenize:i,resolveAll:s};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function s(a,l){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},p={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},m=[["enter",f,l],["enter",a[d][1],l],["exit",a[d][1],l],["enter",p,l]],g=l.parser.constructs.insideSpan.null;g&&xi(m,m.length,0,Bb(g,a.slice(d+1,c),l)),xi(m,m.length,0,[["exit",p,l],["enter",a[c][1],l],["exit",a[c][1],l],["exit",f,l]]),xi(a,d-1,c-d+3,m),c=d+m.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function i(a,l,c){const d=this.previous,f=this.events;let p=0;return m;function m(y){return d===126&&f[f.length-1][1].type!=="characterEscape"?c(y):(a.enter("strikethroughSequenceTemporary"),g(y))}function g(y){const x=sf(d);if(y===126)return p>1?c(y):(a.consume(y),p++,g);if(p<2&&!r)return c(y);const w=a.exit("strikethroughSequenceTemporary"),_=sf(y);return w._open=!_||_===2&&!!x,w._close=!x||x===2&&!!_,l(y)}}}class wNe{constructor(){this.map=[],this.index=new Map}add(e,r,n){SNe(this,e,r,n)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];n.push(e.slice()),e.length=0;let s=n.pop();for(;s;){for(const i of s)e.push(i);s=n.pop()}this.map.length=0,this.index.clear()}}function SNe(t,e,r,n){if(r===0&&n.length===0)return;const s=t.index.get(e);if(s){s[1]+=r,s[2].push(...n);return}const i=[e,r,n];t.map.push(i),t.index.set(e,i)}function kNe(t,e){let r=!1;const n=[];for(;e<t.length;){const s=t[e];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&n.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const i=n.length-1;n[i]=n[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return n}function ENe(){return{flow:{null:{name:"table",tokenize:CNe,resolveAll:NNe}}}}function CNe(t,e,r){const n=this;let s=0,i=0,a;return l;function l($){let Q=n.events.length-1;for(;Q>-1;){const{type:R}=n.events[Q][1];if(R==="lineEnding"||R==="linePrefix")Q--;else break}const M=Q>-1?n.events[Q][1].type:null,z=M==="tableHead"||M==="tableRow"?T:c;return z===T&&n.parser.lazy[n.now().line]?r($):z($)}function c($){return t.enter("tableHead"),t.enter("tableRow"),d($)}function d($){return $===124||(a=!0,i+=1),f($)}function f($){return $===null?r($):gt($)?i>1?(i=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),g):r($):$t($)?Kt(t,f,"whitespace")($):(i+=1,a&&(a=!1,s+=1),$===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),p($)))}function p($){return $===null||$===124||_r($)?(t.exit("data"),f($)):(t.consume($),$===92?m:p)}function m($){return $===92||$===124?(t.consume($),p):p($)}function g($){return n.interrupt=!1,n.parser.lazy[n.now().line]?r($):(t.enter("tableDelimiterRow"),a=!1,$t($)?Kt(t,y,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):y($))}function y($){return $===45||$===58?w($):$===124?(a=!0,t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),x):j($)}function x($){return $t($)?Kt(t,w,"whitespace")($):w($)}function w($){return $===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),_):$===45?(i+=1,_($)):$===null||gt($)?N($):j($)}function _($){return $===45?(t.enter("tableDelimiterFiller"),S($)):j($)}function S($){return $===45?(t.consume($),S):$===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),k):(t.exit("tableDelimiterFiller"),k($))}function k($){return $t($)?Kt(t,N,"whitespace")($):N($)}function N($){return $===124?y($):$===null||gt($)?!a||s!==i?j($):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e($)):j($)}function j($){return r($)}function T($){return t.enter("tableRow"),D($)}function D($){return $===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),D):$===null||gt($)?(t.exit("tableRow"),e($)):$t($)?Kt(t,D,"whitespace")($):(t.enter("data"),I($))}function I($){return $===null||$===124||_r($)?(t.exit("data"),D($)):(t.consume($),$===92?L:I)}function L($){return $===92||$===124?(t.consume($),I):I($)}}function NNe(t,e){let r=-1,n=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,d,f,p;const m=new wNe;for(;++r<t.length;){const g=t[r],y=g[1];g[0]==="enter"?y.type==="tableHead"?(l=!1,c!==0&&(nL(m,e,c,d,f),f=void 0,c=0),d={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},m.add(r,0,[["enter",d,e]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(n=!0,p=void 0,i=[0,0,0,0],a=[0,r+1,0,0],l&&(l=!1,f={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},m.add(r,0,[["enter",f,e]])),s=y.type==="tableDelimiterRow"?2:f?3:1):s&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(n=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],p=Sx(m,e,i,s,void 0,p),i=[0,0,0,0]),a[2]=r)):y.type==="tableCellDivider"&&(n?n=!1:(i[1]!==0&&(a[0]=a[1],p=Sx(m,e,i,s,void 0,p)),i=a,a=[i[1],r,0,0])):y.type==="tableHead"?(l=!0,c=r):y.type==="tableRow"||y.type==="tableDelimiterRow"?(c=r,i[1]!==0?(a[0]=a[1],p=Sx(m,e,i,s,r,p)):a[1]!==0&&(p=Sx(m,e,a,s,r,p)),s=0):s&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(a[3]=r)}for(c!==0&&nL(m,e,c,d,f),m.consume(e.events),r=-1;++r<e.events.length;){const g=e.events[r];g[0]==="enter"&&g[1].type==="table"&&(g[1]._align=kNe(e.events,r))}return t}function Sx(t,e,r,n,s,i){const a=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(i.end=Object.assign({},vh(e.events,r[0])),t.add(r[0],0,[["exit",i,e]]));const c=vh(e.events,r[1]);if(i={type:a,start:Object.assign({},c),end:Object.assign({},c)},t.add(r[1],0,[["enter",i,e]]),r[2]!==0){const d=vh(e.events,r[2]),f=vh(e.events,r[3]),p={type:l,start:Object.assign({},d),end:Object.assign({},f)};if(t.add(r[2],0,[["enter",p,e]]),n!==2){const m=e.events[r[2]],g=e.events[r[3]];if(m[1].end=Object.assign({},g[1].end),m[1].type="chunkText",m[1].contentType="text",r[3]>r[2]+1){const y=r[2]+1,x=r[3]-r[2]-1;t.add(y,x,[])}}t.add(r[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},vh(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function nL(t,e,r,n,s){const i=[],a=vh(e.events,r);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),n.end=Object.assign({},a),i.push(["exit",n,e]),t.add(r+1,0,i)}function vh(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const jNe={name:"tasklistCheck",tokenize:ANe};function TNe(){return{text:{91:jNe}}}function ANe(t,e,r){const n=this;return s;function s(c){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return _r(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):r(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),l):r(c)}function l(c){return gt(c)?e(c):$t(c)?t.check({tokenize:RNe},e,r)(c):r(c)}}function RNe(t,e,r){return Kt(t,n,"whitespace");function n(s){return s===null?r(s):e(s)}}function DNe(t){return _q([nNe(),fNe(),bNe(t),ENe(),TNe()])}const ONe={};function PNe(t){const e=this,r=t||ONe,n=e.data(),s=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);s.push(DNe(r)),i.push(JCe()),a.push(eNe(r))}const ZA=E.forwardRef(({className:t,...e},r)=>o.jsx("textarea",{className:we("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...e}));ZA.displayName="Textarea";async function MNe(t){try{const e=await fetch(`${Df}/v1/agent/config`,{headers:{Authorization:`Bearer ${t}`}});if(!e.ok)return{enabled:!1};const r=await e.json().catch(()=>({data:{enabled:!1}}));return(r==null?void 0:r.data)??{enabled:!1}}catch{return{enabled:!1}}}async function INe(t,e,r,n){const s=await fetch(`${Df}/v1/agent/chat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({messages:e}),signal:n});if(!s.ok||!s.body){let c=`Request failed (${s.status})`;try{const d=await s.json();d!=null&&d.error&&(c=d.error)}catch{}throw new Error(c)}const i=s.body.getReader(),a=new TextDecoder;let l="";for(;;){const{done:c,value:d}=await i.read();if(c)break;l+=a.decode(d,{stream:!0});let f;for(;(f=l.indexOf(`
|
||
|
||
`))!==-1;){const p=l.slice(0,f);l=l.slice(f+2);const m=p.trim();if(!m.startsWith("data:"))continue;const g=m.slice(5).trim();if(!(!g||g==="[DONE]"))try{r(JSON.parse(g))}catch{}}}}const LNe=["Deploy an nginx app called my-site and expose port 80","What apps do I have running?","Show me the logs for my app","How much am I spending this month?","Create a PostgreSQL database named analytics"];function UN(t){if(t==null)return"";if(typeof t=="string"||typeof t=="number")return String(t);if(Array.isArray(t))return t.map(UN).join("");if(E.isValidElement(t)){const e=t.props;return UN(e.children)}return""}function $Ne({text:t,lang:e}){const[r,n]=E.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),2e3)}catch{}};return o.jsxs("div",{className:"my-2 overflow-hidden rounded-lg border border-border bg-zinc-950",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-3 py-1.5",children:[o.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wide text-zinc-400",children:e||"code"}),o.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-zinc-400 transition-colors hover:bg-zinc-800 hover:text-zinc-100",children:[r?o.jsx(Lr,{className:"h-3 w-3"}):o.jsx(cn,{className:"h-3 w-3"}),r?"Copied":"Copy"]})]}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed text-zinc-100",children:o.jsx("code",{children:t})})]})}const BNe={pre({node:t,children:e}){var s,i,a;let r="";const n=(s=t==null?void 0:t.children)==null?void 0:s[0];if(n&&n.type==="element"){const l=(i=n.properties)==null?void 0:i.className,c=Array.isArray(l)?l.join(" "):"";r=((a=/language-([\w-]+)/.exec(c))==null?void 0:a[1])??""}return o.jsx($Ne,{text:UN(e).replace(/\n$/,""),lang:r})},code({children:t}){return o.jsx("code",{className:"rounded bg-muted/60 px-1 py-0.5 font-mono text-[0.85em]",children:t})},a({href:t,children:e}){return o.jsx("a",{href:t,target:"_blank",rel:"noreferrer",children:e})}};function sL({content:t}){return o.jsx("div",{className:"markdown",children:o.jsx(bEe,{remarkPlugins:[PNe],components:BNe,children:t})})}function iL(){const t=bo(),[e,r]=E.useState(null),[n,s]=E.useState([]),[i,a]=E.useState(""),[l,c]=E.useState(!1),[d,f]=E.useState(null),p=E.useRef(null),m=E.useRef(null),g=E.useRef(null);E.useEffect(()=>{t&&MNe(t).then(r).catch(()=>r({enabled:!1}))},[t]),E.useEffect(()=>{const S=g.current;S&&(S.style.height="auto",S.style.height=`${Math.min(S.scrollHeight,200)}px`)},[i]),E.useEffect(()=>{const S=m.current;if(S){if(d){const k=requestAnimationFrame(()=>{S.scrollTop=S.scrollHeight});return()=>cancelAnimationFrame(k)}S.scrollTo({top:S.scrollHeight,behavior:"smooth"})}},[n,d]);const y=E.useCallback(async S=>{const k=(S??i).trim();if(!k||l||!t)return;const N=[...n,{role:"user",content:k}];s(N),a(""),c(!0),f({content:"",tools:[]});const j=new AbortController;p.current=j;let T="";const D=[];try{await INe(t,N,I=>{switch(I.type){case"delta":T+=I.content,f({content:T,tools:[...D]});break;case"tool":{if(I.status==="started")D.push({key:`${I.name}-${D.length}`,name:I.name,label:I.label||I.name,status:"started"});else for(let L=D.length-1;L>=0;L--)if(D[L].name===I.name&&D[L].status==="started"){D[L]={...D[L],status:"done",summary:I.summary};break}f({content:T,tools:[...D]});break}case"done":{const L=I.content||T||"Done.";s($=>[...$,{role:"assistant",content:L}]),f(null);break}case"error":{s(L=>[...L,{role:"assistant",content:`⚠️ ${I.message}`}]),f(null);break}}},j.signal)}catch(I){if((I==null?void 0:I.name)==="AbortError")return;s(L=>[...L,{role:"assistant",content:`⚠️ ${I instanceof Error?I.message:"Something went wrong"}`}])}finally{f(null),c(!1),p.current=null}},[i,l,t,n]),x=()=>{var S;return(S=p.current)==null?void 0:S.abort()},w=()=>{l&&x(),s([]),f(null)},_=e!==null&&!e.enabled;return o.jsxs("div",{className:"flex h-[calc(100dvh-8.5rem)] min-h-[480px] flex-col",children:[o.jsx(Rn,{title:"Ghaymah Assistant",description:"Your in-cloud AI operator — deploy apps, inspect logs, and manage databases, storage and billing by chatting.",className:"p-4 sm:p-6"}),o.jsxs($e,{className:"flex flex-1 flex-col overflow-hidden border-primary/10",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-border/60 px-4 py-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(I0,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"font-medium text-foreground",children:"Assistant"}),(e==null?void 0:e.model)&&o.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px]",children:e.model})]}),o.jsxs(le,{variant:"ghost",size:"sm",onClick:w,disabled:n.length===0&&!l,children:[o.jsx(ds,{className:"mr-1 h-3.5 w-3.5"})," Clear"]})]}),o.jsx("div",{ref:m,className:"flex-1 space-y-4 overflow-y-auto overscroll-contain p-4",children:_?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"max-w-sm text-center",children:[o.jsx(I0,{className:"mx-auto mb-3 h-10 w-10 text-muted-foreground"}),o.jsx("p",{className:"font-medium",children:"The assistant is not enabled"}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"This deployment has not configured an in-cloud assistant. It becomes available automatically once the gateway is wired to a model."})]})}):n.length===0&&!d?o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[o.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-primary/10",children:o.jsx(tF,{className:"h-6 w-6 text-primary"})}),o.jsxs("div",{className:"max-w-md text-center",children:[o.jsx("p",{className:"font-medium",children:"What would you like to do?"}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"I can deploy containers, read logs, create databases and buckets, and report on your billing — just ask."})]}),o.jsx("div",{className:"grid w-full max-w-lg grid-cols-1 gap-2 sm:grid-cols-2",children:LNe.map(S=>o.jsx("button",{onClick:()=>y(S),disabled:l,className:"rounded-xl border border-border/70 bg-background px-3 py-2 text-left text-xs leading-snug text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground disabled:opacity-50",children:S},S))})]}):o.jsxs(o.Fragment,{children:[n.map((S,k)=>o.jsx("div",{className:we("flex",S.role==="user"?"justify-end":"justify-start"),children:o.jsx("div",{className:we("max-w-[85%] min-w-0 break-words rounded-2xl px-4 py-2.5 text-sm sm:max-w-[75%]",S.role==="user"?"bg-primary text-primary-foreground":"border border-border/60 bg-muted/40"),children:S.role==="user"?o.jsx("p",{className:"whitespace-pre-wrap",children:S.content}):o.jsx(sL,{content:S.content})})},k)),d&&o.jsx("div",{className:"flex justify-start",children:o.jsxs("div",{className:"max-w-[85%] min-w-0 break-words rounded-2xl border border-border/60 bg-muted/40 px-4 py-2.5 text-sm sm:max-w-[75%]",children:[d.tools.map(S=>o.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[S.status==="started"?o.jsx(kt,{className:"h-3 w-3 animate-spin text-primary"}):o.jsx(Bs,{className:"h-3 w-3 text-emerald-500"}),o.jsx("span",{children:S.label}),S.summary&&o.jsxs("span",{className:"truncate text-muted-foreground/60",children:["— ",S.summary]})]},S.key)),d.content?o.jsx(sL,{content:d.content}):o.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[o.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-current"}),o.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-current [animation-delay:0.15s]"}),o.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-current [animation-delay:0.3s]"})]})]})})]})}),o.jsxs("div",{className:"border-t border-border/60 p-3",children:[o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsx(ZA,{ref:g,value:i,onChange:S=>a(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),y())},placeholder:"Ask the assistant… (Enter to send, Shift+Enter for a new line)",disabled:l||_,rows:1,className:"max-h-[200px] min-h-[44px] resize-none"}),l?o.jsx(le,{size:"icon",variant:"outline",onClick:x,title:"Stop",children:o.jsx(Xre,{className:"h-4 w-4"})}):o.jsx(le,{size:"icon",onClick:()=>y(),disabled:!i.trim()||_,title:"Send",children:o.jsx(Bre,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx(ti,{className:"h-3 w-3 text-primary"}),"The assistant acts on your account — always review destructive actions before confirming."]})]})]})]})}function FNe(){const{toast:t}=br(),e=i=>{navigator.clipboard.writeText(i),t({title:"Copied",description:"Command copied to clipboard"})},r="curl -sSl https://cli.ghaymah.systems/install.sh | bash",n="gy auth login",s="gy tunnel start <tunnelname> --port <localport>";return o.jsxs("div",{className:"space-y-8",children:[o.jsx(Rn,{title:"Ghaymah Tunnels",description:"Secure public URLs for your localhost.",actions:o.jsxs(le,{variant:"outline",onClick:()=>window.open("https://docs.ghaymah.cloud/","_blank"),children:[o.jsx(al,{className:"mr-2 h-4 w-4"}),"Read Docs"]})}),o.jsxs($e,{children:[o.jsx(ot,{children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(An,{className:"w-5 h-5"}),"What are Ghaymah Tunnels?"]})}),o.jsxs(Be,{className:"space-y-4",children:[o.jsx("p",{className:"text-muted-foreground",children:"Ghaymah Tunnels allow you to expose your local development server to the internet securely. This is useful for sharing your work with others, testing webhooks, or accessing your local server from anywhere."}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 pt-2",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(wa,{className:"h-5 w-5 text-primary mt-0.5"}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium",children:"Secure"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Encrypted connections with HTTPS support"})]})]}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(hc,{className:"h-5 w-5 text-primary mt-0.5"}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium",children:"Fast"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Low latency connections with global CDN"})]})]}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(An,{className:"h-5 w-5 text-primary mt-0.5"}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium",children:"Easy"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"One command to create a public URL"})]})]})]})]})]}),o.jsxs(ua,{children:[o.jsx(Bi,{className:"h-4 w-4"}),o.jsx(Lb,{children:"Quick tip"}),o.jsxs(da,{children:["Choose a tunnel name like ",o.jsx("code",{children:"myapp"})," or ",o.jsx("code",{children:"backend"}),"; lowercase letters only, no dash or space."]})]}),o.jsxs($e,{children:[o.jsx(ot,{children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(Bs,{className:"w-5 h-5"}),"Get Started"]})}),o.jsxs(Be,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Step 1: Install CLI"}),o.jsxs("div",{className:"relative bg-muted rounded-md p-3 font-mono text-sm",children:[o.jsx("code",{children:r}),o.jsx(le,{size:"icon",variant:"ghost",className:"absolute right-2 top-1/2 -translate-y-1/2 h-8 w-8",onClick:()=>e(r),children:o.jsx(cn,{className:"w-4 h-4"})})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Step 2: Login"}),o.jsxs("div",{className:"relative bg-muted rounded-md p-3 font-mono text-sm",children:[o.jsx("code",{children:n}),o.jsx(le,{size:"icon",variant:"ghost",className:"absolute right-2 top-1/2 -translate-y-1/2 h-8 w-8",onClick:()=>e(n),children:o.jsx(cn,{className:"w-4 h-4"})})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Step 3: Start Tunnel"}),o.jsxs("div",{className:"relative bg-muted rounded-md p-3 font-mono text-sm",children:[o.jsx("code",{children:s}),o.jsx(le,{size:"icon",variant:"ghost",className:"absolute right-2 top-1/2 -translate-y-1/2 h-8 w-8",onClick:()=>e(s),children:o.jsx(cn,{className:"w-4 h-4"})})]})]}),o.jsxs("div",{className:"pt-4 border-t border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"Example"}),o.jsxs("div",{className:"relative bg-muted rounded-md p-3 font-mono text-sm",children:[o.jsx("code",{children:"gy tunnel start myapp --port 3000"}),o.jsx(le,{size:"icon",variant:"ghost",className:"absolute right-2 top-1/2 -translate-y-1/2 h-8 w-8",onClick:()=>e("gy tunnel start myapp --port 3000"),children:o.jsx(cn,{className:"w-4 h-4"})})]}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["This will create a tunnel at ",o.jsx("code",{children:"myapp.ghaymah.systems"})," pointing to your local port 3000"]})]})]})]}),o.jsxs($e,{children:[o.jsx(ot,{children:o.jsx(dt,{children:"Common Use Cases"})}),o.jsx(Be,{className:"space-y-4",children:o.jsxs("ul",{className:"space-y-2 text-muted-foreground",children:[o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary mt-2 flex-shrink-0"}),o.jsx("span",{children:"Share your local development server with clients or team members for feedback"})]}),o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary mt-2 flex-shrink-0"}),o.jsx("span",{children:"Test webhooks and callbacks from external services"})]}),o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary mt-2 flex-shrink-0"}),o.jsx("span",{children:"Access your local development environment from mobile devices"})]}),o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary mt-2 flex-shrink-0"}),o.jsx("span",{children:"Demo your application without deploying to a production environment"})]})]})})]})]})}const zNe=()=>{const t=new Date().getHours();return t<5?"Working late":t<12?"Good morning":t<18?"Good afternoon":"Good evening"};function UNe(){const t=Yn(),{projects:e,apps:r,volumes:n,managedResources:s,loading:i}=Nr(),{volumeUsageMap:a}=DA(),l=E.useMemo(()=>r.filter(m=>m.values.instances!==0),[r]),c=E.useMemo(()=>r.filter(m=>m.values.instances===0),[r]),d=E.useMemo(()=>s.filter(m=>m.status==="active"),[s]),f=E.useMemo(()=>Object.values(a).filter(m=>m.isInUse).length,[a]);if(i)return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Gr,{className:"h-40 w-full rounded-2xl"}),o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 gap-4",children:Array.from({length:5}).map((m,g)=>o.jsxs($e,{children:[o.jsxs(ot,{className:"pb-2",children:[o.jsx(Gr,{className:"h-4 w-20"}),o.jsx(Gr,{className:"h-8 w-16 mt-2"})]}),o.jsx(Be,{children:o.jsx(Gr,{className:"h-3 w-24"})})]},g))}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[o.jsxs($e,{className:"lg:col-span-2",children:[o.jsx(ot,{children:o.jsx(Gr,{className:"h-6 w-40"})}),o.jsx(Be,{children:o.jsx(Gr,{className:"h-64 w-full"})})]}),o.jsxs($e,{children:[o.jsx(ot,{children:o.jsx(Gr,{className:"h-6 w-32"})}),o.jsx(Be,{children:o.jsx(Gr,{className:"h-64 w-full"})})]})]})]});const p=[{label:"Projects",value:e.length,hint:`${e.filter(m=>m.status==="synced").length} ready`,icon:eC,onClick:()=>t("/dashboard/projects")},{label:"Applications",value:r.length,hint:`${l.length} active · ${c.length} idle`,icon:io,onClick:()=>t("/dashboard/projects")},{label:"Volumes",value:n.length,hint:`${f} in use`,icon:Es,onClick:()=>t("/dashboard/volumes")},{label:"Databases",value:d.length,hint:"PostgreSQL",icon:Zs,onClick:()=>t("/dashboard/postgres")}];return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-primary/10 bg-gradient-to-br from-primary/10 via-background to-background/95 p-6 md:p-8",children:[o.jsx("div",{className:"pointer-events-none absolute -right-16 -top-16 h-64 w-64 rounded-full bg-primary/10 blur-3xl"}),o.jsx("div",{className:"pointer-events-none absolute -bottom-20 right-32 h-56 w-56 rounded-full bg-purple-500/10 blur-3xl"}),o.jsxs("div",{className:"relative flex flex-col lg:flex-row justify-between gap-6",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs(Lt,{variant:"secondary",className:"border-primary/20 bg-primary/5 text-primary",children:[o.jsx(ti,{className:"mr-1 h-3 w-3"}),"Cloud Control Center"]}),o.jsxs("div",{children:[o.jsxs("h1",{className:"text-3xl md:text-4xl font-bold tracking-tight",children:[zNe(),", welcome back"]}),o.jsx("p",{className:"mt-2 text-muted-foreground max-w-xl",children:"Deploy, monitor, and scale your applications from a single place. Everything is running smoothly across your workspace."})]}),o.jsxs("div",{className:"flex flex-wrap gap-3 pt-1",children:[o.jsxs(le,{onClick:()=>t("/dashboard/projects"),className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"New Project"]}),o.jsxs(le,{variant:"outline",onClick:()=>t("/dashboard/static-deploy"),className:"border-primary/20",children:[o.jsx(qh,{className:"mr-2 h-4 w-4"}),"Deploy Static Site"]}),o.jsxs(le,{variant:"outline",onClick:()=>t("/dashboard/postgres"),className:"border-primary/20",children:[o.jsx(Zs,{className:"mr-2 h-4 w-4"}),"Create Database"]})]})]}),o.jsx("div",{className:"hidden lg:flex shrink-0 items-center",children:o.jsx($e,{className:"border-green-500/20 bg-green-50 dark:bg-green-900/10",children:o.jsxs(ot,{className:"flex flex-row items-center gap-3",children:[o.jsx(od,{className:"h-8 w-8 text-green-500"}),o.jsxs("div",{children:[o.jsx(dt,{className:"text-sm font-semibold text-green-800 dark:text-green-200",children:"All Systems Secure"}),o.jsx("p",{className:"text-xs text-green-600 dark:text-green-300",children:"No threats detected in your apps"})]})]})})})]})]}),o.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-5",children:p.map(m=>o.jsxs("div",{onClick:m.onClick,className:"group flex cursor-pointer items-center gap-3 rounded-xl border border-border/80 bg-card px-4 py-3.5 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md",children:[o.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-primary/15 bg-primary/10 text-primary transition-transform duration-200 group-hover:scale-105",children:o.jsx(m.icon,{className:"h-5 w-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"truncate text-lg font-semibold leading-none tracking-tight",children:m.value}),o.jsxs("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:[m.label," · ",m.hint]})]})]},m.label))}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[o.jsxs($e,{className:"lg:col-span-2 border-primary/20",children:[o.jsxs(ot,{className:"flex flex-row items-center",children:[o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(VB,{className:"h-5 w-5 text-primary"}),"Active Applications"]}),o.jsxs(le,{variant:"ghost",size:"sm",className:"ml-auto text-primary hover:text-primary",onClick:()=>t("/dashboard/projects"),children:["View All",o.jsx(ei,{className:"ml-1 h-4 w-4"})]})]}),o.jsx(Be,{children:l.length>0?o.jsxs("div",{className:"space-y-2",children:[l.slice(0,6).map(m=>{const g=e.find(y=>y.id===m.values.projectId);return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-accent cursor-pointer transition-colors group",onClick:()=>t(`/dashboard/projects/${m.values.projectId}/apps/${m.id}`),children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsxs("div",{className:"relative flex h-2 w-2 shrink-0",children:[o.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-60"}),o.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"font-medium text-sm truncate",children:m.values.name}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:(g==null?void 0:g.values.name)||m.values.projectId})]})]}),o.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[o.jsx(Lt,{variant:"secondary",className:"text-xs bg-green-100 text-green-800 hover:bg-green-100 dark:bg-green-900/30 dark:text-green-200",children:"Running"}),o.jsx(ei,{className:"h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})]},m.id)}),l.length>6&&o.jsxs(le,{variant:"ghost",size:"sm",className:"w-full text-primary hover:text-primary",onClick:()=>t("/dashboard/projects"),children:["+ ",l.length-6," more applications"]})]}):o.jsxs("div",{className:"rounded-lg border border-dashed border-primary/20 p-10 text-center",children:[o.jsx($r,{className:"h-8 w-8 mx-auto text-muted-foreground mb-3"}),o.jsx("p",{className:"font-medium",children:"No active applications"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Deploy your first app to see it running here."}),o.jsxs(le,{size:"sm",className:"mt-4 bg-gradient-to-r from-primary to-primary/90",onClick:()=>t("/dashboard/projects"),children:[o.jsx($r,{className:"mr-2 h-4 w-4"}),"Deploy an App"]})]})})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs($e,{className:"border-primary/20",children:[o.jsx(ot,{children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(qB,{className:"h-5 w-5 text-primary"}),"Quick Actions"]})}),o.jsx(Be,{className:"space-y-1",children:[{label:"New Project",icon:nr,href:"/dashboard/projects"},{label:"Deploy Static Site",icon:qh,href:"/dashboard/static-deploy"},{label:"Create Database",icon:Zs,href:"/dashboard/postgres"},{label:"Add Volume",icon:Es,href:"/dashboard/volumes"},{label:"Browse Store",icon:ti,href:"/dashboard/store"}].map(m=>o.jsxs("button",{onClick:()=>t(m.href),className:"flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm hover:bg-accent transition-colors group",children:[o.jsx(m.icon,{className:"h-4 w-4 text-primary transition-transform group-hover:scale-110"}),o.jsx("span",{className:"flex-1 text-left",children:m.label}),o.jsx(ei,{className:"h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]},m.label))})]}),o.jsxs($e,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-background",children:[o.jsx(ot,{children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(jM,{className:"h-5 w-5 text-primary"}),"Need Help?"]})}),o.jsxs(Be,{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Ask our AI assistant about Ghaymah Cloud or browse the docs."}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(le,{variant:"outline",size:"sm",className:"border-primary/20 justify-start",onClick:()=>window.open("https://ghaymah-rag-ghaymah-documentation.hf.space","_blank"),children:[o.jsx(ti,{className:"mr-2 h-4 w-4 text-primary"}),"AI Documentation Assistant"]}),o.jsxs(le,{variant:"outline",size:"sm",className:"border-primary/20 justify-start",onClick:()=>window.open("https://docs.ghaymah.cloud","_blank"),children:[o.jsx(jM,{className:"mr-2 h-4 w-4 text-primary"}),"Browse Documentation"]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-green-500/20 bg-green-50 dark:bg-green-900/10 px-3 py-2",children:[o.jsx(is,{className:"h-4 w-4 text-green-500 shrink-0"}),o.jsx("span",{className:"text-xs text-green-700 dark:text-green-300",children:"All services operational"})]})]})]})]})]})]})}const VNe=Et`
|
||
subscription GetProjectStoreTemplates {
|
||
ghaymah_cloud_store(
|
||
where: { deleted: { _eq: false } }
|
||
order_by: { updated_at: desc }
|
||
) {
|
||
id
|
||
created_at
|
||
updated_at
|
||
template
|
||
deleted
|
||
}
|
||
}
|
||
`,dW=E.createContext(void 0);function HNe({children:t}){const[e,r]=E.useState(null),[n,s]=E.useState(!0),[i,a]=E.useState(null),{data:l,loading:c,error:d}=wg(VNe);E.useEffect(()=>{if(l!=null&&l.ghaymah_cloud_store)try{const m=l.ghaymah_cloud_store.map(g=>({...g.template,id:g.template.id||g.id}));r(m),s(!1)}catch(m){a(m instanceof Error?m:new Error("Failed to process templates")),s(!1)}else l!==void 0&&(r([]),s(!1))},[l]),E.useEffect(()=>{c&&e===null&&s(!0)},[c,e]),E.useEffect(()=>{d&&(a(d),s(!1))},[d]);const p={templates:e,loading:n,error:i,refreshTemplates:async()=>{}};return o.jsx(dW.Provider,{value:p,children:t})}function qNe(){const t=E.useContext(dW);if(t===void 0)throw new Error("useProjectStore must be used within a ProjectStoreProvider");return t}var JA="Progress",eR=100,[WNe,$5e]=Us(JA),[GNe,KNe]=WNe(JA),hW=E.forwardRef((t,e)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:i=YNe,...a}=t;(s||s===0)&&!aL(s)&&console.error(QNe(`${s}`,"Progress"));const l=aL(s)?s:eR;n!==null&&!oL(n,l)&&console.error(XNe(`${n}`,"Progress"));const c=oL(n,l)?n:null,d=p_(c)?i(c,l):void 0;return o.jsx(GNe,{scope:r,value:c,max:l,children:o.jsx(pt.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":p_(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":mW(c,l),"data-value":c??void 0,"data-max":l,...a,ref:e})})});hW.displayName=JA;var fW="ProgressIndicator",pW=E.forwardRef((t,e)=>{const{__scopeProgress:r,...n}=t,s=KNe(fW,r);return o.jsx(pt.div,{"data-state":mW(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:e})});pW.displayName=fW;function YNe(t,e){return`${Math.round(t/e*100)}%`}function mW(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function p_(t){return typeof t=="number"}function aL(t){return p_(t)&&!isNaN(t)&&t>0}function oL(t,e){return p_(t)&&!isNaN(t)&&t<=e&&t>=0}function QNe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${eR}\`.`}function XNe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
|
||
- a positive number
|
||
- less than the value passed to \`max\` (or ${eR} if no \`max\` prop is set)
|
||
- \`null\` or \`undefined\` if the progress is indeterminate.
|
||
|
||
Defaulting to \`null\`.`}var gW=hW,ZNe=pW;const tR=E.forwardRef(({className:t,value:e,...r},n)=>o.jsx(gW,{ref:n,className:we("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...r,children:o.jsx(ZNe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));tR.displayName=gW.displayName;const vW=!0;function JNe(){const{templates:t,loading:e,error:r}=qNe(),[n,s]=E.useState(""),[i,a]=E.useState("grid"),[l,c]=E.useState([]),[d,f]=E.useState(null),[p,m]=E.useState(!1),[g,y]=E.useState(!1);E.useEffect(()=>{if(!t)return;const w=t.filter(_=>{var S;return _.name.toLowerCase().includes(n.toLowerCase())||_.description.toLowerCase().includes(n.toLowerCase())||((S=_.category)==null?void 0:S.toLowerCase().includes(n.toLowerCase()))});c(w)},[t,n]);const x=w=>{f(w),m(!0)};return e?o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Project Store",description:"Discover and deploy pre-configured projects"}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((w,_)=>o.jsxs($e,{className:"h-48 animate-pulse",children:[o.jsx(ot,{children:o.jsx("div",{className:"h-6 bg-muted rounded"})}),o.jsxs(Be,{children:[o.jsx("div",{className:"h-4 bg-muted rounded mb-2"}),o.jsx("div",{className:"h-4 bg-muted rounded w-2/3"})]})]},_))})]}):r?o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Project Store",description:"Discover and deploy pre-configured projects"}),o.jsx(Wu,{icon:io,title:"Error Loading Templates",description:r.message||"Failed to load project store templates",actionLabel:"Retry",onAction:()=>window.location.reload()})]}):o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Project Store",description:"Discover and deploy pre-configured projects"}),o.jsx("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-sm text-amber-600 dark:text-amber-400",children:"The store is temporarily unavailable while we upgrade our backend. Please check back soon."}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(sv,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(tt,{placeholder:"Search templates...",value:n,onChange:w=>s(w.target.value),className:"pl-10"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(le,{variant:"default",onClick:()=>y(!0),disabled:vW,children:[o.jsx(nr,{className:"h-4 w-4 mr-2"}),"Custom Template"]}),o.jsx(le,{variant:i==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),children:o.jsx(Kte,{className:"h-4 w-4"})}),o.jsx(le,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),children:o.jsx(kj,{className:"h-4 w-4"})})]})]}),!1,l.length===0?o.jsx(Wu,{icon:io,title:"No templates found",description:n?"Try a different search term":"No project store templates available"}):o.jsx("div",{className:i==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:l.map(w=>o.jsx(e2e,{template:w,viewMode:i,onDeploy:()=>x(w.id)},w.id))}),!1]})}function e2e({template:t,viewMode:e,onDeploy:r}){const n={Server:io,Globe:An,FileText:Ite,Code:JE,Zap:hc},s=t.icon&&n[t.icon]?n[t.icon]:io;return o.jsxs($e,{className:e==="grid"?"hover:shadow-md transition-shadow h-full flex flex-col":"hover:shadow-md transition-shadow",children:[o.jsx(ot,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10",children:o.jsx(s,{className:"h-5 w-5 text-primary"})}),o.jsx(dt,{className:"text-lg",children:t.name})]})}),o.jsxs(Be,{className:"flex-grow flex flex-col",children:[o.jsxs("div",{className:"flex-grow",children:[o.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:t.description}),t.category&&o.jsx("div",{className:"flex flex-wrap gap-2",children:o.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:t.category})})]}),o.jsx(le,{className:"w-full mt-4",disabled:vW,onClick:i=>{i.stopPropagation(),r()},children:"Deploy Template"})]})]})}const t2e=!1,r2e=[{type:"Automatic",time:"2 hours ago",size:"84 MB"},{type:"Manual",time:"2 days ago",size:"82 MB"},{type:"Manual",time:"5 days ago",size:"79 MB"}];function n2e(t){const r=(t.url??"").replace("postgresql://","").split("/")[0]||"db.ghaymah.cloud",n=t.postgres_user??"postgres",s=t.postgres_db??"postgres",i=t.postgres_version??"17",a=t.alias??"";return{host:r,user:n,db:s,version:i,alias:a}}function lL(t){const e=(t.status??"").toLowerCase();return e==="active"||e==="running"||e==="synced"||e===""}function s2e(){const{toast:t}=br(),{listPostgresDb:e,createPostgresDb:r,deletePostgresDb:n}=Nr(),{freeOnly:s}=wv(),[i,a]=E.useState([]),[l,c]=E.useState(!1),[d,f]=E.useState(!1),[p,m]=E.useState(!1),[g,y]=E.useState(null),[x,w]=E.useState(!1),[_,S]=E.useState(null),[k,N]=E.useState(null),[j,T]=E.useState({name:"",dbName:"postgres",username:"postgres",password:""}),D=E.useCallback(async()=>{c(!0);try{const z=await e();a(z??[])}catch(z){t({title:"Failed to load databases",description:z instanceof Error?z.message:"An unknown error occurred",variant:"destructive"})}finally{c(!1)}},[e,t]);E.useEffect(()=>{D()},[D]);const I=async()=>{m(!0);try{if(j.name.includes("_")||j.dbName.includes("_")||j.username.includes("_"))throw new Error("Underscores are not allowed in name, database name or username");if(!await r(j.name,j.dbName,j.username,j.password||void 0))throw new Error("Failed to create database");f(!1),T({name:"",dbName:"postgres",username:"postgres",password:""}),t({title:"Database created",description:"Your PostgreSQL database is being provisioned. It may take a few minutes."}),D()}catch(z){t({title:"Failed to create database",description:z instanceof Error?z.message:"An unknown error occurred",variant:"destructive"})}finally{m(!1)}},L=async()=>{if(g)try{if(!await n(g.id,g.id))throw new Error("Failed to delete database");y(null),t({title:"Database deleted",description:"Your database has been deleted."}),D()}catch(z){t({title:"Failed to delete database",description:z instanceof Error?z.message:"An unknown error occurred",variant:"destructive"})}},$=async z=>{const R=z.url??"";if(R)try{await navigator.clipboard.writeText(R),N(R),setTimeout(()=>N(null),2e3),t({title:"Copied",description:"Connection URL copied to clipboard."})}catch{t({title:"Copy failed",variant:"destructive"})}},Q=()=>{t({title:"Pro plan required",description:"billing isn't connected yet."})},M=i.filter(lL).length;return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"PostgreSQL Databases",description:"Provision, connect, and manage fully-managed PostgreSQL instances.",actions:[o.jsxs(le,{onClick:()=>f(!0),className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"Create Database"]},"create-db"),o.jsxs(le,{variant:"outline",onClick:()=>void D(),disabled:l,children:[o.jsx(kt,{className:`mr-2 h-4 w-4 ${l?"animate-spin":""}`}),"Refresh"]},"refresh")]}),o.jsx($e,{className:"border-primary/20 bg-gradient-to-r from-primary/5 via-background to-background",children:o.jsxs(Be,{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between",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-lg bg-primary/10",children:o.jsx(ti,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"You're on the Free plan"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Automated backups and point-in-time recovery are available on Pro."})]})]}),o.jsxs(Lt,{variant:"secondary",className:"gap-1 self-start sm:self-auto",children:[o.jsx(Gn,{className:"h-3 w-3"})," Pro feature"]})]})}),o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4",children:[o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Zs,{className:"h-4 w-4 text-primary"})," Databases"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:i.length})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"active instances"})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(VB,{className:"h-4 w-4 text-primary"})," Status"]}),o.jsxs("div",{className:"text-2xl font-bold text-emerald-600",children:[M," / ",i.length]})]}),o.jsx(Be,{children:o.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[o.jsx(is,{className:"h-3 w-3 text-emerald-500"})," running"]})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Au,{className:"h-4 w-4 text-primary"})," Backups"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:"0"})]}),o.jsx(Be,{children:o.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[o.jsx(Gn,{className:"h-3 w-3"})," Pro only"]})})]})]}),l?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx(kt,{className:"mx-auto h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading your databases…"})]})}):i.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx("div",{className:"mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(Zs,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"No databases yet"}),o.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Create your first managed PostgreSQL database and get a connection string in minutes."}),o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90",onClick:()=>f(!0),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"})," Create Database"]})]})}):o.jsx("div",{className:"space-y-4",children:i.map(z=>{const R=n2e(z),B=lL(z);return o.jsxs($e,{className:"overflow-hidden border-primary/20",children:[o.jsxs(ot,{className:"flex flex-row items-start justify-between border-b border-border/60 px-6 py-5",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(Zs,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx(dt,{className:"text-base",children:z.name||"PostgreSQL Database"}),o.jsxs(rn,{className:"flex items-center gap-2",children:["PostgreSQL ",R.version,o.jsx("span",{className:"text-muted-foreground",children:"·"}),B?"Ready":"Provisioning"]})]})]}),o.jsxs(Lt,{className:B?"gap-1 bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300":"gap-1 bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-950 dark:text-amber-300",children:[B?o.jsx(is,{className:"h-3 w-3"}):o.jsx(Vu,{className:"h-3 w-3"}),B?"Active":"Provisioning"]})]}),o.jsxs(Be,{className:"space-y-5 p-6",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Host"}),o.jsx("p",{className:"font-mono text-sm",children:R.host})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Region"}),o.jsxs("p",{className:"flex items-center gap-1 text-sm",children:[o.jsx(An,{className:"h-3.5 w-3.5 text-muted-foreground"})," Managed"]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Version"}),o.jsxs("p",{className:"text-sm",children:["PostgreSQL ",R.version]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Credentials"}),o.jsxs("p",{className:"flex items-center gap-1 text-sm",children:[o.jsx(gi,{className:"h-3.5 w-3.5 text-muted-foreground"}),R.user]})]})]}),o.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-3",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Connection URL"}),o.jsx("p",{className:"truncate font-mono text-sm",children:z.url||"—"})]}),o.jsxs(le,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>$(z),disabled:!z.url,children:[k===z.url?o.jsx(Lr,{className:"mr-1.5 h-4 w-4 text-emerald-500"}):o.jsx(cn,{className:"mr-1.5 h-4 w-4"}),"Copy"]})]})}),R.alias&&o.jsx(OA,{hostname:R.alias,description:"Reach this database from your apps and other services over Ghaymah's private network — no public exposure. Use this hostname in connection strings between your services.",example:`postgresql://${R.user}@${R.alias}:5432/${R.db}`}),o.jsxs("div",{className:"flex flex-col gap-3 border-t border-border/60 pt-4 sm:flex-row sm:items-center sm:justify-between",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-lg bg-muted",children:o.jsx(Au,{className:"h-4 w-4 text-muted-foreground"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Backups"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Not enabled — requires Pro"})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>S(z),children:[o.jsx(Au,{className:"mr-2 h-4 w-4"})," Manage backups"]}),o.jsxs(le,{variant:"outline",size:"sm",className:"border-destructive/20 text-destructive hover:text-destructive",onClick:()=>y(z),children:[o.jsx(ds,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]})]},z.id)})}),o.jsx(hs,{open:!!_,onOpenChange:z=>!z&&S(null),children:o.jsxs(un,{className:"max-w-lg",children:[o.jsxs(Dn,{children:[o.jsxs(On,{className:"flex items-center gap-2",children:[o.jsx(Au,{className:"h-5 w-5 text-primary"}),"Backups"]}),o.jsxs(fs,{children:["Manage backups for"," ",o.jsx("span",{className:"font-medium",children:(_==null?void 0:_.name)||"this database"}),"."]})]}),o.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-primary/20 bg-primary/5 p-3",children:[o.jsx(Gn,{className:"h-4 w-4 shrink-0 text-primary"}),o.jsxs("p",{className:"text-sm",children:["Backups are a ",o.jsx("span",{className:"font-medium",children:"Pro"})," feature. Upgrade to unlock automated daily backups and point-in-time recovery."]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Automated daily backups"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"One snapshot every 24 hours"})]}),o.jsx(Pc,{checked:t2e,disabled:!0})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Retention"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"How long backups are kept"})]}),o.jsxs(ja,{disabled:!0,defaultValue:"7",children:[o.jsx(Wi,{className:"w-32",children:o.jsx(Ta,{})}),o.jsxs(Gi,{children:[o.jsx(bn,{value:"7",children:"7 days"}),o.jsx(bn,{value:"14",children:"14 days"}),o.jsx(bn,{value:"30",children:"30 days"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"Backup history"}),o.jsx("div",{className:we("space-y-2","opacity-60"),children:r2e.map((z,R)=>o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-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-md bg-muted",children:o.jsx(Au,{className:"h-4 w-4 text-muted-foreground"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:z.type}),o.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[o.jsx(Vu,{className:"h-3 w-3"})," ",z.time," · ",z.size]})]})]}),o.jsx(Gn,{className:"h-4 w-4 text-muted-foreground"})]},R))})]})]}),o.jsxs(Ki,{className:"flex-col gap-2 sm:flex-row",children:[o.jsx(le,{variant:"outline",onClick:()=>S(null),children:"Close"}),o.jsxs(le,{className:"bg-gradient-to-r from-primary to-primary/90",onClick:Q,children:[o.jsx(ti,{className:"mr-2 h-4 w-4"})," Upgrade to Pro"]})]})]})}),o.jsx(hs,{open:d,onOpenChange:f,children:o.jsxs(un,{className:"sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Create PostgreSQL Database"}),o.jsx(fs,{children:"Configure your new managed database."}),o.jsx("div",{className:"text-sm text-amber-600 dark:text-amber-400 pt-2",children:"Note: Your database will take approximately 5 minutes to be ready for connections."})]}),s&&o.jsxs("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400",children:["Databases require a payment method."," ",o.jsx("a",{href:"/dashboard/billing",className:"font-medium underline",children:"Add a card"})," to unlock."]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"name",children:"Instance name"}),o.jsx(tt,{id:"name",value:j.name,onChange:z=>T({...j,name:z.target.value}),placeholder:"my-db-instance",required:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"dbName",children:"Database name"}),o.jsx(tt,{id:"dbName",value:j.dbName,onChange:z=>T({...j,dbName:z.target.value}),placeholder:"postgres",required:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"username",children:"Username"}),o.jsx(tt,{id:"username",value:j.username,onChange:z=>T({...j,username:z.target.value}),placeholder:"postgres",required:!0})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(Xe,{htmlFor:"password",children:["Password",o.jsx("span",{className:"text-xs font-normal text-muted-foreground ml-2",children:"(save it — it won't be shown again)"})]}),o.jsxs("div",{className:"relative",children:[o.jsx(tt,{id:"password",type:x?"text":"password",value:j.password,onChange:z=>T({...j,password:z.target.value}),placeholder:"Enter a strong password",className:"pr-10"}),o.jsx("button",{type:"button",onClick:()=>w(!x),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":x?"Hide password":"Show password",children:x?o.jsx(ol,{size:18}):o.jsx(ll,{size:18})})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{children:"PostgreSQL version"}),o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2",children:[o.jsx(Zs,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm",children:"PostgreSQL 17"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-emerald-500/20 bg-emerald-50 px-3 py-2 dark:bg-emerald-950/20",children:[o.jsx(wa,{className:"h-4 w-4 text-emerald-500"}),o.jsx("span",{className:"text-xs text-emerald-700 dark:text-emerald-300",children:"Encrypted at rest and in transit"})]})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),o.jsx(le,{onClick:I,disabled:p||!j.name||s,className:"bg-gradient-to-r from-primary to-primary/90",children:p?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Creating..."]}):"Create Database"})]})]})}),o.jsx(So,{open:!!g,onOpenChange:z=>!z&&y(null),children:o.jsxs(Oa,{children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete Database"}),o.jsxs(La,{children:["Are you sure you want to delete"," ",o.jsx("span",{className:"font-medium",children:g==null?void 0:g.name}),"? This action cannot be undone."]})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{children:"Cancel"}),o.jsx($a,{onClick:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}const VN=1024*1024*1024;function i2e(t){if(!t||t<=0)return"—";const e=t/VN;return e>=1?`${e%1===0?e:e.toFixed(1)} GB`:`${Math.round(t/(1024*1024))} MB`}const a2e=[{value:"aws-cli",label:"AWS CLI"},{value:"python",label:"Python (boto3)"},{value:"node",label:"Node.js"}];function cL(t,e){var l;const r=t.endpoint||"https://your-endpoint",n=t.id||"your-bucket-name",s=(l=t.keys)==null?void 0:l[0],i=(s==null?void 0:s.access_key_id)||"YOUR_ACCESS_KEY_ID",a=(s==null?void 0:s.secret_access_key)||"YOUR_SECRET_ACCESS_KEY";switch(e){case"python":return`# Install: pip install boto3
|
||
|
||
import boto3
|
||
|
||
s3 = boto3.client(
|
||
"s3",
|
||
endpoint_url="${r}",
|
||
aws_access_key_id="${i}",
|
||
aws_secret_access_key="${a}",
|
||
region_name="us-east-1",
|
||
)
|
||
|
||
BUCKET = "${n}"
|
||
|
||
# List the files in your bucket
|
||
print(s3.list_objects_v2(Bucket=BUCKET))
|
||
|
||
# Upload a file
|
||
s3.upload_file("photo.jpg", BUCKET, "photo.jpg")
|
||
|
||
# Download a file
|
||
s3.download_file(BUCKET, "photo.jpg", "downloaded.jpg")`;case"node":return`# Install: npm install @aws-sdk/client-s3
|
||
|
||
import { S3Client, ListObjectsV2Command, PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";
|
||
import { readFileSync } from "fs";
|
||
|
||
const s3 = new S3Client({
|
||
endpoint: "${r}",
|
||
region: "us-east-1",
|
||
credentials: {
|
||
accessKeyId: "${i}",
|
||
secretAccessKey: "${a}",
|
||
},
|
||
forcePathStyle: true,
|
||
});
|
||
|
||
const BUCKET = "${n}";
|
||
|
||
async function main() {
|
||
// List files
|
||
const list = await s3.send(new ListObjectsV2Command({ Bucket: BUCKET }));
|
||
console.log(list.Contents);
|
||
|
||
// Upload a file
|
||
await s3.send(new PutObjectCommand({
|
||
Bucket: BUCKET,
|
||
Key: "photo.jpg",
|
||
Body: readFileSync("photo.jpg"),
|
||
}));
|
||
|
||
// Download a file
|
||
const { Body } = await s3.send(new GetObjectCommand({ Bucket: BUCKET, Key: "photo.jpg" }));
|
||
console.log(await Body.transformToByteArray());
|
||
}
|
||
|
||
main();`;case"aws-cli":default:return`# 1. Install the AWS CLI
|
||
# https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
|
||
|
||
# 2. Set your credentials
|
||
export AWS_ACCESS_KEY_ID="${i}"
|
||
export AWS_SECRET_ACCESS_KEY="${a}"
|
||
|
||
# 3. List files in your bucket
|
||
aws --endpoint-url ${r} s3 ls s3://${n}
|
||
|
||
# Upload a file
|
||
aws --endpoint-url ${r} s3 cp ./photo.jpg s3://${n}/
|
||
|
||
# Download a file
|
||
aws --endpoint-url ${r} s3 cp s3://${n}/photo.jpg ./downloaded.jpg`}}function o2e(){const{toast:t}=br(),{freeOnly:e}=wv(),{createManagedS3Bucket:r,listS3Buckets:n,deleteS3Bucket:s,listS3BucketKeys:i,rotateS3BucketKey:a,deleteS3BucketKey:l}=Nr(),[c,d]=E.useState([]),[f,p]=E.useState(!1),[m,g]=E.useState(!1),[y,x]=E.useState(!1),[w,_]=E.useState(null),[S,k]=E.useState(null),[N,j]=E.useState({}),[T,D]=E.useState(null),[I,L]=E.useState({}),[$,Q]=E.useState({name:"",maxSizeGB:"1"}),M=E.useCallback(async()=>{p(!0);try{const O=await n();if(!O)return;const H=await Promise.all(O.map(async G=>{const q=await i(G.id);return{...G,keys:q??[]}}));d(H)}catch(O){t({title:"Failed to load buckets",description:O instanceof Error?O.message:"An unknown error occurred",variant:"destructive"})}finally{p(!1)}},[n,i,t]);E.useEffect(()=>{M()},[M]);const z=c.reduce((O,H)=>O+(H.max_size||0)/VN,0),R=async(O,H)=>{try{await navigator.clipboard.writeText(H),D(O),setTimeout(()=>D(null),2e3),t({title:"Copied",description:`${O} copied to clipboard.`})}catch{t({title:"Copy failed",variant:"destructive"})}},B=O=>{j(H=>({...H,[O]:!H[O]}))},V=async()=>{var G;if(!$.name.trim())return;const O=Number($.maxSizeGB),H=Number.isFinite(O)?Math.floor(O):0;if(H<1||H>50){t({title:"Invalid size",description:"Bucket size must be a whole number between 1 and 50 GB.",variant:"destructive"});return}x(!0);try{const q=H*VN,J=await r($.name.trim(),q);if(!J)throw new Error("Failed to create bucket");if(d(te=>[J,...te]),(G=J.keys)!=null&&G.length){const te=J.keys[0];te.secret_access_key&&j(ve=>({...ve,[te.id]:!0}))}g(!1),Q({name:"",maxSizeGB:"1"}),t({title:"Bucket created",description:`${J.id||J.name||"Your bucket"} is ready. Copy the access key secret now — it is shown only once.`})}catch(q){t({title:"Failed to create bucket",description:q instanceof Error?q.message:"An unknown error occurred",variant:"destructive"})}finally{x(!1)}},F=async()=>{if(w)try{if(!await s(w.id))throw new Error("Failed to delete bucket");d(H=>H.filter(G=>G.id!==w.id)),_(null),t({title:"Bucket deleted",description:"Your bucket has been deleted."})}catch(O){t({title:"Failed to delete bucket",description:O instanceof Error?O.message:"An unknown error occurred",variant:"destructive"})}},K=async O=>{k(O);try{const H=await a(O);if(!H)throw new Error("Failed to rotate key");d(G=>G.map(q=>q.id===O?{...q,keys:[...q.keys||[],H]}:q)),H.secret_access_key&&j(G=>({...G,[H.id]:!0})),t({title:"Access key rotated",description:"A new key was generated. Copy the secret access key now."})}catch(H){t({title:"Failed to rotate key",description:H instanceof Error?H.message:"An unknown error occurred",variant:"destructive"})}finally{k(null)}},Y=async(O,H)=>{try{if(!await l(O,H))throw new Error("Failed to delete access key");d(q=>q.map(J=>J.id===O?{...J,keys:(J.keys||[]).filter(te=>te.id!==H)}:J)),t({title:"Access key deleted"})}catch(G){t({title:"Failed to delete access key",description:G instanceof Error?G.message:"An unknown error occurred",variant:"destructive"})}};return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"S3 Object Storage",description:"Provision S3-compatible buckets and get access keys in seconds.",actions:[o.jsxs(le,{onClick:()=>g(!0),className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"Create Bucket"]},"create-bucket"),o.jsxs(le,{variant:"outline",onClick:()=>void M(),disabled:f,children:[o.jsx(wn,{className:`mr-2 h-4 w-4 ${f?"animate-spin":""}`}),"Refresh"]},"refresh")]}),o.jsx($e,{className:"border-primary/20 bg-gradient-to-r from-primary/5 via-background to-background",children:o.jsxs(Be,{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between",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-lg bg-primary/10",children:o.jsx(ti,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"S3-compatible object storage"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Use any S3 client (aws cli, s3cmd, boto3) against your bucket endpoint."})]})]}),o.jsxs(Lt,{variant:"secondary",className:"gap-1 self-start sm:self-auto",children:[o.jsx(wa,{className:"h-3 w-3"})," Encrypted"]})]})}),o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4",children:[o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Hu,{className:"h-4 w-4 text-primary"})," Buckets"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:c.length})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"provisioned"})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Es,{className:"h-4 w-4 text-primary"})," Quota"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:z?`${z.toFixed(1)} GB`:"—"})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"provisioned total"})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(gi,{className:"h-4 w-4 text-primary"})," Access keys"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:c.reduce((O,H)=>{var G;return O+(((G=H.keys)==null?void 0:G.length)||0)},0)})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"minted for your buckets"})})]})]}),f?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx(kt,{className:"mx-auto h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading your buckets…"})]})}):c.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx("div",{className:"mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(Hu,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"No buckets yet"}),o.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Create your first S3 bucket and get an endpoint plus access keys to start storing objects."}),o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90",onClick:()=>g(!0),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"})," Create Bucket"]})]})}):o.jsx("div",{className:"space-y-4",children:c.map(O=>o.jsxs($e,{className:"overflow-hidden border-primary/20",children:[o.jsxs(ot,{className:"flex flex-row items-start justify-between border-b border-border/60 px-6 py-5",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(Hu,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx(dt,{className:"text-base",children:O.id||O.name||"S3 Bucket"}),o.jsxs(rn,{className:"flex items-center gap-2",children:[i2e(O.max_size),o.jsx("span",{className:"text-muted-foreground",children:"·"}),"S3-compatible"]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Lt,{className:"gap-1 bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300",children:[o.jsx(Lr,{className:"h-3 w-3"})," Ready"]}),o.jsxs(le,{variant:"outline",size:"sm",className:"border-destructive/20 text-destructive hover:text-destructive",onClick:()=>_(O),children:[o.jsx(ds,{className:"mr-1.5 h-3.5 w-3.5"})," Delete"]})]})]}),o.jsxs(Be,{className:"space-y-5 p-6",children:[o.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-3",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Bucket name"}),o.jsx("p",{className:"truncate font-mono text-sm",children:O.id||"—"})]}),O.id&&o.jsxs(le,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>R(`BN-${O.id}`,O.id),children:[T===`BN-${O.id}`?o.jsx(Lr,{className:"mr-1.5 h-4 w-4 text-emerald-500"}):o.jsx(cn,{className:"mr-1.5 h-4 w-4"}),"Copy"]})]})}),o.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-3",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Endpoint"}),o.jsx("p",{className:"truncate font-mono text-sm",children:O.endpoint||"—"})]}),O.endpoint&&o.jsxs(le,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>R("Endpoint",O.endpoint),children:[T==="Endpoint"?o.jsx(Lr,{className:"mr-1.5 h-4 w-4 text-emerald-500"}):o.jsx(cn,{className:"mr-1.5 h-4 w-4"}),"Copy"]})]})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(gi,{className:"h-4 w-4 text-muted-foreground"})," Access keys"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>K(O.id),disabled:S===O.id,children:[S===O.id?o.jsx(kt,{className:"mr-1.5 h-4 w-4 animate-spin"}):o.jsx(wn,{className:"mr-1.5 h-4 w-4"}),"Rotate key"]})]}),O.keys&&O.keys.length>0?O.keys.map(H=>{const G=!!N[H.id];return o.jsxs("div",{className:"rounded-lg border border-border p-4",children:[o.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[o.jsxs(Lt,{variant:"outline",className:"gap-1",children:[o.jsx(Gn,{className:"h-3 w-3"})," ",H.read?"read":"—"]}),o.jsx(Lt,{variant:"outline",className:"gap-1",children:H.write?"write":"—"}),H.owner&&o.jsx(Lt,{variant:"outline",className:"gap-1",children:"owner"}),o.jsxs(le,{variant:"ghost",size:"sm",className:"ml-auto border-destructive/20 text-destructive hover:text-destructive",onClick:()=>Y(O.id,H.id),children:[o.jsx(ds,{className:"mr-1.5 h-3.5 w-3.5"})," Delete key"]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Access key ID"}),o.jsx("p",{className:"truncate font-mono text-sm",children:H.access_key_id||"—"})]}),H.access_key_id&&o.jsxs(le,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>R(`AK-${H.id}`,H.access_key_id),children:[T===`AK-${H.id}`?o.jsx(Lr,{className:"mr-1.5 h-4 w-4 text-emerald-500"}):o.jsx(cn,{className:"mr-1.5 h-4 w-4"}),"Copy"]})]}),o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Secret access key"}),o.jsx("p",{className:"truncate font-mono text-sm",children:H.secret_access_key?G?H.secret_access_key:"•".repeat(Math.min(32,H.secret_access_key.length)):"—"})]}),H.secret_access_key&&o.jsxs("div",{className:"flex shrink-0 gap-1",children:[o.jsx(le,{variant:"ghost",size:"sm",onClick:()=>B(H.id),title:G?"Hide secret":"Reveal secret",children:G?o.jsx(ol,{className:"h-4 w-4"}):o.jsx(ll,{className:"h-4 w-4"})}),o.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>R(`SK-${H.id}`,H.secret_access_key),children:[T===`SK-${H.id}`?o.jsx(Lr,{className:"mr-1.5 h-4 w-4 text-emerald-500"}):o.jsx(cn,{className:"mr-1.5 h-4 w-4"}),"Copy"]})]})]}),H.endpoint&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(An,{className:"h-3.5 w-3.5"})," ",H.endpoint]})]})]},H.id)}):o.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-4 text-center text-sm text-muted-foreground",children:"No access keys minted for this bucket."}),o.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(Gn,{className:"h-3 w-3"})," Your secret access key is shown ",o.jsx("strong",{children:"only once"})," and cannot be recovered later — copy it now and store it securely."]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("p",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Bs,{className:"h-4 w-4 text-muted-foreground"})," Sample code"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ja,{value:I[O.id]||"aws-cli",onValueChange:H=>L(G=>({...G,[O.id]:H})),children:[o.jsx(Wi,{className:"h-8 w-[160px]",children:o.jsx(Ta,{})}),o.jsx(Gi,{children:a2e.map(H=>o.jsx(bn,{value:H.value,children:H.label},H.value))})]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>R(`code-${O.id}`,cL(O,I[O.id]||"aws-cli")),children:[T===`code-${O.id}`?o.jsx(Lr,{className:"mr-1.5 h-4 w-4 text-emerald-500"}):o.jsx(cn,{className:"mr-1.5 h-4 w-4"}),"Copy"]})]})]}),o.jsx("pre",{className:"overflow-x-auto rounded-lg border border-border bg-muted/50 p-4 text-xs font-mono whitespace-pre leading-relaxed",children:cL(O,I[O.id]||"aws-cli")}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Replace ",o.jsx("span",{className:"font-mono",children:"photo.jpg"})," with your own file name."]})]})]})]},O.id))}),o.jsx(hs,{open:m,onOpenChange:g,children:o.jsxs(un,{className:"sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Create S3 Bucket"}),o.jsx(fs,{children:"Give your bucket a friendly name. We generate the actual bucket name (ID), endpoint, and access keys for you."})]}),e&&o.jsxs("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400",children:["S3 buckets require a payment method."," ",o.jsx("a",{href:"/dashboard/billing",className:"font-medium underline",children:"Add a card"})," to unlock."]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"name",children:"Bucket name"}),o.jsx(tt,{id:"name",value:$.name,onChange:O=>Q({...$,name:O.target.value}),placeholder:"my-bucket",required:!0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This is just a label. Your real bucket name (ID) is generated automatically and shown after creation."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"maxSize",children:"Max size (GB)"}),o.jsx(tt,{id:"maxSize",type:"number",min:1,max:50,step:1,value:$.maxSizeGB,onChange:O=>Q({...$,maxSizeGB:O.target.value}),placeholder:"1–50"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter a whole number between 1 and 50 GB."})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-50 px-3 py-2 dark:bg-amber-950/20",children:[o.jsx(gi,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),o.jsxs("span",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Your secret access key is shown ",o.jsx("strong",{children:"only once"})," right after creation — copy it before closing. It cannot be recovered later."]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-emerald-500/20 bg-emerald-50 px-3 py-2 dark:bg-emerald-950/20",children:[o.jsx(wa,{className:"h-4 w-4 text-emerald-500"}),o.jsx("span",{className:"text-xs text-emerald-700 dark:text-emerald-300",children:"Encrypted at rest and in transit"})]})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),o.jsx(le,{onClick:V,disabled:y||!$.name.trim()||e,className:"bg-gradient-to-r from-primary to-primary/90",children:y?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Creating..."]}):"Create Bucket"})]})]})}),o.jsx(So,{open:!!w,onOpenChange:O=>!O&&_(null),children:o.jsxs(Oa,{children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete Bucket"}),o.jsxs(La,{children:["Are you sure you want to delete"," ",o.jsx("span",{className:"font-medium",children:(w==null?void 0:w.id)||(w==null?void 0:w.name)}),"? This will also revoke all of its access keys. This action cannot be undone."]})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{children:"Cancel"}),o.jsx($a,{onClick:F,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}const l2e={stdout:"text-emerald-500 dark:text-emerald-400",stderr:"text-rose-500 dark:text-rose-400",event:"text-sky-500 dark:text-sky-400"};function c2e(t){const e=new Date(t);return isNaN(e.getTime())?t:e.toLocaleTimeString([],{hour12:!1})}function u2e({app:t,open:e,onOpenChange:r}){const{appLogs:n}=Nr(),[s,i]=E.useState([]),[a,l]=E.useState(!0),[c,d]=E.useState(!1),[f,p]=E.useState(null),m=E.useRef(null),g=E.useCallback(async()=>{if(t){d(!0),p(null);try{const y=await n(t.id,200);i([...y??[]].reverse())}catch(y){p(y instanceof Error?y.message:"Failed to load logs")}finally{d(!1)}}},[t,n]);return E.useEffect(()=>{!e||!t||(l(!0),g())},[e,t,g]),E.useEffect(()=>{if(!e||!t||!a)return;const y=window.setInterval(()=>void g(),3e3);return()=>window.clearInterval(y)},[e,t,a,g]),E.useEffect(()=>{const y=m.current;y&&a&&(y.scrollTop=y.scrollHeight)},[s,a]),o.jsx(hs,{open:e,onOpenChange:r,children:o.jsxs(un,{className:"max-w-3xl max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden",children:[o.jsx(Dn,{className:"border-b border-border/60 px-6 py-4 shrink-0",children:o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs(On,{className:"flex items-center gap-2",children:[o.jsx(Bs,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"truncate",children:(t==null?void 0:t.name)||(t==null?void 0:t.id)})]}),o.jsx(fs,{children:"Live container logs"})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a?o.jsxs(Lt,{className:"gap-1.5 bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300",children:[o.jsxs("span",{className:"relative flex h-2 w-2",children:[o.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),o.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-emerald-500"})]}),"Live"]}):o.jsx(Lt,{variant:"secondary",children:"Paused"}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>l(!a),children:[a?o.jsx(Cre,{className:"mr-1.5 h-3.5 w-3.5"}):o.jsx(Q_,{className:"mr-1.5 h-3.5 w-3.5"}),a?"Pause":"Resume"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>void g(),disabled:c,children:[o.jsx(wn,{className:we("mr-1.5 h-3.5 w-3.5",c&&"animate-spin")}),"Refresh"]})]})]})}),o.jsx("div",{ref:m,className:"flex-1 overflow-y-auto bg-slate-950 font-mono text-xs leading-relaxed p-4",children:c&&s.length===0?o.jsxs("div",{className:"flex h-full items-center justify-center text-slate-400",children:[o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading logs…"]}):f&&s.length===0?o.jsx("div",{className:"flex h-full items-center justify-center text-rose-400",children:f}):s.length===0?o.jsx("div",{className:"flex h-full items-center justify-center text-slate-500",children:"No logs yet — the app may still be starting."}):o.jsx("div",{className:"space-y-1",children:s.map((y,x)=>o.jsxs("div",{className:"flex gap-3 whitespace-pre-wrap break-words",children:[o.jsx("span",{className:"shrink-0 text-slate-500",children:c2e(y.timestamp)}),o.jsx("span",{className:we("shrink-0 w-14 font-semibold",l2e[y.source??""]??"text-slate-400"),children:y.source??"—"}),o.jsx("span",{className:"text-slate-200",children:y.message})]},x))})})]})})}const d2e={slate:"bg-slate-100 text-slate-700 border-slate-200/80 dark:bg-slate-500/10 dark:text-slate-300 dark:border-slate-500/20",blue:"bg-blue-50 text-blue-700 border-blue-200/80 dark:bg-blue-500/10 dark:text-blue-300 dark:border-blue-500/20",green:"bg-emerald-50 text-emerald-700 border-emerald-200/80 dark:bg-emerald-500/10 dark:text-emerald-300 dark:border-emerald-500/20",amber:"bg-amber-50 text-amber-700 border-amber-200/80 dark:bg-amber-500/10 dark:text-amber-300 dark:border-amber-500/20",red:"bg-red-50 text-red-700 border-red-200/80 dark:bg-red-500/10 dark:text-red-300 dark:border-red-500/20",purple:"bg-purple-50 text-purple-700 border-purple-200/80 dark:bg-purple-500/10 dark:text-purple-300 dark:border-purple-500/20",pink:"bg-pink-50 text-pink-700 border-pink-200/80 dark:bg-pink-500/10 dark:text-pink-300 dark:border-pink-500/20",teal:"bg-teal-50 text-teal-700 border-teal-200/80 dark:bg-teal-500/10 dark:text-teal-300 dark:border-teal-500/20",orange:"bg-orange-50 text-orange-700 border-orange-200/80 dark:bg-orange-500/10 dark:text-orange-300 dark:border-orange-500/20",cyan:"bg-cyan-50 text-cyan-700 border-cyan-200/80 dark:bg-cyan-500/10 dark:text-cyan-300 dark:border-cyan-500/20",lime:"bg-lime-50 text-lime-700 border-lime-200/80 dark:bg-lime-500/10 dark:text-lime-300 dark:border-lime-500/20",indigo:"bg-indigo-50 text-indigo-700 border-indigo-200/80 dark:bg-indigo-500/10 dark:text-indigo-300 dark:border-indigo-500/20"},uL=["blue","green","purple","amber","pink","teal","cyan","orange","indigo","red","lime","slate"];function h2e(t){const e=t.trim().toLowerCase();if(!e)return"slate";let r=0;for(let n=0;n<e.length;n++)r=r*31+e.charCodeAt(n)>>>0;return uL[r%uL.length]}function yW({label:t,color:e,onRemove:r,icon:n,className:s,...i}){const a=e??h2e(t);return o.jsxs("span",{...i,className:we("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium leading-5 transition-colors",d2e[a],s),children:[n??o.jsx("span",{className:we("h-1.5 w-1.5 rounded-full",t.length%2===0?"bg-current opacity-60":"bg-current opacity-30")}),o.jsx("span",{className:"max-w-40 truncate",children:t}),r&&o.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),r()},className:"-mr-0.5 ml-0.5 rounded-full p-0.5 opacity-60 transition-opacity hover:opacity-100","aria-label":`Remove ${t}`,children:o.jsx(yc,{className:"h-3 w-3"})})]})}function f2e({tags:t,className:e}){return t.length?o.jsx("div",{className:we("flex flex-wrap items-center gap-1.5",e),children:t.map((r,n)=>{var a;const s=typeof r=="string"?r:((a=r.value)==null?void 0:a.trim())||r.key.trim(),i=typeof r=="string"?r:r.key;return s?o.jsx(yW,{label:s,title:i!==s?`${i}: ${s}`:s},`${i}-${n}`):null})}):null}function p2e({value:t,onChange:e,placeholder:r="Add tags…",suggestions:n=[],className:s}){const[i,a]=E.useState(""),l=E.useRef(null),c=m=>{var _;const g=m.trim();if(!g)return;const y=g.indexOf("="),x=y>0?{key:g.slice(0,y).trim(),value:g.slice(y+1).trim()}:{key:g,value:g};t.some(S=>S.key.toLowerCase()===x.key.toLowerCase())||e([...t,x]),a(""),(_=l.current)==null||_.focus()},d=m=>{m.key==="Enter"||m.key===","?(m.preventDefault(),c(i)):m.key==="Backspace"&&!i&&t.length&&e(t.slice(0,-1))},f=m=>{e(t.filter((g,y)=>y!==m))},p=n.filter(m=>!t.some(g=>g.key===m)&&m.toLowerCase().includes(i.toLowerCase()));return o.jsxs("div",{className:we("space-y-2",s),children:[o.jsxs("div",{onClick:()=>{var m;return(m=l.current)==null?void 0:m.focus()},className:"flex min-h-11 cursor-text flex-wrap items-center gap-1.5 rounded-xl border border-input bg-background px-3 py-2 transition-colors focus-within:border-primary/40 focus-within:ring-2 focus-within:ring-primary/15",children:[o.jsx(rne,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.map((m,g)=>{var x;const y=((x=m.value)==null?void 0:x.trim())||m.key.trim();return o.jsx(yW,{label:y,title:m.key!==y?`${m.key}: ${y}`:y,onRemove:()=>f(g)},`${m.key}-${g}`)}),o.jsx("input",{ref:l,value:i,onChange:m=>a(m.target.value),onKeyDown:d,onBlur:()=>i.trim()&&c(i),placeholder:t.length?"":r,className:"h-7 min-w-24 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),p.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(m=>o.jsxs("button",{type:"button",onMouseDown:g=>g.preventDefault(),onClick:()=>c(m),className:"inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:text-primary",children:[o.jsx(nr,{className:"h-3 w-3"}),m]},m))})]})}function dL(t){const e=(t??"").replace(/^https?:\/\//i,"");return e.includes(".hosted.")?"":e}const _0={"g3.small":{cpu:250,memory:512,vcpu:"0.25 vCPU",mem:"512MB",free:!0},"g4.medium":{cpu:400,memory:1024,vcpu:"0.40 vCPU",mem:"1GB",free:!1},"g5.large":{cpu:700,memory:2048,vcpu:"0.70 vCPU",mem:"2GB",free:!1},"g6.xlarge":{cpu:1400,memory:4096,vcpu:"1.40 vCPU",mem:"4GB",free:!1},"g7.2xlarge":{cpu:2100,memory:6144,vcpu:"2.10 vCPU",mem:"6GB",free:!1}};function m2e(t,e){var n;const r=(n=e==null?void 0:e.find(s=>s.key==="billing.tier"))==null?void 0:n.value;return r&&r in _0?r:!t||t<=300?"g3.small":t<=400?"g4.medium":t<=700?"g5.large":t<=1400?"g6.xlarge":"g7.2xlarge"}const g2e=["nginx","node:20","python:3.12","alpine"];function xW({open:t,onOpenChange:e,app:r,onSaved:n}){const{toast:s}=br(),{freeOnly:i}=wv(),{listVolumes:a,listPullSecrets:l,listSecrets:c,createManagedApp:d,updateManagedApp:f}=Nr(),[p,m]=E.useState([]),[g,y]=E.useState([]),[x,w]=E.useState([]),[_,S]=E.useState(!1),[k,N]=E.useState(0),[j,T]=E.useState(""),[D,I]=E.useState(""),[L,$]=E.useState("g3.small"),[Q,M]=E.useState(1),[z,R]=E.useState(!1),[B,V]=E.useState(!1),[F,K]=E.useState(""),[Y,O]=E.useState(""),[H,G]=E.useState([{name:"web",number:"80",hostname:"",healthPath:""}]),[q,J]=E.useState([]),[te,ve]=E.useState([]),[he,xe]=E.useState([]);E.useEffect(()=>{a().then(X=>m(X??[])).catch(()=>{}),l().then(X=>y(X??[])).catch(()=>{}),c().then(X=>w(X??[])).catch(()=>{})},[a,l,c]);const ke=()=>{T(""),I(""),$("g3.small"),M(1),R(!1),V(!1),K(""),O(""),G([{name:"web",number:"80",hostname:"",healthPath:""}]),J([]),ve([]),xe([]),N(0)};E.useEffect(()=>{if(!t)return;if(!r){ke();return}T(r.name??""),I(r.image??""),$(m2e(r.cpu,r.tags)),M(r.instances??1),R(r.hibernated??!1),V(r.ephemeral??!1),K((r.args??[]).join(" ")),O(r.pull_secret_id??"");const X=(r.ports??[]).map(W=>{var Z;return{name:W.name??"",number:String(W.number??""),hostname:W.hostname?dL(W.hostname):"",healthPath:((Z=W.health)==null?void 0:Z.path)??""}});G(X.length?X:[{name:"web",number:"80",hostname:"",healthPath:""}]),J((r.env??[]).map(W=>({name:W.name??"",value:W.is_secret?"":W.value??"",secretId:W.is_secret?W.value??"":"",filePath:W.file_path??""}))),ve((r.mounts??[]).map(W=>({volumeId:W.volume_id??"",path:W.path??""}))),xe((r.tags??[]).map(W=>({key:W.key,value:W.value}))),N(0)},[t,r]);const Oe=E.useCallback(()=>{const X=_0[L];return{name:j.trim(),image:D.trim(),cpu:X.cpu,memory:X.memory,instances:Q,hibernated:z,ephemeral:B,args:F.split(/\s+/).map(W=>W.trim()).filter(Boolean),ports:H.filter(W=>W.name.trim()&&Number(W.number)>0).map(W=>({name:W.name.trim(),number:Number(W.number),...W.hostname.trim()?{hostname:dL(W.hostname)}:{},...W.healthPath.trim()?{health:{path:W.healthPath.trim()}}:{}})),env:q.filter(W=>W.name.trim()).map(W=>W.secretId?{name:W.name.trim(),value:W.secretId,is_secret:!0,...W.filePath.trim()?{file_path:W.filePath.trim()}:{}}:{name:W.name.trim(),value:W.value}),mounts:te.filter(W=>W.volumeId&&W.path.trim()).map(W=>({volume_id:W.volumeId,path:W.path.trim()})),tags:[...he.filter(W=>W.key.trim()&&W.key.trim()!=="billing.tier").map(W=>({key:W.key.trim(),value:W.value})),{key:"billing.tier",value:L}],...Y?{pull_secret_id:Y}:{}}},[j,D,L,Q,z,B,F,H,q,te,he,Y]),He=async()=>{if(!j.trim()||!D.trim()){s({title:"Almost there",description:"Name and image are required.",variant:"destructive"}),N(0);return}const X=Oe();S(!0);try{const W=r?await f(r.id,X):await d(X);if(!W)throw new Error(r?"Failed to update app":"Failed to create app");e(!1),s({title:r?"App updated":"App deployed 🚀",description:r?`${W.name} was updated.`:`${W.name??"Your app"} is spinning up — this can take a minute.`}),n==null||n()}catch(W){s({title:r?"Failed to update app":"Failed to create app",description:W instanceof Error?W.message:"An unknown error occurred",variant:"destructive"})}finally{S(!1)}},Ye=k!==0||!!(j.trim()&&D.trim()),lt=()=>G([...H,{name:"",number:"",hostname:"",healthPath:""}]),P=()=>J([...q,{name:"",value:"",secretId:"",filePath:""}]),ne=()=>ve([...te,{volumeId:"",path:"/data/"}]);return o.jsx(hs,{open:t,onOpenChange:e,children:o.jsxs(un,{className:"flex max-h-[90vh] max-w-2xl flex-col overflow-hidden p-0 gap-0",children:[o.jsxs(Dn,{className:"shrink-0 border-b border-border/60 px-6 pb-4 pt-6",children:[o.jsxs(On,{className:"flex items-center gap-2",children:[o.jsx(nv,{className:"h-5 w-5 text-primary"}),r?"Edit App":"Deploy an App"]}),o.jsx(fs,{children:r?"Update your app's configuration.":"A few clicks and it's live."}),i&&o.jsxs("div",{className:"mt-4 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400",children:["Free plan: you can run one ",o.jsx("span",{className:"font-semibold",children:"g3.small"})," server.",o.jsx("a",{href:"/dashboard/billing",className:"ml-1 font-medium underline",children:"Add a payment method"})," to unlock every tier, databases, S3 buckets, and volumes."]}),o.jsxs("div",{className:"mt-5",children:[o.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-xs",children:[o.jsxs("span",{className:"font-medium text-foreground",children:["Step ",k+1," of 3 — ",["Details","Resources","Advanced"][k]]}),o.jsx("span",{className:"text-muted-foreground",children:"Details · Resources · Advanced"})]}),o.jsx("div",{className:"h-1 w-full overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300",style:{width:`${(k+1)/3*100}%`}})})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:[k===0&&o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"name",children:"App name"}),o.jsx(tt,{id:"name",value:j,onChange:X=>T(X.target.value),placeholder:"my-app",autoFocus:!0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Lowercase letters, numbers, and hyphens."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"image",children:"Container image"}),o.jsx(tt,{id:"image",value:D,onChange:X=>I(X.target.value),placeholder:"e.g. nginx"}),o.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground self-center",children:"Popular:"}),g2e.map(X=>o.jsx("button",{type:"button",onClick:()=>I(X),className:we("rounded-full border px-3 py-1 font-mono text-xs transition-colors",D===X?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:border-primary/40 hover:text-foreground"),children:X},X))]})]})]}),k===1&&o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs(Xe,{className:"flex items-center gap-2",children:[o.jsx(il,{className:"h-4 w-4 text-primary"})," Size"]}),o.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-4",children:Object.keys(_0).map(X=>{const W=_0[X],Z=L===X;return o.jsxs("button",{type:"button",onClick:()=>$(X),className:we("rounded-xl border p-3 text-left transition-all",Z?"border-primary bg-primary/5 ring-1 ring-primary/40":"border-border hover:border-primary/30"),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("p",{className:"text-sm font-semibold",children:X}),W.free&&o.jsx("span",{className:"rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400",children:"Free"})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[W.vcpu," · ",W.mem]}),o.jsxs("p",{className:"mt-1 font-mono text-xs text-primary",children:[W.cpu,"m · ",W.memory,"MB"]})]},X)})})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-3 py-2.5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Instances"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"How many copies to run"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>M(Math.max(1,Q-1)),children:o.jsx(yre,{className:"h-4 w-4"})}),o.jsx("span",{className:"w-8 text-center font-semibold",children:Q}),o.jsx(le,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>M(Math.min(10,Q+1)),children:o.jsx(nr,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(Xe,{className:"flex items-center gap-2",children:[o.jsx(An,{className:"h-4 w-4 text-primary"})," Ports"]}),o.jsxs(le,{type:"button",variant:"ghost",size:"sm",onClick:lt,children:[o.jsx(nr,{className:"mr-1 h-3.5 w-3.5"})," Add port"]})]}),H.map((X,W)=>o.jsxs("div",{className:"space-y-2 rounded-xl border border-border p-3",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx(tt,{placeholder:"name (e.g. web)",value:X.name,onChange:Z=>G(H.map((re,ae)=>ae===W?{...re,name:Z.target.value}:re))}),o.jsx(tt,{placeholder:"80",type:"number",value:X.number,onChange:Z=>G(H.map((re,ae)=>ae===W?{...re,number:Z.target.value}:re)),className:"w-24"}),o.jsx(le,{type:"button",variant:"ghost",size:"icon",onClick:()=>G(H.filter((Z,re)=>re!==W)),children:o.jsx(yc,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(tt,{placeholder:"hostname (optional)",value:X.hostname,onChange:Z=>G(H.map((re,ae)=>ae===W?{...re,hostname:Z.target.value}:re))}),o.jsx(tt,{placeholder:"health path (optional, /health)",value:X.healthPath,onChange:Z=>G(H.map((re,ae)=>ae===W?{...re,healthPath:Z.target.value}:re))})]})]},W))]})]}),k===2&&o.jsxs("div",{className:"space-y-5",children:[o.jsx("p",{className:"rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-xs text-muted-foreground",children:"All of this is optional — you can leave it empty and deploy with defaults."}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"args",children:"Command arguments"}),o.jsx(tt,{id:"args",value:F,onChange:X=>K(X.target.value),placeholder:"e.g. --flag value"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated args passed to the container."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Xe,{children:"Environment variables"}),o.jsxs(le,{type:"button",variant:"ghost",size:"sm",onClick:P,children:[o.jsx(nr,{className:"mr-1 h-3.5 w-3.5"})," Add"]})]}),q.map((X,W)=>{var Z;return o.jsxs("div",{className:"space-y-2 rounded-xl border border-border p-3",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx(tt,{placeholder:"KEY",value:X.name,onChange:re=>J(q.map((ae,fe)=>fe===W?{...ae,name:re.target.value}:ae))}),X.secretId?o.jsx(tt,{value:((Z=x.find(re=>re.id===X.secretId))==null?void 0:Z.name)??X.secretId,disabled:!0,className:"bg-muted/50"}):o.jsx(tt,{placeholder:"value",value:X.value,onChange:re=>J(q.map((ae,fe)=>fe===W?{...ae,value:re.target.value}:ae))}),o.jsx(le,{type:"button",variant:"ghost",size:"icon",onClick:()=>J(q.filter((re,ae)=>ae!==W)),children:o.jsx(yc,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("select",{value:X.secretId,onChange:re=>J(q.map((ae,fe)=>fe===W?{...ae,secretId:re.target.value}:ae)),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm",children:[o.jsx("option",{value:"",children:"Plain value"}),x.map(re=>o.jsxs("option",{value:re.id,children:["Secret: ",re.name||re.id]},re.id))]}),X.secretId&&o.jsx(tt,{placeholder:"file path (optional, mount as file)",value:X.filePath,onChange:re=>J(q.map((ae,fe)=>fe===W?{...ae,filePath:re.target.value}:ae))})]})]},W)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(Xe,{className:"flex items-center gap-2",children:[o.jsx(Es,{className:"h-4 w-4 text-primary"})," Volumes"]}),o.jsxs(le,{type:"button",variant:"ghost",size:"sm",onClick:ne,children:[o.jsx(nr,{className:"mr-1 h-3.5 w-3.5"})," Mount"]})]}),te.map((X,W)=>{const Z=X.path.trim()!==""&&!X.path.trim().endsWith("/");return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("select",{value:X.volumeId,onChange:re=>ve(te.map((ae,fe)=>fe===W?{...ae,volumeId:re.target.value}:ae)),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[o.jsx("option",{value:"",children:"Select a volume…"}),p.map(re=>o.jsx("option",{value:re.id,children:re.name||re.id},re.id))]}),o.jsx(tt,{placeholder:"/data/",value:X.path,onChange:re=>ve(te.map((ae,fe)=>fe===W?{...ae,path:re.target.value}:ae))}),o.jsx(le,{type:"button",variant:"ghost",size:"icon",onClick:()=>ve(te.filter((re,ae)=>ae!==W)),children:o.jsx(yc,{className:"h-4 w-4"})})]}),Z&&o.jsxs("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:["Mount path must end with a trailing slash — e.g. ",o.jsx("span",{className:"font-mono",children:"/data/"}),", not ",o.jsx("span",{className:"font-mono",children:"/data"}),"."]})]},W)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(Xe,{className:"flex items-center gap-2",children:[o.jsx(sne,{className:"h-4 w-4 text-primary"})," Labels"]}),o.jsx(p2e,{value:he.map(X=>({key:X.key,value:X.value})),onChange:X=>xe(X.map(W=>({key:W.key,value:W.value??W.key}))),placeholder:"Add a label and press Enter…",suggestions:["production","staging","development","api","web","worker","cron"]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Press Enter to add. Use ",o.jsx("span",{className:"font-mono",children:"key=value"})," for a custom pair."]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"pullSecret",children:"Private registry credentials"}),o.jsxs("select",{id:"pullSecret",value:Y,onChange:X=>O(X.target.value),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[o.jsx("option",{value:"",children:"Public image (no credentials)"}),g.map(X=>o.jsxs("option",{value:X.id,children:[X.server||X.id," (",X.username,")"]},X.id))]})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[o.jsxs("button",{type:"button",onClick:()=>R(!z),className:we("flex items-center gap-2 rounded-lg border p-3 text-left transition-colors",z?"border-primary bg-primary/5":"border-border hover:border-primary/30"),children:[o.jsx(cl,{className:"h-4 w-4 text-primary"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Sleep when idle"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Scale to zero to save credits"})]}),o.jsx(Pc,{className:"ml-auto",checked:z,onCheckedChange:R,onClick:X=>X.stopPropagation()})]}),o.jsxs("button",{type:"button",onClick:()=>V(!B),className:we("flex items-center gap-2 rounded-lg border p-3 text-left transition-colors",B?"border-primary bg-primary/5":"border-border hover:border-primary/30"),children:[o.jsx(hc,{className:"h-4 w-4 text-primary"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Run once"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Stop after the process exits"})]}),o.jsx(Pc,{className:"ml-auto",checked:B,onCheckedChange:V,onClick:X=>X.stopPropagation()})]})]})]})]}),o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-6 py-4",children:[o.jsx("div",{children:k>0&&o.jsxs(le,{variant:"ghost",onClick:()=>N(k-1),children:[o.jsx(Qa,{className:"mr-1 h-4 w-4"})," Back"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),k<2?o.jsxs(le,{onClick:()=>N(k+1),disabled:!Ye,className:"bg-gradient-to-r from-primary to-primary/90",children:["Next",o.jsx(_s,{className:"ml-1 h-4 w-4"})]}):o.jsx(le,{onClick:He,disabled:_||!j.trim()||!D.trim()||i&&L!=="g3.small",className:"bg-gradient-to-r from-primary to-primary/90",children:_?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),r?"Saving…":"Deploying…"]}):o.jsxs(o.Fragment,{children:[o.jsx(ti,{className:"h-4 w-4 mr-2"}),r?"Save Changes":"Deploy App"]})})]})]})]})})}function m_(t){var e,r;return((r=(e=t.ports)==null?void 0:e.find(n=>n.hostname))==null?void 0:r.hostname)??""}function _W(t){return t?/^https?:\/\//i.test(t)?t:`https://${t}`:""}function bW(t){const e=(t??"").replace(/^https?:\/\//i,"");return e.includes(".hosted.")?"":e}function v2e(t){return{name:t.name??"",image:t.image??"",args:t.args??[],cpu:t.cpu,memory:t.memory,instances:t.instances??1,hibernated:t.hibernated??!1,ephemeral:t.ephemeral??!1,ports:(t.ports??[]).map(e=>{var r;return{name:e.name??"",number:e.number??0,...e.hostname?{hostname:bW(e.hostname)}:{},...(r=e.health)!=null&&r.path?{health:{path:e.health.path}}:{}}}),env:(t.env??[]).map(e=>({name:e.name??"",value:e.value??""})),mounts:(t.mounts??[]).map(e=>({volume_id:e.volume_id??"",path:e.path??""})),tags:(t.tags??[]).map(e=>({key:e.key,value:e.value})),...t.pull_secret_id?{pull_secret_id:t.pull_secret_id}:{}}}function Ou(t){return DH(t)}const wW={healthy:{label:"Healthy",dot:"bg-emerald-500",pill:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 ring-emerald-500/20"},deploying:{label:"Deploying",dot:"bg-amber-500",pill:"bg-amber-500/10 text-amber-600 dark:text-amber-400 ring-amber-500/20"},degraded:{label:"Degraded",dot:"bg-orange-500",pill:"bg-orange-500/10 text-orange-600 dark:text-orange-400 ring-orange-500/20"},hibernated:{label:"Hibernated",dot:"bg-sky-500",pill:"bg-sky-500/10 text-sky-600 dark:text-sky-400 ring-sky-500/20"},failed:{label:"Failed",dot:"bg-rose-500",pill:"bg-rose-500/10 text-rose-600 dark:text-rose-400 ring-rose-500/20"},removed:{label:"Removed",dot:"bg-gray-400",pill:"bg-gray-400/10 text-gray-500 dark:text-gray-400 ring-gray-500/20"}};function rR({status:t}){const e=wW[t];return o.jsxs("span",{className:"relative flex h-2.5 w-2.5 shrink-0",children:[t==="healthy"&&o.jsx("span",{className:we("absolute inline-flex h-full w-full animate-ping rounded-full opacity-60",e.dot)}),o.jsx("span",{className:we("relative inline-flex h-2.5 w-2.5 rounded-full",e.dot)})]})}function SW({status:t}){const e=wW[t];return o.jsxs("span",{className:we("inline-flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-medium ring-1 ring-inset",e.pill),children:[o.jsx(rR,{status:t}),e.label]})}function zu({icon:t,label:e}){return o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(t,{className:"h-3 w-3"}),e]})}function so({title:t,onClick:e,danger:r,children:n}){return o.jsx("button",{type:"button",title:t,onClick:s=>{s.stopPropagation(),e()},className:we("flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",r&&"hover:bg-destructive/10 hover:text-destructive"),children:n})}function y2e({url:t}){const[e,r]=E.useState(!1);return o.jsx("button",{type:"button",title:e?"Copied":"Copy URL",onClick:n=>{n.stopPropagation(),navigator.clipboard.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground",children:e?o.jsx(Lr,{className:"h-3.5 w-3.5 text-emerald-500"}):o.jsx(cn,{className:"h-3.5 w-3.5"})})}function x2e({app:t,busy:e,onEdit:r,onLogs:n,onDelete:s,onToggleSleep:i}){var m,g,y;const a=Yn(),l=Ou(t),c=l==="hibernated",d=t.url??_W(m_(t)),f=t.url??m_(t),p=(t.tags??[]).filter(x=>{var w;return((w=x.value)==null?void 0:w.trim())||x.key.trim()});return o.jsxs("div",{onClick:()=>a(`/dashboard/apps/${t.id}`),className:"group relative flex cursor-pointer flex-col overflow-hidden rounded-2xl border border-border/80 bg-card transition-all duration-200 hover:border-primary/30",children:[o.jsxs("div",{className:"flex flex-1 flex-col p-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[o.jsx("div",{className:"mt-1",children:o.jsx(rR,{status:l})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"truncate font-semibold tracking-tight",children:t.name||t.id}),o.jsx("p",{className:"mt-0.5 truncate font-mono text-xs text-muted-foreground",children:t.image||"—"})]})]}),o.jsx(SW,{status:l})]}),o.jsx("div",{className:"mt-4",children:d?o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-emerald-500/20 bg-emerald-500/5 px-2.5 py-1.5",children:[o.jsx(An,{className:"h-3.5 w-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),o.jsx("a",{href:d,target:"_blank",rel:"noreferrer",onClick:x=>x.stopPropagation(),className:"min-w-0 flex-1 truncate font-mono text-xs text-emerald-700 hover:underline dark:text-emerald-300",children:f}),o.jsx(y2e,{url:d})]}):o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dashed border-border/70 px-2.5 py-1.5 text-xs text-muted-foreground",children:[o.jsx(An,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:"No public hostname"})]})}),o.jsxs("div",{className:"mt-4 flex flex-wrap gap-1.5",children:[o.jsx(zu,{icon:il,label:t.cpu?`${t.cpu}m`:"—"}),o.jsx(zu,{icon:QB,label:t.memory?`${t.memory}MB`:"—"}),o.jsx(zu,{icon:Wh,label:`${c?0:t.instances??1}× instance${(t.instances??1)===1?"":"s"}`}),o.jsx(zu,{icon:An,label:`${((m=t.ports)==null?void 0:m.length)??0} port${(((g=t.ports)==null?void 0:g.length)??0)===1?"":"s"}`})]}),(((y=t.ports)==null?void 0:y.length)??0)>1&&o.jsx("div",{className:"mt-2 space-y-0.5",children:t.ports.slice(1).map((x,w)=>o.jsxs("div",{className:"flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[o.jsxs("span",{className:"font-mono",children:[x.name||"port",":",x.number]}),x.hostname?o.jsx("span",{className:"truncate font-mono",children:bW(x.hostname)}):o.jsx("span",{className:"truncate",children:"internal"})]},w))}),p.length>0&&o.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:p.map((x,w)=>{var _;return o.jsx("span",{className:"rounded-full border border-border/60 bg-muted/40 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:((_=x.value)==null?void 0:_.trim())||x.key.trim()},w)})})]}),o.jsxs("div",{className:"flex items-center justify-between border-t border-border/60 px-3 py-1.5",children:[o.jsx("span",{className:"truncate text-[11px] text-muted-foreground",children:t.created_at?`Created ${Ig(new Date(t.created_at*1e3),{addSuffix:!0})}`:t.image??""}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[d&&o.jsx(so,{title:"Open URL",onClick:()=>window.open(d,"_blank"),children:o.jsx(al,{className:"h-4 w-4"})}),o.jsx(so,{title:"Logs",onClick:()=>n(t),children:o.jsx(Bs,{className:"h-4 w-4"})}),o.jsx(so,{title:"Edit",onClick:()=>r(t),children:o.jsx(Y_,{className:"h-4 w-4"})}),o.jsx(so,{title:c?"Start":"Sleep",onClick:()=>i(t),children:e?o.jsx(kt,{className:"h-4 w-4 animate-spin"}):c?o.jsx(Q_,{className:"h-4 w-4"}):o.jsx(cl,{className:"h-4 w-4"})}),o.jsx(so,{title:"Delete",danger:!0,onClick:()=>s(t),children:o.jsx(ds,{className:"h-4 w-4"})})]})]})]})}function _2e({app:t,busy:e,onEdit:r,onLogs:n,onDelete:s,onToggleSleep:i}){const a=Yn(),l=Ou(t),c=l==="hibernated",d=t.url??_W(m_(t));return o.jsxs("div",{onClick:()=>a(`/dashboard/apps/${t.id}`),className:"group flex cursor-pointer items-center gap-4 rounded-xl border border-border/80 bg-card px-4 py-3 transition-all duration-200 hover:border-primary/30",children:[o.jsx(rR,{status:l}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"truncate font-semibold tracking-tight",children:t.name||t.id}),o.jsx("span",{className:"hidden truncate font-mono text-xs text-muted-foreground sm:inline",children:t.image||""})]}),d&&o.jsx("a",{href:d,target:"_blank",rel:"noreferrer",onClick:f=>f.stopPropagation(),className:"truncate font-mono text-xs text-primary hover:underline",children:t.url??m_(t)})]}),o.jsxs("div",{className:"hidden items-center gap-1.5 md:flex",children:[o.jsx(zu,{icon:il,label:t.cpu?`${t.cpu}m`:"—"}),o.jsx(zu,{icon:QB,label:t.memory?`${t.memory}MB`:"—"}),o.jsx(zu,{icon:Wh,label:`${c?0:t.instances??1}×`})]}),o.jsx(SW,{status:l}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[d&&o.jsx(so,{title:"Open URL",onClick:()=>window.open(d,"_blank"),children:o.jsx(al,{className:"h-4 w-4"})}),o.jsx(so,{title:"Logs",onClick:()=>n(t),children:o.jsx(Bs,{className:"h-4 w-4"})}),o.jsx(so,{title:"Edit",onClick:()=>r(t),children:o.jsx(Y_,{className:"h-4 w-4"})}),o.jsx(so,{title:c?"Start":"Sleep",onClick:()=>i(t),children:e?o.jsx(kt,{className:"h-4 w-4 animate-spin"}):c?o.jsx(Q_,{className:"h-4 w-4"}):o.jsx(cl,{className:"h-4 w-4"})}),o.jsx(so,{title:"Delete",danger:!0,onClick:()=>s(t),children:o.jsx(ds,{className:"h-4 w-4"})})]})]})}function b2e(){const{toast:t}=br(),{listApps:e,updateManagedApp:r,deleteManagedApp:n}=Nr(),[s,i]=E.useState([]),[a,l]=E.useState(!1),[c,d]=E.useState("grid"),[f,p]=E.useState("updated"),[m,g]=E.useState(!1),[y,x]=E.useState(null),[w,_]=E.useState(null),[S,k]=E.useState(null),[N,j]=E.useState(null),T=E.useCallback(async(G=!1)=>{G||l(!0);try{i(await e()??[])}catch(q){G||t({title:"Failed to load applications",description:q instanceof Error?q.message:"An unknown error occurred",variant:"destructive"})}finally{G||l(!1)}},[e,t]);E.useEffect(()=>{T()},[T]);const D=s.some(G=>OH(Ou(G)));E.useEffect(()=>{if(!D||m)return;const G=window.setInterval(()=>void T(!0),3e3);return()=>window.clearInterval(G)},[D,m,T]);const I=async()=>{if(w)try{if(!await n(w.id))throw new Error("Failed to delete app");i(q=>q.filter(J=>J.id!==w.id)),_(null),t({title:"App deleted"})}catch(G){t({title:"Failed to delete app",description:G instanceof Error?G.message:"An unknown error occurred",variant:"destructive"})}},L=async G=>{j(G.id);try{const q=v2e(G),J=q.hibernated;if(q.hibernated=!q.hibernated,!await r(G.id,q))throw new Error("Failed to update app");t({title:J?"App started":"App sleeping",description:J?`${G.name??"App"} is waking up.`:`${G.name??"App"} was put to sleep.`}),T()}catch(q){t({title:"Failed to update app",description:q instanceof Error?q.message:"An unknown error occurred",variant:"destructive"})}finally{j(null)}},$=s.filter(G=>Ou(G)==="healthy").length,Q=s.filter(G=>Ou(G)==="hibernated").length,[M,z]=E.useState([]),[R,B]=E.useState(""),V=E.useMemo(()=>{const G=new Set;return s.forEach(q=>(q.tags??[]).forEach(J=>{var ve;const te=((ve=J.value)==null?void 0:ve.trim())||J.key.trim();te&&G.add(te)})),Array.from(G).sort((q,J)=>q.localeCompare(J))},[s]),F=E.useMemo(()=>{const G=R.trim().toLowerCase();let q=s.filter(J=>{var ve;const te=(J.tags??[]).map(he=>{var xe;return((xe=he.value)==null?void 0:xe.trim())||he.key.trim()});return!(M.length&&!M.every(he=>te.includes(he))||G&&!`${J.name??""} ${J.image??""} ${((ve=J.ports)==null?void 0:ve.map(xe=>xe.hostname).join(" "))??""} ${te.join(" ")}`.toLowerCase().includes(G))});if(f==="name")q=[...q].sort((J,te)=>(J.name??"").localeCompare(te.name??""));else if(f==="status"){const J={healthy:0,degraded:1,deploying:2,hibernated:3,failed:4,removed:5};q=[...q].sort((te,ve)=>J[Ou(te)]-J[Ou(ve)])}else q=[...q].sort((J,te)=>(te.updated_at??te.created_at??0)-(J.updated_at??J.created_at??0));return q},[s,M,R,f]),K=G=>{z(q=>q.includes(G)?q.filter(J=>J!==G):[...q,G])},Y=()=>{x(null),g(!0)},O=G=>{x(G),g(!0)},H=[{label:"Apps",value:s.length,icon:qB,sub:"deployed",tint:"text-primary"},{label:"Healthy",value:`${$} / ${s.length}`,icon:is,sub:"running now",tint:"text-emerald-500"},{label:"Hibernated",value:Q,icon:cl,sub:"scaled to zero",tint:"text-sky-500"}];return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Applications",description:"Deploy containerized apps from any image — no Docker knowledge required.",actions:[o.jsxs(le,{onClick:Y,className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"Deploy App"]},"create-app"),o.jsxs(le,{variant:"outline",onClick:()=>void T(),disabled:a,children:[o.jsx(wn,{className:`mr-2 h-4 w-4 ${a?"animate-spin":""}`}),"Refresh"]},"refresh")]}),o.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:H.map(G=>o.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-border/80 bg-card px-4 py-3.5",children:[o.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-primary/15 bg-primary/10",children:o.jsx(G.icon,{className:we("h-5 w-5",G.tint)})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xl font-semibold leading-none tracking-tight",children:G.value}),o.jsxs("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:[G.label," · ",G.sub]})]})]},G.label))}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[o.jsxs("div",{className:"relative w-full lg:max-w-sm",children:[o.jsx(sv,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx("input",{value:R,onChange:G=>B(G.target.value),placeholder:"Filter by name, image or hostname…",className:"h-9 w-full rounded-lg border border-border/60 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground transition-colors focus:border-primary/40 focus:outline-none focus:ring-2 focus:ring-primary/15"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("select",{value:f,onChange:G=>p(G.target.value),className:"h-9 rounded-lg border border-border/60 bg-background px-2.5 text-sm text-foreground focus:border-primary/40 focus:outline-none focus:ring-2 focus:ring-primary/15",children:[o.jsx("option",{value:"updated",children:"Recently updated"}),o.jsx("option",{value:"name",children:"Name A→Z"}),o.jsx("option",{value:"status",children:"By status"})]}),o.jsxs("div",{className:"flex h-9 items-center rounded-lg border border-border/60 bg-background p-0.5",children:[o.jsx("button",{type:"button",title:"Grid view",onClick:()=>d("grid"),className:we("flex h-8 w-8 items-center justify-center rounded-md transition-colors",c==="grid"?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground"),children:o.jsx(YB,{className:"h-4 w-4"})}),o.jsx("button",{type:"button",title:"List view",onClick:()=>d("list"),className:we("flex h-8 w-8 items-center justify-center rounded-md transition-colors",c==="list"?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground"),children:o.jsx(kj,{className:"h-4 w-4"})})]})]})]}),V.length>0&&o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.jsx(DM,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),V.map(G=>o.jsx("button",{type:"button",onClick:()=>K(G),className:we("rounded-full border px-2.5 py-0.5 text-[11px] font-medium transition-colors",M.includes(G)?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:border-primary/40 hover:text-foreground"),children:G},G)),M.length>0&&o.jsx("button",{type:"button",onClick:()=>z([]),className:"text-[11px] font-medium text-muted-foreground underline underline-offset-2 transition-colors hover:text-foreground",children:"Clear"})]})]}),a?o.jsxs("div",{className:"flex items-center justify-center rounded-lg border border-border/80 bg-card py-20 text-sm text-muted-foreground",children:[o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin text-primary"}),"Loading apps…"]}):s.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx("div",{className:"mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx($r,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"Deploy your first app"}),o.jsxs("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["Pick an image like ",o.jsx("span",{className:"font-mono",children:"nginx"})," or"," ",o.jsx("span",{className:"font-mono",children:"ghcr.io/your-name/app"})," and we'll handle the rest."]}),o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90",onClick:Y,children:[o.jsx($r,{className:"mr-2 h-4 w-4"})," Deploy App"]})]})}):F.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-16 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-muted",children:o.jsx(DM,{className:"h-6 w-6 text-muted-foreground"})}),o.jsx("h3",{className:"text-lg font-semibold",children:"No apps match your filters"}),o.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm text-muted-foreground",children:"Try clearing the search or changing your tag filters."}),o.jsx(le,{variant:"outline",className:"mt-5",onClick:()=>{B(""),z([])},children:"Clear filters"})]})}):c==="grid"?o.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:F.map(G=>o.jsx(x2e,{app:G,busy:N===G.id,onEdit:O,onLogs:k,onDelete:_,onToggleSleep:L},G.id))}):o.jsx("div",{className:"flex flex-col gap-2",children:F.map(G=>o.jsx(_2e,{app:G,busy:N===G.id,onEdit:O,onLogs:k,onDelete:_,onToggleSleep:L},G.id))}),o.jsx(xW,{open:m,onOpenChange:g,app:y,onSaved:()=>void T()}),o.jsx(u2e,{app:S,open:!!S,onOpenChange:G=>!G&&k(null)}),o.jsx(So,{open:!!w,onOpenChange:G=>!G&&_(null),children:o.jsxs(Oa,{children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete App"}),o.jsxs(La,{children:["Are you sure you want to delete"," ",o.jsx("span",{className:"font-medium",children:(w==null?void 0:w.name)||(w==null?void 0:w.id)}),"? This action cannot be undone."]})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{children:"Cancel"}),o.jsx($a,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}/**
|
||
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
||
* @license MIT
|
||
*
|
||
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
||
* @license MIT
|
||
*
|
||
* Originally forked from (with the author's permission):
|
||
* Fabrice Bellard's javascript vt100 for jslinux:
|
||
* http://bellard.org/jslinux/
|
||
* Copyright (c) 2011 Fabrice Bellard
|
||
*/var kW=Object.defineProperty,w2e=Object.getOwnPropertyDescriptor,S2e=(t,e)=>{for(var r in e)kW(t,r,{get:e[r],enumerable:!0})},nn=(t,e,r,n)=>{for(var s=n>1?void 0:n?w2e(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(s=(n?a(e,r,s):a(s))||s);return n&&s&&kW(e,r,s),s},et=(t,e)=>(r,n)=>e(r,n,t),hL="Terminal input",HN={get:()=>hL,set:t=>hL=t},fL="Too much output to announce, navigate to rows manually to read",qN={get:()=>fL,set:t=>fL=t};function k2e(t){return t.replace(/\r?\n/g,"\r")}function E2e(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function C2e(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function N2e(t,e,r,n){if(t.stopPropagation(),t.clipboardData){let s=t.clipboardData.getData("text/plain");EW(s,e,r,n)}}function EW(t,e,r,n){t=k2e(t),t=E2e(t,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(t,!0),e.value=""}function CW(t,e,r){let n=r.getBoundingClientRect(),s=t.clientX-n.left-10,i=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${s}px`,e.style.top=`${i}px`,e.style.zIndex="1000",e.focus()}function pL(t,e,r,n,s){CW(t,e,r),s&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function oc(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Vb(t,e=0,r=t.length){let n="";for(let s=e;s<r;++s){let i=t[s];i>65535?(i-=65536,n+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):n+=String.fromCharCode(i)}return n}var j2e=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,r){let n=e.length;if(!n)return 0;let s=0,i=0;if(this._interim){let a=e.charCodeAt(i++);56320<=a&&a<=57343?r[s++]=(this._interim-55296)*1024+a-56320+65536:(r[s++]=this._interim,r[s++]=a),this._interim=0}for(let a=i;a<n;++a){let l=e.charCodeAt(a);if(55296<=l&&l<=56319){if(++a>=n)return this._interim=l,s;let c=e.charCodeAt(a);56320<=c&&c<=57343?r[s++]=(l-55296)*1024+c-56320+65536:(r[s++]=l,r[s++]=c);continue}l!==65279&&(r[s++]=l)}return s}},T2e=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,r){let n=e.length;if(!n)return 0;let s=0,i,a,l,c,d=0,f=0;if(this.interim[0]){let g=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let x=0,w;for(;(w=this.interim[++x]&63)&&x<4;)y<<=6,y|=w;let _=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,S=_-x;for(;f<S;){if(f>=n)return 0;if(w=e[f++],(w&192)!==128){f--,g=!0;break}else this.interim[x++]=w,y<<=6,y|=w&63}g||(_===2?y<128?f--:r[s++]=y:_===3?y<2048||y>=55296&&y<=57343||y===65279||(r[s++]=y):y<65536||y>1114111||(r[s++]=y)),this.interim.fill(0)}let p=n-4,m=f;for(;m<n;){for(;m<p&&!((i=e[m])&128)&&!((a=e[m+1])&128)&&!((l=e[m+2])&128)&&!((c=e[m+3])&128);)r[s++]=i,r[s++]=a,r[s++]=l,r[s++]=c,m+=4;if(i=e[m++],i<128)r[s++]=i;else if((i&224)===192){if(m>=n)return this.interim[0]=i,s;if(a=e[m++],(a&192)!==128){m--;continue}if(d=(i&31)<<6|a&63,d<128){m--;continue}r[s++]=d}else if((i&240)===224){if(m>=n)return this.interim[0]=i,s;if(a=e[m++],(a&192)!==128){m--;continue}if(m>=n)return this.interim[0]=i,this.interim[1]=a,s;if(l=e[m++],(l&192)!==128){m--;continue}if(d=(i&15)<<12|(a&63)<<6|l&63,d<2048||d>=55296&&d<=57343||d===65279)continue;r[s++]=d}else if((i&248)===240){if(m>=n)return this.interim[0]=i,s;if(a=e[m++],(a&192)!==128){m--;continue}if(m>=n)return this.interim[0]=i,this.interim[1]=a,s;if(l=e[m++],(l&192)!==128){m--;continue}if(m>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=l,s;if(c=e[m++],(c&192)!==128){m--;continue}if(d=(i&7)<<18|(a&63)<<12|(l&63)<<6|c&63,d<65536||d>1114111)continue;r[s++]=d}}return s}},NW="",fc=" ",Cv=class jW{constructor(){this.fg=0,this.bg=0,this.extended=new g_}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new jW;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},g_=class TW{constructor(e=0,r=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new TW(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Hi=class AW extends Cv{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new g_,this.combinedData=""}static fromCharData(e){let r=new AW;return r.setFromCharData(e),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?oc(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let r=!1;if(e[1].length>2)r=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(n-55296)*1024+s-56320+65536|e[2]<<22:r=!0}else r=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;r&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mL="di$target",WN="di$dependencies",zk=new Map;function A2e(t){return t[WN]||[]}function Qn(t){if(zk.has(t))return zk.get(t);let e=function(r,n,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");R2e(e,r,s)};return e._id=t,zk.set(t,e),e}function R2e(t,e,r){e[mL]===e?e[WN].push({id:t,index:r}):(e[WN]=[{id:t,index:r}],e[mL]=e)}var Hs=Qn("BufferService"),RW=Qn("CoreMouseService"),pd=Qn("CoreService"),D2e=Qn("CharsetService"),nR=Qn("InstantiationService"),DW=Qn("LogService"),qs=Qn("OptionsService"),OW=Qn("OscLinkService"),O2e=Qn("UnicodeService"),Nv=Qn("DecorationService"),GN=class{constructor(e,r,n){this._bufferService=e,this._optionsService=r,this._oscLinkService=n}provideLinks(e,r){var p;let n=this._bufferService.buffer.lines.get(e-1);if(!n){r(void 0);return}let s=[],i=this._optionsService.rawOptions.linkHandler,a=new Hi,l=n.getTrimmedLength(),c=-1,d=-1,f=!1;for(let m=0;m<l;m++)if(!(d===-1&&!n.hasContent(m))){if(n.loadCell(m,a),a.hasExtendedAttrs()&&a.extended.urlId)if(d===-1){d=m,c=a.extended.urlId;continue}else f=a.extended.urlId!==c;else d!==-1&&(f=!0);if(f||d!==-1&&m===l-1){let g=(p=this._oscLinkService.getLinkData(c))==null?void 0:p.uri;if(g){let y={start:{x:d+1,y:e},end:{x:m+(!f&&m===l-1?1:0),y:e}},x=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let w=new URL(g);["http:","https:"].includes(w.protocol)||(x=!0)}catch{x=!0}x||s.push({text:g,range:y,activate:(w,_)=>i?i.activate(w,_,y):P2e(w,_),hover:(w,_)=>{var S;return(S=i==null?void 0:i.hover)==null?void 0:S.call(i,w,_,y)},leave:(w,_)=>{var S;return(S=i==null?void 0:i.leave)==null?void 0:S.call(i,w,_,y)}})}f=!1,a.hasExtendedAttrs()&&a.extended.urlId?(d=m,c=a.extended.urlId):(d=-1,c=-1)}}r(s)}};GN=nn([et(0,Hs),et(1,qs),et(2,OW)],GN);function P2e(t,e){if(confirm(`Do you want to navigate to ${e}?
|
||
|
||
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var Hb=Qn("CharSizeService"),wl=Qn("CoreBrowserService"),sR=Qn("MouseService"),Sl=Qn("RenderService"),M2e=Qn("SelectionService"),PW=Qn("CharacterJoinerService"),$f=Qn("ThemeService"),MW=Qn("LinkProviderService"),I2e=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?gL.isErrorNoTelemetry(e)?new gL(e.message+`
|
||
|
||
`+e.stack):new Error(e.message+`
|
||
|
||
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(r=>{r(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},L2e=new I2e;function b0(t){$2e(t)||L2e.onUnexpectedError(t)}var KN="Canceled";function $2e(t){return t instanceof B2e?!0:t instanceof Error&&t.name===KN&&t.message===KN}var B2e=class extends Error{constructor(){super(KN),this.name=this.message}};function F2e(t){return new Error(`Illegal argument: ${t}`)}var gL=class YN extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof YN)return e;let r=new YN;return r.message=e.message,r.stack=e.stack,r}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},QN=class IW extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,IW.prototype)}};function ui(t,e=0){return t[t.length-(1+e)]}var z2e;(t=>{function e(i){return i<0}t.isLessThan=e;function r(i){return i<=0}t.isLessThanOrEqual=r;function n(i){return i>0}t.isGreaterThan=n;function s(i){return i===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(z2e||(z2e={}));function U2e(t,e){let r=this,n=!1,s;return function(){return n||(n=!0,e||(s=t.apply(r,arguments))),s}}var LW;(t=>{function e(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}t.is=e;let r=Object.freeze([]);function n(){return r}t.empty=n;function*s(N){yield N}t.single=s;function i(N){return e(N)?N:s(N)}t.wrap=i;function a(N){return N||r}t.from=a;function*l(N){for(let j=N.length-1;j>=0;j--)yield N[j]}t.reverse=l;function c(N){return!N||N[Symbol.iterator]().next().done===!0}t.isEmpty=c;function d(N){return N[Symbol.iterator]().next().value}t.first=d;function f(N,j){let T=0;for(let D of N)if(j(D,T++))return!0;return!1}t.some=f;function p(N,j){for(let T of N)if(j(T))return T}t.find=p;function*m(N,j){for(let T of N)j(T)&&(yield T)}t.filter=m;function*g(N,j){let T=0;for(let D of N)yield j(D,T++)}t.map=g;function*y(N,j){let T=0;for(let D of N)yield*j(D,T++)}t.flatMap=y;function*x(...N){for(let j of N)yield*j}t.concat=x;function w(N,j,T){let D=T;for(let I of N)D=j(D,I);return D}t.reduce=w;function*_(N,j,T=N.length){for(j<0&&(j+=N.length),T<0?T+=N.length:T>N.length&&(T=N.length);j<T;j++)yield N[j]}t.slice=_;function S(N,j=Number.POSITIVE_INFINITY){let T=[];if(j===0)return[T,N];let D=N[Symbol.iterator]();for(let I=0;I<j;I++){let L=D.next();if(L.done)return[T,t.empty()];T.push(L.value)}return[T,{[Symbol.iterator](){return D}}]}t.consume=S;async function k(N){let j=[];for await(let T of N)j.push(T);return Promise.resolve(j)}t.asyncToArray=k})(LW||(LW={}));function sd(t){if(LW.is(t)){let e=[];for(let r of t)if(r)try{r.dispose()}catch(n){e.push(n)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function V2e(...t){return zr(()=>sd(t))}function zr(t){return{dispose:U2e(()=>{t()})}}var $W=class BW{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{sd(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?BW.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};$W.DISABLE_DISPOSED_WARNING=!1;var bc=$W,Dt=class{constructor(){this._store=new bc,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Dt.None=Object.freeze({dispose(){}});var af=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var r;this._isDisposed||e===this._value||((r=this._value)==null||r.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Jo=typeof window=="object"?window:globalThis,XN=class ZN{constructor(e){this.element=e,this.next=ZN.Undefined,this.prev=ZN.Undefined}};XN.Undefined=new XN(void 0);var Hr=XN,vL=class{constructor(){this._first=Hr.Undefined,this._last=Hr.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Hr.Undefined}clear(){let e=this._first;for(;e!==Hr.Undefined;){let r=e.next;e.prev=Hr.Undefined,e.next=Hr.Undefined,e=r}this._first=Hr.Undefined,this._last=Hr.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,r){let n=new Hr(e);if(this._first===Hr.Undefined)this._first=n,this._last=n;else if(r){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first!==Hr.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Hr.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Hr.Undefined&&e.next!==Hr.Undefined){let r=e.prev;r.next=e.next,e.next.prev=r}else e.prev===Hr.Undefined&&e.next===Hr.Undefined?(this._first=Hr.Undefined,this._last=Hr.Undefined):e.next===Hr.Undefined?(this._last=this._last.prev,this._last.next=Hr.Undefined):e.prev===Hr.Undefined&&(this._first=this._first.next,this._first.prev=Hr.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Hr.Undefined;)yield e.element,e=e.next}},H2e=globalThis.performance&&typeof globalThis.performance.now=="function",q2e=class FW{static create(e){return new FW(e)}constructor(e){this._now=H2e&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ls;(t=>{t.None=()=>Dt.None;function e(M,z){return p(M,()=>{},0,void 0,!0,void 0,z)}t.defer=e;function r(M){return(z,R=null,B)=>{let V=!1,F;return F=M(K=>{if(!V)return F?F.dispose():V=!0,z.call(R,K)},null,B),V&&F.dispose(),F}}t.once=r;function n(M,z,R){return d((B,V=null,F)=>M(K=>B.call(V,z(K)),null,F),R)}t.map=n;function s(M,z,R){return d((B,V=null,F)=>M(K=>{z(K),B.call(V,K)},null,F),R)}t.forEach=s;function i(M,z,R){return d((B,V=null,F)=>M(K=>z(K)&&B.call(V,K),null,F),R)}t.filter=i;function a(M){return M}t.signal=a;function l(...M){return(z,R=null,B)=>{let V=V2e(...M.map(F=>F(K=>z.call(R,K))));return f(V,B)}}t.any=l;function c(M,z,R,B){let V=R;return n(M,F=>(V=z(V,F),V),B)}t.reduce=c;function d(M,z){let R,B={onWillAddFirstListener(){R=M(V.fire,V)},onDidRemoveLastListener(){R==null||R.dispose()}},V=new We(B);return z==null||z.add(V),V.event}function f(M,z){return z instanceof Array?z.push(M):z&&z.add(M),M}function p(M,z,R=100,B=!1,V=!1,F,K){let Y,O,H,G=0,q,J={leakWarningThreshold:F,onWillAddFirstListener(){Y=M(ve=>{G++,O=z(O,ve),B&&!H&&(te.fire(O),O=void 0),q=()=>{let he=O;O=void 0,H=void 0,(!B||G>1)&&te.fire(he),G=0},typeof R=="number"?(clearTimeout(H),H=setTimeout(q,R)):H===void 0&&(H=0,queueMicrotask(q))})},onWillRemoveListener(){V&&G>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,Y.dispose()}},te=new We(J);return K==null||K.add(te),te.event}t.debounce=p;function m(M,z=0,R){return t.debounce(M,(B,V)=>B?(B.push(V),B):[V],z,void 0,!0,void 0,R)}t.accumulate=m;function g(M,z=(B,V)=>B===V,R){let B=!0,V;return i(M,F=>{let K=B||!z(F,V);return B=!1,V=F,K},R)}t.latch=g;function y(M,z,R){return[t.filter(M,z,R),t.filter(M,B=>!z(B),R)]}t.split=y;function x(M,z=!1,R=[],B){let V=R.slice(),F=M(O=>{V?V.push(O):Y.fire(O)});B&&B.add(F);let K=()=>{V==null||V.forEach(O=>Y.fire(O)),V=null},Y=new We({onWillAddFirstListener(){F||(F=M(O=>Y.fire(O)),B&&B.add(F))},onDidAddFirstListener(){V&&(z?setTimeout(K):K())},onDidRemoveLastListener(){F&&F.dispose(),F=null}});return B&&B.add(Y),Y.event}t.buffer=x;function w(M,z){return(R,B,V)=>{let F=z(new S);return M(function(K){let Y=F.evaluate(K);Y!==_&&R.call(B,Y)},void 0,V)}}t.chain=w;let _=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(z){return this.steps.push(z),this}forEach(z){return this.steps.push(R=>(z(R),R)),this}filter(z){return this.steps.push(R=>z(R)?R:_),this}reduce(z,R){let B=R;return this.steps.push(V=>(B=z(B,V),B)),this}latch(z=(R,B)=>R===B){let R=!0,B;return this.steps.push(V=>{let F=R||!z(V,B);return R=!1,B=V,F?V:_}),this}evaluate(z){for(let R of this.steps)if(z=R(z),z===_)break;return z}}function k(M,z,R=B=>B){let B=(...Y)=>K.fire(R(...Y)),V=()=>M.on(z,B),F=()=>M.removeListener(z,B),K=new We({onWillAddFirstListener:V,onDidRemoveLastListener:F});return K.event}t.fromNodeEventEmitter=k;function N(M,z,R=B=>B){let B=(...Y)=>K.fire(R(...Y)),V=()=>M.addEventListener(z,B),F=()=>M.removeEventListener(z,B),K=new We({onWillAddFirstListener:V,onDidRemoveLastListener:F});return K.event}t.fromDOMEventEmitter=N;function j(M){return new Promise(z=>r(M)(z))}t.toPromise=j;function T(M){let z=new We;return M.then(R=>{z.fire(R)},()=>{z.fire(void 0)}).finally(()=>{z.dispose()}),z.event}t.fromPromise=T;function D(M,z){return M(R=>z.fire(R))}t.forward=D;function I(M,z,R){return z(R),M(B=>z(B))}t.runAndSubscribe=I;class L{constructor(z,R){this._observable=z,this._counter=0,this._hasChanged=!1;let B={onWillAddFirstListener:()=>{z.addObserver(this)},onDidRemoveLastListener:()=>{z.removeObserver(this)}};this.emitter=new We(B),R&&R.add(this.emitter)}beginUpdate(z){this._counter++}handlePossibleChange(z){}handleChange(z,R){this._hasChanged=!0}endUpdate(z){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function $(M,z){return new L(M,z).emitter.event}t.fromObservable=$;function Q(M){return(z,R,B)=>{let V=0,F=!1,K={beginUpdate(){V++},endUpdate(){V--,V===0&&(M.reportChanges(),F&&(F=!1,z.call(R)))},handlePossibleChange(){},handleChange(){F=!0}};M.addObserver(K),M.reportChanges();let Y={dispose(){M.removeObserver(K)}};return B instanceof bc?B.add(Y):Array.isArray(B)&&B.push(Y),Y}}t.fromObservableLight=Q})(ls||(ls={}));var JN=class e2{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${e2._idPool++}`,e2.all.add(this)}start(e){this._stopWatch=new q2e,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};JN.all=new Set,JN._idPool=0;var W2e=JN,G2e=-1,zW=class UW{constructor(e,r,n=(UW._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[i,a]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${a}):`;console.warn(l),console.warn(i);let c=new Q2e(l,i);this._errorHandler(c)}return()=>{let i=this._stacks.get(e.value)||0;this._stacks.set(e.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,r=0;for(let[n,s]of this._stacks)(!e||r<s)&&(e=[n,s],r=s);return e}};zW._idPool=1;var K2e=zW,Y2e=class VW{constructor(e){this.value=e}static create(){let e=new Error;return new VW(e.stack??"")}print(){console.warn(this.value.split(`
|
||
`).slice(2).join(`
|
||
`))}},Q2e=class extends Error{constructor(e,r){super(e),this.name="ListenerLeakError",this.stack=r}},X2e=class extends Error{constructor(e,r){super(e),this.name="ListenerRefusalError",this.stack=r}},Z2e=0,Uk=class{constructor(e){this.value=e,this.id=Z2e++}},J2e=2,eje,We=class{constructor(e){var r,n,s,i;this._size=0,this._options=e,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new K2e((e==null?void 0:e.onListenerError)??b0,((n=this._options)==null?void 0:n.leakWarningThreshold)??G2e):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new W2e(this._options._profName):void 0,this._deliveryQueue=(i=this._options)==null?void 0:i.deliveryQueue}dispose(){var e,r,n,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||n.call(r),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,r,n)=>{var l,c,d,f,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let m=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(m);let g=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new X2e(`${m}. HINT: Stack shows most frequent listener (${g[1]}-times)`,g[0]);return(((l=this._options)==null?void 0:l.onListenerError)||b0)(y),Dt.None}if(this._disposed)return Dt.None;r&&(e=e.bind(r));let s=new Uk(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Y2e.create(),i=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Uk?(this._deliveryQueue??(this._deliveryQueue=new tje),this._listeners=[this._listeners,s]):this._listeners.push(s):((d=(c=this._options)==null?void 0:c.onWillAddFirstListener)==null||d.call(c,this),this._listeners=s,(p=(f=this._options)==null?void 0:f.onDidAddFirstListener)==null||p.call(f,this)),this._size++;let a=zr(()=>{i==null||i(),this._removeListener(s)});return n instanceof bc?n.add(a):Array.isArray(n)&&n.push(a),a}),this._event}_removeListener(e){var i,a,l,c;if((a=(i=this._options)==null?void 0:i.onWillRemoveListener)==null||a.call(i,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(c=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||c.call(l,this),this._size=0;return}let r=this._listeners,n=r.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[n]=void 0;let s=this._deliveryQueue.current===this;if(this._size*J2e<=r.length){let d=0;for(let f=0;f<r.length;f++)r[f]?r[d++]=r[f]:s&&(this._deliveryQueue.end--,d<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=d}}_deliver(e,r){var s;if(!e)return;let n=((s=this._options)==null?void 0:s.onListenerError)||b0;if(!n){e.value(r);return}try{e.value(r)}catch(i){n(i)}}_deliverQueue(e){let r=e.current._listeners;for(;e.i<e.end;)this._deliver(r[e.i++],e.value);e.reset()}fire(e){var r,n,s,i;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof Uk)this._deliver(this._listeners,e);else{let a=this._deliveryQueue;a.enqueue(this,e,this._listeners.length),this._deliverQueue(a)}(i=this._perfMon)==null||i.stop()}hasListeners(){return this._size>0}},tje=class{constructor(){this.i=-1,this.end=0}enqueue(e,r,n){this.i=0,this.end=n,this.current=e,this.value=r}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},t2=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new We,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new We,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,r){if(this.getZoomLevel(r)===e)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),e)}setFullscreen(e,r){if(this.isFullscreen(r)===e)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};t2.INSTANCE=new t2;var iR=t2;function rje(t,e,r){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",r)}iR.INSTANCE.onDidChangeZoomLevel;function nje(t){return iR.INSTANCE.getZoomFactor(t)}iR.INSTANCE.onDidChangeFullscreen;var Bf=typeof navigator=="object"?navigator.userAgent:"",r2=Bf.indexOf("Firefox")>=0,sje=Bf.indexOf("AppleWebKit")>=0,aR=Bf.indexOf("Chrome")>=0,ije=!aR&&Bf.indexOf("Safari")>=0;Bf.indexOf("Electron/")>=0;Bf.indexOf("Android")>=0;var Vk=!1;if(typeof Jo.matchMedia=="function"){let t=Jo.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Jo.matchMedia("(display-mode: fullscreen)");Vk=t.matches,rje(Jo,t,({matches:r})=>{Vk&&e.matches||(Vk=r)})}var jh="en",n2=!1,s2=!1,w0=!1,HW=!1,kx,S0=jh,yL=jh,aje,sa,Ku=globalThis,ss,X6;typeof Ku.vscode<"u"&&typeof Ku.vscode.process<"u"?ss=Ku.vscode.process:typeof process<"u"&&typeof((X6=process==null?void 0:process.versions)==null?void 0:X6.node)=="string"&&(ss=process);var Z6,oje=typeof((Z6=ss==null?void 0:ss.versions)==null?void 0:Z6.electron)=="string",lje=oje&&(ss==null?void 0:ss.type)==="renderer",J6;if(typeof ss=="object"){n2=ss.platform==="win32",s2=ss.platform==="darwin",w0=ss.platform==="linux",w0&&ss.env.SNAP&&ss.env.SNAP_REVISION,ss.env.CI||ss.env.BUILD_ARTIFACTSTAGINGDIRECTORY,kx=jh,S0=jh;let t=ss.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);kx=e.userLocale,yL=e.osLocale,S0=e.resolvedLanguage||jh,aje=(J6=e.languagePack)==null?void 0:J6.translationsConfigFile}catch{}HW=!0}else typeof navigator=="object"&&!lje?(sa=navigator.userAgent,n2=sa.indexOf("Windows")>=0,s2=sa.indexOf("Macintosh")>=0,(sa.indexOf("Macintosh")>=0||sa.indexOf("iPad")>=0||sa.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,w0=sa.indexOf("Linux")>=0,(sa==null?void 0:sa.indexOf("Mobi"))>=0,S0=globalThis._VSCODE_NLS_LANGUAGE||jh,kx=navigator.language.toLowerCase(),yL=kx):console.error("Unable to resolve platform.");var qW=n2,fo=s2,cje=w0,xL=HW,yo=sa,Yl=S0,uje;(t=>{function e(){return Yl}t.value=e;function r(){return Yl.length===2?Yl==="en":Yl.length>=3?Yl[0]==="e"&&Yl[1]==="n"&&Yl[2]==="-":!1}t.isDefaultVariant=r;function n(){return Yl==="en"}t.isDefault=n})(uje||(uje={}));var dje=typeof Ku.postMessage=="function"&&!Ku.importScripts;(()=>{if(dje){let t=[];Ku.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,s=t.length;n<s;n++){let i=t[n];if(i.id===r.data.vscodeScheduleAsyncWork){t.splice(n,1),i.callback();return}}});let e=0;return r=>{let n=++e;t.push({id:n,callback:r}),Ku.postMessage({vscodeScheduleAsyncWork:n},"*")}}return t=>setTimeout(t)})();var hje=!!(yo&&yo.indexOf("Chrome")>=0);yo&&yo.indexOf("Firefox")>=0;!hje&&yo&&yo.indexOf("Safari")>=0;yo&&yo.indexOf("Edg/")>=0;yo&&yo.indexOf("Android")>=0;var sh=typeof navigator=="object"?navigator:{};xL||document.queryCommandSupported&&document.queryCommandSupported("copy")||sh&&sh.clipboard&&sh.clipboard.writeText,xL||sh&&sh.clipboard&&sh.clipboard.readText;var oR=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,r){this._keyCodeToStr[e]=r,this._strToKeyCode[r.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Hk=new oR,_L=new oR,bL=new oR,fje=new Array(230),WW;(t=>{function e(l){return Hk.keyCodeToStr(l)}t.toString=e;function r(l){return Hk.strToKeyCode(l)}t.fromString=r;function n(l){return _L.keyCodeToStr(l)}t.toUserSettingsUS=n;function s(l){return bL.keyCodeToStr(l)}t.toUserSettingsGeneral=s;function i(l){return _L.strToKeyCode(l)||bL.strToKeyCode(l)}t.fromUserSettings=i;function a(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Hk.keyCodeToStr(l)}t.toElectronAccelerator=a})(WW||(WW={}));var pje=class GW{constructor(e,r,n,s,i){this.ctrlKey=e,this.shiftKey=r,this.altKey=n,this.metaKey=s,this.keyCode=i}equals(e){return e instanceof GW&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",n=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${e}${r}${n}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new mje([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},mje=class{constructor(e){if(e.length===0)throw F2e("chords");this.chords=e}getHashCode(){let e="";for(let r=0,n=this.chords.length;r<n;r++)r!==0&&(e+=";"),e+=this.chords[r].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let r=0;r<this.chords.length;r++)if(!this.chords[r].equals(e.chords[r]))return!1;return!0}};function gje(t){if(t.charCode){let r=String.fromCharCode(t.charCode).toUpperCase();return WW.fromString(r)}let e=t.keyCode;if(e===3)return 7;if(r2)switch(e){case 59:return 85;case 60:if(cje)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(fo)return 57;break}else if(sje&&(fo&&e===93||!fo&&e===92))return 57;return fje[e]||0}var vje=fo?256:2048,yje=512,xje=1024,_je=fo?2048:256,wL=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let r=e;this.browserEvent=r,this.target=r.target,this.ctrlKey=r.ctrlKey,this.shiftKey=r.shiftKey,this.altKey=r.altKey,this.metaKey=r.metaKey,this.altGraphKey=(n=r.getModifierState)==null?void 0:n.call(r,"AltGraph"),this.keyCode=gje(r),this.code=r.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let r=0;return this.ctrlKey&&(r|=vje),this.altKey&&(r|=yje),this.shiftKey&&(r|=xje),this.metaKey&&(r|=_je),r|=e,r}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new pje(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},SL=new WeakMap;function bje(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,r=t.parent.location;if(e.origin!=="null"&&r.origin!=="null"&&e.origin!==r.origin)return null}catch{return null}return t.parent}var wje=class{static getSameOriginWindowChain(e){let r=SL.get(e);if(!r){r=[],SL.set(e,r);let n=e,s;do s=bje(n),s?r.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):r.push({window:new WeakRef(n),iframeElement:null}),n=s;while(n)}return r.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,r){if(!r||e===r)return{top:0,left:0};let n=0,s=0,i=this.getSameOriginWindowChain(e);for(let a of i){let l=a.window.deref();if(n+=(l==null?void 0:l.scrollY)??0,s+=(l==null?void 0:l.scrollX)??0,l===r||!a.iframeElement)break;let c=a.iframeElement.getBoundingClientRect();n+=c.top,s+=c.left}return{top:n,left:s}}},Ex=class{constructor(e,r){this.timestamp=Date.now(),this.browserEvent=r,this.leftButton=r.button===0,this.middleButton=r.button===1,this.rightButton=r.button===2,this.buttons=r.buttons,this.target=r.target,this.detail=r.detail||1,r.type==="dblclick"&&(this.detail=2),this.ctrlKey=r.ctrlKey,this.shiftKey=r.shiftKey,this.altKey=r.altKey,this.metaKey=r.metaKey,typeof r.pageX=="number"?(this.posx=r.pageX,this.posy=r.pageY):(this.posx=r.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=r.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=wje.getPositionOfChildWindowRelativeToAncestorWindow(e,r.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},kL=class{constructor(e,r=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=r;let s=!1;if(aR){let a=navigator.userAgent.match(/Chrome\/(\d+)/);s=(a?parseInt(a[1]):123)<=122}if(e){let a=e,l=e,c=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")s?this.deltaY=a.wheelDeltaY/(120*c):this.deltaY=a.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?r2&&!fo?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")ije&&qW?this.deltaX=-(a.wheelDeltaX/120):s?this.deltaX=a.wheelDeltaX/(120*c):this.deltaX=a.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?r2&&!fo?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},KW=Object.freeze(function(t,e){let r=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(r)}}}),Sje;(t=>{function e(r){return r===t.None||r===t.Cancelled||r instanceof kje?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ls.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:KW})})(Sje||(Sje={}));var kje=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?KW:(this._emitter||(this._emitter=new We),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},lR=class{constructor(e,r){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof r=="number"&&this.setIfNotSet(e,r)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,r){if(this._isDisposed)throw new QN("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},r)}setIfNotSet(e,r){if(this._isDisposed)throw new QN("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},r))}},Eje=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,r,n=globalThis){if(this.isDisposed)throw new QN("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},r);this.disposable=zr(()=>{n.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Cje;(t=>{async function e(n){let s,i=await Promise.all(n.map(a=>a.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return i}t.settled=e;function r(n){return new Promise(async(s,i)=>{try{await n(s,i)}catch(a){i(a)}})}t.withAsyncBody=r})(Cje||(Cje={}));var EL=class Li{static fromArray(e){return new Li(r=>{r.emitMany(e)})}static fromPromise(e){return new Li(async r=>{r.emitMany(await e)})}static fromPromises(e){return new Li(async r=>{await Promise.all(e.map(async n=>r.emitOne(await n)))})}static merge(e){return new Li(async r=>{await Promise.all(e.map(async n=>{for await(let s of n)r.emitOne(s)}))})}constructor(e,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new We,queueMicrotask(async()=>{let n={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(n)),this.resolve()}catch(s){this.reject(s)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await ls.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(e,r){return new Li(async n=>{for await(let s of e)n.emitOne(r(s))})}map(e){return Li.map(this,e)}static filter(e,r){return new Li(async n=>{for await(let s of e)r(s)&&n.emitOne(s)})}filter(e){return Li.filter(this,e)}static coalesce(e){return Li.filter(e,r=>!!r)}coalesce(){return Li.coalesce(this)}static async toPromise(e){let r=[];for await(let n of e)r.push(n);return r}toPromise(){return Li.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};EL.EMPTY=EL.fromArray([]);var{getWindow:ao,getWindowId:Nje,onDidRegisterWindow:jje}=function(){let t=new Map,e={window:Jo,disposables:new bc};t.set(Jo.vscodeWindowId,e);let r=new We,n=new We,s=new We;function i(a,l){return(typeof a=="number"?t.get(a):void 0)??(l?e:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:n.event,registerWindow(a){if(t.has(a.vscodeWindowId))return Dt.None;let l=new bc,c={window:a,disposables:l.add(new bc)};return t.set(a.vscodeWindowId,c),l.add(zr(()=>{t.delete(a.vscodeWindowId),n.fire(a)})),l.add(_t(a,zn.BEFORE_UNLOAD,()=>{s.fire(a)})),r.fire(c),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(a){return a.vscodeWindowId},hasWindow(a){return t.has(a)},getWindowById:i,getWindow(a){var d;let l=a;if((d=l==null?void 0:l.ownerDocument)!=null&&d.defaultView)return l.ownerDocument.defaultView.window;let c=a;return c!=null&&c.view?c.view.window:Jo},getDocument(a){return ao(a).document}}}(),Tje=class{constructor(e,r,n,s){this._node=e,this._type=r,this._handler=n,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function _t(t,e,r,n){return new Tje(t,e,r,n)}var CL=function(t,e,r,n){return _t(t,e,r,n)},cR,Aje=class extends Eje{constructor(e){super(),this.defaultTarget=e&&ao(e)}cancelAndSet(e,r,n){return super.cancelAndSet(e,r,n??this.defaultTarget)}},NL=class{constructor(e,r=0){this._runner=e,this.priority=r,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){b0(e)}}static sort(e,r){return r.priority-e.priority}};(function(){let t=new Map,e=new Map,r=new Map,n=new Map,s=i=>{r.set(i,!1);let a=t.get(i)??[];for(e.set(i,a),t.set(i,[]),n.set(i,!0);a.length>0;)a.sort(NL.sort),a.shift().execute();n.set(i,!1)};cR=(i,a,l=0)=>{let c=Nje(i),d=new NL(a,l),f=t.get(c);return f||(f=[],t.set(c,f)),f.push(d),r.get(c)||(r.set(c,!0),i.requestAnimationFrame(()=>s(c))),d}})();function Rje(t){let e=t.getBoundingClientRect(),r=ao(t);return{left:e.left+r.scrollX,top:e.top+r.scrollY,width:e.width,height:e.height}}var zn={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},Dje=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let r=Ys(e);this._maxWidth!==r&&(this._maxWidth=r,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let r=Ys(e);this._width!==r&&(this._width=r,this.domNode.style.width=this._width)}setHeight(e){let r=Ys(e);this._height!==r&&(this._height=r,this.domNode.style.height=this._height)}setTop(e){let r=Ys(e);this._top!==r&&(this._top=r,this.domNode.style.top=this._top)}setLeft(e){let r=Ys(e);this._left!==r&&(this._left=r,this.domNode.style.left=this._left)}setBottom(e){let r=Ys(e);this._bottom!==r&&(this._bottom=r,this.domNode.style.bottom=this._bottom)}setRight(e){let r=Ys(e);this._right!==r&&(this._right=r,this.domNode.style.right=this._right)}setPaddingTop(e){let r=Ys(e);this._paddingTop!==r&&(this._paddingTop=r,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let r=Ys(e);this._paddingLeft!==r&&(this._paddingLeft=r,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let r=Ys(e);this._paddingBottom!==r&&(this._paddingBottom=r,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let r=Ys(e);this._paddingRight!==r&&(this._paddingRight=r,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let r=Ys(e);this._fontSize!==r&&(this._fontSize=r,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let r=Ys(e);this._lineHeight!==r&&(this._lineHeight=r,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let r=Ys(e);this._letterSpacing!==r&&(this._letterSpacing=r,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,r){this.domNode.classList.toggle(e,r),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,r){this.domNode.setAttribute(e,r)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ys(t){return typeof t=="number"?`${t}px`:t}function rg(t){return new Dje(t)}var YW=class{constructor(){this._hooks=new bc,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,r){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(r)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,r,n,s,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=i;let a=e;try{e.setPointerCapture(r),this._hooks.add(zr(()=>{try{e.releasePointerCapture(r)}catch{}}))}catch{a=ao(e)}this._hooks.add(_t(a,zn.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(_t(a,zn.POINTER_UP,l=>this.stopMonitoring(!0)))}};function Oje(t,e,r){let n=null,s=null;if(typeof r.value=="function"?(n="value",s=r.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",s=r.get),!s)throw new Error("not supported");let i=`$memoize$${e}`;r[n]=function(...a){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,a)}),this[i]}}var Xa;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(Xa||(Xa={}));var Pm=class ys extends Dt{constructor(){super(),this.dispatched=!1,this.targets=new vL,this.ignoreTargets=new vL,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ls.runAndSubscribe(jje,({window:e,disposables:r})=>{r.add(_t(e.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(_t(e.document,"touchend",n=>this.onTouchEnd(e,n))),r.add(_t(e.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Jo,disposables:this._store}))}static addTarget(e){if(!ys.isTouchDevice())return Dt.None;ys.INSTANCE||(ys.INSTANCE=new ys);let r=ys.INSTANCE.targets.push(e);return zr(r)}static ignoreTarget(e){if(!ys.isTouchDevice())return Dt.None;ys.INSTANCE||(ys.INSTANCE=new ys);let r=ys.INSTANCE.ignoreTargets.push(e);return zr(r)}static isTouchDevice(){return"ontouchstart"in Jo||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,s=e.targetTouches.length;n<s;n++){let i=e.targetTouches.item(n);this.activeTouches[i.identifier]={id:i.identifier,initialTarget:i.target,initialTimeStamp:r,initialPageX:i.pageX,initialPageY:i.pageY,rollingTimestamps:[r],rollingPageX:[i.pageX],rollingPageY:[i.pageY]};let a=this.newGestureEvent(Xa.Start,i.target);a.pageX=i.pageX,a.pageY=i.pageY,this.dispatchEvent(a)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,r){let n=Date.now(),s=Object.keys(this.activeTouches).length;for(let i=0,a=r.changedTouches.length;i<a;i++){let l=r.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],d=Date.now()-c.initialTimeStamp;if(d<ys.HOLD_DELAY&&Math.abs(c.initialPageX-ui(c.rollingPageX))<30&&Math.abs(c.initialPageY-ui(c.rollingPageY))<30){let f=this.newGestureEvent(Xa.Tap,c.initialTarget);f.pageX=ui(c.rollingPageX),f.pageY=ui(c.rollingPageY),this.dispatchEvent(f)}else if(d>=ys.HOLD_DELAY&&Math.abs(c.initialPageX-ui(c.rollingPageX))<30&&Math.abs(c.initialPageY-ui(c.rollingPageY))<30){let f=this.newGestureEvent(Xa.Contextmenu,c.initialTarget);f.pageX=ui(c.rollingPageX),f.pageY=ui(c.rollingPageY),this.dispatchEvent(f)}else if(s===1){let f=ui(c.rollingPageX),p=ui(c.rollingPageY),m=ui(c.rollingTimestamps)-c.rollingTimestamps[0],g=f-c.rollingPageX[0],y=p-c.rollingPageY[0],x=[...this.targets].filter(w=>c.initialTarget instanceof Node&&w.contains(c.initialTarget));this.inertia(e,x,n,Math.abs(g)/m,g>0?1:-1,f,Math.abs(y)/m,y>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(Xa.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,r){let n=document.createEvent("CustomEvent");return n.initEvent(e,!1,!0),n.initialTarget=r,n.tapCount=0,n}dispatchEvent(e){if(e.type===Xa.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>ys.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,e.tapCount=n}else(e.type===Xa.Change||e.type===Xa.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(e.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(e.initialTarget)){let s=0,i=e.initialTarget;for(;i&&i!==n;)s++,i=i.parentElement;r.push([s,n])}r.sort((n,s)=>n[0]-s[0]);for(let[n,s]of r)s.dispatchEvent(e),this.dispatched=!0}}inertia(e,r,n,s,i,a,l,c,d){this.handle=cR(e,()=>{let f=Date.now(),p=f-n,m=0,g=0,y=!0;s+=ys.SCROLL_FRICTION*p,l+=ys.SCROLL_FRICTION*p,s>0&&(y=!1,m=i*s*p),l>0&&(y=!1,g=c*l*p);let x=this.newGestureEvent(Xa.Change);x.translationX=m,x.translationY=g,r.forEach(w=>w.dispatchEvent(x)),y||this.inertia(e,r,f,s,i,a+m,l,c,d+g)})}onTouchMove(e){let r=Date.now();for(let n=0,s=e.changedTouches.length;n<s;n++){let i=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(i.identifier))){console.warn("end of an UNKNOWN touch",i);continue}let a=this.activeTouches[i.identifier],l=this.newGestureEvent(Xa.Change,a.initialTarget);l.translationX=i.pageX-ui(a.rollingPageX),l.translationY=i.pageY-ui(a.rollingPageY),l.pageX=i.pageX,l.pageY=i.pageY,this.dispatchEvent(l),a.rollingPageX.length>3&&(a.rollingPageX.shift(),a.rollingPageY.shift(),a.rollingTimestamps.shift()),a.rollingPageX.push(i.pageX),a.rollingPageY.push(i.pageY),a.rollingTimestamps.push(r)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};Pm.SCROLL_FRICTION=-.005,Pm.HOLD_DELAY=700,Pm.CLEAR_TAP_COUNT_TIME=400,nn([Oje],Pm,"isTouchDevice",1);var Pje=Pm,uR=class extends Dt{onclick(e,r){this._register(_t(e,zn.CLICK,n=>r(new Ex(ao(e),n))))}onmousedown(e,r){this._register(_t(e,zn.MOUSE_DOWN,n=>r(new Ex(ao(e),n))))}onmouseover(e,r){this._register(_t(e,zn.MOUSE_OVER,n=>r(new Ex(ao(e),n))))}onmouseleave(e,r){this._register(_t(e,zn.MOUSE_LEAVE,n=>r(new Ex(ao(e),n))))}onkeydown(e,r){this._register(_t(e,zn.KEY_DOWN,n=>r(new wL(n))))}onkeyup(e,r){this._register(_t(e,zn.KEY_UP,n=>r(new wL(n))))}oninput(e,r){this._register(_t(e,zn.INPUT,r))}onblur(e,r){this._register(_t(e,zn.BLUR,r))}onfocus(e,r){this._register(_t(e,zn.FOCUS,r))}onchange(e,r){this._register(_t(e,zn.CHANGE,r))}ignoreGesture(e){return Pje.ignoreTarget(e)}},jL=11,Mje=class extends uR{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=jL+"px",this.domNode.style.height=jL+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new YW),this._register(CL(this.bgDomNode,zn.POINTER_DOWN,r=>this._arrowPointerDown(r))),this._register(CL(this.domNode,zn.POINTER_DOWN,r=>this._arrowPointerDown(r))),this._pointerdownRepeatTimer=this._register(new Aje),this._pointerdownScheduleRepeatTimer=this._register(new lR)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let r=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ao(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(r,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Ije=class i2{constructor(e,r,n,s,i,a,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,s=s|0,i=i|0,a=a|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,r<0&&(r=0),s+r>n&&(s=n-r),s<0&&(s=0),i<0&&(i=0),l+i>a&&(l=a-i),l<0&&(l=0),this.width=r,this.scrollWidth=n,this.scrollLeft=s,this.height=i,this.scrollHeight=a,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,r){return new i2(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new i2(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,r){let n=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,c=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:r,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:s,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:l,scrollTopChanged:c}}},Lje=class extends Dt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new We),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Ije(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,r){var s;let n=this._state.withScrollDimensions(e,r);this._setState(n,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let r=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(r,!1)}setScrollPositionSmooth(e,r){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let s;r?s=new AL(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=AL.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),r=this._state.withScrollPosition(e);if(this._setState(r,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,r){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,r)))}},TL=class{constructor(e,r,n){this.scrollLeft=e,this.scrollTop=r,this.isDone=n}};function qk(t,e){let r=e-t;return function(n){return t+r*Fje(n)}}function $je(t,e,r){return function(n){return n<r?t(n/r):e((n-r)/(1-r))}}var AL=class a2{constructor(e,r,n,s){this.from=e,this.to=r,this.duration=s,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,r,n){if(Math.abs(e-r)>2.5*n){let s,i;return e<r?(s=e+.75*n,i=r-.75*n):(s=e-.75*n,i=r+.75*n),$je(qk(e,s),qk(i,r),.33)}return qk(e,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let r=(e-this.startTime)/this.duration;if(r<1){let n=this.scrollLeft(r),s=this.scrollTop(r);return new TL(n,s,!1)}return new TL(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,r,n){return a2.start(e,r,n)}static start(e,r,n){n=n+10;let s=Date.now()-10;return new a2(e,r,s,n)}};function Bje(t){return Math.pow(t,3)}function Fje(t){return 1-Bje(1-t)}var zje=class extends Dt{constructor(e,r,n){super(),this._visibility=e,this._visibleClassName=r,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new lR)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var r;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(r=this._domNode)==null||r.setClassName(this._invisibleClassName+(e?" fade":"")))}},Uje=140,QW=class extends uR{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new zje(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new YW),this._shouldRender=!0,this.domNode=rg(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(_t(this.domNode.domNode,zn.POINTER_DOWN,r=>this._domNodePointerDown(r)))}_createArrow(e){let r=this._register(new Mje(e));this.domNode.domNode.appendChild(r.bgDomNode),this.domNode.domNode.appendChild(r.domNode)}_createSlider(e,r,n,s){this.slider=rg(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(r),typeof n=="number"&&this.slider.setWidth(n),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(_t(this.slider.domNode,zn.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let r=this.domNode.domNode.getClientRects()[0].top,n=r+this._scrollbarState.getSliderPosition(),s=r+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let r,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")r=e.offsetX,n=e.offsetY;else{let i=Rje(this.domNode.domNode);r=e.pageX-i.left,n=e.pageY-i.top}let s=this._pointerDownRelativePosition(r,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let r=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let a=this._sliderOrthogonalPointerPosition(i),l=Math.abs(a-n);if(qW&&l>Uje){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let c=this._sliderPointerPosition(i)-r;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let r={};this.writeScrollPosition(r,e),this._scrollable.setScrollPositionNow(r)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},XW=class o2{constructor(e,r,n,s,i,a){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new o2(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let r=Math.round(e);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(e){let r=Math.round(e);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let r=Math.round(e);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,r,n,s,i){let a=Math.max(0,n-e),l=Math.max(0,a-2*r),c=s>0&&s>n;if(!c)return{computedAvailableSize:Math.round(a),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(n*l/s))),f=(l-d)/(s-n),p=i*f;return{computedAvailableSize:Math.round(a),computedIsNeeded:c,computedSliderSize:Math.round(d),computedSliderRatio:f,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let e=o2._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let r=e-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let r=e-this._arrowSize,n=this._scrollPosition;return r<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+e;return Math.round(r/this._computedSliderRatio)}},Vje=class extends QW{constructor(e,r,n){let s=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:r.lazyRender,host:n,scrollbarState:new XW(r.horizontalHasArrows?r.arrowSize:0,r.horizontal===2?0:r.horizontalScrollbarSize,r.vertical===2?0:r.verticalScrollbarSize,s.width,s.scrollWidth,i.scrollLeft),visibility:r.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:r.scrollByPage}),r.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((r.horizontalScrollbarSize-r.horizontalSliderSize)/2),0,void 0,r.horizontalSliderSize)}_updateSlider(e,r){this.slider.setWidth(e),this.slider.setLeft(r)}_renderDomNode(e,r){this.domNode.setWidth(e),this.domNode.setHeight(r),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,r){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,r){e.scrollLeft=r}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Hje=class extends QW{constructor(e,r,n){let s=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:r.lazyRender,host:n,scrollbarState:new XW(r.verticalHasArrows?r.arrowSize:0,r.vertical===2?0:r.verticalScrollbarSize,0,s.height,s.scrollHeight,i.scrollTop),visibility:r.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:r.scrollByPage}),r.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((r.verticalScrollbarSize-r.verticalSliderSize)/2),r.verticalSliderSize,void 0)}_updateSlider(e,r){this.slider.setHeight(e),this.slider.setTop(r)}_renderDomNode(e,r){this.domNode.setWidth(r),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,r){return r}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,r){e.scrollTop=r}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},qje=500,RL=50,Wje=class{constructor(e,r,n){this.timestamp=e,this.deltaX=r,this.deltaY=n,this.score=0}},l2=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,r=0,n=1,s=this._rear;do{let i=s===this._front?e:Math.pow(2,-n);if(e-=i,r+=this._memory[s].score*i,s===this._front)break;s=(this._capacity+s-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(e){if(aR){let r=ao(e.browserEvent),n=nje(r);this.accept(Date.now(),e.deltaX*n,e.deltaY*n)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,r,n){let s=null,i=new Wje(e,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,s)}_computeScore(e,r){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),r){let s=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(r.deltaX),l=Math.abs(r.deltaY),c=Math.max(Math.min(s,a),1),d=Math.max(Math.min(i,l),1),f=Math.max(s,a),p=Math.max(i,l);f%c===0&&p%d===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};l2.INSTANCE=new l2;var Gje=l2,Kje=class extends uR{constructor(e,r,n){super(),this._onScroll=this._register(new We),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new We),this.onWillScroll=this._onWillScroll.event,this._options=Qje(r),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let s={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Hje(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new Vje(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=rg(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=rg(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=rg(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new lR),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=sd(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,fo&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new kL(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=sd(this._mouseWheelToDispose),e)){let r=n=>{this._onMouseWheel(new kL(n))};this._mouseWheelToDispose.push(_t(this._listenOnDomNode,zn.MOUSE_WHEEL,r,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let r=Gje.INSTANCE;r.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+a===0?l=a=0:Math.abs(a)>=Math.abs(l)?l=0:a=0),this._options.flipAxes&&([a,l]=[l,a]);let c=!fo&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||c)&&!l&&(l=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),f={};if(a){let p=RL*a,m=d.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(f,m)}if(l){let p=RL*l,m=d.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(f,m)}f=this._scrollable.validateScrollPosition(f),(d.scrollLeft!==f.scrollLeft||d.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&r.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),n=!0)}let s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),r=e.scrollTop>0,n=e.scrollLeft>0,s=n?" left":"",i=r?" top":"",a=n||r?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),qje)}},Yje=class extends Kje{constructor(e,r,n){super(e,r,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Qje(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,fo&&(e.className+=" mac"),e}var c2=class extends Dt{constructor(e,r,n,s,i,a,l,c){super(),this._bufferService=n,this._optionsService=l,this._renderService=c,this._onRequestScrollLines=this._register(new We),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let d=this._register(new Lje({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>cR(s.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{d.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Yje(r,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},d)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ls.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(zr(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),r.appendChild(this._styleElement),this._register(zr(()=>this._styleElement.remove())),this._register(ls.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
||
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let r=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:r.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,r){r&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!r,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let r=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=r-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=r,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};c2=nn([et(2,Hs),et(3,wl),et(4,RW),et(5,$f),et(6,qs),et(7,Sl)],c2);var u2=class extends Dt{constructor(e,r,n,s,i){super(),this._screenElement=e,this._bufferService=r,this._coreBrowserService=n,this._decorationService=s,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(a=>this._removeDecoration(a))),this._register(zr(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let r=this._coreBrowserService.mainDocument.createElement("div");r.classList.add("xterm-decoration"),r.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(r.style.display="none"),this._refreshXPosition(e,r),r}_refreshStyle(e){let r=e.marker.line-this._bufferService.buffers.active.ydisp;if(r<0||r>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${r*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,r=e.element){if(!r)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?r.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":r.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var r;(r=this._decorationElements.get(e))==null||r.remove(),this._decorationElements.delete(e),e.dispose()}};u2=nn([et(1,Hs),et(2,wl),et(3,Nv),et(4,Sl)],u2);var Xje=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let r of this._zones)if(r.color===e.options.overviewRulerOptions.color&&r.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(r,e.marker.line))return;if(this._lineAdjacentToZone(r,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(r,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,r){return r>=e.startBufferLine&&r<=e.endBufferLine}_lineAdjacentToZone(e,r,n){return r>=e.startBufferLine-this._linePadding[n||"full"]&&r<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,r){e.startBufferLine=Math.min(e.startBufferLine,r),e.endBufferLine=Math.max(e.endBufferLine,r)}},Ga={full:0,left:0,center:0,right:0},Ql={full:0,left:0,center:0,right:0},rm={full:0,left:0,center:0,right:0},v_=class extends Dt{constructor(e,r,n,s,i,a,l,c){var f;super(),this._viewportElement=e,this._screenElement=r,this._bufferService=n,this._decorationService=s,this._renderService=i,this._optionsService=a,this._themeService=l,this._coreBrowserService=c,this._colorZoneStore=new Xje,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(f=this._viewportElement.parentElement)==null||f.insertBefore(this._canvas,this._viewportElement),this._register(zr(()=>{var p;return(p=this._canvas)==null?void 0:p.remove()}));let d=this._canvas.getContext("2d");if(d)this._ctx=d;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),r=Math.ceil((this._canvas.width-1)/3);Ql.full=this._canvas.width,Ql.left=e,Ql.center=r,Ql.right=e,this._refreshDrawHeightConstants(),rm.full=1,rm.left=1,rm.center=1+Ql.left,rm.right=1+Ql.left+Ql.center}_refreshDrawHeightConstants(){Ga.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,r=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ga.left=r,Ga.center=r,Ga.right=r}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ga.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ga.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ga.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ga.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let r of this._decorationService.decorations)this._colorZoneStore.addDecoration(r);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let r of e)r.position!=="full"&&this._renderColorZone(r);for(let r of e)r.position==="full"&&this._renderColorZone(r);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(rm[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ga[e.position||"full"]/2),Ql[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ga[e.position||"full"]))}_queueRefresh(e,r){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=r||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};v_=nn([et(2,Hs),et(3,Nv),et(4,Sl),et(5,qs),et(6,$f),et(7,wl)],v_);var Re;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
|
||
`,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(Re||(Re={}));var k0;(t=>(t.PAD="",t.HOP="",t.BPH="",t.NBH="",t.IND="",t.NEL="
",t.SSA="",t.ESA="",t.HTS="",t.HTJ="",t.VTS="",t.PLD="",t.PLU="",t.RI="",t.SS2="",t.SS3="",t.DCS="",t.PU1="",t.PU2="",t.STS="",t.CCH="",t.MW="",t.SPA="",t.EPA="",t.SOS="",t.SGCI="",t.SCI="",t.CSI="",t.ST="",t.OSC="",t.PM="",t.APC=""))(k0||(k0={}));var ZW;(t=>t.ST=`${Re.ESC}\\`)(ZW||(ZW={}));var d2=class{constructor(e,r,n,s,i,a){this._textarea=e,this._compositionView=r,this._bufferService=n,this._optionsService=s,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let r={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;r.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(r.start,this._compositionPosition.start):n=this._textarea.value.substring(r.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let r=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(r,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let r=this._textarea.value,n=r.replace(e,"");this._dataAlreadySent=n,r.length>e.length?this._coreService.triggerDataEvent(n,!0):r.length<e.length?this._coreService.triggerDataEvent(`${Re.DEL}`,!0):r.length===e.length&&r!==e&&this._coreService.triggerDataEvent(r,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let r=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=r*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};d2=nn([et(2,Hs),et(3,qs),et(4,pd),et(5,Sl)],d2);var Vn=0,Hn=0,qn=0,Jr=0,DL={css:"#00000000",rgba:0},_n;(t=>{function e(s,i,a,l){return l!==void 0?`#${mu(s)}${mu(i)}${mu(a)}${mu(l)}`:`#${mu(s)}${mu(i)}${mu(a)}`}t.toCss=e;function r(s,i,a,l=255){return(s<<24|i<<16|a<<8|l)>>>0}t.toRgba=r;function n(s,i,a,l){return{css:t.toCss(s,i,a,l),rgba:t.toRgba(s,i,a,l)}}t.toColor=n})(_n||(_n={}));var Rr;(t=>{function e(c,d){if(Jr=(d.rgba&255)/255,Jr===1)return{css:d.css,rgba:d.rgba};let f=d.rgba>>24&255,p=d.rgba>>16&255,m=d.rgba>>8&255,g=c.rgba>>24&255,y=c.rgba>>16&255,x=c.rgba>>8&255;Vn=g+Math.round((f-g)*Jr),Hn=y+Math.round((p-y)*Jr),qn=x+Math.round((m-x)*Jr);let w=_n.toCss(Vn,Hn,qn),_=_n.toRgba(Vn,Hn,qn);return{css:w,rgba:_}}t.blend=e;function r(c){return(c.rgba&255)===255}t.isOpaque=r;function n(c,d,f){let p=E0.ensureContrastRatio(c.rgba,d.rgba,f);if(p)return _n.toColor(p>>24&255,p>>16&255,p>>8&255)}t.ensureContrastRatio=n;function s(c){let d=(c.rgba|255)>>>0;return[Vn,Hn,qn]=E0.toChannels(d),{css:_n.toCss(Vn,Hn,qn),rgba:d}}t.opaque=s;function i(c,d){return Jr=Math.round(d*255),[Vn,Hn,qn]=E0.toChannels(c.rgba),{css:_n.toCss(Vn,Hn,qn,Jr),rgba:_n.toRgba(Vn,Hn,qn,Jr)}}t.opacity=i;function a(c,d){return Jr=c.rgba&255,i(c,Jr*d/255)}t.multiplyOpacity=a;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}t.toColorRGB=l})(Rr||(Rr={}));var Wr;(t=>{let e,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let i=s.getContext("2d",{willReadFrequently:!0});i&&(e=i,e.globalCompositeOperation="copy",r=e.createLinearGradient(0,0,1,1))}catch{}function n(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Vn=parseInt(s.slice(1,2).repeat(2),16),Hn=parseInt(s.slice(2,3).repeat(2),16),qn=parseInt(s.slice(3,4).repeat(2),16),_n.toColor(Vn,Hn,qn);case 5:return Vn=parseInt(s.slice(1,2).repeat(2),16),Hn=parseInt(s.slice(2,3).repeat(2),16),qn=parseInt(s.slice(3,4).repeat(2),16),Jr=parseInt(s.slice(4,5).repeat(2),16),_n.toColor(Vn,Hn,qn,Jr);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let i=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(i)return Vn=parseInt(i[1]),Hn=parseInt(i[2]),qn=parseInt(i[3]),Jr=Math.round((i[5]===void 0?1:parseFloat(i[5]))*255),_n.toColor(Vn,Hn,qn,Jr);if(!e||!r)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=r,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Vn,Hn,qn,Jr]=e.getImageData(0,0,1,1).data,Jr!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_n.toRgba(Vn,Hn,qn,Jr),css:s}}t.toColor=n})(Wr||(Wr={}));var Os;(t=>{function e(n){return r(n>>16&255,n>>8&255,n&255)}t.relativeLuminance=e;function r(n,s,i){let a=n/255,l=s/255,c=i/255,d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),f=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),p=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return d*.2126+f*.7152+p*.0722}t.relativeLuminance2=r})(Os||(Os={}));var E0;(t=>{function e(a,l){if(Jr=(l&255)/255,Jr===1)return l;let c=l>>24&255,d=l>>16&255,f=l>>8&255,p=a>>24&255,m=a>>16&255,g=a>>8&255;return Vn=p+Math.round((c-p)*Jr),Hn=m+Math.round((d-m)*Jr),qn=g+Math.round((f-g)*Jr),_n.toRgba(Vn,Hn,qn)}t.blend=e;function r(a,l,c){let d=Os.relativeLuminance(a>>8),f=Os.relativeLuminance(l>>8);if(Ho(d,f)<c){if(f<d){let g=n(a,l,c),y=Ho(d,Os.relativeLuminance(g>>8));if(y<c){let x=s(a,l,c),w=Ho(d,Os.relativeLuminance(x>>8));return y>w?g:x}return g}let p=s(a,l,c),m=Ho(d,Os.relativeLuminance(p>>8));if(m<c){let g=n(a,l,c),y=Ho(d,Os.relativeLuminance(g>>8));return m>y?p:g}return p}}t.ensureContrastRatio=r;function n(a,l,c){let d=a>>24&255,f=a>>16&255,p=a>>8&255,m=l>>24&255,g=l>>16&255,y=l>>8&255,x=Ho(Os.relativeLuminance2(m,g,y),Os.relativeLuminance2(d,f,p));for(;x<c&&(m>0||g>0||y>0);)m-=Math.max(0,Math.ceil(m*.1)),g-=Math.max(0,Math.ceil(g*.1)),y-=Math.max(0,Math.ceil(y*.1)),x=Ho(Os.relativeLuminance2(m,g,y),Os.relativeLuminance2(d,f,p));return(m<<24|g<<16|y<<8|255)>>>0}t.reduceLuminance=n;function s(a,l,c){let d=a>>24&255,f=a>>16&255,p=a>>8&255,m=l>>24&255,g=l>>16&255,y=l>>8&255,x=Ho(Os.relativeLuminance2(m,g,y),Os.relativeLuminance2(d,f,p));for(;x<c&&(m<255||g<255||y<255);)m=Math.min(255,m+Math.ceil((255-m)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Ho(Os.relativeLuminance2(m,g,y),Os.relativeLuminance2(d,f,p));return(m<<24|g<<16|y<<8|255)>>>0}t.increaseLuminance=s;function i(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}t.toChannels=i})(E0||(E0={}));function mu(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Ho(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var Zje=class extends Cv{constructor(e,r,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=r,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},y_=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Hi}register(e){let r={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(r),r.id}deregister(e){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===e)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let r=this._bufferService.buffer.lines.get(e);if(!r||r.length===0)return[];let n=[],s=r.translateToString(!0),i=0,a=0,l=0,c=r.getFg(0),d=r.getBg(0);for(let f=0;f<r.getTrimmedLength();f++)if(r.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==d){if(f-i>1){let p=this._getJoinedRanges(s,l,a,r,i);for(let m=0;m<p.length;m++)n.push(p[m])}i=f,l=a,c=this._workCell.fg,d=this._workCell.bg}a+=this._workCell.getChars().length||fc.length}if(this._bufferService.cols-i>1){let f=this._getJoinedRanges(s,l,a,r,i);for(let p=0;p<f.length;p++)n.push(f[p])}return n}_getJoinedRanges(e,r,n,s,i){let a=e.substring(r,n),l=[];try{l=this._characterJoiners[0].handler(a)}catch(c){console.error(c)}for(let c=1;c<this._characterJoiners.length;c++)try{let d=this._characterJoiners[c].handler(a);for(let f=0;f<d.length;f++)y_._mergeRanges(l,d[f])}catch(d){console.error(d)}return this._stringRangesToCellRanges(l,s,i),l}_stringRangesToCellRanges(e,r,n){let s=0,i=!1,a=0,l=e[s];if(l){for(let c=n;c<this._bufferService.cols;c++){let d=r.getWidth(c),f=r.getString(c).length||fc.length;if(d!==0){if(!i&&l[0]<=a&&(l[0]=c,i=!0),l[1]<=a){if(l[1]=c,l=e[++s],!l)break;l[0]<=a?(l[0]=c,i=!0):i=!1}a+=f}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,r){let n=!1;for(let s=0;s<e.length;s++){let i=e[s];if(n){if(r[1]<=i[0])return e[s-1][1]=r[1],e;if(r[1]<=i[1])return e[s-1][1]=Math.max(r[1],i[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(r[1]<=i[0])return e.splice(s,0,r),e;if(r[1]<=i[1])return i[0]=Math.min(r[0],i[0]),e;r[0]<i[1]&&(i[0]=Math.min(r[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=r[1]:e.push(r),e}};y_=nn([et(0,Hs)],y_);function Jje(t){return 57508<=t&&t<=57558}function eTe(t){return 9472<=t&&t<=9631}function tTe(t){return Jje(t)||eTe(t)}function rTe(){return{css:{canvas:Cx(),cell:Cx()},device:{canvas:Cx(),cell:Cx(),char:{width:0,height:0,left:0,top:0}}}}function Cx(){return{width:0,height:0}}var h2=class{constructor(e,r,n,s,i,a,l){this._document=e,this._characterJoinerService=r,this._optionsService=n,this._coreBrowserService=s,this._coreService=i,this._decorationService=a,this._themeService=l,this._workCell=new Hi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,r,n){this._selectionStart=e,this._selectionEnd=r,this._columnSelectMode=n}createRow(e,r,n,s,i,a,l,c,d,f,p){let m=[],g=this._characterJoinerService.getJoinedCharacters(r),y=this._themeService.colors,x=e.getNoBgTrimmedLength();n&&x<a+1&&(x=a+1);let w,_=0,S="",k=0,N=0,j=0,T=0,D=!1,I=0,L=!1,$=0,Q=0,M=[],z=f!==-1&&p!==-1;for(let R=0;R<x;R++){e.loadCell(R,this._workCell);let B=this._workCell.getWidth();if(B===0)continue;let V=!1,F=R>=Q,K=R,Y=this._workCell;if(g.length>0&&R===g[0][0]&&F){let P=g.shift(),ne=this._isCellInSelection(P[0],r);for(k=P[0]+1;k<P[1];k++)F&&(F=ne===this._isCellInSelection(k,r));F&&(F=!n||a<P[0]||a>=P[1]),F?(V=!0,Y=new Zje(this._workCell,e.translateToString(!0,P[0],P[1]),P[1]-P[0]),K=P[1]-1,B=Y.getWidth()):Q=P[1]}let O=this._isCellInSelection(R,r),H=n&&R===a,G=z&&R>=f&&R<=p,q=!1;this._decorationService.forEachDecorationAtCell(R,r,void 0,P=>{q=!0});let J=Y.getChars()||fc;if(J===" "&&(Y.isUnderline()||Y.isOverline())&&(J=" "),$=B*c-d.get(J,Y.isBold(),Y.isItalic()),!w)w=this._document.createElement("span");else if(_&&(O&&L||!O&&!L&&Y.bg===N)&&(O&&L&&y.selectionForeground||Y.fg===j)&&Y.extended.ext===T&&G===D&&$===I&&!H&&!V&&!q&&F){Y.isInvisible()?S+=fc:S+=J,_++;continue}else _&&(w.textContent=S),w=this._document.createElement("span"),_=0,S="";if(N=Y.bg,j=Y.fg,T=Y.extended.ext,D=G,I=$,L=O,V&&a>=R&&a<=K&&(a=R),!this._coreService.isCursorHidden&&H&&this._coreService.isCursorInitialized){if(M.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&M.push("xterm-cursor-blink"),M.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":M.push("xterm-cursor-outline");break;case"block":M.push("xterm-cursor-block");break;case"bar":M.push("xterm-cursor-bar");break;case"underline":M.push("xterm-cursor-underline");break}}if(Y.isBold()&&M.push("xterm-bold"),Y.isItalic()&&M.push("xterm-italic"),Y.isDim()&&M.push("xterm-dim"),Y.isInvisible()?S=fc:S=Y.getChars()||fc,Y.isUnderline()&&(M.push(`xterm-underline-${Y.extended.underlineStyle}`),S===" "&&(S=" "),!Y.isUnderlineColorDefault()))if(Y.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${Cv.toColorRGB(Y.getUnderlineColor()).join(",")})`;else{let P=Y.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Y.isBold()&&P<8&&(P+=8),w.style.textDecorationColor=y.ansi[P].css}Y.isOverline()&&(M.push("xterm-overline"),S===" "&&(S=" ")),Y.isStrikethrough()&&M.push("xterm-strikethrough"),G&&(w.style.textDecoration="underline");let te=Y.getFgColor(),ve=Y.getFgColorMode(),he=Y.getBgColor(),xe=Y.getBgColorMode(),ke=!!Y.isInverse();if(ke){let P=te;te=he,he=P;let ne=ve;ve=xe,xe=ne}let Oe,He,Ye=!1;this._decorationService.forEachDecorationAtCell(R,r,void 0,P=>{P.options.layer!=="top"&&Ye||(P.backgroundColorRGB&&(xe=50331648,he=P.backgroundColorRGB.rgba>>8&16777215,Oe=P.backgroundColorRGB),P.foregroundColorRGB&&(ve=50331648,te=P.foregroundColorRGB.rgba>>8&16777215,He=P.foregroundColorRGB),Ye=P.options.layer==="top")}),!Ye&&O&&(Oe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,he=Oe.rgba>>8&16777215,xe=50331648,Ye=!0,y.selectionForeground&&(ve=50331648,te=y.selectionForeground.rgba>>8&16777215,He=y.selectionForeground)),Ye&&M.push("xterm-decoration-top");let lt;switch(xe){case 16777216:case 33554432:lt=y.ansi[he],M.push(`xterm-bg-${he}`);break;case 50331648:lt=_n.toColor(he>>16,he>>8&255,he&255),this._addStyle(w,`background-color:#${OL((he>>>0).toString(16),"0",6)}`);break;case 0:default:ke?(lt=y.foreground,M.push("xterm-bg-257")):lt=y.background}switch(Oe||Y.isDim()&&(Oe=Rr.multiplyOpacity(lt,.5)),ve){case 16777216:case 33554432:Y.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(w,lt,y.ansi[te],Y,Oe,void 0)||M.push(`xterm-fg-${te}`);break;case 50331648:let P=_n.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(w,lt,P,Y,Oe,He)||this._addStyle(w,`color:#${OL(te.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(w,lt,y.foreground,Y,Oe,He)||ke&&M.push("xterm-fg-257")}M.length&&(w.className=M.join(" "),M.length=0),!H&&!V&&!q&&F?_++:w.textContent=S,$!==this.defaultSpacing&&(w.style.letterSpacing=`${$}px`),m.push(w),R=K}return w&&_&&(w.textContent=S),m}_applyMinimumContrast(e,r,n,s,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||tTe(s.getCode()))return!1;let l=this._getContrastCache(s),c;if(!i&&!a&&(c=l.getColor(r.rgba,n.rgba)),c===void 0){let d=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);c=Rr.ensureContrastRatio(i||r,a||n,d),l.setColor((i||r).rgba,(a||n).rgba,c??null)}return c?(this._addStyle(e,`color:${c.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,r){e.setAttribute("style",`${e.getAttribute("style")||""}${r};`)}_isCellInSelection(e,r){let n=this._selectionStart,s=this._selectionEnd;return!n||!s?!1:this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&r>=n[1]&&e<s[0]&&r<=s[1]:e<n[0]&&r>=n[1]&&e>=s[0]&&r<=s[1]:r>n[1]&&r<s[1]||n[1]===s[1]&&r===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&r===s[1]&&e<s[0]||n[1]<s[1]&&r===n[1]&&e>=n[0]}};h2=nn([et(1,PW),et(2,qs),et(3,wl),et(4,pd),et(5,Nv),et(6,$f)],h2);function OL(t,e,r){for(;t.length<r;)t=e+t;return t}var nTe=class{constructor(e,r){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[n,s,i,a],this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(i),this._container.appendChild(a),r.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,r,n,s){e===this._font&&r===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=r,this._weight=n,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,r,n){let s=0;if(!r&&!n&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let l=this._measure(e,0);return l>0&&(this._flat[s]=l),l}let i=e;r&&(i+="B"),n&&(i+="I");let a=this._holey.get(i);if(a===void 0){let l=0;r&&(l|=1),n&&(l|=2),a=this._measure(e,l),a>0&&this._holey.set(i,a)}return a}_measure(e,r){let n=this._measureElements[r];return n.textContent=e.repeat(32),n.offsetWidth/32}},sTe=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,r,n,s=!1){if(this.selectionStart=r,this.selectionEnd=n,!r||!n||r[0]===n[0]&&r[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=r[1]-i,l=n[1]-i,c=Math.max(a,0),d=Math.min(l,e.rows-1);if(c>=e.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=a,this.viewportEndRow=l,this.viewportCappedStartRow=c,this.viewportCappedEndRow=d,this.startCol=r[0],this.endCol=n[0]}isCellSelected(e,r,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&n>=this.viewportCappedStartRow&&r<this.endCol&&n<=this.viewportCappedEndRow:r<this.startCol&&n>=this.viewportCappedStartRow&&r>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol):!1}};function iTe(){return new sTe}var Wk="xterm-dom-renderer-owner-",Mi="xterm-rows",Nx="xterm-fg-",PL="xterm-bg-",nm="xterm-focus",jx="xterm-selection",aTe=1,f2=class extends Dt{constructor(e,r,n,s,i,a,l,c,d,f,p,m,g,y){super(),this._terminal=e,this._document=r,this._element=n,this._screenElement=s,this._viewportElement=i,this._helperContainer=a,this._linkifier2=l,this._charSizeService=d,this._optionsService=f,this._bufferService=p,this._coreService=m,this._coreBrowserService=g,this._themeService=y,this._terminalClass=aTe++,this._rowElements=[],this._selectionRenderModel=iTe(),this.onRequestRedraw=this._register(new We).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Mi),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(jx),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=rTe(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=c.createInstance(h2,document),this._element.classList.add(Wk+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(zr(()=>{this._element.classList.remove(Wk+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new nTe(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let r=`${this._terminalSelector} .${Mi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=r,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let r=`${this._terminalSelector} .${Mi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;r+=`${this._terminalSelector} .${Mi} .xterm-dim { color: ${Rr.multiplyOpacity(e.foreground,.5).css};}`,r+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;r+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,r+=`@keyframes ${s} { 50% { box-shadow: none; }}`,r+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,r+=`${this._terminalSelector} .${Mi}.${nm} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Mi}.${nm} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Mi}.${nm} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,r+=`${this._terminalSelector} .${jx} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${jx} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${jx} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,l]of e.ansi.entries())r+=`${this._terminalSelector} .${Nx}${a} { color: ${l.css}; }${this._terminalSelector} .${Nx}${a}.xterm-dim { color: ${Rr.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${PL}${a} { background-color: ${l.css}; }`;r+=`${this._terminalSelector} .${Nx}257 { color: ${Rr.opaque(e.background).css}; }${this._terminalSelector} .${Nx}257.xterm-dim { color: ${Rr.multiplyOpacity(Rr.opaque(e.background),.5).css}; }${this._terminalSelector} .${PL}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=r}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,r){for(let n=this._rowElements.length;n<=r;n++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>r;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,r){this._refreshRowElements(e,r),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(nm),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(nm),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,r,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,r,n),this.renderRows(0,this._bufferService.rows-1),!e||!r||(this._selectionRenderModel.update(this._terminal,e,r,n),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,c=this._document.createDocumentFragment();if(n){let d=e[0]>r[0];c.appendChild(this._createSelectionElement(a,d?r[0]:e[0],d?e[0]:r[0],l-a+1))}else{let d=s===a?e[0]:0,f=a===i?r[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(a,d,f));let p=l-a-1;if(c.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,p)),a!==l){let m=i===l?r[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,m))}}this._selectionContainer.appendChild(c)}_createSelectionElement(e,r,n,s=1){let i=this._document.createElement("div"),a=r*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-r);return a+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-a),i.style.height=`${s*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${l}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,r){let n=this._bufferService.buffer,s=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,c=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=e;d<=r;d++){let f=d+n.ydisp,p=this._rowElements[d],m=n.lines.get(f);if(!p||!m)break;p.replaceChildren(...this._rowFactory.createRow(m,f,f===s,l,c,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Wk}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,r,n,s,i,a){n<0&&(e=0),s<0&&(r=0);let l=this._bufferService.rows-1;n=Math.max(Math.min(n,l),0),s=Math.max(Math.min(s,l),0),i=Math.min(i,this._bufferService.cols);let c=this._bufferService.buffer,d=c.ybase+c.y,f=Math.min(c.x,i-1),p=this._optionsService.rawOptions.cursorBlink,m=this._optionsService.rawOptions.cursorStyle,g=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=s;++y){let x=y+c.ydisp,w=this._rowElements[y],_=c.lines.get(x);if(!w||!_)break;w.replaceChildren(...this._rowFactory.createRow(_,x,x===d,m,g,f,p,this.dimensions.css.cell.width,this._widthCache,a?y===n?e:0:-1,a?(y===s?r:i)-1:-1))}}};f2=nn([et(7,nR),et(8,Hb),et(9,qs),et(10,Hs),et(11,pd),et(12,wl),et(13,$f)],f2);var p2=class extends Dt{constructor(e,r,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new We),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new lTe(this._optionsService))}catch{this._measureStrategy=this._register(new oTe(e,r,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};p2=nn([et(2,qs)],p2);var JW=class extends Dt{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,r){e!==void 0&&e>0&&r!==void 0&&r>0&&(this._result.width=e,this._result.height=r)}},oTe=class extends JW{constructor(e,r,n){super(),this._document=e,this._parentElement=r,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},lTe=class extends JW{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let r=this._ctx.measureText("W");if(!("width"in r&&"fontBoundingBoxAscent"in r&&"fontBoundingBoxDescent"in r))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},cTe=class extends Dt{constructor(e,r,n){super(),this._textarea=e,this._window=r,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new uTe(this._window)),this._onDprChange=this._register(new We),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new We),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(ls.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(_t(this._textarea,"focus",()=>this._isFocused=!0)),this._register(_t(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},uTe=class extends Dt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new af),this._onDprChange=this._register(new We),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(zr(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=_t(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},dTe=class extends Dt{constructor(){super(),this.linkProviders=[],this._register(zr(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let r=this.linkProviders.indexOf(e);r!==-1&&this.linkProviders.splice(r,1)}}}};function dR(t,e,r){let n=r.getBoundingClientRect(),s=t.getComputedStyle(r),i=parseInt(s.getPropertyValue("padding-left")),a=parseInt(s.getPropertyValue("padding-top"));return[e.clientX-n.left-i,e.clientY-n.top-a]}function hTe(t,e,r,n,s,i,a,l,c){if(!i)return;let d=dR(t,e,r);if(d)return d[0]=Math.ceil((d[0]+(c?a/2:0))/a),d[1]=Math.ceil(d[1]/l),d[0]=Math.min(Math.max(d[0],1),n+(c?1:0)),d[1]=Math.min(Math.max(d[1],1),s),d}var m2=class{constructor(e,r){this._renderService=e,this._charSizeService=r}getCoords(e,r,n,s,i){return hTe(window,e,r,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,r){let n=dR(window,e,r);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};m2=nn([et(0,Sl),et(1,Hb)],m2);var fTe=class{constructor(e,r){this._renderCallback=e,this._coreBrowserService=r,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,r,n){this._rowCount=n,e=e!==void 0?e:0,r=r!==void 0?r:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,r):r,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),r=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,r),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},eG={};S2e(eG,{getSafariVersion:()=>mTe,isChromeOS:()=>sG,isFirefox:()=>tG,isIpad:()=>gTe,isIphone:()=>vTe,isLegacyEdge:()=>pTe,isLinux:()=>hR,isMac:()=>x_,isNode:()=>qb,isSafari:()=>rG,isWindows:()=>nG});var qb=typeof process<"u"&&"title"in process,jv=qb?"node":navigator.userAgent,Tv=qb?"node":navigator.platform,tG=jv.includes("Firefox"),pTe=jv.includes("Edge"),rG=/^((?!chrome|android).)*safari/i.test(jv);function mTe(){if(!rG)return 0;let t=jv.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var x_=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Tv),gTe=Tv==="iPad",vTe=Tv==="iPhone",nG=["Windows","Win16","Win32","WinCE"].includes(Tv),hR=Tv.indexOf("Linux")>=0,sG=/\bCrOS\b/.test(jv),iG=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let r=0,n=0,s=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(r=performance.now(),this._tasks[this._i]()||this._i++,r=Math.max(1,performance.now()-r),n=Math.max(r,n),i=e.timeRemaining(),n*1.5>i){s-r<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-r))}ms`),this._start();return}s=i}this.clear()}},yTe=class extends iG{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let r=performance.now()+e;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},xTe=class extends iG{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},__=!qb&&"requestIdleCallback"in window?xTe:yTe,_Te=class{constructor(){this._queue=new __}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},g2=class extends Dt{constructor(e,r,n,s,i,a,l,c,d){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=s,this._coreService=i,this._coreBrowserService=c,this._renderer=this._register(new af),this._pausedResizeTask=new _Te,this._observerDisposable=this._register(new af),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new We),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new We),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new We),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new We),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new fTe((f,p)=>this._renderRows(f,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new bTe(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(zr(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var f;return(f=this._renderer.value)==null?void 0:f.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,r),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,r)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,r){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});n.observe(r),this._observerDisposable.value=zr(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,r,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,r);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),r=Math.max(r,s.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,r,this._rowCount)}_renderRows(e,r){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,r);return}e=Math.min(e,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(e,r),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:r}),this._onRender.fire({start:e,end:r}),this._isNextRenderRedrawOnly=!0}}resize(e,r){this._rowCount=r,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(r=>this.refreshRows(r.start,r.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,r;this._renderer.value&&((r=(e=this._renderer.value).clearTextureAtlas)==null||r.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,r)}):this._renderer.value.handleResize(e,r),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,r,n){var s;this._selectionState.start=e,this._selectionState.end=r,this._selectionState.columnSelectMode=n,(s=this._renderer.value)==null||s.handleSelectionChanged(e,r,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};g2=nn([et(2,qs),et(3,Hb),et(4,pd),et(5,Nv),et(6,Hs),et(7,wl),et(8,$f)],g2);var bTe=class{constructor(e,r,n){this._coreBrowserService=e,this._coreService=r,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,r){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,r)):(this._start=e,this._end=r,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function wTe(t,e,r,n){let s=r.buffer.x,i=r.buffer.y;if(!r.buffer.hasScrollback)return ETe(s,i,t,e,r,n)+Wb(i,e,r,n)+CTe(s,i,t,e,r,n);let a;if(i===e)return a=s>t?"D":"C",zg(Math.abs(s-t),Fg(a,n));a=i>e?"D":"C";let l=Math.abs(i-e),c=kTe(i>e?t:s,r)+(l-1)*r.cols+1+STe(i>e?s:t);return zg(c,Fg(a,n))}function STe(t,e){return t-1}function kTe(t,e){return e.cols-t}function ETe(t,e,r,n,s,i){return Wb(e,n,s,i).length===0?"":zg(oG(t,e,t,e-id(e,s),!1,s).length,Fg("D",i))}function Wb(t,e,r,n){let s=t-id(t,r),i=e-id(e,r),a=Math.abs(s-i)-NTe(t,e,r);return zg(a,Fg(aG(t,e),n))}function CTe(t,e,r,n,s,i){let a;Wb(e,n,s,i).length>0?a=n-id(n,s):a=e;let l=n,c=jTe(t,e,r,n,s,i);return zg(oG(t,a,r,l,c==="C",s).length,Fg(c,i))}function NTe(t,e,r){var a;let n=0,s=t-id(t,r),i=e-id(e,r);for(let l=0;l<Math.abs(s-i);l++){let c=aG(t,e)==="A"?-1:1;(a=r.buffer.lines.get(s+c*l))!=null&&a.isWrapped&&n++}return n}function id(t,e){let r=0,n=e.buffer.lines.get(t),s=n==null?void 0:n.isWrapped;for(;s&&t>=0&&t<e.rows;)r++,n=e.buffer.lines.get(--t),s=n==null?void 0:n.isWrapped;return r}function jTe(t,e,r,n,s,i){let a;return Wb(r,n,s,i).length>0?a=n-id(n,s):a=e,t<r&&a<=n||t>=r&&a<n?"C":"D"}function aG(t,e){return t>e?"A":"B"}function oG(t,e,r,n,s,i){let a=t,l=e,c="";for(;(a!==r||l!==n)&&l>=0&&l<i.buffer.lines.length;)a+=s?1:-1,s&&a>i.cols-1?(c+=i.buffer.translateBufferLineToString(l,!1,t,a),a=0,t=0,l++):!s&&a<0&&(c+=i.buffer.translateBufferLineToString(l,!1,0,t+1),a=i.cols-1,t=a,l--);return c+i.buffer.translateBufferLineToString(l,!1,t,a)}function Fg(t,e){let r=e?"O":"[";return Re.ESC+r+t}function zg(t,e){t=Math.floor(t);let r="";for(let n=0;n<t;n++)r+=e;return r}var TTe=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,r=this.selectionEnd;return!e||!r?!1:e[1]>r[1]||e[1]===r[1]&&e[0]>r[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function ML(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var IL=50,ATe=15,RTe=50,DTe=500,OTe=" ",PTe=new RegExp(OTe,"g"),v2=class extends Dt{constructor(e,r,n,s,i,a,l,c,d){super(),this._element=e,this._screenElement=r,this._linkifier=n,this._bufferService=s,this._coreService=i,this._mouseService=a,this._optionsService=l,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Hi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new We),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new We),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new We),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new We),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new TTe(this._bufferService),this._activeSelectionMode=0,this._register(zr(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!e||!r?!1:e[0]!==r[0]||e[1]!==r[1]}get selectionText(){let e=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;if(!e||!r)return"";let n=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===r[0])return"";let i=e[0]<r[0]?e[0]:r[0],a=e[0]<r[0]?r[0]:e[0];for(let l=e[1];l<=r[1];l++){let c=n.translateBufferLineToString(l,!0,i,a);s.push(c)}}else{let i=e[1]===r[1]?r[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let a=e[1]+1;a<=r[1]-1;a++){let l=n.lines.get(a),c=n.translateBufferLineToString(a,!0);l!=null&&l.isWrapped?s[s.length-1]+=c:s.push(c)}if(e[1]!==r[1]){let a=n.lines.get(r[1]),l=n.translateBufferLineToString(r[1],!0,0,r[0]);a&&a.isWrapped?s[s.length-1]+=l:s.push(l)}}return s.map(i=>i.replace(PTe," ")).join(nG?`\r
|
||
`:`
|
||
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),hR&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let r=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s||!r?!1:this._areCoordsInSelection(r,n,s)}isCellInSelection(e,r){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s?!1:this._areCoordsInSelection([e,r],n,s)}_areCoordsInSelection(e,r,n){return e[1]>r[1]&&e[1]<n[1]||r[1]===n[1]&&e[1]===r[1]&&e[0]>=r[0]&&e[0]<n[0]||r[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||r[1]<n[1]&&e[1]===r[1]&&e[0]>=r[0]}_selectWordAtCursor(e,r){var i,a;let n=(a=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:a.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=ML(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,r),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,r){this._model.clearSelection(),e=Math.max(e,0),r=Math.min(r,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,r],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let r=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(r)return r[0]--,r[1]--,r[1]+=this._bufferService.buffer.ydisp,r}_getMouseEventScrollAmount(e){let r=dR(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return r>=0&&r<=n?0:(r>n&&(r-=n),r=Math.min(Math.max(r,-50),IL),r/=IL,r/Math.abs(r)+Math.round(r*(ATe-1)))}shouldForceSelection(e){return x_?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),RTe)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let r=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);r&&r.length!==this._model.selectionStart[0]&&r.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let r=this._getMouseBufferCoords(e);r&&(this._activeSelectionMode=2,this._selectLineAt(r[1]))}shouldColumnSelect(e){return e.altKey&&!(x_&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let r=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let s=n.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!r||r[0]!==this._model.selectionEnd[0]||r[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let r=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&r<DTe&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let s=wTe(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,r=this._model.finalSelectionEnd,n=!!e&&!!r&&(e[0]!==r[0]||e[1]!==r[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,r,n);return}!e||!r||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||r[0]!==this._oldSelectionEnd[0]||r[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,r,n)}_fireOnSelectionChange(e,r,n){this._oldSelectionStart=e,this._oldSelectionEnd=r,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(r=>this._handleTrim(r))}_convertViewportColToCharacterIndex(e,r){let n=r;for(let s=0;r>=s;s++){let i=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&r!==s&&(n+=i-1)}return n}setSelection(e,r,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,r],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,r,n=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let l=i.translateBufferLineToString(e[1],!1),c=this._convertViewportColToCharacterIndex(a,e[0]),d=c,f=e[0]-c,p=0,m=0,g=0,y=0;if(l.charAt(c)===" "){for(;c>0&&l.charAt(c-1)===" ";)c--;for(;d<l.length&&l.charAt(d+1)===" ";)d++}else{let _=e[0],S=e[0];a.getWidth(_)===0&&(p++,_--),a.getWidth(S)===2&&(m++,S++);let k=a.getString(S).length;for(k>1&&(y+=k-1,d+=k-1);_>0&&c>0&&!this._isCharWordSeparator(a.loadCell(_-1,this._workCell));){a.loadCell(_-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,_--):N>1&&(g+=N-1,c-=N-1),c--,_--}for(;S<a.length&&d+1<l.length&&!this._isCharWordSeparator(a.loadCell(S+1,this._workCell));){a.loadCell(S+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(m++,S++):N>1&&(y+=N-1,d+=N-1),d++,S++}}d++;let x=c+f-p+g,w=Math.min(this._bufferService.cols,d-c+p+m-g-y);if(!(!r&&l.slice(c,d).trim()==="")){if(n&&x===0&&a.getCodePoint(0)!==32){let _=i.lines.get(e[1]-1);if(_&&a.isWrapped&&_.getCodePoint(this._bufferService.cols-1)!==32){let S=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(S){let k=this._bufferService.cols-S.start;x-=k,w+=k}}}if(s&&x+w===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let _=i.lines.get(e[1]+1);if(_!=null&&_.isWrapped&&_.getCodePoint(0)!==32){let S=this._getWordAt([0,e[1]+1],!1,!1,!0);S&&(w+=S.length)}}return{start:x,length:w}}}_selectWordAt(e,r){let n=this._getWordAt(e,r);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let r=this._getWordAt(e,!0);if(r){let n=e[1];for(;r.start<0;)r.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;r.start+r.length>this._bufferService.cols;)r.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?r.start:r.start+r.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let r=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:r.first},end:{x:this._bufferService.cols-1,y:r.last}};this._model.selectionStart=[0,r.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=ML(n,this._bufferService.cols)}};v2=nn([et(3,Hs),et(4,pd),et(5,sR),et(6,qs),et(7,Sl),et(8,wl)],v2);var LL=class{constructor(){this._data={}}set(e,r,n){this._data[e]||(this._data[e]={}),this._data[e][r]=n}get(e,r){return this._data[e]?this._data[e][r]:void 0}clear(){this._data={}}},$L=class{constructor(){this._color=new LL,this._css=new LL}setCss(e,r,n){this._css.set(e,r,n)}getCss(e,r){return this._css.get(e,r)}setColor(e,r,n){this._color.set(e,r,n)}getColor(e,r){return this._color.get(e,r)}clear(){this._color.clear(),this._css.clear()}},En=Object.freeze((()=>{let t=[Wr.toColor("#2e3436"),Wr.toColor("#cc0000"),Wr.toColor("#4e9a06"),Wr.toColor("#c4a000"),Wr.toColor("#3465a4"),Wr.toColor("#75507b"),Wr.toColor("#06989a"),Wr.toColor("#d3d7cf"),Wr.toColor("#555753"),Wr.toColor("#ef2929"),Wr.toColor("#8ae234"),Wr.toColor("#fce94f"),Wr.toColor("#729fcf"),Wr.toColor("#ad7fa8"),Wr.toColor("#34e2e2"),Wr.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=e[r/36%6|0],s=e[r/6%6|0],i=e[r%6];t.push({css:_n.toCss(n,s,i),rgba:_n.toRgba(n,s,i)})}for(let r=0;r<24;r++){let n=8+r*10;t.push({css:_n.toCss(n,n,n),rgba:_n.toRgba(n,n,n)})}return t})()),Eu=Wr.toColor("#ffffff"),Mm=Wr.toColor("#000000"),BL=Wr.toColor("#ffffff"),FL=Mm,sm={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},MTe=Eu,y2=class extends Dt{constructor(e){super(),this._optionsService=e,this._contrastCache=new $L,this._halfContrastCache=new $L,this._onChangeColors=this._register(new We),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Eu,background:Mm,cursor:BL,cursorAccent:FL,selectionForeground:void 0,selectionBackgroundTransparent:sm,selectionBackgroundOpaque:Rr.blend(Mm,sm),selectionInactiveBackgroundTransparent:sm,selectionInactiveBackgroundOpaque:Rr.blend(Mm,sm),scrollbarSliderBackground:Rr.opacity(Eu,.2),scrollbarSliderHoverBackground:Rr.opacity(Eu,.4),scrollbarSliderActiveBackground:Rr.opacity(Eu,.5),overviewRulerBorder:Eu,ansi:En.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let r=this._colors;if(r.foreground=fr(e.foreground,Eu),r.background=fr(e.background,Mm),r.cursor=Rr.blend(r.background,fr(e.cursor,BL)),r.cursorAccent=Rr.blend(r.background,fr(e.cursorAccent,FL)),r.selectionBackgroundTransparent=fr(e.selectionBackground,sm),r.selectionBackgroundOpaque=Rr.blend(r.background,r.selectionBackgroundTransparent),r.selectionInactiveBackgroundTransparent=fr(e.selectionInactiveBackground,r.selectionBackgroundTransparent),r.selectionInactiveBackgroundOpaque=Rr.blend(r.background,r.selectionInactiveBackgroundTransparent),r.selectionForeground=e.selectionForeground?fr(e.selectionForeground,DL):void 0,r.selectionForeground===DL&&(r.selectionForeground=void 0),Rr.isOpaque(r.selectionBackgroundTransparent)&&(r.selectionBackgroundTransparent=Rr.opacity(r.selectionBackgroundTransparent,.3)),Rr.isOpaque(r.selectionInactiveBackgroundTransparent)&&(r.selectionInactiveBackgroundTransparent=Rr.opacity(r.selectionInactiveBackgroundTransparent,.3)),r.scrollbarSliderBackground=fr(e.scrollbarSliderBackground,Rr.opacity(r.foreground,.2)),r.scrollbarSliderHoverBackground=fr(e.scrollbarSliderHoverBackground,Rr.opacity(r.foreground,.4)),r.scrollbarSliderActiveBackground=fr(e.scrollbarSliderActiveBackground,Rr.opacity(r.foreground,.5)),r.overviewRulerBorder=fr(e.overviewRulerBorder,MTe),r.ansi=En.slice(),r.ansi[0]=fr(e.black,En[0]),r.ansi[1]=fr(e.red,En[1]),r.ansi[2]=fr(e.green,En[2]),r.ansi[3]=fr(e.yellow,En[3]),r.ansi[4]=fr(e.blue,En[4]),r.ansi[5]=fr(e.magenta,En[5]),r.ansi[6]=fr(e.cyan,En[6]),r.ansi[7]=fr(e.white,En[7]),r.ansi[8]=fr(e.brightBlack,En[8]),r.ansi[9]=fr(e.brightRed,En[9]),r.ansi[10]=fr(e.brightGreen,En[10]),r.ansi[11]=fr(e.brightYellow,En[11]),r.ansi[12]=fr(e.brightBlue,En[12]),r.ansi[13]=fr(e.brightMagenta,En[13]),r.ansi[14]=fr(e.brightCyan,En[14]),r.ansi[15]=fr(e.brightWhite,En[15]),e.extendedAnsi){let n=Math.min(r.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)r.ansi[s+16]=fr(e.extendedAnsi[s],En[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let r=0;r<this._restoreColors.ansi.length;++r)this._colors.ansi[r]=this._restoreColors.ansi[r];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};y2=nn([et(0,qs)],y2);function fr(t,e){if(t!==void 0)try{return Wr.toColor(t)}catch{}return e}var ITe=class{constructor(...e){this._entries=new Map;for(let[r,n]of e)this.set(r,n)}set(e,r){let n=this._entries.get(e);return this._entries.set(e,r),n}forEach(e){for(let[r,n]of this._entries.entries())e(r,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},LTe=class{constructor(){this._services=new ITe,this._services.set(nR,this)}setService(e,r){this._services.set(e,r)}getService(e){return this._services.get(e)}createInstance(e,...r){let n=A2e(e).sort((a,l)=>a.index-l.index),s=[];for(let a of n){let l=this._services.get(a.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);s.push(l)}let i=n.length>0?n[0].index:r.length;if(r.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${r.length} static arguments`);return new e(...r,...s)}},$Te={trace:0,debug:1,info:2,warn:3,error:4,off:5},BTe="xterm.js: ",x2=class extends Dt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=$Te[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":BTe)+r,...n)}trace(e,...r){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,r)}};x2=nn([et(0,qs)],x2);var zL=class extends Dt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new We),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new We),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new We),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let r=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)r[n]=this._array[this._getCyclicIndex(n)];this._array=r,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let r=this._length;r<e;r++)this._array[r]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,r){this._array[this._getCyclicIndex(e)]=r}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,r,...n){if(r){for(let s=e;s<this._length-r;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+r)];this._length-=r,this.onDeleteEmitter.fire({index:e,amount:r})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let s=this._length+n.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,r,n){if(!(r<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=r-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let s=e+r+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<r;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Rt=3,yn=Object.freeze(new Cv),Tx=0,Gk=2,Im=class lG{constructor(e,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Rt);let s=r||Hi.fromCharData([0,NW,1,0]);for(let i=0;i<e;++i)this.setCell(i,s);this.length=e}get(e){let r=this._data[e*Rt+0],n=r&2097151;return[this._data[e*Rt+1],r&2097152?this._combined[e]:n?oc(n):"",r>>22,r&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,r){this._data[e*Rt+1]=r[0],r[1].length>1?(this._combined[e]=r[1],this._data[e*Rt+0]=e|2097152|r[2]<<22):this._data[e*Rt+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(e){return this._data[e*Rt+0]>>22}hasWidth(e){return this._data[e*Rt+0]&12582912}getFg(e){return this._data[e*Rt+1]}getBg(e){return this._data[e*Rt+2]}hasContent(e){return this._data[e*Rt+0]&4194303}getCodePoint(e){let r=this._data[e*Rt+0];return r&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):r&2097151}isCombined(e){return this._data[e*Rt+0]&2097152}getString(e){let r=this._data[e*Rt+0];return r&2097152?this._combined[e]:r&2097151?oc(r&2097151):""}isProtected(e){return this._data[e*Rt+2]&536870912}loadCell(e,r){return Tx=e*Rt,r.content=this._data[Tx+0],r.fg=this._data[Tx+1],r.bg=this._data[Tx+2],r.content&2097152&&(r.combinedData=this._combined[e]),r.bg&268435456&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){r.content&2097152&&(this._combined[e]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Rt+0]=r.content,this._data[e*Rt+1]=r.fg,this._data[e*Rt+2]=r.bg}setCellFromCodepoint(e,r,n,s){s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*Rt+0]=r|n<<22,this._data[e*Rt+1]=s.fg,this._data[e*Rt+2]=s.bg}addCodepointToCell(e,r,n){let s=this._data[e*Rt+0];s&2097152?this._combined[e]+=oc(r):s&2097151?(this._combined[e]=oc(s&2097151)+oc(r),s&=-2097152,s|=2097152):s=r|1<<22,n&&(s&=-12582913,s|=n<<22),this._data[e*Rt+0]=s}insertCells(e,r,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),r<this.length-e){let s=new Hi;for(let i=this.length-e-r-1;i>=0;--i)this.setCell(e+r+i,this.loadCell(e+i,s));for(let i=0;i<r;++i)this.setCell(e+i,n)}else for(let s=e;s<this.length;++s)this.setCell(s,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,r,n){if(e%=this.length,r<this.length-e){let s=new Hi;for(let i=0;i<this.length-e-r;++i)this.setCell(e+i,this.loadCell(e+r+i,s));for(let i=this.length-r;i<this.length;++i)this.setCell(i,n)}else for(let s=e;s<this.length;++s)this.setCell(s,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,r,n,s=!1){if(s){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,n);e<r&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,n);e<r&&e<this.length;)this.setCell(e++,n)}resize(e,r){if(e===this.length)return this._data.length*4*Gk<this._data.buffer.byteLength;let n=e*Rt;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let s=new Uint32Array(n);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,n);let s=Object.keys(this._combined);for(let a=0;a<s.length;a++){let l=parseInt(s[a],10);l>=e&&delete this._combined[l]}let i=Object.keys(this._extendedAttrs);for(let a=0;a<i.length;a++){let l=parseInt(i[a],10);l>=e&&delete this._extendedAttrs[l]}}return this.length=e,n*4*Gk<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Gk<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,r=!1){if(r){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,e);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let r in e._combined)this._combined[r]=e._combined[r];this._extendedAttrs={};for(let r in e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){let e=new lG(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let r in this._combined)e._combined[r]=this._combined[r];for(let r in this._extendedAttrs)e._extendedAttrs[r]=this._extendedAttrs[r];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Rt+0]&4194303)return e+(this._data[e*Rt+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Rt+0]&4194303||this._data[e*Rt+2]&50331648)return e+(this._data[e*Rt+0]>>22);return 0}copyCellsFrom(e,r,n,s,i){let a=e._data;if(i)for(let c=s-1;c>=0;c--){for(let d=0;d<Rt;d++)this._data[(n+c)*Rt+d]=a[(r+c)*Rt+d];a[(r+c)*Rt+2]&268435456&&(this._extendedAttrs[n+c]=e._extendedAttrs[r+c])}else for(let c=0;c<s;c++){for(let d=0;d<Rt;d++)this._data[(n+c)*Rt+d]=a[(r+c)*Rt+d];a[(r+c)*Rt+2]&268435456&&(this._extendedAttrs[n+c]=e._extendedAttrs[r+c])}let l=Object.keys(e._combined);for(let c=0;c<l.length;c++){let d=parseInt(l[c],10);d>=r&&(this._combined[d-r+n]=e._combined[d])}}translateToString(e,r,n,s){r=r??0,n=n??this.length,e&&(n=Math.min(n,this.getTrimmedLength())),s&&(s.length=0);let i="";for(;r<n;){let a=this._data[r*Rt+0],l=a&2097151,c=a&2097152?this._combined[r]:l?oc(l):fc;if(i+=c,s)for(let d=0;d<c.length;++d)s.push(r);r+=a>>22||1}return s&&s.push(r),i}};function FTe(t,e,r,n,s,i){let a=[];for(let l=0;l<t.length-1;l++){let c=l,d=t.get(++c);if(!d.isWrapped)continue;let f=[t.get(l)];for(;c<t.length&&d.isWrapped;)f.push(d),d=t.get(++c);if(!i&&n>=l&&n<c){l+=f.length-1;continue}let p=0,m=Ug(f,p,e),g=1,y=0;for(;g<f.length;){let w=Ug(f,g,e),_=w-y,S=r-m,k=Math.min(_,S);f[p].copyCellsFrom(f[g],y,m,k,!1),m+=k,m===r&&(p++,m=0),y+=k,y===w&&(g++,y=0),m===0&&p!==0&&f[p-1].getWidth(r-1)===2&&(f[p].copyCellsFrom(f[p-1],r-1,m++,1,!1),f[p-1].setCell(r-1,s))}f[p].replaceCells(m,r,s);let x=0;for(let w=f.length-1;w>0&&(w>p||f[w].getTrimmedLength()===0);w--)x++;x>0&&(a.push(l+f.length-x),a.push(x)),l+=f.length-1}return a}function zTe(t,e){let r=[],n=0,s=e[n],i=0;for(let a=0;a<t.length;a++)if(s===a){let l=e[++n];t.onDeleteEmitter.fire({index:a-i,amount:l}),a+=l-1,i+=l,s=e[++n]}else r.push(a);return{layout:r,countRemoved:i}}function UTe(t,e){let r=[];for(let n=0;n<e.length;n++)r.push(t.get(e[n]));for(let n=0;n<r.length;n++)t.set(n,r[n]);t.length=e.length}function VTe(t,e,r){let n=[],s=t.map((c,d)=>Ug(t,d,e)).reduce((c,d)=>c+d),i=0,a=0,l=0;for(;l<s;){if(s-l<r){n.push(s-l);break}i+=r;let c=Ug(t,a,e);i>c&&(i-=c,a++);let d=t[a].getWidth(i-1)===2;d&&i--;let f=d?r-1:r;n.push(f),l+=f}return n}function Ug(t,e,r){if(e===t.length-1)return t[e].getTrimmedLength();let n=!t[e].hasContent(r-1)&&t[e].getWidth(r-1)===1,s=t[e+1].getWidth(0)===2;return n&&s?r-1:r}var cG=class uG{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=uG._nextId++,this._onDispose=this.register(new We),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),sd(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};cG._nextId=1;var HTe=cG,Pn={},Cu=Pn.B;Pn[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Pn.A={"#":"£"};Pn.B=void 0;Pn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Pn.C=Pn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Pn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Pn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Pn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Pn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Pn.E=Pn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Pn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Pn.H=Pn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Pn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var UL=4294967295,VL=class{constructor(e,r,n){this._hasScrollback=e,this._optionsService=r,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=yn.clone(),this.savedCharset=Cu,this.markers=[],this._nullCell=Hi.fromCharData([0,NW,1,0]),this._whitespaceCell=Hi.fromCharData([0,fc,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new __,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new zL(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new g_),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new g_),this._whitespaceCell}getBlankLine(e,r){return new Im(this._bufferService.cols,this.getNullCell(e),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let r=e+this._optionsService.rawOptions.scrollback;return r>UL?UL:r}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=yn);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new zL(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,r){let n=this.getNullCell(yn),s=0,i=this._getCorrectBufferLength(r);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)s+=+this.lines.get(l).resize(e,n);let a=0;if(this._rows<r)for(let l=this._rows;l<r;l++)this.lines.length<r+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Im(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new Im(e,n)));else for(let l=this._rows;l>r;l--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let l=this.lines.length-i;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,r-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(e,r),this._cols>e))for(let a=0;a<this.lines.length;a++)s+=+this.lines.get(a).resize(e,n);this._cols=e,this._rows=r,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,r){this._cols!==e&&(e>this._cols?this._reflowLarger(e,r):this._reflowSmaller(e,r))}_reflowLarger(e,r){let n=this._optionsService.rawOptions.reflowCursorLine,s=FTe(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(yn),n);if(s.length>0){let i=zTe(this.lines,s);UTe(this.lines,i.layout),this._reflowLargerAdjustViewport(e,r,i.countRemoved)}}_reflowLargerAdjustViewport(e,r,n){let s=this.getNullCell(yn),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new Im(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,r){let n=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(yn),i=[],a=0;for(let l=this.lines.length-1;l>=0;l--){let c=this.lines.get(l);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let d=[c];for(;c.isWrapped&&l>0;)c=this.lines.get(--l),d.unshift(c);if(!n){let N=this.ybase+this.y;if(N>=l&&N<l+d.length)continue}let f=d[d.length-1].getTrimmedLength(),p=VTe(d,this._cols,e),m=p.length-d.length,g;this.ybase===0&&this.y!==this.lines.length-1?g=Math.max(0,this.y-this.lines.maxLength+m):g=Math.max(0,this.lines.length-this.lines.maxLength+m);let y=[];for(let N=0;N<m;N++){let j=this.getBlankLine(yn,!0);y.push(j)}y.length>0&&(i.push({start:l+d.length+a,newLines:y}),a+=y.length),d.push(...y);let x=p.length-1,w=p[x];w===0&&(x--,w=p[x]);let _=d.length-m-1,S=f;for(;_>=0;){let N=Math.min(S,w);if(d[x]===void 0)break;if(d[x].copyCellsFrom(d[_],S-N,w-N,N,!0),w-=N,w===0&&(x--,w=p[x]),S-=N,S===0){_--;let j=Math.max(_,0);S=Ug(d,j,this._cols)}}for(let N=0;N<d.length;N++)p[N]<e&&d[N].setCell(p[N],s);let k=m-g;for(;k-- >0;)this.ybase===0?this.y<r-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+m,this.ybase+r-1)}if(i.length>0){let l=[],c=[];for(let w=0;w<this.lines.length;w++)c.push(this.lines.get(w));let d=this.lines.length,f=d-1,p=0,m=i[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let g=0;for(let w=Math.min(this.lines.maxLength-1,d+a-1);w>=0;w--)if(m&&m.start>f+g){for(let _=m.newLines.length-1;_>=0;_--)this.lines.set(w--,m.newLines[_]);w++,l.push({index:f+1,amount:m.newLines.length}),g+=m.newLines.length,m=i[++p]}else this.lines.set(w,c[f--]);let y=0;for(let w=l.length-1;w>=0;w--)l[w].index+=y,this.lines.onInsertEmitter.fire(l[w]),y+=l[w].amount;let x=Math.max(0,d+a-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,r,n=0,s){let i=this.lines.get(e);return i?i.translateToString(r,n,s):""}getWrappedRangeForLine(e){let r=e,n=e;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:r,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===e&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let r=new HTe(e);return this.markers.push(r),r.register(this.lines.onTrim(n=>{r.line-=n,r.line<0&&r.dispose()})),r.register(this.lines.onInsert(n=>{r.line>=n.index&&(r.line+=n.amount)})),r.register(this.lines.onDelete(n=>{r.line>=n.index&&r.line<n.index+n.amount&&r.dispose(),r.line>n.index&&(r.line-=n.amount)})),r.register(r.onDispose(()=>this._removeMarker(r))),r}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},qTe=class extends Dt{constructor(e,r){super(),this._optionsService=e,this._bufferService=r,this._onBufferActivate=this._register(new We),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new VL(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new VL(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,r){this._normal.resize(e,r),this._alt.resize(e,r),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},dG=2,hG=1,_2=class extends Dt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new We),this.onResize=this._onResize.event,this._onScroll=this._register(new We),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,dG),this.rows=Math.max(e.rawOptions.rows||0,hG),this.buffers=this._register(new qTe(e,this)),this._register(this.buffers.onBufferActivate(r=>{this._onScroll.fire(r.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,r){let n=this.cols!==e,s=this.rows!==r;this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!1){let n=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=n.getBlankLine(e,r),this._cachedBlankLine=s),s.isWrapped=r;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;a===n.lines.length-1?l?n.lines.recycle().copyFrom(s):n.lines.push(s.clone()):n.lines.splice(a+1,0,s.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=a-i+1;n.lines.shiftElements(i+1,l-1,-1),n.lines.set(a,s.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,r){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(r||this._onScroll.fire(n.ydisp))}};_2=nn([et(0,qs)],_2);var ih={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:x_,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},WTe=["normal","bold","100","200","300","400","500","600","700","800","900"],GTe=class extends Dt{constructor(e){super(),this._onOptionChange=this._register(new We),this.onOptionChange=this._onOptionChange.event;let r={...ih};for(let n in e)if(n in r)try{let s=e[n];r[n]=this._sanitizeAndValidateOption(n,s)}catch(s){console.error(s)}this.rawOptions=r,this.options={...r},this._setupOptions(),this._register(zr(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,r){return this.onOptionChange(n=>{n===e&&r(this.rawOptions[e])})}onMultipleOptionChange(e,r){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&r()})}_setupOptions(){let e=n=>{if(!(n in ih))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},r=(n,s)=>{if(!(n in ih))throw new Error(`No option with key "${n}"`);s=this._sanitizeAndValidateOption(n,s),this.rawOptions[n]!==s&&(this.rawOptions[n]=s,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,r){switch(e){case"cursorStyle":if(r||(r=ih[e]),!KTe(r))throw new Error(`"${r}" is not a valid value for ${e}`);break;case"wordSeparator":r||(r=ih[e]);break;case"fontWeight":case"fontWeightBold":if(typeof r=="number"&&1<=r&&r<=1e3)break;r=WTe.includes(r)?r:ih[e];break;case"cursorWidth":r=Math.floor(r);case"lineHeight":case"tabStopWidth":if(r<1)throw new Error(`${e} cannot be less than 1, value: ${r}`);break;case"minimumContrastRatio":r=Math.max(1,Math.min(21,Math.round(r*10)/10));break;case"scrollback":if(r=Math.min(r,4294967295),r<0)throw new Error(`${e} cannot be less than 0, value: ${r}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(r<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${r}`);break;case"rows":case"cols":if(!r&&r!==0)throw new Error(`${e} must be numeric, value: ${r}`);break;case"windowsPty":r=r??{};break}return r}};function KTe(t){return t==="block"||t==="underline"||t==="bar"}function Lm(t,e=5){if(typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t)r[n]=e<=1?t[n]:t[n]&&Lm(t[n],e-1);return r}var HL=Object.freeze({insertMode:!1}),qL=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),b2=class extends Dt{constructor(e,r,n){super(),this._bufferService=e,this._logService=r,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new We),this.onData=this._onData.event,this._onUserInput=this._register(new We),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new We),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new We),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Lm(HL),this.decPrivateModes=Lm(qL)}reset(){this.modes=Lm(HL),this.decPrivateModes=Lm(qL)}triggerDataEvent(e,r=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onBinary.fire(e))}};b2=nn([et(0,Hs),et(1,DW),et(2,qs)],b2);var WL={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Kk(t,e){let r=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(r|=64,r|=t.action):(r|=t.button&3,t.button&4&&(r|=64),t.button&8&&(r|=128),t.action===32?r|=32:t.action===0&&!e&&(r|=3)),r}var Yk=String.fromCharCode,GL={DEFAULT:t=>{let e=[Kk(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Yk(e[0])}${Yk(e[1])}${Yk(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Kk(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Kk(t,!0)};${t.x};${t.y}${e}`}},w2=class extends Dt{constructor(e,r,n){super(),this._bufferService=e,this._coreService=r,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new We),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(WL))this.addProtocol(s,WL[s]);for(let s of Object.keys(GL))this.addEncoding(s,GL[s]);this.reset()}addProtocol(e,r){this._protocols[e]=r}addEncoding(e,r){this._encodings[e]=r}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,r,n){if(e.deltaY===0||e.shiftKey||r===void 0||n===void 0)return 0;let s=r/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=s+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,r){return r.altKey||r.ctrlKey||r.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let r=this._encodings[this._activeEncoding](e);return r&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(r):this._coreService.triggerDataEvent(r,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,r,n){if(n){if(e.x!==r.x||e.y!==r.y)return!1}else if(e.col!==r.col||e.row!==r.row)return!1;return!(e.button!==r.button||e.action!==r.action||e.ctrl!==r.ctrl||e.alt!==r.alt||e.shift!==r.shift)}};w2=nn([et(0,Hs),et(1,pd),et(2,qs)],w2);var Qk=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],YTe=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Cn;function QTe(t,e){let r=0,n=e.length-1,s;if(t<e[0][0]||t>e[n][1])return!1;for(;n>=r;)if(s=r+n>>1,t>e[s][1])r=s+1;else if(t<e[s][0])n=s-1;else return!0;return!1}var XTe=class{constructor(){if(this.version="6",!Cn){Cn=new Uint8Array(65536),Cn.fill(1),Cn[0]=0,Cn.fill(0,1,32),Cn.fill(0,127,160),Cn.fill(2,4352,4448),Cn[9001]=2,Cn[9002]=2,Cn.fill(2,11904,42192),Cn[12351]=1,Cn.fill(2,44032,55204),Cn.fill(2,63744,64256),Cn.fill(2,65040,65050),Cn.fill(2,65072,65136),Cn.fill(2,65280,65377),Cn.fill(2,65504,65511);for(let e=0;e<Qk.length;++e)Cn.fill(0,Qk[e][0],Qk[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Cn[e]:QTe(e,YTe)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,r){let n=this.wcwidth(e),s=n===0&&r!==0;if(s){let i=Uu.extractWidth(r);i===0?s=!1:i>n&&(n=i)}return Uu.createPropertyValue(0,n,s)}},Uu=class C0{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new We,this.onChange=this._onChange.event;let e=new XTe;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,r,n=!1){return(e&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let r=0,n=0,s=e.length;for(let i=0;i<s;++i){let a=e.charCodeAt(i);if(55296<=a&&a<=56319){if(++i>=s)return r+this.wcwidth(a);let d=e.charCodeAt(i);56320<=d&&d<=57343?a=(a-55296)*1024+d-56320+65536:r+=this.wcwidth(d)}let l=this.charProperties(a,n),c=C0.extractWidth(l);C0.extractShouldJoin(l)&&(c-=C0.extractWidth(n)),r+=c,n=l}return r}charProperties(e,r){return this._activeProvider.charProperties(e,r)}},ZTe=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,r){this._charsets[e]=r,this.glevel===e&&(this.charset=r)}};function KL(t){var n;let e=(n=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:n.get(t.cols-1),r=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);r&&e&&(r.isWrapped=e[3]!==0&&e[3]!==32)}var im=2147483647,JTe=256,fG=class S2{constructor(e=32,r=32){if(this.maxLength=e,this.maxSubParamsLength=r,r>JTe)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let r=new S2;if(!e.length)return r;for(let n=Array.isArray(e[0])?1:0;n<e.length;++n){let s=e[n];if(Array.isArray(s))for(let i=0;i<s.length;++i)r.addSubParam(s[i]);else r.addParam(s)}return r}clone(){let e=new S2(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let r=0;r<this.length;++r){e.push(this.params[r]);let n=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>im?im:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>im?im:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let r=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-r>0?this._subParams.subarray(r,n):null}getSubParamsAll(){let e={};for(let r=0;r<this.length;++r){let n=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-n>0&&(e[r]=this._subParams.slice(n,s))}return e}addDigit(e){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,s=n[r-1];n[r-1]=~s?Math.min(s*10+e,im):e}},am=[],eAe=class{constructor(){this._state=0,this._active=am,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,r){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(r),{dispose:()=>{let s=n.indexOf(r);s!==-1&&n.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=am}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=am,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||am,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,r,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Vb(e,r,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,r,n)}start(){this.reset(),this._state=1}put(e,r,n){if(this._state!==3){if(this._state===1)for(;r<n;){let s=e[r++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&n-r>0&&this._put(e,r,n)}}end(e,r=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,s=this._active.length-1,i=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=r,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;s>=0&&(n=this._active[s].end(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=am,this._id=-1,this._state=0}}},di=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,r,n){this._hitLimit||(this._data+=Vb(e,r,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let r=!1;if(this._hitLimit)r=!1;else if(e&&(r=this._handler(this._data),r instanceof Promise))return r.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,r}},om=[],tAe=class{constructor(){this._handlers=Object.create(null),this._active=om,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=om}registerHandler(e,r){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(r),{dispose:()=>{let s=n.indexOf(r);s!==-1&&n.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=om,this._ident=0}hook(e,r){if(this.reset(),this._ident=e,this._active=this._handlers[e]||om,!this._active.length)this._handlerFb(this._ident,"HOOK",r);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(r)}put(e,r,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Vb(e,r,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,r,n)}unhook(e,r=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,s=this._active.length-1,i=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=r,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;s>=0&&(n=this._active[s].unhook(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=om,this._ident=0}},$m=new fG;$m.addParam(0);var YL=class{constructor(e){this._handler=e,this._data="",this._params=$m,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():$m,this._data="",this._hitLimit=!1}put(e,r,n){this._hitLimit||(this._data+=Vb(e,r,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let r=!1;if(this._hitLimit)r=!1;else if(e&&(r=this._handler(this._data,this._params),r instanceof Promise))return r.then(n=>(this._params=$m,this._data="",this._hitLimit=!1,n));return this._params=$m,this._data="",this._hitLimit=!1,r}},rAe=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,r){this.table.fill(e<<4|r)}add(e,r,n,s){this.table[r<<8|e]=n<<4|s}addMany(e,r,n,s){for(let i=0;i<e.length;i++)this.table[r<<8|e[i]]=n<<4|s}},zi=160,nAe=function(){let t=new rAe(4095),e=Array.apply(null,Array(256)).map((l,c)=>c),r=(l,c)=>e.slice(l,c),n=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let i=r(0,14),a;t.setDefault(1,0),t.addMany(n,0,2,0);for(a in i)t.addMany([24,26,153,154],a,3,0),t.addMany(r(128,144),a,3,0),t.addMany(r(144,152),a,3,0),t.add(156,a,0,0),t.add(27,a,11,1),t.add(157,a,4,8),t.addMany([152,158,159],a,0,7),t.add(155,a,11,3),t.add(144,a,11,9);return t.addMany(s,0,3,0),t.addMany(s,1,3,1),t.add(127,1,0,1),t.addMany(s,8,0,8),t.addMany(s,3,3,3),t.add(127,3,0,3),t.addMany(s,4,3,4),t.add(127,4,0,4),t.addMany(s,6,3,6),t.addMany(s,5,3,5),t.add(127,5,0,5),t.addMany(s,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(n,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(r(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(n,7,0,7),t.addMany(s,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(r(64,127),3,7,0),t.addMany(r(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(r(48,60),4,8,4),t.addMany(r(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(r(32,64),6,0,6),t.add(127,6,0,6),t.addMany(r(64,127),6,0,0),t.addMany(r(32,48),3,9,5),t.addMany(r(32,48),5,9,5),t.addMany(r(48,64),5,0,6),t.addMany(r(64,127),5,7,0),t.addMany(r(32,48),4,9,5),t.addMany(r(32,48),1,9,2),t.addMany(r(32,48),2,9,2),t.addMany(r(48,127),2,10,0),t.addMany(r(48,80),1,10,0),t.addMany(r(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(r(96,127),1,10,0),t.add(80,1,11,9),t.addMany(s,9,0,9),t.add(127,9,0,9),t.addMany(r(28,32),9,0,9),t.addMany(r(32,48),9,9,12),t.addMany(r(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(s,11,0,11),t.addMany(r(32,128),11,0,11),t.addMany(r(28,32),11,0,11),t.addMany(s,10,0,10),t.add(127,10,0,10),t.addMany(r(28,32),10,0,10),t.addMany(r(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(r(32,48),10,9,12),t.addMany(s,12,0,12),t.add(127,12,0,12),t.addMany(r(28,32),12,0,12),t.addMany(r(32,48),12,9,12),t.addMany(r(48,64),12,0,11),t.addMany(r(64,127),12,12,13),t.addMany(r(64,127),10,12,13),t.addMany(r(64,127),9,12,13),t.addMany(s,13,13,13),t.addMany(n,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(zi,0,2,0),t.add(zi,8,5,8),t.add(zi,6,0,6),t.add(zi,11,0,11),t.add(zi,13,13,13),t}(),sAe=class extends Dt{constructor(e=nAe){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new fG,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,n,s)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,n)=>{},this._escHandlerFb=r=>{},this._errorHandlerFb=r=>r,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(zr(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new eAe),this._dcsParser=this._register(new tAe),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,r=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let a=e.intermediates.charCodeAt(i);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(r[0]>s||s>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return n<<=8,n|=s,n}identToString(e){let r=[];for(;e;)r.push(String.fromCharCode(e&255)),e>>=8;return r.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,r){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let s=this._escHandlers[n];return s.push(r),{dispose:()=>{let i=s.indexOf(r);i!==-1&&s.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,r){this._executeHandlers[e.charCodeAt(0)]=r}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,r){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let s=this._csiHandlers[n];return s.push(r),{dispose:()=>{let i=s.indexOf(r);i!==-1&&s.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,r){return this._dcsParser.registerHandler(this._identifier(e),r)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,r){return this._oscParser.registerHandler(e,r)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,r,n,s,i){this._parseStack.state=e,this._parseStack.handlers=r,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=i}parse(e,r,n){let s=0,i=0,a=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let c=this._parseStack.handlers,d=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&d>-1){for(;d>=0&&(l=c[d](this._params),l!==!0);d--)if(l instanceof Promise)return this._parseStack.handlerPos=d,l}this._parseStack.handlers=[];break;case 4:if(n===!1&&d>-1){for(;d>=0&&(l=c[d](),l!==!0);d--)if(l instanceof Promise)return this._parseStack.handlerPos=d,l}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(s!==24&&s!==26,n),l)return l;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],l=this._oscParser.end(s!==24&&s!==26,n),l)return l;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let c=a;c<r;++c){switch(s=e[c],i=this._transitions.table[this.currentState<<8|(s<160?s:zi)],i>>4){case 2:for(let g=c+1;;++g){if(g>=r||(s=e[g])<32||s>126&&s<zi){this._printHandler(e,c,g),c=g-1;break}if(++g>=r||(s=e[g])<32||s>126&&s<zi){this._printHandler(e,c,g),c=g-1;break}if(++g>=r||(s=e[g])<32||s>126&&s<zi){this._printHandler(e,c,g),c=g-1;break}if(++g>=r||(s=e[g])<32||s>126&&s<zi){this._printHandler(e,c,g),c=g-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:c,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let d=this._csiHandlers[this._collect<<8|s],f=d?d.length-1:-1;for(;f>=0&&(l=d[f](this._params),l!==!0);f--)if(l instanceof Promise)return this._preserveStack(3,d,f,i,c),l;f<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++c<r&&(s=e[c])>47&&s<60);c--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let p=this._escHandlers[this._collect<<8|s],m=p?p.length-1:-1;for(;m>=0&&(l=p[m](),l!==!0);m--)if(l instanceof Promise)return this._preserveStack(4,p,m,i,c),l;m<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let g=c+1;;++g)if(g>=r||(s=e[g])===24||s===26||s===27||s>127&&s<zi){this._dcsParser.put(e,c,g),c=g-1;break}break;case 14:if(l=this._dcsParser.unhook(s!==24&&s!==26),l)return this._preserveStack(6,[],0,i,c),l;s===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let g=c+1;;g++)if(g>=r||(s=e[g])<32||s>127&&s<zi){this._oscParser.put(e,c,g),c=g-1;break}break;case 6:if(l=this._oscParser.end(s!==24&&s!==26),l)return this._preserveStack(5,[],0,i,c),l;s===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},iAe=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,aAe=/^[\da-f]+$/;function QL(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let r=iAe.exec(e);if(r){let n=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/n*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/n*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/n*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),aAe.exec(e)&&[3,6,9,12].includes(e.length))){let r=e.length/3,n=[0,0,0];for(let s=0;s<3;++s){let i=parseInt(e.slice(r*s,r*s+r),16);n[s]=r===1?i<<4:r===2?i:r===3?i>>4:i>>8}return n}}function Xk(t,e){let r=t.toString(16),n=r.length<2?"0"+r:r;switch(e){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function oAe(t,e=16){let[r,n,s]=t;return`rgb:${Xk(r,e)}/${Xk(n,e)}/${Xk(s,e)}`}var lAe={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Xl=131072,XL=10;function ZL(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var JL=5e3,e$=0,cAe=class extends Dt{constructor(e,r,n,s,i,a,l,c,d=new sAe){super(),this._bufferService=e,this._charsetService=r,this._coreService=n,this._logService=s,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=l,this._unicodeService=c,this._parser=d,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new j2e,this._utf8Decoder=new T2e,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=yn.clone(),this._eraseAttrDataInternal=yn.clone(),this._onRequestBell=this._register(new We),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new We),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new We),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new We),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new We),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new We),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new We),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new We),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new We),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new We),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new We),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new We),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new We),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new k2(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:p.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,p,m)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:p,data:m})}),this._parser.setDcsHandlerFallback((f,p,m)=>{p==="HOOK"&&(m=m.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:p,payload:m})}),this._parser.setPrintHandler((f,p,m)=>this.print(f,p,m)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(Re.BEL,()=>this.bell()),this._parser.setExecuteHandler(Re.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Re.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Re.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Re.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Re.BS,()=>this.backspace()),this._parser.setExecuteHandler(Re.HT,()=>this.tab()),this._parser.setExecuteHandler(Re.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Re.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(k0.IND,()=>this.index()),this._parser.setExecuteHandler(k0.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(k0.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new di(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new di(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new di(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new di(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new di(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new di(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new di(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new di(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new di(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new di(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new di(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new di(f=>this.restoreCursorColor(f))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let f in Pn)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new YL((f,p)=>this.requestStatusString(f,p)))}getAttrData(){return this._curAttrData}_preserveStack(e,r,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=r,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((r,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),JL))]).catch(r=>{if(r!=="#SLOW_TIMEOUT")throw r;console.warn(`async parser handler taking longer than ${JL} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,r){let n,s=this._activeBuffer.x,i=this._activeBuffer.y,a=0,l=this._parseStack.paused;if(l){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,r))return this._logSlowResolvingAsync(n),n;s=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Xl&&(a=this._parseStack.position+Xl)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Xl&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Xl))),l||this._dirtyRowTracker.clearRange(),e.length>Xl)for(let f=a;f<e.length;f+=Xl){let p=f+Xl<e.length?f+Xl:e.length,m=typeof e=="string"?this._stringDecoder.decode(e.substring(f,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,p),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,m))return this._preserveStack(s,i,m,f),this._logSlowResolvingAsync(n),n}else if(!l){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(s,i,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let c=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),d=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);d<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(d,this._bufferService.rows-1),end:Math.min(c,this._bufferService.rows-1)})}print(e,r,n){let s,i,a=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,c=this._bufferService.cols,d=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,p=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-r>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let g=this._parser.precedingJoinState;for(let y=r;y<n;++y){if(s=e[y],s<127&&a){let S=a[String.fromCharCode(s)];S&&(s=S.charCodeAt(0))}let x=this._unicodeService.charProperties(s,g);i=Uu.extractWidth(x);let w=Uu.extractShouldJoin(x),_=w?Uu.extractWidth(g):0;if(g=x,l&&this._onA11yChar.fire(oc(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-_>c){if(d){let S=m,k=this._activeBuffer.x-_;for(this._activeBuffer.x=_,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),_>0&&m instanceof Im&&m.copyCellsFrom(S,k,0,_,!1);k<c;)S.setCellFromCodepoint(k++,0,1,p)}else if(this._activeBuffer.x=c-1,i===2)continue}if(w&&this._activeBuffer.x){let S=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-S,s,i);for(let k=i-_;--k>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(f&&(m.insertCells(this._activeBuffer.x,i-_,this._activeBuffer.getNullCell(p)),m.getWidth(c-1)===2&&m.setCellFromCodepoint(c-1,0,1,p)),m.setCellFromCodepoint(this._activeBuffer.x++,s,i,p),i>0)for(;--i;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=g,this._activeBuffer.x<c&&n-r>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,r){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>ZL(n.params[0],this._optionsService.rawOptions.windowOptions)?r(n):!0):this._parser.registerCsiHandler(e,r)}registerDcsHandler(e,r){return this._parser.registerDcsHandler(e,new YL(r))}registerEscHandler(e,r){return this._parser.registerEscHandler(e,r)}registerOscHandler(e,r){return this._parser.registerOscHandler(e,new di(r))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);r.hasWidth(this._activeBuffer.x)&&!r.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,r){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+r):(this._activeBuffer.x=e,this._activeBuffer.y=r),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,r){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+r)}cursorUp(e){let r=this._activeBuffer.y-this._activeBuffer.scrollTop;return r>=0?this._moveCursor(0,-Math.min(r,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let r=this._activeBuffer.scrollBottom-this._activeBuffer.y;return r>=0?this._moveCursor(0,Math.min(r,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let r=e.params[0];return r===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:r===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let r=e.params[0]||1;for(;r--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let r=e.params[0]||1;for(;r--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let r=e.params[0];return r===1&&(this._curAttrData.bg|=536870912),(r===2||r===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,r,n,s=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(r,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),s&&(a.isWrapped=!1)}_resetBufferLine(e,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),r),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,r=!1){var s;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,r);n<this._bufferService.rows;n++)this._resetBufferLine(n,r);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,r),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,r);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&s.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,r);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,r=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,r);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,r);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,r);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let r=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;r--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let r=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;r--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return r&&(r.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return r&&(r.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let r=e.params[0]||1;for(;r--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let r=e.params[0]||1;for(;r--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(yn));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(0,r,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(0,r,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(this._activeBuffer.x,r,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(this._activeBuffer.x,r,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return r&&(r.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let r=this._parser.precedingJoinState;if(!r)return!0;let n=e.params[0]||1,s=Uu.extractWidth(r),i=this._activeBuffer.x-s,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),l=new Uint32Array(a.length*n),c=0;for(let f=0;f<a.length;){let p=a.codePointAt(f)||0;l[c++]=p,f+=p>65535?2:1}let d=c;for(let f=1;f<n;++f)l.copyWithin(d,0,c),d+=c;return this.print(l,0,d),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Re.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Re.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Re.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Re.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Re.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let r=0;r<e.length;r++)switch(e.params[r]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let r=0;r<e.length;r++)switch(e.params[r]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Cu),this._charsetService.setgCharset(1,Cu),this._charsetService.setgCharset(2,Cu),this._charsetService.setgCharset(3,Cu);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let r=0;r<e.length;r++)switch(e.params[r]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let r=0;r<e.length;r++)switch(e.params[r]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[r]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,r){(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let s=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,l=this._coreService,{buffers:c,cols:d}=this._bufferService,{active:f,alt:p}=c,m=this._optionsService.rawOptions,g=(w,_)=>(l.triggerDataEvent(`${Re.ESC}[${r?"":"?"}${w};${_}$y`),!0),y=w=>w?1:2,x=e.params[0];return r?x===2?g(x,4):x===4?g(x,y(l.modes.insertMode)):x===12?g(x,3):x===20?g(x,y(m.convertEol)):g(x,0):x===1?g(x,y(s.applicationCursorKeys)):x===3?g(x,m.windowOptions.setWinLines?d===80?2:d===132?1:0:0):x===6?g(x,y(s.origin)):x===7?g(x,y(s.wraparound)):x===8?g(x,3):x===9?g(x,y(i==="X10")):x===12?g(x,y(m.cursorBlink)):x===25?g(x,y(!l.isCursorHidden)):x===45?g(x,y(s.reverseWraparound)):x===66?g(x,y(s.applicationKeypad)):x===67?g(x,4):x===1e3?g(x,y(i==="VT200")):x===1002?g(x,y(i==="DRAG")):x===1003?g(x,y(i==="ANY")):x===1004?g(x,y(s.sendFocus)):x===1005?g(x,4):x===1006?g(x,y(a==="SGR")):x===1015?g(x,4):x===1016?g(x,y(a==="SGR_PIXELS")):x===1048?g(x,1):x===47||x===1047||x===1049?g(x,y(f===p)):x===2004?g(x,y(s.bracketedPasteMode)):x===2026?g(x,y(s.synchronizedOutput)):g(x,0)}_updateAttrColor(e,r,n,s,i){return r===2?(e|=50331648,e&=-16777216,e|=Cv.fromColorRGB([n,s,i])):r===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,r,n){let s=[0,0,-1,0,0,0],i=0,a=0;do{if(s[a+i]=e.params[r+a],e.hasSubParams(r+a)){let l=e.getSubParams(r+a),c=0;do s[1]===5&&(i=1),s[a+c+1+i]=l[c];while(++c<l.length&&c+a+1+i<s.length);break}if(s[1]===5&&a+i>=2||s[1]===2&&a+i>=5)break;s[1]&&(i=1)}while(++a+r<e.length&&a+i<s.length);for(let l=2;l<s.length;++l)s[l]===-1&&(s[l]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[5])}return a}_processUnderline(e,r){r.extended=r.extended.clone(),(!~e||e>5)&&(e=1),r.extended.underlineStyle=e,r.fg|=268435456,e===0&&(r.fg&=-268435457),r.updateExtended()}_processSGR0(e){e.fg=yn.fg,e.bg=yn.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let r=e.length,n,s=this._curAttrData;for(let i=0;i<r;i++)n=e.params[i],n>=30&&n<=37?(s.fg&=-50331904,s.fg|=16777216|n-30):n>=40&&n<=47?(s.bg&=-50331904,s.bg|=16777216|n-40):n>=90&&n<=97?(s.fg&=-50331904,s.fg|=16777216|n-90|8):n>=100&&n<=107?(s.bg&=-50331904,s.bg|=16777216|n-100|8):n===0?this._processSGR0(s):n===1?s.fg|=134217728:n===3?s.bg|=67108864:n===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,s)):n===5?s.fg|=536870912:n===7?s.fg|=67108864:n===8?s.fg|=1073741824:n===9?s.fg|=2147483648:n===2?s.bg|=134217728:n===21?this._processUnderline(2,s):n===22?(s.fg&=-134217729,s.bg&=-134217729):n===23?s.bg&=-67108865:n===24?(s.fg&=-268435457,this._processUnderline(0,s)):n===25?s.fg&=-536870913:n===27?s.fg&=-67108865:n===28?s.fg&=-1073741825:n===29?s.fg&=2147483647:n===39?(s.fg&=-67108864,s.fg|=yn.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=yn.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,s):n===53?s.bg|=1073741824:n===55?s.bg&=-1073741825:n===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):n===100?(s.fg&=-67108864,s.fg|=yn.fg&16777215,s.bg&=-67108864,s.bg|=yn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Re.ESC}[0n`);break;case 6:let r=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Re.ESC}[${r};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let r=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Re.ESC}[?${r};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=yn.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let r=e.length===0?1:e.params[0];if(r===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(r){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=r%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let r=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>r&&(this._activeBuffer.scrollTop=r-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!ZL(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let r=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:r!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Re.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(r===0||r===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>XL&&this._windowTitleStack.shift()),(r===0||r===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>XL&&this._iconNameStack.shift());break;case 23:(r===0||r===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(r===0||r===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let r=[],n=e.split(";");for(;n.length>1;){let s=n.shift(),i=n.shift();if(/^\d+$/.exec(s)){let a=parseInt(s);if(t$(a))if(i==="?")r.push({type:0,index:a});else{let l=QL(i);l&&r.push({type:1,index:a,color:l})}}}return r.length&&this._onColor.fire(r),!0}setHyperlink(e){let r=e.indexOf(";");if(r===-1)return!0;let n=e.slice(0,r).trim(),s=e.slice(r+1);return s?this._createHyperlink(n,s):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,r){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),s,i=n.findIndex(a=>a.startsWith("id="));return i!==-1&&(s=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:r}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,r){let n=e.split(";");for(let s=0;s<n.length&&!(r>=this._specialColors.length);++s,++r)if(n[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[r]}]);else{let i=QL(n[s]);i&&this._onColor.fire([{type:1,index:this._specialColors[r],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let r=[],n=e.split(";");for(let s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let i=parseInt(n[s]);t$(i)&&r.push({type:2,index:i})}return r.length&&this._onColor.fire(r),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Cu),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(lAe[e[0]],Pn[e[1]]||Cu),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=yn.clone(),this._eraseAttrDataInternal=yn.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Hi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let r=0;r<this._bufferService.rows;++r){let n=this._activeBuffer.ybase+this._activeBuffer.y+r,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,r){let n=l=>(this._coreService.triggerDataEvent(`${Re.ESC}${l}${Re.ESC}\\`),!0),s=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,r){this._dirtyRowTracker.markRangeDirty(e,r)}},k2=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,r){e>r&&(e$=e,e=r,r=e$),e<this.start&&(this.start=e),r>this.end&&(this.end=r)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};k2=nn([et(0,Hs)],k2);function t$(t){return 0<=t&&t<256}var uAe=5e7,r$=12,dAe=50,hAe=class extends Dt{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new We),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,r){if(r!==void 0&&this._syncCalls>r){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,r){if(this._pendingData>uAe)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(r),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(r)}_innerWrite(e=0,r=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],i=this._action(s,r);if(i){let l=c=>performance.now()-n>=r$?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(n,c);i.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(l);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-n>=r$)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>dAe&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},E2=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let r=this._bufferService.buffer;if(e.id===void 0){let c=r.addMarker(r.ybase+r.y),d={data:e,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(d,c)),this._dataByLinkId.set(d.id,d),d.id}let n=e,s=this._getEntryIdKey(n),i=this._entriesWithId.get(s);if(i)return this.addLineToLink(i.id,r.ybase+r.y),i.id;let a=r.addMarker(r.ybase+r.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,r){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(s=>s.line!==r)){let s=this._bufferService.buffer.addMarker(r);n.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(n,s))}}getLinkData(e){var r;return(r=this._dataByLinkId.get(e))==null?void 0:r.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,r){let n=e.lines.indexOf(r);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};E2=nn([et(0,Hs)],E2);var n$=!1,fAe=class extends Dt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new af),this._onBinary=this._register(new We),this.onBinary=this._onBinary.event,this._onData=this._register(new We),this.onData=this._onData.event,this._onLineFeed=this._register(new We),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new We),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new We),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new We),this._instantiationService=new LTe,this.optionsService=this._register(new GTe(e)),this._instantiationService.setService(qs,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(_2)),this._instantiationService.setService(Hs,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(x2)),this._instantiationService.setService(DW,this._logService),this.coreService=this._register(this._instantiationService.createInstance(b2)),this._instantiationService.setService(pd,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(w2)),this._instantiationService.setService(RW,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Uu)),this._instantiationService.setService(O2e,this.unicodeService),this._charsetService=this._instantiationService.createInstance(ZTe),this._instantiationService.setService(D2e,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(E2),this._instantiationService.setService(OW,this._oscLinkService),this._inputHandler=this._register(new cAe(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ls.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ls.forward(this._bufferService.onResize,this._onResize)),this._register(ls.forward(this.coreService.onData,this._onData)),this._register(ls.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new hAe((r,n)=>this._inputHandler.parse(r,n))),this._register(ls.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new We),this._onScroll.event(e=>{var r;(r=this._onScrollApi)==null||r.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let r in e)this.optionsService.options[r]=e[r]}write(e,r){this._writeBuffer.write(e,r)}writeSync(e,r){this._logService.logLevel<=3&&!n$&&(this._logService.warn("writeSync is unreliable and will be removed soon."),n$=!0),this._writeBuffer.writeSync(e,r)}input(e,r=!0){this.coreService.triggerDataEvent(e,r)}resize(e,r){isNaN(e)||isNaN(r)||(e=Math.max(e,dG),r=Math.max(r,hG),this._bufferService.resize(e,r))}scroll(e,r=!1){this._bufferService.scroll(e,r)}scrollLines(e,r){this._bufferService.scrollLines(e,r)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let r=e-this._bufferService.buffer.ydisp;r!==0&&this.scrollLines(r)}registerEscHandler(e,r){return this._inputHandler.registerEscHandler(e,r)}registerDcsHandler(e,r){return this._inputHandler.registerDcsHandler(e,r)}registerCsiHandler(e,r){return this._inputHandler.registerCsiHandler(e,r)}registerOscHandler(e,r){return this._inputHandler.registerOscHandler(e,r)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,r=this.optionsService.rawOptions.windowsPty;r&&r.buildNumber!==void 0&&r.buildNumber!==void 0?e=r.backend==="conpty"&&r.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(KL.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(KL(this._bufferService),!1))),this._windowsWrappingHeuristics.value=zr(()=>{for(let r of e)r.dispose()})}}},pAe={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function mAe(t,e,r,n){var a;let s={type:0,cancel:!1,key:void 0},i=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?s.key=Re.ESC+"OA":s.key=Re.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?s.key=Re.ESC+"OD":s.key=Re.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?s.key=Re.ESC+"OC":s.key=Re.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?s.key=Re.ESC+"OB":s.key=Re.ESC+"[B");break;case 8:s.key=t.ctrlKey?"\b":Re.DEL,t.altKey&&(s.key=Re.ESC+s.key);break;case 9:if(t.shiftKey){s.key=Re.ESC+"[Z";break}s.key=Re.HT,s.cancel=!0;break;case 13:s.key=t.altKey?Re.ESC+Re.CR:Re.CR,s.cancel=!0;break;case 27:s.key=Re.ESC,t.altKey&&(s.key=Re.ESC+Re.ESC),s.cancel=!0;break;case 37:if(t.metaKey)break;i?s.key=Re.ESC+"[1;"+(i+1)+"D":e?s.key=Re.ESC+"OD":s.key=Re.ESC+"[D";break;case 39:if(t.metaKey)break;i?s.key=Re.ESC+"[1;"+(i+1)+"C":e?s.key=Re.ESC+"OC":s.key=Re.ESC+"[C";break;case 38:if(t.metaKey)break;i?s.key=Re.ESC+"[1;"+(i+1)+"A":e?s.key=Re.ESC+"OA":s.key=Re.ESC+"[A";break;case 40:if(t.metaKey)break;i?s.key=Re.ESC+"[1;"+(i+1)+"B":e?s.key=Re.ESC+"OB":s.key=Re.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(s.key=Re.ESC+"[2~");break;case 46:i?s.key=Re.ESC+"[3;"+(i+1)+"~":s.key=Re.ESC+"[3~";break;case 36:i?s.key=Re.ESC+"[1;"+(i+1)+"H":e?s.key=Re.ESC+"OH":s.key=Re.ESC+"[H";break;case 35:i?s.key=Re.ESC+"[1;"+(i+1)+"F":e?s.key=Re.ESC+"OF":s.key=Re.ESC+"[F";break;case 33:t.shiftKey?s.type=2:t.ctrlKey?s.key=Re.ESC+"[5;"+(i+1)+"~":s.key=Re.ESC+"[5~";break;case 34:t.shiftKey?s.type=3:t.ctrlKey?s.key=Re.ESC+"[6;"+(i+1)+"~":s.key=Re.ESC+"[6~";break;case 112:i?s.key=Re.ESC+"[1;"+(i+1)+"P":s.key=Re.ESC+"OP";break;case 113:i?s.key=Re.ESC+"[1;"+(i+1)+"Q":s.key=Re.ESC+"OQ";break;case 114:i?s.key=Re.ESC+"[1;"+(i+1)+"R":s.key=Re.ESC+"OR";break;case 115:i?s.key=Re.ESC+"[1;"+(i+1)+"S":s.key=Re.ESC+"OS";break;case 116:i?s.key=Re.ESC+"[15;"+(i+1)+"~":s.key=Re.ESC+"[15~";break;case 117:i?s.key=Re.ESC+"[17;"+(i+1)+"~":s.key=Re.ESC+"[17~";break;case 118:i?s.key=Re.ESC+"[18;"+(i+1)+"~":s.key=Re.ESC+"[18~";break;case 119:i?s.key=Re.ESC+"[19;"+(i+1)+"~":s.key=Re.ESC+"[19~";break;case 120:i?s.key=Re.ESC+"[20;"+(i+1)+"~":s.key=Re.ESC+"[20~";break;case 121:i?s.key=Re.ESC+"[21;"+(i+1)+"~":s.key=Re.ESC+"[21~";break;case 122:i?s.key=Re.ESC+"[23;"+(i+1)+"~":s.key=Re.ESC+"[23~";break;case 123:i?s.key=Re.ESC+"[24;"+(i+1)+"~":s.key=Re.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?s.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?s.key=Re.NUL:t.keyCode>=51&&t.keyCode<=55?s.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?s.key=Re.DEL:t.keyCode===219?s.key=Re.ESC:t.keyCode===220?s.key=Re.FS:t.keyCode===221&&(s.key=Re.GS);else if((!r||n)&&t.altKey&&!t.metaKey){let l=(a=pAe[t.keyCode])==null?void 0:a[t.shiftKey?1:0];if(l)s.key=Re.ESC+l;else if(t.keyCode>=65&&t.keyCode<=90){let c=t.ctrlKey?t.keyCode-64:t.keyCode+32,d=String.fromCharCode(c);t.shiftKey&&(d=d.toUpperCase()),s.key=Re.ESC+d}else if(t.keyCode===32)s.key=Re.ESC+(t.ctrlKey?Re.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let c=t.code.slice(3,4);t.shiftKey||(c=c.toLowerCase()),s.key=Re.ESC+c,s.cancel=!0}}else r&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(s.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?s.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(s.key=Re.US),t.key==="@"&&(s.key=Re.NUL));break}return s}var an=0,gAe=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new __,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new __,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,a)=>this._getKey(i)-this._getKey(a)),r=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<s.length;i++)n>=this._array.length||this._getKey(e[r])<=this._getKey(this._array[n])?(s[i]=e[r],r++):s[i]=this._array[n++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let r=this._getKey(e);if(r===void 0||(an=this._search(r),an===-1)||this._getKey(this._array[an])!==r)return!1;do if(this._array[an]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(an),!0;while(++an<this._array.length&&this._getKey(this._array[an])===r);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,a)=>i-a),r=0,n=new Array(this._array.length-e.length),s=0;for(let i=0;i<this._array.length;i++)e[r]===i?r++:n[s++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(an=this._search(e),!(an<0||an>=this._array.length)&&this._getKey(this._array[an])===e))do yield this._array[an];while(++an<this._array.length&&this._getKey(this._array[an])===e)}forEachByKey(e,r){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(an=this._search(e),!(an<0||an>=this._array.length)&&this._getKey(this._array[an])===e))do r(this._array[an]);while(++an<this._array.length&&this._getKey(this._array[an])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let r=0,n=this._array.length-1;for(;n>=r;){let s=r+n>>1,i=this._getKey(this._array[s]);if(i>e)n=s-1;else if(i<e)r=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return r}},Zk=0,s$=0,vAe=class extends Dt{constructor(){super(),this._decorations=new gAe(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new We),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new We),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(zr(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let r=new yAe(e);if(r){let n=r.marker.onDispose(()=>r.dispose()),s=r.onDispose(()=>{s.dispose(),r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),n.dispose())});this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,r,n){let s=0,i=0;for(let a of this._decorations.getKeyIterator(r))s=a.options.x??0,i=s+(a.options.width??1),e>=s&&e<i&&(!n||(a.options.layer??"bottom")===n)&&(yield a)}forEachDecorationAtCell(e,r,n,s){this._decorations.forEachByKey(r,i=>{Zk=i.options.x??0,s$=Zk+(i.options.width??1),e>=Zk&&e<s$&&(!n||(i.options.layer??"bottom")===n)&&s(i)})}},yAe=class extends bc{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new We),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new We),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Wr.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Wr.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},xAe=1e3,_Ae=class{constructor(e,r=xAe){this._renderCallback=e,this._debounceThresholdMS=r,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,r,n){this._rowCount=n,e=e!==void 0?e:0,r=r!==void 0?r:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,r):r;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=s-this._lastRefreshMs,a=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),r=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,r)}},i$=20,b_=class extends Dt{constructor(e,r,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new _Ae(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
||
`))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(_t(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(zr(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let r=0;r<e;r++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<i$+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
||
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===i$+1&&(this._liveRegion.textContent+=qN.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,r){this._liveRegionDebouncer.refresh(e,r,this._terminal.rows)}_renderRows(e,r){let n=this._terminal.buffer,s=n.lines.length.toString();for(let i=e;i<=r;i++){let a=n.lines.get(n.ydisp+i),l=[],c=(a==null?void 0:a.translateToString(!0,void 0,void 0,l))||"",d=(n.ydisp+i+1).toString(),f=this._rowElements[i];f&&(c.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=c,this._rowColumns.set(f,l)),f.setAttribute("aria-posinset",d),f.setAttribute("aria-setsize",s),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,r){let n=e.target,s=this._rowElements[r===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),a=r===0?"1":`${this._terminal.buffer.lines.length}`;if(i===a||e.relatedTarget!==s)return;let l,c;if(r===0?(l=n,c=this._rowElements.pop(),this._rowContainer.removeChild(c)):(l=this._rowElements.shift(),c=n,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),c.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){let d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{let d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var c;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let r={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((r.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===n.node&&r.offset>n.offset)&&([r,n]=[n,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;let s=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:s,offset:((c=s.textContent)==null?void 0:c.length)??0}),!this._rowContainer.contains(n.node))return;let i=({node:d,offset:f})=>{let p=d instanceof Text?d.parentNode:d,m=parseInt(p==null?void 0:p.getAttribute("aria-posinset"),10)-1;if(isNaN(m))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(p);if(!g)return console.warn("columns is null. Race condition?"),null;let y=f<g.length?g[f]:g.slice(-1)[0]+1;return y>=this._terminal.cols&&(++m,y=0),{row:m,column:y}},a=i(r),l=i(n);if(!(!a||!l)){if(a.row>l.row||a.row===l.row&&a.column>=l.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(l.row-a.row)*this._terminal.cols-a.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,a;e.style.transform="";let r=e.getBoundingClientRect().width,n=(a=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:a[0];if(!n)return;let s=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/r})`}};b_=nn([et(1,nR),et(2,wl),et(3,Sl)],b_);var C2=class extends Dt{constructor(e,r,n,s,i){super(),this._element=e,this._mouseService=r,this._renderService=n,this._bufferService=s,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new We),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new We),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(zr(()=>{var a;sd(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(_t(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(_t(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(_t(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(_t(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let r=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!r)return;this._isMouseOut=!1;let n=e.composedPath();for(let s=0;s<n.length;s++){let i=n[s];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||r.x!==this._lastBufferCell.x||r.y!==this._lastBufferCell.y)&&(this._handleHover(r),this._lastBufferCell=r)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,r){var s,i;(!this._activeProviderReplies||!r)&&((s=this._activeProviderReplies)==null||s.forEach(a=>{a==null||a.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[a,l]of this._linkProviderService.linkProviders.entries())r?(i=this._activeProviderReplies)!=null&&i.get(a)&&(n=this._checkLinkProviderResult(a,e,n)):l.provideLinks(e.y,c=>{var f,p;if(this._isMouseOut)return;let d=c==null?void 0:c.map(m=>({link:m}));(f=this._activeProviderReplies)==null||f.set(a,d),n=this._checkLinkProviderResult(a,e,n),((p=this._activeProviderReplies)==null?void 0:p.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,r){let n=new Set;for(let s=0;s<r.size;s++){let i=r.get(s);if(i)for(let a=0;a<i.length;a++){let l=i[a],c=l.link.range.start.y<e?0:l.link.range.start.x,d=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let f=c;f<=d;f++){if(n.has(f)){i.splice(a--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,r,n){var a;if(!this._activeProviderReplies)return n;let s=this._activeProviderReplies.get(e),i=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(i=!0);if(!i&&s){let l=s.find(c=>this._linkAtPosition(c.link,r));l&&(n=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let l=0;l<this._activeProviderReplies.size;l++){let c=(a=this._activeProviderReplies.get(l))==null?void 0:a.find(d=>this._linkAtPosition(d.link,r));if(c){n=!0,this._handleNewLink(c);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let r=this._positionFromMouseEvent(e,this._element,this._mouseService);r&&this._mouseDownLink&&bAe(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,r)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,r){!this._currentLink||!this._lastMouseEvent||(!e||!r||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=r)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,sd(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(e.link,r)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.pointerCursor},set:n=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline},set:n=>{var s,i,a;(s=this._currentLink)!=null&&s.state&&((a=(i=this._currentLink)==null?void 0:i.state)==null?void 0:a.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let s=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(s,i),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,r,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),r.hover&&r.hover(n,r.text)}_fireUnderlineEvent(e,r){let n=e.range,s=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(r?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,r,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),r.leave&&r.leave(n,r.text)}_linkAtPosition(e,r){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,i=r.y*this._bufferService.cols+r.x;return n<=i&&i<=s}_positionFromMouseEvent(e,r,n){let s=n.getCoords(e,r,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,r,n,s,i){return{x1:e,y1:r,x2:n,y2:s,cols:this._bufferService.cols,fg:i}}};C2=nn([et(1,sR),et(2,Sl),et(3,Hs),et(4,MW)],C2);function bAe(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var wAe=class extends fAe{constructor(e={}){super(e),this._linkifier=this._register(new af),this.browser=eG,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new af),this._onCursorMove=this._register(new We),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new We),this.onKey=this._onKey.event,this._onRender=this._register(new We),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new We),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new We),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new We),this.onBell=this._onBell.event,this._onFocus=this._register(new We),this._onBlur=this._register(new We),this._onA11yCharEmitter=this._register(new We),this._onA11yTabEmitter=this._register(new We),this._onWillOpen=this._register(new We),this._setup(),this._decorationService=this._instantiationService.createInstance(vAe),this._instantiationService.setService(Nv,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(dTe),this._instantiationService.setService(MW,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(GN)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(r=>this.refresh((r==null?void 0:r.start)??0,(r==null?void 0:r.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(r=>this._reportWindowsOptions(r))),this._register(this._inputHandler.onColor(r=>this._handleColorEvent(r))),this._register(ls.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ls.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ls.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ls.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(r=>this._afterResize(r.cols,r.rows))),this._register(zr(()=>{var r,n;this._customKeyEventHandler=void 0,(n=(r=this.element)==null?void 0:r.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let r of e){let n,s="";switch(r.index){case 256:n="foreground",s="10";break;case 257:n="background",s="11";break;case 258:n="cursor",s="12";break;default:n="ansi",s="4;"+r.index}switch(r.type){case 0:let i=Rr.toColorRGB(n==="ansi"?this._themeService.colors.ansi[r.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${Re.ESC}]${s};${oAe(i)}${ZW.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(a=>a.ansi[r.index]=_n.toColor(...r.color));else{let a=n;this._themeService.modifyColors(l=>l[a]=_n.toColor(...r.color))}break;case 2:this._themeService.restoreColor(r.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(b_,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Re.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Re.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,r=this.buffer.lines.get(e);if(!r)return;let n=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,i=r.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,l=this.buffer.y*this._renderService.dimensions.css.cell.height,c=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=c+"px",this.textarea.style.top=l+"px",this.textarea.style.width=a+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(_t(this.element,"copy",r=>{this.hasSelection()&&C2e(r,this._selectionService)}));let e=r=>N2e(r,this.textarea,this.coreService,this.optionsService);this._register(_t(this.textarea,"paste",e)),this._register(_t(this.element,"paste",e)),tG?this._register(_t(this.element,"mousedown",r=>{r.button===2&&pL(r,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(_t(this.element,"contextmenu",r=>{pL(r,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),hR&&this._register(_t(this.element,"auxclick",r=>{r.button===1&&CW(r,this.textarea,this.screenElement)}))}_bindKeys(){this._register(_t(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(_t(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(_t(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(_t(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(_t(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(_t(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(_t(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let r=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(_t(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",HN.get()),sG||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(cTe,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(wl,this._coreBrowserService),this._register(_t(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(_t(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p2,this._document,this._helperContainer),this._instantiationService.setService(Hb,this._charSizeService),this._themeService=this._instantiationService.createInstance(y2),this._instantiationService.setService($f,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(y_),this._instantiationService.setService(PW,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(g2,this.rows,this.screenElement)),this._instantiationService.setService(Sl,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d2,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(m2),this._instantiationService.setService(sR,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(C2,this.screenElement));this.element.appendChild(r);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(c2,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(v2,this.element,this.screenElement,s)),this._instantiationService.setService(M2e,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(ls.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(u2,this.screenElement)),this._register(_t(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(b_,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(v_,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(v_,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f2,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,r=this.element;function n(a){var f,p,m,g,y;let l=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!l)return!1;let c,d;switch(a.overrideType||a.type){case"mousemove":d=32,a.buttons===void 0?(c=3,a.button!==void 0&&(c=a.button<3?a.button:3)):c=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":d=0,c=a.button<3?a.button:3;break;case"mousedown":d=1,c=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let x=a.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(a,(g=(m=(p=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:p.device)==null?void 0:m.cell)==null?void 0:g.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;d=x<0?0:1,c=4;break;default:return!1}return d===void 0||c===void 0||c>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:c,action:d,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:a=>(n(a),a.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(a)),wheel:a=>(n(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&n(a)},mousemove:a=>{a.buttons||n(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),a&8?s.mousemove||(r.addEventListener("mousemove",i.mousemove),s.mousemove=i.mousemove):(r.removeEventListener("mousemove",s.mousemove),s.mousemove=null),a&16?s.wheel||(r.addEventListener("wheel",i.wheel,{passive:!1}),s.wheel=i.wheel):(r.removeEventListener("wheel",s.wheel),s.wheel=null),a&2?s.mouseup||(s.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),a&4?s.mousedrag||(s.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(_t(r,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return n(a),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(a)})),this._register(_t(r,"wheel",a=>{var l,c,d,f,p;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(f=(d=(c=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:c.device)==null?void 0:d.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return this.cancel(a,!0);let m=Re.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(m,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,r){var n;(n=this._renderService)==null||n.refreshRows(e,r)}updateCursorStyle(e){var r;(r=this._selectionService)!=null&&r.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,r){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,r),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let r=e-this._bufferService.buffer.ydisp;r!==0&&this.scrollLines(r)}paste(e){EW(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let r=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),r}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,r,n){this._selectionService.setSelection(e,r,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,r){var n;(n=this._selectionService)==null||n.selectLines(e,r)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let r=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!r&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!r&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=mAe(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let s=this.rows-1;return this.scrollLines(n.type===2?-s:s),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Re.ETX||n.key===Re.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,r){let n=e.isMac&&!this.options.macOptionIsMeta&&r.altKey&&!r.ctrlKey&&!r.metaKey||e.isWindows&&r.altKey&&r.ctrlKey&&!r.metaKey||e.isWindows&&r.getModifierState("AltGraph");return r.type==="keypress"?n:n&&(!r.keyCode||r.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(SAe(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let r;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)r=e.charCode;else if(e.which===null||e.which===void 0)r=e.keyCode;else if(e.which!==0&&e.charCode!==0)r=e.which;else return!1;return!r||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(r=String.fromCharCode(r),this._onKey.fire({key:r,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let r=e.data;return this.coreService.triggerDataEvent(r,!0),this.cancel(e),!0}return!1}resize(e,r){if(e===this.cols&&r===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,r)}_afterResize(e,r){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(yn));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var r;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(r=this._selectionService)==null||r.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(Re.ESC+"[I"):this.coreService.triggerDataEvent(Re.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let r=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Re.ESC}[4;${n};${r}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Re.ESC}[6;${i};${s}t`);break}}cancel(e,r){if(!(!this.options.cancelEvents&&!r))return e.preventDefault(),e.stopPropagation(),!1}};function SAe(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var kAe=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,r){let n={instance:r,dispose:r.dispose,isDisposed:!1};this._addons.push(n),r.dispose=()=>this._wrappedAddonDispose(n),r.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let r=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){r=n;break}if(r===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(r,1)}},EAe=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,r){if(!(e<0||e>=this._line.length))return r?(this._line.loadCell(e,r),r):this._line.loadCell(e,new Hi)}translateToString(e,r,n){return this._line.translateToString(e,r,n)}},a$=class{constructor(e,r){this._buffer=e,this.type=r}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let r=this._buffer.lines.get(e);if(r)return new EAe(r)}getNullCell(){return new Hi}},CAe=class extends Dt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new We),this.onBufferChange=this._onBufferChange.event,this._normal=new a$(this._core.buffers.normal,"normal"),this._alternate=new a$(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},NAe=class{constructor(e){this._core=e}registerCsiHandler(e,r){return this._core.registerCsiHandler(e,n=>r(n.toArray()))}addCsiHandler(e,r){return this.registerCsiHandler(e,r)}registerDcsHandler(e,r){return this._core.registerDcsHandler(e,(n,s)=>r(n,s.toArray()))}addDcsHandler(e,r){return this.registerDcsHandler(e,r)}registerEscHandler(e,r){return this._core.registerEscHandler(e,r)}addEscHandler(e,r){return this.registerEscHandler(e,r)}registerOscHandler(e,r){return this._core.registerOscHandler(e,r)}addOscHandler(e,r){return this.registerOscHandler(e,r)}},jAe=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},TAe=["cols","rows"],Ka=0,AAe=class extends Dt{constructor(e){super(),this._core=this._register(new wAe(e)),this._addonManager=this._register(new kAe),this._publicOptions={...this._core.options};let r=s=>this._core.options[s],n=(s,i)=>{this._checkReadonlyOptions(s),this._core.options[s]=i};for(let s in this._core.options){let i={get:r.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,i)}}_checkReadonlyOptions(e){if(TAe.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new NAe(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new jAe(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new CAe(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,r="none";switch(this._core.coreMouseService.activeProtocol){case"X10":r="x10";break;case"VT200":r="vt200";break;case"DRAG":r="drag";break;case"ANY":r="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:r,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let r in e)this._publicOptions[r]=e[r]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,r=!0){this._core.input(e,r)}resize(e,r){this._verifyIntegers(e,r),this._core.resize(e,r)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,r,n){this._verifyIntegers(e,r,n),this._core.select(e,r,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,r){this._verifyIntegers(e,r),this._core.selectLines(e,r)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,r){this._core.write(e,r)}writeln(e,r){this._core.write(e),this._core.write(`\r
|
||
`,r)}paste(e){this._core.paste(e)}refresh(e,r){this._verifyIntegers(e,r),this._core.refresh(e,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return HN.get()},set promptLabel(e){HN.set(e)},get tooMuchOutput(){return qN.get()},set tooMuchOutput(e){qN.set(e)}}}_verifyIntegers(...e){for(Ka of e)if(Ka===1/0||isNaN(Ka)||Ka%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ka of e)if(Ka&&(Ka===1/0||isNaN(Ka)||Ka%1!==0||Ka<0))throw new Error("This API only accepts positive integers")}};/**
|
||
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
||
* @license MIT
|
||
*
|
||
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
||
* @license MIT
|
||
*
|
||
* Originally forked from (with the author's permission):
|
||
* Fabrice Bellard's javascript vt100 for jslinux:
|
||
* http://bellard.org/jslinux/
|
||
* Copyright (c) 2011 Fabrice Bellard
|
||
*/var RAe=2,DAe=1,OAe=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),l={top:parseInt(a.getPropertyValue("padding-top")),bottom:parseInt(a.getPropertyValue("padding-bottom")),right:parseInt(a.getPropertyValue("padding-right")),left:parseInt(a.getPropertyValue("padding-left"))},c=l.top+l.bottom,d=l.right+l.left,f=s-c,p=i-d-r;return{cols:Math.max(RAe,Math.floor(p/e.css.cell.width)),rows:Math.max(DAe,Math.floor(f/e.css.cell.height))}}};function PAe(t){const e=new TextEncoder().encode(t);let r="";for(const n of e)r+=String.fromCharCode(n);return btoa(r)}function MAe(t){const e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function IAe(t,e,r="/bin/sh"){const n=Df.replace(/^http/i,"ws"),s=encodeURIComponent(JSON.stringify([r]));return`${n}/v1/apps/${encodeURIComponent(t)}/exec/ws?cmd=${s}&token=${encodeURIComponent(e)}`}function LAe({open:t,onOpenChange:e,appId:r,appName:n}){const s=bo(),[i,a]=E.useState(null),[l,c]=E.useState("connecting"),[d,f]=E.useState(0);E.useEffect(()=>{const m=i;if(!t||!m||!s)return;let g=!1,y=null;const x=new AAe({fontFamily:'Menlo, Monaco, Consolas, "Courier New", monospace',fontSize:13,cursorBlink:!0,scrollback:5e3,theme:{background:"#0b0e14",foreground:"#d8dee9"}}),w=new OAe;x.loadAddon(w),x.open(m),w.fit(),x.focus();const _=()=>{y&&y.readyState===WebSocket.OPEN&&y.send(JSON.stringify({tty_size:{width:x.cols,height:x.rows}}))},S=()=>{try{w.fit()}catch{}_()};c("connecting");try{const N=IAe(r,s);y=new WebSocket(N),y.onopen=()=>{g||(c("connected"),S(),x.onData(j=>{y&&y.readyState===WebSocket.OPEN&&y.send(JSON.stringify({stdin:{data:PAe(j)}}))}),x.onResize(_))},y.onmessage=j=>{let T;try{T=JSON.parse(j.data)}catch{return}if(T.stdout&&T.stdout.data)x.write(MAe(T.stdout.data));else if(T.error)x.write(`\r
|
||
\x1B[31m${T.error}\x1B[0m\r
|
||
`),c("error");else if(T.exited){const D=T.exited.result?T.exited.result.exit_code:"?";x.write(`\r
|
||
\x1B[2m[process exited with code ${D}]\x1B[0m\r
|
||
`),c("closed")}},y.onclose=()=>{g||c("closed")},y.onerror=()=>c("error")}catch(N){if(!g){const j=N instanceof Error?N.message:String(N);c("error"),x.write(`\x1B[31m${j}\x1B[0m\r
|
||
`)}}const k=()=>S();return window.addEventListener("resize",k),()=>{if(g=!0,window.removeEventListener("resize",k),y)try{y.close()}catch{}try{x.dispose()}catch{}}},[t,i,r,s,d]);const p={connecting:"connecting…",connected:"connected",closed:"session closed",error:"connection error"};return o.jsx(hs,{open:t,onOpenChange:e,children:o.jsxs(un,{className:"max-w-4xl",onEscapeKeyDown:m=>m.preventDefault(),children:[o.jsx(Dn,{children:o.jsxs(On,{className:"flex items-center gap-2 font-mono",children:[o.jsx(Yre,{className:"h-4 w-4 text-primary"}),"Terminal — ",n]})}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx("span",{className:we("inline-flex h-2 w-2 rounded-full",l==="connected"&&"bg-emerald-500",l==="connecting"&&"bg-amber-500",l==="closed"&&"bg-zinc-500",l==="error"&&"bg-red-500")}),o.jsx("span",{children:p[l]}),o.jsxs(le,{variant:"ghost",size:"sm",className:"ml-auto gap-1.5",onClick:()=>f(m=>m+1),children:[o.jsx(wn,{className:"h-3.5 w-3.5"}),"Reconnect"]})]}),o.jsx("div",{ref:a,className:"h-[60vh] w-full overflow-hidden rounded-md border border-border bg-[#0b0e14] p-2"})]})})}function o$(t){return DH(t)}function $Ae(t){var e,r;return((r=(e=t.ports)==null?void 0:e.find(n=>n.hostname))==null?void 0:r.hostname)??""}function BAe(t){return t?/^https?:\/\//i.test(t)?t:`https://${t}`:""}function FAe(t){const e=(t??"").replace(/^https?:\/\//i,"");return e.includes(".hosted.")?"":e}function zAe(t){return{name:t.name??"",image:t.image??"",args:t.args??[],cpu:t.cpu,memory:t.memory,instances:t.instances??1,hibernated:t.hibernated??!1,ephemeral:t.ephemeral??!1,ports:(t.ports??[]).map(e=>{var r;return{name:e.name??"",number:e.number??0,...e.hostname?{hostname:FAe(e.hostname)}:{},...(r=e.health)!=null&&r.path?{health:{path:e.health.path}}:{}}}),env:(t.env??[]).map(e=>({name:e.name??"",value:e.value??"",...e.is_secret?{is_secret:!0}:{},...e.file_path?{file_path:e.file_path}:{}})),mounts:(t.mounts??[]).map(e=>({volume_id:e.volume_id??"",path:e.path??""})),tags:(t.tags??[]).filter((e,r,n)=>e.key!=="billing.tier"||n.findIndex(s=>s.key==="billing.tier")===r).map(e=>({key:e.key,value:e.value})),...t.pull_secret_id?{pull_secret_id:t.pull_secret_id}:{}}}function Ax({icon:t,label:e,value:r}){return o.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-border/60 bg-background/50 px-3.5 py-2.5",children:[o.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-primary/15 bg-primary/10 text-primary",children:o.jsx(t,{className:"h-4 w-4"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),o.jsx("p",{className:"truncate text-sm font-semibold",children:r})]})]})}function UAe(){var ke,Oe,He,Ye,lt,P;const{appId:t}=Hh(),e=Yn(),{toast:r}=br(),{listApps:n,updateManagedApp:s,deleteManagedApp:i,appLogs:a}=Nr(),[l,c]=E.useState(null),[d,f]=E.useState(!0),[p,m]=E.useState(!1),[g,y]=E.useState("idle"),[x,w]=E.useState(!1),[_,S]=E.useState(!1),[k,N]=E.useState(!1),[j,T]=E.useState(!1),[D,I]=E.useState([]),[L,$]=E.useState(!1),[Q,M]=E.useState(!0),z=E.useRef(null),R=E.useRef(null),B=E.useCallback(async(ne=!1)=>{if(t){ne||f(!0);try{const W=(await n()??[]).find(Z=>Z.id===t)??null;c(W),m(!W)}catch{ne||(c(null),m(!0))}finally{ne||f(!1)}}},[t,n]);E.useEffect(()=>{B()},[B]);const V=l?OH(o$(l)):!1;E.useEffect(()=>{if(!V||k)return;const ne=window.setInterval(()=>void B(!0),3e3);return()=>window.clearInterval(ne)},[V,k,B]);const F=E.useCallback(async()=>{if(t){$(!0);try{const ne=await a(t,200);I((ne??[]).map(X=>X.message??"").reverse())}catch{}finally{$(!1)}}},[t,a]);E.useEffect(()=>{F()},[F]),E.useEffect(()=>{if(!Q)return;const ne=window.setInterval(()=>void F(),3e3);return()=>window.clearInterval(ne)},[Q,F]),E.useEffect(()=>{const ne=z.current;ne&&Q&&(ne.scrollTop=ne.scrollHeight)},[D,Q]);const K=l?o$(l):"healthy",Y=K==="hibernated",O=l?l.url??BAe($Ae(l)):"",H=(Oe=(ke=l==null?void 0:l.ports)==null?void 0:ke.find(ne=>ne.number))==null?void 0:Oe.number,G=l!=null&&l.alias?`http://${l.alias}${H?`:${H}`:""}`:"",q=async()=>{if(O)try{await navigator.clipboard.writeText(O),y("copied"),setTimeout(()=>y("idle"),1500),r({title:"Copied",description:"URL copied to clipboard."})}catch{y("error")}},J=async()=>{if(!l)return;const ne=zAe(l);ne.hibernated=!ne.hibernated;const X=!ne.hibernated;w(!0);try{const W=await s(l.id,ne);if(!W)throw new Error("Failed to update app");r({title:X?"App started":"App sleeping",description:X?`${W.name??"App"} is waking up.`:`${W.name??"App"} was put to sleep.`}),B()}catch(W){r({title:"Failed to update app",description:W instanceof Error?W.message:"An unknown error occurred",variant:"destructive"})}finally{w(!1)}},te=async()=>{if(l)try{if(!await i(l.id))throw new Error("Failed to delete app");r({title:"App deleted"}),e("/dashboard/apps")}catch(ne){r({title:"Failed to delete app",description:ne instanceof Error?ne.message:"An unknown error occurred",variant:"destructive"}),S(!1)}},ve=()=>N(!0);if(d)return o.jsxs("div",{className:"flex items-center justify-center py-24 text-sm text-muted-foreground",children:[o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin text-primary"}),"Loading app…"]});if(p||!l)return o.jsx("div",{className:"space-y-6",children:o.jsx(Rn,{title:"App not found",backTo:"/dashboard/apps",backIcon:o.jsx(mo,{className:"h-4 w-4"}),description:"This application doesn't exist or was deleted."})});const he=l.created_at?new Date(l.created_at*1e3):null,xe=l.updated_at?new Date(l.updated_at*1e3):null;return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-primary/10 bg-card shadow-sm",children:[o.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-32 bg-gradient-to-b from-primary/10 via-primary/5 to-transparent"}),o.jsxs("div",{className:"relative px-6 pb-6 pt-6",children:[o.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between",children:[o.jsxs("div",{className:"flex items-start gap-4",children:[o.jsx(le,{variant:"outline",size:"icon",onClick:()=>e("/dashboard/apps"),className:"mt-1 h-10 w-10 shrink-0 rounded-full border-primary/15 bg-background/70 hover:border-primary/30 hover:bg-primary/5",children:o.jsx(mo,{className:"h-4 w-4"})}),o.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl border border-primary/20 bg-gradient-to-br from-primary/15 to-primary/5 text-primary shadow-sm",children:o.jsx(nv,{className:"h-7 w-7"})}),o.jsxs("div",{className:"min-w-0 space-y-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[o.jsx("h1",{className:"truncate text-2xl font-bold tracking-tight",children:l.name||l.id}),o.jsx(CA,{status:K})]}),o.jsx("p",{className:"truncate font-mono text-sm text-muted-foreground",children:l.image||"Container application"}),(((He=l.tags)==null?void 0:He.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:o.jsx(f2e,{tags:(l.tags??[]).map(ne=>({key:ne.key,value:ne.value}))})}),o.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground",children:[he&&o.jsxs("span",{className:"inline-flex items-center gap-1.5",title:he.toLocaleString(),children:[o.jsx(ste,{className:"h-3.5 w-3.5 text-primary/70"}),"Created ",Ig(he,{addSuffix:!0})]}),xe&&o.jsxs("span",{className:"inline-flex items-center gap-1.5",title:xe.toLocaleString(),children:[o.jsx(Vu,{className:"h-3.5 w-3.5 text-primary/70"}),"Updated ",Ig(xe,{addSuffix:!0})]})]})]})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 lg:justify-end",children:[o.jsxs(le,{variant:"outline",disabled:Y,onClick:()=>T(!0),title:Y?"Start the app to open a terminal":"Open an interactive terminal",children:[o.jsx(Bs,{className:"mr-2 h-4 w-4"}),"Terminal"]}),O&&o.jsxs(le,{variant:"outline",className:"border-primary/30 text-primary hover:bg-primary/10",onClick:()=>window.open(O,"_blank"),children:[o.jsx(al,{className:"mr-2 h-4 w-4"}),"Open URL"]}),o.jsxs(le,{variant:"outline",onClick:ve,children:[o.jsx(Y_,{className:"mr-2 h-4 w-4"}),"Edit"]}),o.jsxs(le,{variant:"outline",disabled:x,onClick:()=>void J(),className:Y?"border-amber-500/30 text-amber-600 hover:bg-amber-500/10":void 0,children:[x?o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}):Y?o.jsx(Q_,{className:"mr-2 h-4 w-4"}):o.jsx(cl,{className:"mr-2 h-4 w-4"}),Y?"Start":"Sleep"]}),o.jsxs(le,{variant:"outline",className:"border-destructive/30 text-destructive hover:bg-destructive/10",onClick:()=>S(!0),children:[o.jsx(ds,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]}),o.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3 border-t border-border/60 pt-5 sm:grid-cols-4",children:[o.jsx(Ax,{icon:il,label:"CPU",value:l.cpu?`${l.cpu}m`:"—"}),o.jsx(Ax,{icon:Es,label:"Memory",value:l.memory?`${l.memory}Mi`:"—"}),o.jsx(Ax,{icon:Wh,label:"Instances",value:String(l.instances??1)}),o.jsx(Ax,{icon:An,label:"Ports",value:String(((Ye=l.ports)==null?void 0:Ye.length)??0)})]})]})]}),o.jsxs($e,{className:"border-primary/10 overflow-hidden",children:[o.jsx(ot,{className:"bg-gradient-to-r from-primary/5 to-transparent",children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(An,{className:"h-5 w-5 text-primary"}),O?"Public Access":"Internal Access"]})}),o.jsx(Be,{className:"p-6",children:O?o.jsx("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:o.jsxs("div",{className:"w-full",children:[o.jsx("h3",{className:"mb-1 font-medium",children:"Your application is accessible at:"}),o.jsxs("div",{className:"flex items-center justify-between gap-3 rounded border border-primary/10 bg-background/80 p-3",children:[o.jsx("a",{href:O,target:"_blank",rel:"noreferrer",className:"flex min-w-0 items-center gap-1.5 truncate font-mono text-sm text-primary hover:underline",children:O}),o.jsxs(le,{size:"sm",className:"shrink-0 bg-gradient-to-r from-primary to-primary/90 shadow-md",onClick:()=>void q(),children:[g==="copied"?o.jsx(Lr,{className:"mr-2 h-4 w-4"}):g==="error"?o.jsx(wn,{className:"mr-2 h-4 w-4"}):o.jsx(cn,{className:"mr-2 h-4 w-4"}),g==="copied"?"Copied!":g==="error"?"Failed":"Copy URL"]})]})]})}):o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start gap-2 rounded border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-300",children:[o.jsx(An,{className:"mt-0.5 h-4 w-4 shrink-0"}),o.jsx("span",{children:"Public access is disabled — this app isn't reachable from the internet. It can still be reached over your project's private network using the internal hostname below."})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a hostname to one of your ports to expose this app publicly."})]})})]}),l.alias&&o.jsx(OA,{hostname:l.alias,description:"Other apps and services in this project can reach this app directly through this hostname — no public IP and no internet exposure. The public URL above is separate and optional.",example:G}),o.jsxs($e,{className:"border-primary/10",children:[o.jsx(ot,{className:"bg-gradient-to-r from-primary/5 to-transparent",children:o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(Bi,{className:"h-5 w-5 text-primary"}),"App Details"]})}),o.jsxs(Be,{className:"space-y-4 p-6",children:[o.jsxs("div",{className:"space-y-2 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-muted-foreground",children:"Image"}),o.jsx("span",{className:"max-w-[60%] truncate font-mono",children:l.image||"—"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[o.jsx(il,{className:"h-4 w-4"})," CPU"]}),o.jsx("span",{className:"font-mono",children:l.cpu?`${l.cpu}m`:"—"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[o.jsx(Es,{className:"h-4 w-4"})," Memory"]}),o.jsx("span",{className:"font-mono",children:l.memory?`${l.memory}Mi`:"—"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[o.jsx(Wh,{className:"h-4 w-4"})," Instances"]}),o.jsx("span",{className:"font-mono",children:l.instances??1})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[o.jsx(An,{className:"h-4 w-4"})," Ports"]}),o.jsx("span",{className:"font-mono",children:((lt=l.ports)==null?void 0:lt.length)??0})]})]}),(((P=l.env)==null?void 0:P.length)??0)>0&&o.jsxs("div",{className:"border-t border-border pt-3",children:[o.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Environment"}),o.jsx("div",{className:"space-y-1",children:(l.env??[]).map((ne,X)=>o.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[o.jsx("span",{className:"font-mono text-muted-foreground",children:ne.name}),o.jsx("span",{className:"truncate font-mono",children:"••••••"})]},X))})]})]})]}),o.jsx("div",{ref:R,children:o.jsxs($e,{className:"border-primary/10 overflow-hidden",children:[o.jsx(ot,{className:"bg-gradient-to-r from-primary/5 to-transparent",children:o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(Bs,{className:"h-5 w-5 text-primary"}),"Application Logs"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Lt,{className:we("gap-1.5",Q?"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300":"bg-secondary text-secondary-foreground"),children:[o.jsx("span",{className:we("relative flex h-2 w-2",Q&&"rounded-full bg-emerald-500")}),Q?"Live":"Paused"]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>M(!Q),children:Q?"Pause":"Resume"}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>void F(),disabled:L,children:o.jsx(wn,{className:we("h-3.5 w-3.5",L&&"animate-spin")})})]})]})}),o.jsx(Be,{className:"p-0",children:o.jsx("div",{ref:z,className:"h-96 overflow-y-auto bg-slate-950 p-4 font-mono text-xs leading-relaxed text-slate-200",children:L&&D.length===0?o.jsxs("div",{className:"flex h-full items-center justify-center text-slate-400",children:[o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading logs…"]}):D.length===0?o.jsx("div",{className:"flex h-full items-center justify-center text-slate-500",children:"No logs yet — the app may still be starting."}):D.map((ne,X)=>o.jsx("div",{className:"whitespace-pre-wrap break-words",children:ne},X))})})]})}),o.jsx(xW,{open:k,onOpenChange:N,app:l,onSaved:()=>void B()}),o.jsx(LAe,{open:j,onOpenChange:T,appId:l.id,appName:l.name||l.id}),o.jsx(So,{open:_,onOpenChange:S,children:o.jsxs(Oa,{children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete App"}),o.jsxs(La,{children:["Are you sure you want to delete"," ",o.jsx("span",{className:"font-medium",children:(l==null?void 0:l.name)||(l==null?void 0:l.id)}),"? This action cannot be undone."]})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{children:"Cancel"}),o.jsx($a,{onClick:()=>void te(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}const pG=1024*1024*1024,mG=1024*1024;function l$(t){if(!t||t<=0)return"—";const e=t/pG;return e>=1?`${e%1===0?e:e.toFixed(1)} GB`:`${Math.round(t/mG)} MB`}function VAe(){const{toast:t}=br(),{listVolumes:e,createManagedVolume:r,deleteManagedVolume:n}=Nr(),{freeOnly:s}=wv(),[i,a]=E.useState([]),[l,c]=E.useState(!1),[d,f]=E.useState(!1),[p,m]=E.useState(!1),[g,y]=E.useState(null),[x,w]=E.useState(""),[_,S]=E.useState("1"),[k,N]=E.useState("Gi"),j=E.useCallback(async()=>{c(!0);try{const $=await e();a($??[])}catch($){t({title:"Failed to load volumes",description:$ instanceof Error?$.message:"An unknown error occurred",variant:"destructive"})}finally{c(!1)}},[e,t]);E.useEffect(()=>{j()},[j]);const T=()=>{w(""),S("1"),N("Gi"),f(!0)},D=async()=>{if(!x.trim()){t({title:"Invalid input",description:"Please enter a volume name",variant:"destructive"});return}const $=Number(_);if(!$||$<=0){t({title:"Invalid size",description:"Enter a valid number",variant:"destructive"});return}const Q=k==="Gi"?$*pG:$*mG;m(!0);try{const M=await r(x.trim(),Math.round(Q));if(!M)throw new Error("Failed to create volume");f(!1),t({title:"Volume created",description:`${M.name||"Your volume"} is ready.`}),j()}catch(M){t({title:"Failed to create volume",description:M instanceof Error?M.message:"An unknown error occurred",variant:"destructive"})}finally{m(!1)}},I=async()=>{if(g)try{if(!await n(g.id))throw new Error("Failed to delete volume");a(Q=>Q.filter(M=>M.id!==g.id)),y(null),t({title:"Volume deleted"})}catch($){t({title:"Failed to delete volume",description:$ instanceof Error?$.message:"An unknown error occurred",variant:"destructive"})}},L=i.reduce(($,Q)=>$+(Q.size||0),0);return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Managed Volumes",description:"Provision persistent volumes independently and attach them to your apps.",actions:[o.jsxs(le,{onClick:T,className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"Create Volume"]},"create-volume"),o.jsxs(le,{variant:"outline",onClick:()=>void j(),disabled:l,children:[o.jsx(wn,{className:`mr-2 h-4 w-4 ${l?"animate-spin":""}`}),"Refresh"]},"refresh")]}),o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4",children:[o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Es,{className:"h-4 w-4 text-primary"})," Volumes"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:i.length})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"provisioned"})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Es,{className:"h-4 w-4 text-primary"})," Total storage"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:l$(L)})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"across all volumes"})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Es,{className:"h-4 w-4 text-primary"})," Managed"]}),o.jsx("div",{className:"text-2xl font-bold text-emerald-600",children:i.length})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"by the gateway"})})]})]}),l?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx(kt,{className:"mx-auto h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading your volumes…"})]})}):i.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx("div",{className:"mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(Es,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"No volumes yet"}),o.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Create a persistent volume to attach to your applications."}),o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90",onClick:T,children:[o.jsx(nr,{className:"mr-2 h-4 w-4"})," Create Volume"]})]})}):o.jsx("div",{className:"space-y-4",children:i.map($=>o.jsxs($e,{className:"overflow-hidden border-primary/20",children:[o.jsxs(ot,{className:"flex flex-row items-start justify-between border-b border-border/60 px-6 py-5",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(Es,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx(dt,{className:"text-base",children:$.name||"Volume"}),o.jsx(rn,{className:"font-mono text-xs",children:$.id})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Lt,{className:"gap-1 bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300",children:"Ready"}),o.jsxs(le,{variant:"outline",size:"sm",className:"border-destructive/20 text-destructive hover:text-destructive",onClick:()=>y($),children:[o.jsx(ds,{className:"mr-1.5 h-3.5 w-3.5"})," Delete"]})]})]}),o.jsxs(Be,{className:"grid grid-cols-2 gap-4 p-6 md:grid-cols-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Size"}),o.jsx("p",{className:"text-sm font-medium",children:l$($.size)})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Project"}),o.jsx("p",{className:"truncate font-mono text-sm",children:$.project_id||"—"})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Created"}),o.jsx("p",{className:"text-sm font-medium",children:$.created_at?new Date($.created_at*1e3).toLocaleDateString():"—"})]})]})]},$.id))}),o.jsx(hs,{open:d,onOpenChange:f,children:o.jsxs(un,{className:"sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Create Volume"}),o.jsx(fs,{children:"Provision a persistent volume for your applications."})]}),s&&o.jsxs("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400",children:["Volumes require a payment method."," ",o.jsx("a",{href:"/dashboard/billing",className:"font-medium underline",children:"Add a card"})," to unlock."]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"volume-name",children:"Volume name"}),o.jsx(tt,{id:"volume-name",value:x,onChange:$=>w($.target.value),placeholder:"my-data-volume"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"volume-size",children:"Size"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(tt,{id:"volume-size",type:"number",min:1,value:_,onChange:$=>S($.target.value),className:"flex-1"}),o.jsxs(ja,{value:k,onValueChange:N,children:[o.jsx(Wi,{className:"w-24",children:o.jsx(Ta,{})}),o.jsxs(Gi,{children:[o.jsx(bn,{value:"Mi",children:"Mi"}),o.jsx(bn,{value:"Gi",children:"Gi"})]})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Minimum 50Mi, maximum 10Gi."})]})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),o.jsx(le,{onClick:D,disabled:p||!x.trim()||s,className:"bg-gradient-to-r from-primary to-primary/90",children:p?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Creating..."]}):"Create Volume"})]})]})}),o.jsx(So,{open:!!g,onOpenChange:$=>!$&&y(null),children:o.jsxs(Oa,{children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete Volume"}),o.jsxs(La,{children:["Are you sure you want to delete"," ",o.jsx("span",{className:"font-medium",children:(g==null?void 0:g.name)||(g==null?void 0:g.id)}),"? Any app mounted to this volume will lose its data. This action cannot be undone."]})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{children:"Cancel"}),o.jsx($a,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function HAe(){const{toast:t}=br(),{listPullSecrets:e,createPullSecret:r,deletePullSecret:n}=Nr(),[s,i]=E.useState([]),[a,l]=E.useState(!1),[c,d]=E.useState(!1),[f,p]=E.useState(!1),[m,g]=E.useState(null),[y,x]=E.useState(!1),[w,_]=E.useState({server:"",username:"",password:""}),S=E.useCallback(async()=>{l(!0);try{const j=await e();i(j??[])}catch(j){t({title:"Failed to load pull secrets",description:j instanceof Error?j.message:"An unknown error occurred",variant:"destructive"})}finally{l(!1)}},[e,t]);E.useEffect(()=>{S()},[S]);const k=async()=>{if(!w.server.trim()||!w.username.trim()||!w.password){t({title:"Invalid input",description:"Please fill in all required fields",variant:"destructive"});return}p(!0);try{const j=await r(w.server.trim(),w.username.trim(),w.password);if(!j)throw new Error("Failed to create pull secret");d(!1),_({server:"",username:"",password:""}),t({title:"Pull secret created",description:`${j.server||"Your registry secret"} is now available for your apps.`}),S()}catch(j){t({title:"Failed to create pull secret",description:j instanceof Error?j.message:"An unknown error occurred",variant:"destructive"})}finally{p(!1)}},N=async()=>{if(m)try{if(!await n(m.id))throw new Error("Failed to delete pull secret");i(T=>T.filter(D=>D.id!==m.id)),g(null),t({title:"Pull secret deleted"})}catch(j){t({title:"Failed to delete pull secret",description:j instanceof Error?j.message:"An unknown error occurred",variant:"destructive"})}};return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Registry Pull Secrets",description:"Store private container registry credentials so your apps can pull private images.",actions:[o.jsxs(le,{onClick:()=>d(!0),className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"Add Pull Secret"]},"create-secret"),o.jsxs(le,{variant:"outline",onClick:()=>void S(),disabled:a,children:[o.jsx(wn,{className:`mr-2 h-4 w-4 ${a?"animate-spin":""}`}),"Refresh"]},"refresh")]}),o.jsx($e,{className:"border-primary/20 bg-gradient-to-r from-primary/5 via-background to-background",children:o.jsxs(Be,{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between",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-lg bg-primary/10",children:o.jsx(wa,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Private registry access"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Credentials are stored securely and never returned after creation."})]})]}),o.jsxs(Lt,{variant:"secondary",className:"gap-1 self-start sm:self-auto",children:[o.jsx(Gn,{className:"h-3 w-3"})," Encrypted"]})]})}),o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4",children:[o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(gi,{className:"h-4 w-4 text-primary"})," Pull secrets"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:s.length})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"configured"})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(B0,{className:"h-4 w-4 text-primary"})," Usernames"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:new Set(s.map(j=>j.username)).size})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"unique accounts"})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Gn,{className:"h-4 w-4 text-primary"})," Security"]}),o.jsx("div",{className:"text-2xl font-bold text-emerald-600",children:"Secure"})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"credentials never re-exposed"})})]})]}),a?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx(kt,{className:"mx-auto h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading your pull secrets…"})]})}):s.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx("div",{className:"mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(gi,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"No pull secrets yet"}),o.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Add a private registry credential (e.g. Docker Hub) to let your apps pull private images."}),o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90",onClick:()=>d(!0),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"})," Add Pull Secret"]})]})}):o.jsx("div",{className:"space-y-4",children:s.map(j=>o.jsxs($e,{className:"overflow-hidden border-primary/20",children:[o.jsxs(ot,{className:"flex flex-row items-start justify-between border-b border-border/60 px-6 py-5",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(gi,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx(dt,{className:"text-base",children:j.server||"Registry"}),o.jsx(rn,{className:"font-mono text-xs",children:j.id})]})]}),o.jsxs(le,{variant:"outline",size:"sm",className:"border-destructive/20 text-destructive hover:text-destructive",onClick:()=>g(j),children:[o.jsx(ds,{className:"mr-1.5 h-3.5 w-3.5"})," Delete"]})]}),o.jsxs(Be,{className:"grid grid-cols-2 gap-4 p-6 md:grid-cols-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Server"}),o.jsx("p",{className:"truncate font-mono text-sm",children:j.server||"—"})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Username"}),o.jsx("p",{className:"truncate font-mono text-sm",children:j.username||"—"})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Created"}),o.jsx("p",{className:"text-sm font-medium",children:j.created_at?new Date(j.created_at*1e3).toLocaleDateString():"—"})]})]})]},j.id))}),o.jsx(hs,{open:c,onOpenChange:d,children:o.jsxs(un,{className:"sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Add Pull Secret"}),o.jsx(fs,{children:"Provide registry credentials for pulling private container images."})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"server",children:"Registry server"}),o.jsx(tt,{id:"server",value:w.server,onChange:j=>_({...w,server:j.target.value}),placeholder:"https://index.docker.io/v1/"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Hostname or full URL of the registry (e.g. Docker Hub)."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"username",children:"Username"}),o.jsx(tt,{id:"username",value:w.username,onChange:j=>_({...w,username:j.target.value}),placeholder:"your-username",autoComplete:"username"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(Xe,{htmlFor:"password",children:["Password / token",o.jsx("span",{className:"text-xs font-normal text-muted-foreground ml-2",children:"(stored securely, never shown again)"})]}),o.jsxs("div",{className:"relative",children:[o.jsx(tt,{id:"password",type:y?"text":"password",value:w.password,onChange:j=>_({...w,password:j.target.value}),placeholder:"••••••••",className:"pr-10",autoComplete:"new-password"}),o.jsx("button",{type:"button",onClick:()=>x(!y),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":y?"Hide password":"Show password",children:y?o.jsx(ol,{size:18}):o.jsx(ll,{size:18})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-emerald-500/20 bg-emerald-50 px-3 py-2 dark:bg-emerald-950/20",children:[o.jsx(wa,{className:"h-4 w-4 text-emerald-500"}),o.jsx("span",{className:"text-xs text-emerald-700 dark:text-emerald-300",children:"Encrypted at rest and in transit"})]})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),o.jsx(le,{onClick:k,disabled:f||!w.server.trim()||!w.username.trim()||!w.password,className:"bg-gradient-to-r from-primary to-primary/90",children:f?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Adding..."]}):"Add Pull Secret"})]})]})}),o.jsx(So,{open:!!m,onOpenChange:j=>!j&&g(null),children:o.jsxs(Oa,{children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete Pull Secret"}),o.jsxs(La,{children:["Are you sure you want to delete"," ",o.jsx("span",{className:"font-medium",children:(m==null?void 0:m.server)||(m==null?void 0:m.id)}),"? Apps using this secret may fail to pull images until updated."]})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{children:"Cancel"}),o.jsx($a,{onClick:N,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function qAe(){const{toast:t}=br(),{listSecrets:e,createSecret:r,deleteSecret:n}=Nr(),[s,i]=E.useState([]),[a,l]=E.useState(!1),[c,d]=E.useState(!1),[f,p]=E.useState(!1),[m,g]=E.useState(null),[y,x]=E.useState({name:"",value:""}),w=E.useCallback(async()=>{l(!0);try{const k=await e();i(k??[])}catch(k){t({title:"Failed to load secrets",description:k instanceof Error?k.message:"An unknown error occurred",variant:"destructive"})}finally{l(!1)}},[e,t]);E.useEffect(()=>{w()},[w]);const _=async()=>{if(!y.name.trim()||!y.value){t({title:"Invalid input",description:"Name and value are required",variant:"destructive"});return}p(!0);try{const k=await r(y.name.trim(),y.value);if(!k)throw new Error("Failed to create secret");d(!1),x({name:"",value:""}),t({title:"Secret created",description:`${k.name||"Your secret"} is now stored securely.`}),w()}catch(k){t({title:"Failed to create secret",description:k instanceof Error?k.message:"An unknown error occurred",variant:"destructive"})}finally{p(!1)}},S=async()=>{if(m)try{if(!await n(m.id))throw new Error("Failed to delete secret");i(N=>N.filter(j=>j.id!==m.id)),g(null),t({title:"Secret deleted"})}catch(k){t({title:"Failed to delete secret",description:k instanceof Error?k.message:"An unknown error occurred",variant:"destructive"})}};return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Secrets",description:"Store API keys, tokens, and other secrets for your apps. Values are write-only.",actions:[o.jsxs(le,{onClick:()=>d(!0),className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"Add Secret"]},"create-secret"),o.jsxs(le,{variant:"outline",onClick:()=>void w(),disabled:a,children:[o.jsx(wn,{className:`mr-2 h-4 w-4 ${a?"animate-spin":""}`}),"Refresh"]},"refresh")]}),o.jsx($e,{className:"border-primary/20 bg-gradient-to-r from-primary/5 via-background to-background",children:o.jsxs(Be,{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between",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-lg bg-primary/10",children:o.jsx(wa,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Key-value secrets"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Values are encrypted and never returned after creation."})]})]}),o.jsxs(Lt,{variant:"secondary",className:"gap-1 self-start sm:self-auto",children:[o.jsx(Gn,{className:"h-3 w-3"})," Write-only"]})]})}),o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4",children:[o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(gi,{className:"h-4 w-4 text-primary"})," Secrets"]}),o.jsx("div",{className:"text-2xl font-bold text-primary",children:s.length})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"stored"})})]}),o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{className:"pb-2",children:[o.jsxs(dt,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[o.jsx(Gn,{className:"h-4 w-4 text-primary"})," Security"]}),o.jsx("div",{className:"text-2xl font-bold text-emerald-600",children:"Secure"})]}),o.jsx(Be,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"values never re-exposed"})})]})]}),a?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx(kt,{className:"mx-auto h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading your secrets…"})]})}):s.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx("div",{className:"mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(gi,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"No secrets yet"}),o.jsxs("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["Store API keys and tokens (e.g. ",o.jsx("span",{className:"font-mono",children:"stripe-api-key"}),") to reference them from your apps."]}),o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90",onClick:()=>d(!0),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"})," Add Secret"]})]})}):o.jsx("div",{className:"space-y-4",children:s.map(k=>o.jsxs($e,{className:"overflow-hidden border-primary/20",children:[o.jsxs(ot,{className:"flex flex-row items-start justify-between border-b border-border/60 px-6 py-5",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(gi,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx(dt,{className:"text-base",children:k.name||"Secret"}),o.jsx(rn,{className:"font-mono text-xs",children:k.id})]})]}),o.jsxs(le,{variant:"outline",size:"sm",className:"border-destructive/20 text-destructive hover:text-destructive",onClick:()=>g(k),children:[o.jsx(ds,{className:"mr-1.5 h-3.5 w-3.5"})," Delete"]})]}),o.jsxs(Be,{className:"grid grid-cols-2 gap-4 p-6 md:grid-cols-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Name"}),o.jsx("p",{className:"truncate font-mono text-sm",children:k.name||"—"})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Value"}),o.jsx("p",{className:"text-sm font-medium",children:"••••••"})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Created"}),o.jsx("p",{className:"text-sm font-medium",children:k.created_at?new Date(k.created_at*1e3).toLocaleDateString():"—"})]})]})]},k.id))}),o.jsx(hs,{open:c,onOpenChange:d,children:o.jsxs(un,{className:"sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Add Secret"}),o.jsx(fs,{children:"Store a key-value secret. The value is encrypted and never shown again."})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"name",children:"Name"}),o.jsx(tt,{id:"name",value:y.name,onChange:k=>x({...y,name:k.target.value}),placeholder:"stripe-api-key"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Lowercase letters, numbers, and hyphens (no underscores or spaces)."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(Xe,{htmlFor:"value",children:["Value",o.jsx("span",{className:"text-xs font-normal text-muted-foreground ml-2",children:"(stored securely, never shown again)"})]}),o.jsx(ZA,{id:"value",value:y.value,onChange:k=>x({...y,value:k.target.value}),placeholder:"••••••••",className:"min-h-20 font-mono",autoComplete:"new-password"})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-emerald-500/20 bg-emerald-50 px-3 py-2 dark:bg-emerald-950/20",children:[o.jsx(wa,{className:"h-4 w-4 text-emerald-500"}),o.jsx("span",{className:"text-xs text-emerald-700 dark:text-emerald-300",children:"Encrypted at rest and in transit"})]})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),o.jsx(le,{onClick:_,disabled:f||!y.name.trim()||!y.value,className:"bg-gradient-to-r from-primary to-primary/90",children:f?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Adding..."]}):"Add Secret"})]})]})}),o.jsx(So,{open:!!m,onOpenChange:k=>!k&&g(null),children:o.jsxs(Oa,{children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete Secret"}),o.jsxs(La,{children:["Are you sure you want to delete"," ",o.jsx("span",{className:"font-medium",children:(m==null?void 0:m.name)||(m==null?void 0:m.id)}),"? Apps referencing this secret may break."]})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{children:"Cancel"}),o.jsx($a,{onClick:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function WAe(){var q;const{toast:t}=br(),e=bo(),r=yl(),[n,s]=E.useState([]),[i,a]=E.useState(!1),[l,c]=E.useState(!1),[d,f]=E.useState(!1),[p,m]=E.useState(""),[g,y]=E.useState(null),[x,w]=E.useState(!1),[_,S]=E.useState(""),[k,N]=E.useState(""),[j,T]=E.useState(!1),[D,I]=E.useState(null),[L,$]=E.useState(!1),[Q,M]=E.useState([]),z=E.useCallback(async()=>{if(e){a(!0);try{s(await sq(e)??[])}catch(J){t({title:"Failed to load teams",description:J instanceof Error?J.message:"An unknown error occurred",variant:"destructive"})}finally{a(!1)}}},[e,t]);E.useEffect(()=>{z()},[z]);const R=E.useCallback(async()=>{if(e)try{M(await Kbe(e)??[])}catch{M([])}},[e]);E.useEffect(()=>{R()},[R]);const B=E.useCallback(async J=>{if(y(J),S(""),N(""),!!e){w(!0);try{const te=await qbe(e,J.id);y(te)}catch(te){t({title:"Failed to load team",description:te instanceof Error?te.message:"An unknown error occurred",variant:"destructive"})}finally{w(!1)}}},[e,t]),V=async()=>{if(e){if(!p.trim()){t({title:"Invalid input",description:"Please enter a team name",variant:"destructive"});return}f(!0);try{await Wbe(e,p.trim()),c(!1),m(""),t({title:"Team created",description:`${p.trim()} is ready to add members.`}),z()}catch(J){t({title:"Failed to create team",description:J instanceof Error?J.message:"An unknown error occurred",variant:"destructive"})}finally{f(!1)}}},F=async()=>{if(!(!e||!g)){if(!_.trim()&&!k.trim()){t({title:"Invalid input",description:"Enter the member's email (or user ID)",variant:"destructive"});return}T(!0);try{const J=await Gbe(e,g.id,_.trim()?{email:_.trim()}:{user_id:k.trim()});y(J),S(""),N(""),t({title:"Invite sent",description:"They must accept the invite before joining."}),z()}catch(J){t({title:"Failed to invite member",description:J instanceof Error?J.message:"An unknown error occurred",variant:"destructive"})}finally{T(!1)}}},K=async J=>{if(!(!e||!g))try{const te=await Xbe(e,g.id,J.user_id);y(te),t({title:"Member removed"}),z()}catch(te){t({title:"Failed to remove member",description:te instanceof Error?te.message:"An unknown error occurred",variant:"destructive"})}},Y=async()=>{if(!(!e||!D)){$(!0);try{await Zbe(e,D.id),I(null),y(null),t({title:"Team deleted"}),z()}catch(J){t({title:"Failed to delete team",description:J instanceof Error?J.message:"An unknown error occurred",variant:"destructive"})}finally{$(!1)}}},O=async J=>{if(e)try{await Ybe(e,J.team_id),t({title:"Invite accepted",description:`You're now a member of ${J.team_name}.`}),R(),z()}catch(te){t({title:"Failed to accept invite",description:te instanceof Error?te.message:"An unknown error occurred",variant:"destructive"})}},H=async J=>{if(e)try{await Qbe(e,J.team_id),t({title:"Invite declined"}),R()}catch(te){t({title:"Failed to decline invite",description:te instanceof Error?te.message:"An unknown error occurred",variant:"destructive"})}},G=J=>!!J&&J.owner_id===(r==null?void 0:r.id);return o.jsxs("div",{className:"space-y-6",children:[o.jsx(Rn,{title:"Teams",description:"Share your cloud with teammates. Everyone in a team manages the same project and resources.",actions:[o.jsxs(le,{onClick:()=>c(!0),className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),"New Team"]},"new-team"),o.jsxs(le,{variant:"outline",onClick:()=>void z(),disabled:i,children:[o.jsx(wn,{className:`mr-2 h-4 w-4 ${i?"animate-spin":""}`}),"Refresh"]},"refresh")]}),o.jsx($e,{className:"border-primary/20 bg-gradient-to-r from-primary/5 via-background to-background",children:o.jsxs(Be,{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between",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-lg bg-primary/10",children:o.jsx(dc,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"One project, shared"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Invite teammates to share your apps, databases, and storage. They must accept the invite first."})]})]}),o.jsxs(Lt,{variant:"secondary",className:"gap-1 self-start sm:self-auto",children:[o.jsx(RM,{className:"h-3 w-3"})," Owner shares their project"]})]})}),Q.length>0&&o.jsxs($e,{className:"border-primary/20",children:[o.jsxs(ot,{children:[o.jsxs(dt,{className:"flex items-center gap-2",children:[o.jsx(Sc,{className:"h-5 w-5 text-primary"}),"Invitations"]}),o.jsx(rn,{children:"Accept an invitation to join a team and share its project."})]}),o.jsx(Be,{className:"space-y-2",children:Q.map(J=>o.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-border/60 px-3 py-2 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:J.team_name}),o.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["invited by ",J.owner_email||"the owner"]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(le,{size:"sm",className:"bg-gradient-to-r from-primary to-primary/90",onClick:()=>void O(J),children:[o.jsx(Lr,{className:"mr-1.5 h-4 w-4"})," Accept"]}),o.jsxs(le,{size:"sm",variant:"outline",onClick:()=>void H(J),children:[o.jsx(yc,{className:"mr-1.5 h-4 w-4"})," Decline"]})]})]},J.team_id))})]}),i?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx(kt,{className:"mx-auto h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading your teams…"})]})}):n.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-20 text-center",children:[o.jsx("div",{className:"mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(dc,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"No teams yet"}),o.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Create a team to share your cloud with teammates. They'll manage the same project and resources as you."}),o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90",onClick:()=>c(!0),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"})," New Team"]})]})}):o.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:n.map(J=>o.jsxs($e,{className:"overflow-hidden border-primary/20",children:[o.jsx(ot,{className:"border-b border-border/60 pb-4",children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(dc,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx(dt,{className:"text-base",children:J.name}),o.jsxs(rn,{className:"font-mono text-xs",children:[J.id.slice(0,8),"…"]})]})]}),o.jsx(Lt,{variant:G(J)?"default":"secondary",className:"shrink-0",children:G(J)?"Owner":"Member"})]})}),o.jsxs(Be,{className:"flex items-center justify-between pt-4",children:[o.jsxs("span",{className:"text-xs text-muted-foreground",children:["You ",G(J)?"own":"share"," this team's project"]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(le,{variant:"outline",size:"sm",onClick:()=>void B(J),children:"Manage"}),G(J)&&o.jsx(le,{variant:"outline",size:"sm",className:"border-destructive/20 text-destructive hover:text-destructive",onClick:()=>I(J),children:o.jsx(ds,{className:"h-3.5 w-3.5"})})]})]})]},J.id))}),o.jsx(hs,{open:l,onOpenChange:c,children:o.jsxs(un,{className:"sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Create a team"}),o.jsx(fs,{children:"A team shares your Cumin project, so members manage the same resources as you."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"team-name",children:"Team name"}),o.jsx(tt,{id:"team-name",value:p,onChange:J=>m(J.target.value),placeholder:"e.g. Acme Engineering"})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),o.jsx(le,{onClick:V,disabled:d||!p.trim(),className:"bg-gradient-to-r from-primary to-primary/90",children:d?o.jsxs(o.Fragment,{children:[o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"})," Creating…"]}):"Create Team"})]})]})}),o.jsx(hs,{open:!!g,onOpenChange:J=>!J&&y(null),children:o.jsxs(un,{className:"sm:max-w-lg",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:g==null?void 0:g.name}),o.jsx(fs,{children:"Invite teammates to share this project. They'll join once they accept."})]}),x?o.jsx("div",{className:"flex items-center justify-center py-10",children:o.jsx(kt,{className:"h-6 w-6 animate-spin text-primary"})}):o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"space-y-2",children:(q=g==null?void 0:g.members)==null?void 0:q.map(J=>o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/60 px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[J.role==="owner"?o.jsx(RM,{className:"h-4 w-4 shrink-0 text-amber-500"}):o.jsx(dc,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:J.email||J.user_id}),J.email&&o.jsx("p",{className:"truncate font-mono text-[10px] text-muted-foreground",children:J.user_id})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Lt,{variant:J.role==="owner"?"default":J.status==="pending"?"outline":"secondary",children:J.role==="owner"?"owner":J.status==="pending"?"invited":"member"}),(G(g)||J.user_id===(r==null?void 0:r.id))&&J.role!=="owner"&&o.jsx(le,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>void K(J),children:o.jsx(ds,{className:"h-3.5 w-3.5"})})]})]},J.user_id))}),G(g)&&o.jsxs("div",{className:"rounded-lg border border-border/60 p-3",children:[o.jsx("p",{className:"mb-2 text-sm font-medium",children:"Invite a member"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(tt,{value:_,onChange:J=>S(J.target.value),placeholder:"teammate@example.com"}),o.jsx(tt,{value:k,onChange:J=>N(J.target.value),placeholder:"…or paste their user ID (optional)",className:"font-mono text-xs"}),o.jsxs(le,{size:"sm",className:"w-full bg-gradient-to-r from-primary to-primary/90",onClick:()=>void F(),disabled:j||!_.trim()&&!k.trim(),children:[j?o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(hne,{className:"mr-2 h-4 w-4"}),"Send invite"]})]})]})]})]})}),o.jsx(So,{open:!!D,onOpenChange:J=>!J&&I(null),children:o.jsxs(Oa,{children:[o.jsxs(Pa,{children:[o.jsx(Ia,{children:"Delete team"}),o.jsxs(La,{children:["Are you sure you want to delete"," ",o.jsx("span",{className:"font-medium",children:D==null?void 0:D.name}),"? Members will revert to their own projects. Your project is not deleted."]})]}),o.jsxs(Ma,{children:[o.jsx(Ba,{children:"Cancel"}),o.jsx($a,{onClick:Y,disabled:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:L?"Deleting…":"Delete"})]})]})})]})}const GAe=[{icon:HB,title:"Deploy apps",description:"Run containerized apps with one click — set CPU, memory, and env vars.",href:"/dashboard/apps",accent:"from-blue-500/15 to-blue-500/5 text-blue-500"},{icon:Zs,title:"Managed PostgreSQL",description:"Fully-managed databases with automatic backups and connection strings.",href:"/dashboard/postgres",accent:"from-emerald-500/15 to-emerald-500/5 text-emerald-500"},{icon:Au,title:"S3 Storage",description:"Object storage and buckets for files, assets, and media.",href:"/dashboard/storage",accent:"from-amber-500/15 to-amber-500/5 text-amber-500"},{icon:Es,title:"Volumes",description:"Persistent block storage that survives restarts and redeploys.",href:"/dashboard/volumes",accent:"from-violet-500/15 to-violet-500/5 text-violet-500"},{icon:An,title:"Static sites",description:"Ship a website in seconds from a folder or a Git repo.",href:"/dashboard/static-deploy",accent:"from-rose-500/15 to-rose-500/5 text-rose-500"},{icon:WB,title:"Tunnels",description:"Expose local services to the internet securely — no port juggling.",href:"/dashboard/tunnels",accent:"from-cyan-500/15 to-cyan-500/5 text-cyan-500"},{icon:dc,title:"Teams",description:"Share your cloud with teammates and build together.",href:"/dashboard/teams",accent:"from-fuchsia-500/15 to-fuchsia-500/5 text-fuchsia-500"},{icon:I0,title:"AI Assistant",description:"Chat with your cloud — deploy, monitor, and debug in plain language.",href:"/dashboard",accent:"from-primary/20 to-primary/5 text-primary"}],KAe=[{icon:$r,title:"Create a project",description:"Projects group your apps and resources in one place."},{icon:ti,title:"Deploy resources",description:"Add apps, databases, storage, and volumes in minutes."},{icon:dc,title:"Ship & share",description:"Expose it to the world, invite your team, and scale as you grow."}],Rx={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.06,delayChildren:.05}}},Dx={hidden:{opacity:0,y:14},show:{opacity:1,y:0,transition:{duration:.4,ease:"easeOut"}}};function YAe(){const t=Yn(),e=yl(),r=((e==null?void 0:e.displayName)??"").trim().split(/\s+/)[0]||"there";return o.jsxs("div",{className:"mx-auto max-w-4xl space-y-10",children:[o.jsxs(ws.section,{variants:Rx,initial:"hidden",animate:"show",className:"relative overflow-hidden rounded-2xl border border-primary/15 bg-gradient-to-br from-primary/10 via-background to-background p-8 md:p-12",children:[o.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse 60% 50% at 85% 0%, hsl(var(--primary) / 0.12), transparent 60%)"}}),o.jsxs(ws.div,{variants:Dx,className:"relative space-y-5",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-xs font-semibold text-primary",children:[o.jsx(ti,{className:"h-3.5 w-3.5"}),"Welcome aboard"]}),o.jsxs("h1",{className:"text-3xl font-bold leading-tight tracking-tight md:text-4xl",children:["Welcome to Ghaymah,"," ",o.jsx("span",{className:"bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent",children:r}),"👋"]}),o.jsx("p",{className:"max-w-xl text-muted-foreground",children:"Your cloud is ready. Ghaymah lets you deploy apps, spin up managed databases, store files, and expose services to the world — all in minutes, no infrastructure headaches. Here's a quick tour of what you can do."}),o.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[o.jsxs(le,{size:"lg",className:"gap-1.5 bg-gradient-to-r from-primary to-primary/90 shadow-md",onClick:()=>t("/dashboard/apps"),children:[o.jsx($r,{className:"h-4 w-4"}),"Deploy your first app",o.jsx(ei,{className:"h-4 w-4"})]}),o.jsx(le,{size:"lg",variant:"outline",onClick:()=>t("/dashboard/overview"),children:"Explore the dashboard"})]})]})]}),o.jsxs(ws.section,{variants:Rx,initial:"hidden",animate:"show",children:[o.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold",children:"How it works"}),o.jsx("span",{className:"h-px flex-1 bg-border"})]}),o.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:KAe.map((n,s)=>o.jsx(ws.div,{variants:Dx,children:o.jsx($e,{className:"relative h-full overflow-hidden border-border/60 bg-card/60",children:o.jsxs(Be,{className:"p-5",children:[o.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[o.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10",children:o.jsx(n.icon,{className:"h-5 w-5 text-primary"})}),o.jsx("span",{className:"text-3xl font-bold text-muted-foreground/20",children:String(s+1).padStart(2,"0")})]}),o.jsx("h3",{className:"font-semibold",children:n.title}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description})]})})},n.title))})]}),o.jsxs(ws.section,{variants:Rx,initial:"hidden",animate:"show",children:[o.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold",children:"What you can do"}),o.jsx("span",{className:"h-px flex-1 bg-border"})]}),o.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:GAe.map(n=>o.jsx(ws.div,{variants:Dx,children:o.jsxs(ba,{to:n.href,className:"group flex h-full items-start gap-4 rounded-xl border border-border/60 bg-card/60 p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:bg-card hover:shadow-lg hover:shadow-primary/5",children:[o.jsx("div",{className:we("flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",n.accent),children:o.jsx(n.icon,{className:"h-5 w-5"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("h3",{className:"font-medium",children:n.title}),o.jsx(ei,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-1 group-hover:text-primary"})]}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description})]})]})},n.title))})]}),o.jsxs(ws.section,{variants:Rx,initial:"hidden",animate:"show",children:[o.jsxs(ws.div,{variants:Dx,className:"flex flex-col items-center gap-4 rounded-2xl border border-primary/15 bg-gradient-to-br from-primary/10 via-background to-background p-8 text-center",children:[o.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx($r,{className:"h-6 w-6 text-primary"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-xl font-semibold",children:"Ready to ship?"}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Jump straight into deploying an app, or organize everything under a project."})]}),o.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[o.jsxs(le,{onClick:()=>t("/dashboard/apps"),children:["Deploy an app ",o.jsx(ei,{className:"h-4 w-4"})]}),o.jsx(le,{variant:"outline",onClick:()=>t("/dashboard/projects"),children:"Create a project"})]}),o.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-center gap-x-5 gap-y-1 text-xs text-muted-foreground",children:[o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx(Lr,{className:"h-3.5 w-3.5 text-emerald-500"})," Pay-as-you-go, no upfront cost"]}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx(Lr,{className:"h-3.5 w-3.5 text-emerald-500"})," Deploy from Git or CLI"]}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx(Lr,{className:"h-3.5 w-3.5 text-emerald-500"})," Built for the region"]})]})]}),o.jsx("p",{className:"mt-6 flex items-center justify-center gap-4 text-center text-xs text-muted-foreground",children:o.jsx(ba,{to:"/dashboard/overview",className:"hover:text-foreground hover:underline",children:"Skip the tour and go to the dashboard"})})]})]})}var QAe=E.forwardRef((t,e)=>{const{children:r,...n}=t,s=E.Children.toArray(r),i=s.find(XAe);if(i){const a=i.props.children,l=s.map(c=>c===i?E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null:c);return o.jsx(N2,{...n,ref:e,children:E.isValidElement(a)?E.cloneElement(a,void 0,l):null})}return o.jsx(N2,{...n,ref:e,children:r})});QAe.displayName="Slot";var N2=E.forwardRef((t,e)=>{const{children:r,...n}=t;if(E.isValidElement(r)){const s=JAe(r),i=ZAe(n,r.props);return r.type!==E.Fragment&&(i.ref=e?_o(e,s):s),E.cloneElement(r,i)}return E.Children.count(r)>1?E.Children.only(null):null});N2.displayName="SlotClone";var gG=({children:t})=>o.jsx(o.Fragment,{children:t});function XAe(t){return E.isValidElement(t)&&t.type===gG}function ZAe(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{i(...l),s(...l)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function JAe(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var[Gb,FIe]=Us("Tooltip",[Rf]),Kb=Rf(),vG="TooltipProvider",eRe=700,j2="tooltip.open",[tRe,fR]=Gb(vG),yG=t=>{const{__scopeTooltip:e,delayDuration:r=eRe,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:i}=t,[a,l]=E.useState(!0),c=E.useRef(!1),d=E.useRef(0);return E.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),o.jsx(tRe,{scope:e,isOpenDelayed:a,delayDuration:r,onOpen:E.useCallback(()=>{window.clearTimeout(d.current),l(!1)},[]),onClose:E.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:E.useCallback(f=>{c.current=f},[]),disableHoverableContent:s,children:i})};yG.displayName=vG;var Yb="Tooltip",[rRe,Av]=Gb(Yb),xG=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:s=!1,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=t,c=fR(Yb,t.__scopeTooltip),d=Kb(e),[f,p]=E.useState(null),m=ya(),g=E.useRef(0),y=a??c.disableHoverableContent,x=l??c.delayDuration,w=E.useRef(!1),[_=!1,S]=po({prop:n,defaultProp:s,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(j2))):c.onClose(),i==null||i(D)}}),k=E.useMemo(()=>_?w.current?"delayed-open":"instant-open":"closed",[_]),N=E.useCallback(()=>{window.clearTimeout(g.current),g.current=0,w.current=!1,S(!0)},[S]),j=E.useCallback(()=>{window.clearTimeout(g.current),g.current=0,S(!1)},[S]),T=E.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{w.current=!0,S(!0),g.current=0},x)},[x,S]);return E.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),o.jsx(RT,{...d,children:o.jsx(rRe,{scope:e,contentId:m,open:_,stateAttribute:k,trigger:f,onTriggerChange:p,onTriggerEnter:E.useCallback(()=>{c.isOpenDelayed?T():N()},[c.isOpenDelayed,T,N]),onTriggerLeave:E.useCallback(()=>{y?j():(window.clearTimeout(g.current),g.current=0)},[j,y]),onOpen:N,onClose:j,disableHoverableContent:y,children:r})})};xG.displayName=Yb;var T2="TooltipTrigger",_G=E.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=Av(T2,r),i=fR(T2,r),a=Kb(r),l=E.useRef(null),c=Ht(e,l,s.onTriggerChange),d=E.useRef(!1),f=E.useRef(!1),p=E.useCallback(()=>d.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(DT,{asChild:!0,...a,children:o.jsx(pt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:Ge(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ge(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Ge(t.onPointerDown,()=>{d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ge(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:Ge(t.onBlur,s.onClose),onClick:Ge(t.onClick,s.onClose)})})});_G.displayName=T2;var pR="TooltipPortal",[nRe,sRe]=Gb(pR,{forceMount:void 0}),bG=t=>{const{__scopeTooltip:e,forceMount:r,children:n,container:s}=t,i=Av(pR,e);return o.jsx(nRe,{scope:e,forceMount:r,children:o.jsx(_i,{present:r||i.open,children:o.jsx(xf,{asChild:!0,container:s,children:n})})})};bG.displayName=pR;var of="TooltipContent",wG=E.forwardRef((t,e)=>{const r=sRe(of,t.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...i}=t,a=Av(of,t.__scopeTooltip);return o.jsx(_i,{present:n||a.open,children:a.disableHoverableContent?o.jsx(SG,{side:s,...i,ref:e}):o.jsx(iRe,{side:s,...i,ref:e})})}),iRe=E.forwardRef((t,e)=>{const r=Av(of,t.__scopeTooltip),n=fR(of,t.__scopeTooltip),s=E.useRef(null),i=Ht(e,s),[a,l]=E.useState(null),{trigger:c,onClose:d}=r,f=s.current,{onPointerInTransitChange:p}=n,m=E.useCallback(()=>{l(null),p(!1)},[p]),g=E.useCallback((y,x)=>{const w=y.currentTarget,_={x:y.clientX,y:y.clientY},S=cRe(_,w.getBoundingClientRect()),k=uRe(_,S),N=dRe(x.getBoundingClientRect()),j=fRe([...k,...N]);l(j),p(!0)},[p]);return E.useEffect(()=>()=>m(),[m]),E.useEffect(()=>{if(c&&f){const y=w=>g(w,f),x=w=>g(w,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[c,f,g,m]),E.useEffect(()=>{if(a){const y=x=>{const w=x.target,_={x:x.clientX,y:x.clientY},S=(c==null?void 0:c.contains(w))||(f==null?void 0:f.contains(w)),k=!hRe(_,a);S?m():k&&(m(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,a,d,m]),o.jsx(SG,{...t,ref:i})}),[aRe,oRe]=Gb(Yb,{isInside:!1}),SG=E.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=t,c=Av(of,r),d=Kb(r),{onClose:f}=c;return E.useEffect(()=>(document.addEventListener(j2,f),()=>document.removeEventListener(j2,f)),[f]),E.useEffect(()=>{if(c.trigger){const p=m=>{const g=m.target;g!=null&&g.contains(c.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,f]),o.jsx(yf,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:o.jsxs(OT,{"data-state":c.stateAttribute,...d,...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(gG,{children:n}),o.jsx(aRe,{scope:r,isInside:!0,children:o.jsx(yee,{id:c.contentId,role:"tooltip",children:s||n})})]})})});wG.displayName=of;var kG="TooltipArrow",lRe=E.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=Kb(r);return oRe(kG,r).isInside?null:o.jsx(PT,{...s,...n,ref:e})});lRe.displayName=kG;function cRe(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,n,s,i)){case i:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function uRe(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function dRe(t){const{top:e,right:r,bottom:n,left:s}=t;return[{x:s,y:e},{x:r,y:e},{x:r,y:n},{x:s,y:n}]}function hRe(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i].x,c=e[i].y,d=e[a].x,f=e[a].y;c>n!=f>n&&r<(d-l)*(n-c)/(f-c)+l&&(s=!s)}return s}function fRe(t){const e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),pRe(e)}function pRe(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const s=t[n];for(;e.length>=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const s=t[n];for(;r.length>=2;){const i=r[r.length-1],a=r[r.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))r.pop();else break}r.push(s)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var mRe=yG,gRe=xG,vRe=_G,yRe=bG,EG=wG;const xRe=mRe,_Re=gRe,bRe=vRe,CG=E.forwardRef(({className:t,sideOffset:e=4,...r},n)=>o.jsx(yRe,{children:o.jsx(EG,{ref:n,sideOffset:e,className:we("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...r})}));CG.displayName=EG.displayName;const wRe=()=>{var lt;const t=Yn(),[e,r]=E.useState(1),[n,s]=E.useState({type:null,source:null,sourceValue:"",port:"8080",serverSize:"small",env:[],postgresConfig:{dbName:"postgres",username:"postgres",password:""},gitPrivate:!1,gitUsername:"",gitToken:"",gitProvider:"github",dockerPrivate:!1,dockerUsername:"",dockerPassword:""}),[i,a]=E.useState(!1),[l,c]=E.useState(""),[d,f]=E.useState(!1),[p,m]=E.useState(!1),g=[{id:"blog",name:"مدونة",icon:qh,meta:"شائع"},{id:"static",name:"موقع ثابت",icon:An,meta:"سريع"},{id:"node",name:"Node.js",icon:Bs,meta:"شائع"},{id:"python",name:"Python",icon:io,meta:"مرن"},{id:"docker",name:"حاوية",icon:xm,meta:"متقدم"},{id:"database",name:"قاعدة بيانات",icon:Zs,meta:"جديد"}],y=[{id:"local",name:"جهازي",icon:eC},{id:"github",name:"GitHub",icon:Zx},{id:"docker",name:"Docker Hub",icon:xm}],x=[{id:"small",name:"صغير",cpu:"0.5 CPU",ram:"512 MB",price:"مجاني"},{id:"medium",name:"متوسط",cpu:"1 CPU",ram:"1 GB",price:"5$ / شهر"},{id:"large",name:"كبير",cpu:"2 CPU",ram:"2 GB",price:"10$ / شهر"}],w=P=>{s(ne=>({...ne,type:P,...P==="docker"?{source:"docker"}:{}}))},_=P=>{s(ne=>({...ne,source:P}))},S=()=>{s(P=>({...P,env:[...P.env,{key:"",value:""}]}))},k=P=>{s(ne=>({...ne,env:ne.env.filter((X,W)=>W!==P)}))},N=(P,ne)=>{const X=[...n.env];X[P].key=ne,s(W=>({...W,env:X}))},j=(P,ne)=>{const X=[...n.env];X[P].value=ne,s(W=>({...W,env:X}))},T=()=>{n.type==="database"?r(7):n.type==="docker"?r(3):r(P=>P+1)},D=()=>{n.type==="docker"&&e===3?r(1):r(P=>P-1)},I=()=>{n.sourceValue.trim()&&r(4)},L=()=>{r(5)},$=()=>{r(6)},Q=()=>{n.source==="github"||n.source==="docker"?r(7):r(8)},M=()=>{r(8)},z=()=>{r(8)},R=()=>{r(8)},B=async()=>{f(!0);try{const P={type:n.type,source:n.source,sourceValue:n.sourceValue,port:n.port,serverSize:n.serverSize,env:n.env,...n.gitPrivate&&{gitAuth:{username:n.gitUsername,token:n.gitToken,provider:n.gitProvider}},...n.dockerPrivate&&{dockerAuth:{username:n.dockerUsername,password:n.dockerPassword}},...n.type==="database"&&{postgresConfig:n.postgresConfig}};console.log("🚀 Deploying with data:",P),console.log("📦 Deployment type:",n.type),console.log("🔗 Source:",n.source),console.log("💾 Server size:",n.serverSize);const X=await fetch("http://localhost:3000/api/deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)});if(!X.ok){const re=await X.json().catch(()=>({}));throw new Error(re.message||`Deployment failed: ${X.statusText}`)}const W=await X.json(),Z=W.url||W.deploymentUrl||`https://${n.type||"app"}-${Math.random().toString(36).substring(2,8)}.ghaym.cloud`;c(Z),a(!0),console.log("✅ Deployment successful:",{type:n.type,source:n.source,serverSize:n.serverSize,url:Z})}catch(P){console.error("❌ Deployment error:",P),alert(P instanceof Error?P.message:"فشل النشر. يرجى المحاولة مرة أخرى.")}finally{f(!1)}},V=()=>{navigator.clipboard.writeText(l),m(!0),setTimeout(()=>m(!1),2e3)},F=()=>{r(1),s({type:null,source:null,sourceValue:"",port:"8080",serverSize:"small",env:[],postgresConfig:{dbName:"postgres",username:"postgres",password:""},gitPrivate:!1,gitUsername:"",gitToken:"",gitProvider:"github",dockerPrivate:!1,dockerUsername:"",dockerPassword:""})},K=()=>o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mb-8",children:o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-3 bg-muted rounded-lg",children:o.jsx(il,{className:"h-8 w-8 text-primary"})}),o.jsxs("div",{className:"text-right",children:[o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"ما نوع التطبيق الذي تريد نشره؟"}),o.jsx("p",{className:"text-muted-foreground",children:"اختر النوع لتخصيص البيئة المناسبة لتطبيقك"})]})]})}),o.jsxs(ua,{className:"mb-6",children:[o.jsx(Bi,{className:"h-4 w-4 ml-2"}),o.jsx(da,{className:"text-right",children:"اختر نوع التطبيق الذي تريد نشره. سيتم تخصيص البيئة والإعدادات بناءً على اختيارك."})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:g.map(P=>o.jsx($e,{className:we("cursor-pointer transition-all duration-200 hover:shadow-sm hover:border-primary/50",n.type===P.id?"border-primary border bg-muted":"border-border"),onClick:()=>w(P.id),children:o.jsxs(Be,{className:"p-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx(Lt,{variant:n.type===P.id?"default":"secondary",children:P.meta}),o.jsx("div",{className:we("p-3 rounded-lg",n.type===P.id?"bg-primary/10":"bg-muted"),children:o.jsx(P.icon,{className:we("h-8 w-8",n.type===P.id?"text-primary":"text-muted-foreground")})})]}),o.jsx("h3",{className:"text-xl font-semibold mb-2 text-right",children:P.name}),o.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:[P.id==="blog"&&"نشر مدونة باستخدام ووردبريس أو غيرها",P.id==="static"&&"موقع ثابت HTML/CSS/JS",P.id==="node"&&"تطبيق Node.js مع npm",P.id==="python"&&"تطبيق Python مع pip",P.id==="docker"&&"حاوية Docker جاهزة",P.id==="database"&&"قاعدة بيانات MySQL/PostgreSQL"]}),n.type===P.id&&o.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:o.jsxs("div",{className:"flex items-center justify-start gap-2 text-sm text-primary",children:[o.jsx(is,{className:"h-4 w-4"}),o.jsx("span",{children:"محدد"})]})})]})},P.id))}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:()=>t("/"),className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع للرئيسية"]}),n.type&&o.jsxs(le,{onClick:T,className:"flex-1",children:[o.jsx("span",{className:"mr-2",children:"متابعة"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]}),Y=()=>o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mb-8",children:o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-3 bg-muted rounded-lg",children:o.jsx(Es,{className:"h-8 w-8 text-primary"})}),o.jsxs("div",{className:"text-right",children:[o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"أين يوجد الكود؟"}),o.jsx("p",{className:"text-muted-foreground",children:"اختر مصدر التطبيق الذي تريد نشره"})]})]})}),o.jsxs(ua,{className:"mb-6",children:[o.jsx(Bi,{className:"h-4 w-4 ml-2"}),o.jsx(da,{className:"text-right",children:n.type==="docker"?"سيتم سحب الصورة مباشرة من Docker Hub":"اختر مصدر الكود لتطبيقك"})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:y.map(P=>o.jsx($e,{className:we("cursor-pointer transition-all duration-200 hover:shadow-sm hover:border-primary/50",n.source===P.id?"border-primary border bg-muted":"border-border"),onClick:()=>_(P.id),children:o.jsxs(Be,{className:"p-6 flex flex-col items-center justify-center h-40",children:[o.jsx("div",{className:we("p-4 rounded-lg mb-4",n.source===P.id?"bg-primary/10":"bg-muted"),children:o.jsx(P.icon,{className:we("h-10 w-10",n.source===P.id?"text-primary":"text-muted-foreground")})}),o.jsx("h3",{className:"text-xl font-semibold mb-2",children:P.name}),o.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:[P.id==="local"&&"رفع المشروع من جهازك المحلي",P.id==="github"&&"مستودع GitHub عام أو خاص",P.id==="docker"&&"صورة Docker من Docker Hub"]}),n.source===P.id&&o.jsx("div",{className:"mt-4 pt-4 border-t border-border w-full",children:o.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-primary",children:[o.jsx(is,{className:"h-4 w-4"}),o.jsx("span",{children:"محدد"})]})})]})},P.id))}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:D,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع"]}),n.source&&o.jsxs(le,{onClick:T,className:"flex-1",children:[o.jsx("span",{className:"mr-2",children:"متابعة"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]}),O=()=>{let P="",ne=Zx,X="";return n.source==="github"?(P="مثال: https://github.com/user/repo",ne=Zx,X="أدخل رابط المستودع على GitHub"):n.source==="docker"?(P="user/image:tag",ne=xm,X="أدخل اسم الصورة على Docker Hub"):(P="مسار المشروع (محلي)",ne=eC,X="أدخل المسار الكامل للمشروع على جهازك"),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mb-8",children:o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-3 bg-muted rounded-lg",children:o.jsx(ne,{className:"h-8 w-8 text-primary"})}),o.jsxs("div",{className:"text-right",children:[o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"أدخل التفاصيل"}),o.jsx("p",{className:"text-muted-foreground",children:X})]})]})}),o.jsxs(ua,{className:"mb-6",children:[o.jsx(Bi,{className:"h-4 w-4 ml-2"}),o.jsx(da,{className:"text-right",children:n.source==="github"?"أدخل رابط المستودع الكامل على GitHub":n.source==="docker"?"أدخل اسم الصورة مع التاج (tag) إن وجد":"أدخل المسار الكامل للمشروع على جهازك"})]}),o.jsxs("div",{className:"mb-8",children:[o.jsxs("div",{className:"relative",children:[o.jsx(tt,{type:"text",placeholder:P,value:n.sourceValue,onChange:W=>s(Z=>({...Z,sourceValue:W.target.value})),className:"text-lg py-6 pr-12 pl-4 text-right",autoFocus:!0}),o.jsx("div",{className:"absolute left-4 top-1/2 transform -translate-y-1/2",children:o.jsx(ne,{className:"h-5 w-5 text-muted-foreground"})})]}),o.jsxs("p",{className:"text-sm text-muted-foreground mt-2 text-right",children:[n.source==="github"&&"مثال: https://github.com/username/repository",n.source==="docker"&&"مثال: nginx:latest أو username/image:tag",n.source==="local"&&"مثال: /home/user/projects/my-app"]})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:D,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع"]}),o.jsxs(le,{onClick:I,className:"flex-1",disabled:!n.sourceValue.trim(),children:[o.jsx("span",{className:"mr-2",children:"حفظ والمتابعة"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]})},H=()=>o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mb-8",children:o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-3 bg-muted rounded-lg",children:o.jsx(hc,{className:"h-8 w-8 text-primary"})}),o.jsxs("div",{className:"text-right",children:[o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"🔌 المنفذ الداخلي للتطبيق"}),o.jsx("p",{className:"text-muted-foreground",children:"أدخل المنفذ الذي يعمل عليه تطبيقك داخلياً"})]})]})}),o.jsxs(ua,{className:"mb-6",children:[o.jsx(Bi,{className:"h-4 w-4 ml-2"}),o.jsx(da,{className:"text-right",children:"عادةً ما يكون المنفذ 8080 أو 3000 أو 80. تأكد من أن تطبيقك يستمع على هذا المنفذ."})]}),o.jsxs("div",{className:"mb-8",children:[o.jsxs("div",{className:"relative",children:[o.jsx(tt,{type:"text",placeholder:"مثال: 8080",value:n.port,onChange:P=>s(ne=>({...ne,port:P.target.value})),className:"text-lg py-6 pr-12 pl-4 text-right",autoFocus:!0}),o.jsx("div",{className:"absolute left-4 top-1/2 transform -translate-y-1/2",children:o.jsx(hc,{className:"h-5 w-5 text-muted-foreground"})})]}),o.jsxs("div",{className:"flex gap-2 mt-4 justify-start",children:[o.jsx(le,{variant:"outline",size:"sm",onClick:()=>s(P=>({...P,port:"8080"})),className:n.port==="8080"?"bg-primary/10 border-primary":"",children:"8080"}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>s(P=>({...P,port:"3000"})),className:n.port==="3000"?"bg-primary/10 border-primary":"",children:"3000"}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>s(P=>({...P,port:"80"})),className:n.port==="80"?"bg-primary/10 border-primary":"",children:"80"}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>s(P=>({...P,port:"443"})),className:n.port==="443"?"bg-primary/10 border-primary":"",children:"443"})]})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:D,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع"]}),o.jsxs(le,{onClick:L,className:"flex-1",children:[o.jsx("span",{className:"mr-2",children:"متابعة"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]}),G=()=>o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mb-8 text-right",children:o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-3 bg-muted rounded-lg",children:o.jsx(io,{className:"h-8 w-8 text-primary"})}),o.jsxs("div",{className:"text-right",children:[o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"حجم الخادم"}),o.jsx("p",{className:"text-muted-foreground",children:"اختر حجم الخادم المناسب لتطبيقك"})]})]})}),o.jsxs(ua,{className:"mb-6",children:[o.jsx(Bi,{className:"h-4 w-4 ml-2"}),o.jsx(da,{className:"text-right",children:"يمكنك تغيير حجم الخادم لاحقاً حسب احتياجات تطبيقك."})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:x.map(P=>o.jsx($e,{className:we("cursor-pointer transition-all duration-200 hover:shadow-sm hover:border-primary/50",n.serverSize===P.id?"border-primary border bg-muted":"border-border"),onClick:()=>s(ne=>({...ne,serverSize:P.id})),children:o.jsxs(Be,{className:"p-6",children:[o.jsxs("div",{className:"text-center mb-4",children:[o.jsx(Lt,{variant:n.serverSize===P.id?"default":"secondary",className:"mb-2",children:P.price}),o.jsx("h3",{className:"text-xl font-semibold mb-2",children:P.name}),o.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[o.jsxs("p",{children:["💻 ",P.cpu]}),o.jsxs("p",{children:["💾 ",P.ram]})]})]}),n.serverSize===P.id&&o.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:o.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-primary",children:[o.jsx(is,{className:"h-4 w-4"}),o.jsx("span",{children:"محدد"})]})})]})},P.id))}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:D,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع"]}),o.jsxs(le,{onClick:$,className:"flex-1",children:[o.jsx("span",{className:"mr-2",children:"متابعة"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]}),q=()=>o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mb-8 text-right",children:o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-3 bg-muted rounded-lg",children:o.jsx(Bs,{className:"h-8 w-8 text-primary"})}),o.jsxs("div",{className:"text-right",children:[o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"🔐 متغيرات البيئة"}),o.jsx("p",{className:"text-muted-foreground",children:"أضف متغيرات البيئة التي يحتاجها تطبيقك (اختياري)"})]})]})}),o.jsxs(ua,{className:"mb-6",children:[o.jsx(Bi,{className:"h-4 w-4 ml-2"}),o.jsx(da,{className:"text-right",children:"يمكنك إضافة متغيرات البيئة مثل مفاتيح API، إعدادات قاعدة البيانات، وغيرها."})]}),o.jsx($e,{className:"mb-8",children:o.jsx(Be,{className:"p-6",children:o.jsxs("div",{className:"space-y-4",children:[n.env.map((P,ne)=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(le,{variant:"ghost",size:"icon",onClick:()=>k(ne),className:"flex-shrink-0 text-destructive hover:text-destructive",children:o.jsx(ds,{className:"h-4 w-4"})}),o.jsx(tt,{type:"text",placeholder:"KEY",value:P.key,onChange:X=>N(ne,X.target.value),className:"flex-1 text-right font-mono"}),o.jsx("span",{className:"text-muted-foreground",children:"="}),o.jsx(tt,{type:"text",placeholder:"value",value:P.value,onChange:X=>j(ne,X.target.value),className:"flex-1 text-right"})]},ne)),o.jsxs(le,{variant:"outline",onClick:S,className:"w-full",children:[o.jsx(nr,{className:"ml-2 h-4 w-4"}),"إضافة متغير جديد"]})]})})}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:D,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع"]}),o.jsxs(le,{onClick:Q,className:"flex-1",children:[o.jsx("span",{className:"mr-2",children:"متابعة"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]}),J=()=>o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-8 text-right",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-2 justify-start",children:[o.jsx(Zs,{className:"h-8 w-8 text-primary"}),o.jsx("h2",{className:"text-3xl font-bold",children:"إعدادات قاعدة بيانات PostgreSQL"})]}),o.jsx("p",{className:"text-muted-foreground mb-4",children:"قم بتكوين إعدادات قاعدة البيانات الخاصة بك"})]}),o.jsx($e,{className:"mb-8",children:o.jsx(Be,{className:"p-6",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"dbName",className:"text-right block",children:"اسم قاعدة البيانات"}),o.jsx(tt,{id:"dbName",type:"text",placeholder:"postgres",value:n.postgresConfig.dbName,onChange:P=>s(ne=>({...ne,postgresConfig:{...ne.postgresConfig,dbName:P.target.value}})),className:"text-lg py-3 text-right"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"username",className:"text-right block",children:"اسم المستخدم"}),o.jsx(tt,{id:"username",type:"text",placeholder:"postgres",value:n.postgresConfig.username,onChange:P=>s(ne=>({...ne,postgresConfig:{...ne.postgresConfig,username:P.target.value}})),className:"text-lg py-3 text-right"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"password",className:"text-right block",children:"كلمة المرور"}),o.jsx(tt,{id:"password",type:"password",placeholder:"كلمة مرور قوية",value:n.postgresConfig.password,onChange:P=>s(ne=>({...ne,postgresConfig:{...ne.postgresConfig,password:P.target.value}})),className:"text-lg py-3 text-right"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{className:"text-right block",children:"إصدار PostgreSQL"}),o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2",children:[o.jsx(Zs,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm",children:"PostgreSQL 17"})]})]})]})})}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:D,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع"]}),o.jsxs(le,{onClick:M,className:"flex-1",children:[o.jsx("span",{className:"mr-2",children:"حفظ والمتابعة"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]}),te=()=>o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-8 text-right",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-2 justify-start",children:[o.jsx(Gn,{className:"h-8 w-8 text-primary"}),o.jsx("h2",{className:"text-3xl font-bold",children:"مصادقة Git"})]}),o.jsx("p",{className:"text-muted-foreground mb-4",children:(n.source==="github","هل المستودع خاص؟ إذا نعم، أدخل بيانات الاعتماد")})]}),o.jsx($e,{className:"mb-8",children:o.jsx(Be,{className:"p-6",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Pc,{checked:n.gitPrivate,onCheckedChange:P=>s(ne=>({...ne,gitPrivate:P}))}),o.jsxs("div",{className:"space-y-0.5 text-right",children:[o.jsx(Xe,{className:"text-base",children:"مستودع خاص"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:(n.source==="github","المستودع يحتاج إلى مصادقة")})]})]}),n.gitPrivate&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"gitProvider",className:"text-right block",children:"مزود Git"}),o.jsxs(ja,{value:n.gitProvider,onValueChange:P=>s(ne=>({...ne,gitProvider:P})),children:[o.jsx(Wi,{className:"w-full text-right",children:o.jsx(Ta,{placeholder:"اختر المزود"})}),o.jsxs(Gi,{children:[o.jsx(bn,{value:"github",children:"GitHub"}),o.jsx(bn,{value:"gitpasha",children:"Gitpasha"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"gitUsername",className:"text-right block",children:"اسم المستخدم"}),o.jsx(tt,{id:"gitUsername",type:"text",placeholder:"your-username",value:n.gitUsername,onChange:P=>s(ne=>({...ne,gitUsername:P.target.value})),className:"text-lg py-3 text-right"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"gitToken",className:"text-right block",children:"رمز الوصول (Token)"}),o.jsx(tt,{id:"gitToken",type:"password",placeholder:n.gitProvider==="github"?"ghp_xxxx":"رمز الوصول",value:n.gitToken,onChange:P=>s(ne=>({...ne,gitToken:P.target.value})),className:"text-lg py-3 text-right"}),o.jsx("p",{className:"text-sm text-muted-foreground text-right",children:n.gitProvider==="github"?"Personal Access Token (PAT) من GitHub":"رمز الوصول من Gitpasha"})]}),o.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2 justify-start",children:[o.jsx(Bi,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"font-medium",children:"معلومات:"})]}),o.jsx("p",{className:"text-sm text-muted-foreground text-right",children:"سيتم تخزين بيانات الاعتماد بشكل آمن في سحابة غَيْم"})]})]})]})})}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:D,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع"]}),o.jsxs(le,{onClick:z,className:"flex-1",disabled:n.gitPrivate&&(!n.gitUsername.trim()||!n.gitToken.trim()),children:[o.jsx("span",{className:"mr-2",children:n.gitPrivate?"حفظ والمتابعة":"تخطي"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]}),ve=()=>o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-8 text-right",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-2 justify-start",children:[o.jsx(xm,{className:"h-8 w-8 text-primary"}),o.jsx("h2",{className:"text-3xl font-bold",children:"مصادقة Docker Hub"})]}),o.jsx("p",{className:"text-muted-foreground mb-4",children:"هل الصورة خاصة؟ إذا نعم، أدخل بيانات اعتماد Docker Hub"})]}),o.jsx($e,{className:"mb-8",children:o.jsx(Be,{className:"p-6",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Pc,{checked:n.dockerPrivate,onCheckedChange:P=>s(ne=>({...ne,dockerPrivate:P}))}),o.jsxs("div",{className:"space-y-0.5 text-right",children:[o.jsx(Xe,{className:"text-base",children:"صورة خاصة"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"الصورة تحتاج إلى مصادقة Docker Hub"})]})]}),n.dockerPrivate&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"dockerUsername",className:"text-right block",children:"اسم مستخدم Docker Hub"}),o.jsx(tt,{id:"dockerUsername",type:"text",placeholder:"your-username",value:n.dockerUsername,onChange:P=>s(ne=>({...ne,dockerUsername:P.target.value})),className:"text-lg py-3 text-right"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"dockerPassword",className:"text-right block",children:"كلمة المرور أو رمز الوصول"}),o.jsx(tt,{id:"dockerPassword",type:"password",placeholder:"••••••••",value:n.dockerPassword,onChange:P=>s(ne=>({...ne,dockerPassword:P.target.value})),className:"text-lg py-3 text-right"}),o.jsx("p",{className:"text-sm text-muted-foreground text-right",children:"يمكن استخدام كلمة المرور أو رمز الوصول الشخصي"})]}),o.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2 justify-start",children:[o.jsx(Bi,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"font-medium",children:"معلومات:"})]}),o.jsx("p",{className:"text-sm text-muted-foreground text-right",children:"سيتم تخزين بيانات الاعتماد بشكل آمن في سحابة غَيْم"})]})]})]})})}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:D,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"رجوع"]}),o.jsxs(le,{onClick:R,className:"flex-1",disabled:n.dockerPrivate&&(!n.dockerUsername.trim()||!n.dockerPassword.trim()),children:[o.jsx("span",{className:"mr-2",children:n.dockerPrivate?"حفظ والمتابعة":"تخطي"}),o.jsx(Qa,{className:"mr-2 h-4 w-4"})]})]})]}),he=()=>{var re,ae,fe;const P=((re=g.find(oe=>oe.id===n.type))==null?void 0:re.name)||"—",ne=((ae=y.find(oe=>oe.id===n.source))==null?void 0:ae.name)||"—",X=n.sourceValue||"—",W=((fe=g.find(oe=>oe.id===n.type))==null?void 0:fe.icon)||Hu,Z=x.find(oe=>oe.id===n.serverSize);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mb-8",children:o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"p-3 bg-primary/5 rounded-lg",children:o.jsx(is,{className:"h-8 w-8 text-primary"})}),o.jsxs("div",{className:"text-right",children:[o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"✅ كل شيء جاهز"}),o.jsx("p",{className:"text-muted-foreground",children:"مراجعة المعلومات قبل النشر"})]})]})}),o.jsxs(ua,{className:"mb-6",children:[o.jsx(Bi,{className:"h-4 w-4 ml-2"}),o.jsx(da,{className:"text-right",children:'تأكد من صحة المعلومات قبل المتابعة. يمكنك الرجوع وتعديل أي خطوة بالنقر على زر "رجوع".'})]}),o.jsxs($e,{className:"mb-8",children:[o.jsxs(ot,{className:"pb-3",children:[o.jsxs(dt,{className:"flex items-center gap-2 justify-start",children:[o.jsx(W,{className:"h-5 w-5 text-primary"}),"تفاصيل النشر"]}),o.jsx(rn,{className:"text-right",children:"مراجعة المعلومات المدخلة"})]}),o.jsx(Be,{className:"p-6",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex justify-between items-center py-3 border-b",children:[o.jsx("span",{className:"font-semibold text-primary text-right",children:P}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(il,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-muted-foreground",children:"نوع التطبيق"})]})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-b",children:[o.jsx("span",{className:"font-semibold text-primary text-right",children:ne}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Es,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-muted-foreground",children:"المصدر"})]})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-b",children:[o.jsx("span",{className:"font-semibold text-primary truncate max-w-[200px] text-right",children:X}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(qh,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-muted-foreground",children:"المسار"})]})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-b",children:[o.jsx("span",{className:"font-semibold text-primary text-right",children:n.port}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(hc,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-muted-foreground",children:"المنفذ"})]})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-b",children:[o.jsxs("div",{className:"text-right",children:[o.jsx("span",{className:"font-semibold text-primary",children:Z==null?void 0:Z.name}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[Z==null?void 0:Z.cpu," • ",Z==null?void 0:Z.ram]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(io,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-muted-foreground",children:"حجم الخادم"})]})]}),n.env.length>0&&o.jsxs("div",{className:"flex justify-between items-center py-3",children:[o.jsxs("div",{className:"text-right",children:[o.jsxs("span",{className:"font-semibold text-primary",children:[n.env.length," متغيرات بيئة"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n.env.map(oe=>oe.key).join(", ")})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Bs,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-muted-foreground",children:"متغيرات البيئة"})]})]})]})})]}),o.jsxs($e,{className:"mb-8",children:[o.jsxs(ot,{className:"pb-3",children:[o.jsxs(dt,{className:"flex items-center gap-2 justify-start",children:[o.jsx(Bs,{className:"h-5 w-5 text-primary"}),"أمر النشر"]}),o.jsx(rn,{className:"text-right",children:"سيتم تنفيذ هذا الأمر تلقائياً"})]}),o.jsx(Be,{className:"p-6",children:o.jsx("div",{className:"font-mono text-sm bg-muted p-4 rounded-lg overflow-x-auto text-left",children:o.jsxs("code",{children:["ghaym deploy --",n.type||"app"," --port ",n.port," --size ",n.serverSize,' --source "',X,'"',n.env.length>0?` --env ${n.env.map(oe=>`${oe.key}=${oe.value}`).join(" ")}`:""]})})})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs(le,{variant:"outline",onClick:F,className:"flex-1",children:[o.jsx(_s,{className:"ml-2 h-4 w-4"}),"ابدأ من جديد"]}),o.jsx(le,{onClick:B,className:"flex-1",disabled:d,children:d?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-4 w-4 border-2 border-white border-t-transparent rounded-full animate-spin mr-2"}),"جاري النشر..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Hu,{className:"ml-2 h-5 w-5"}),o.jsx("span",{className:"mr-2",children:"انشر الآن"})]})})]})]})},xe=()=>{switch(e){case 1:return K();case 2:return Y();case 3:return O();case 4:return H();case 5:return G();case 6:return q();case 7:return n.type==="database"?J():n.source==="github"?te():n.source==="docker"?ve():he();case 8:return he();default:return null}},ke=()=>n.type==="database"?((e===1?1:e===7?2:e===8?3:1)-1)/2*100:n.type==="docker"?((e===1?1:e===3?2:e===4?3:e===5?4:e===6?5:e===7?6:e===8?7:1)-1)/6*100:(e-1)/7*100,Oe=()=>n.type==="database"?["النوع","إعدادات PostgreSQL","المراجعة"]:n.type==="docker"?["النوع","التفاصيل","المنفذ","حجم الخادم","متغيرات البيئة","إعدادات","المراجعة"]:["النوع","المصدر","التفاصيل","المنفذ","حجم الخادم","متغيرات البيئة","إعدادات","المراجعة"],He=ke(),Ye=Oe();return o.jsxs("div",{className:"min-h-screen bg-background p-4 md:p-8",dir:"rtl",children:[o.jsx($e,{className:"max-w-4xl mx-auto",children:o.jsxs(Be,{className:"p-6",children:[o.jsxs("div",{className:"mb-12",children:[o.jsx("div",{className:"flex items-center justify-between mb-4",children:Ye.map((P,ne)=>{let X=ne+1,W=!1,Z=!1;return n.type==="database"?(e===1&&ne===0&&(W=!0),e===7&&ne===1&&(W=!0),e===8&&ne===2&&(W=!0),e>1&&ne===0&&(Z=!0),e>7&&ne===1&&(Z=!0)):n.type==="docker"?(e===1&&ne===0&&(W=!0),e===3&&ne===1&&(W=!0),e===4&&ne===2&&(W=!0),e===5&&ne===3&&(W=!0),e===6&&ne===4&&(W=!0),e===7&&ne===5&&(W=!0),e===8&&ne===6&&(W=!0),e>1&&ne===0&&(Z=!0),e>3&&ne===1&&(Z=!0),e>4&&ne===2&&(Z=!0),e>5&&ne===3&&(Z=!0),e>6&&ne===4&&(Z=!0),e>7&&ne===5&&(Z=!0)):(W=e===X,Z=e>X),o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("div",{className:we("h-8 w-8 rounded-full flex items-center justify-center mb-2 transition-colors duration-200",Z?"bg-primary text-white":W?"bg-primary text-white ring-2 ring-primary/20":"bg-muted text-muted-foreground"),children:X}),o.jsx("span",{className:we("text-sm transition-colors duration-200",Z||W?"text-primary font-medium":"text-muted-foreground"),children:P})]},P)})}),o.jsx(tR,{value:He,className:"h-1.5"})]}),xe()]})}),o.jsx(hs,{open:i,onOpenChange:a,children:o.jsxs(un,{className:"sm:max-w-md",children:[o.jsxs(Dn,{children:[o.jsxs(On,{className:"text-xl text-center flex items-center justify-center gap-2",children:[o.jsx(is,{className:"h-5 w-5 text-primary"}),"تم النشر بنجاح"]}),o.jsx(fs,{className:"text-center",children:"تم نشر تطبيقك على سحابة غَيْم"})]}),o.jsxs("div",{className:"flex flex-col items-center text-center py-6",children:[o.jsxs("div",{className:"relative mb-6",children:[o.jsx("div",{className:"h-20 w-20 rounded-full bg-primary/5 flex items-center justify-center",children:o.jsx("div",{className:"h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:o.jsx("div",{className:"h-9 w-9 rounded-full bg-primary flex items-center justify-center",children:o.jsx(is,{className:"h-5 w-5 text-white"})})})}),o.jsx("div",{className:"absolute -top-2 -right-2",children:o.jsx("div",{className:"h-7 w-7 rounded-full bg-primary flex items-center justify-center",children:o.jsx(Hu,{className:"h-3.5 w-3.5 text-white"})})})]}),o.jsx("p",{className:"text-muted-foreground mb-6",children:"تطبيقك يعمل الآن على سحابة غَيْم"}),o.jsx("div",{className:"w-full mb-6",children:o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"bg-muted p-3 rounded-lg font-mono text-sm break-all pr-12",children:l}),o.jsx(xRe,{children:o.jsxs(_Re,{children:[o.jsx(bRe,{asChild:!0,children:o.jsx(le,{variant:"outline",size:"icon",className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-7 w-7",onClick:V,children:p?o.jsx(is,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(cn,{className:"h-3.5 w-3.5"})})}),o.jsx(CG,{children:o.jsx("p",{children:p?"تم النسخ!":"نسخ الرابط"})})]})})]})}),o.jsxs("div",{className:"flex gap-2 mb-6",children:[o.jsxs(Lt,{variant:"secondary",className:"bg-muted text-foreground",children:[o.jsx(wa,{className:"h-3 w-3 ml-1"}),"SSL مفعل"]}),o.jsxs(Lt,{variant:"secondary",className:"bg-muted text-foreground",children:[o.jsx(An,{className:"h-3 w-3 ml-1"}),"MENA"]}),o.jsxs(Lt,{variant:"secondary",className:"bg-muted text-foreground",children:[o.jsx(hc,{className:"h-3 w-3 ml-1"}),"سريع"]}),o.jsxs(Lt,{variant:"secondary",className:"bg-muted text-foreground",children:[o.jsx(io,{className:"h-3 w-3 ml-1"}),((lt=x.find(P=>P.id===n.serverSize))==null?void 0:lt.name)||"صغير"]})]}),o.jsxs("div",{className:"w-full space-y-3",children:[o.jsxs(le,{onClick:()=>window.open(l,"_blank"),className:"w-full",variant:"default",children:[o.jsx(al,{className:"mr-2 h-4 w-4"}),"زيارة التطبيق"]}),o.jsx(le,{onClick:()=>a(!1),className:"w-full",variant:"outline",children:"إغلاق"})]})]})]})})]})};function SRe(){return o.jsxs(dB,{children:[o.jsx(Qt,{path:"/",element:o.jsx(iL,{})}),o.jsx(Qt,{path:"/onboarding",element:o.jsx(YAe,{})}),o.jsx(Qt,{path:"/assistant",element:o.jsx(iL,{})}),o.jsx(Qt,{path:"/overview",element:o.jsx(UNe,{})}),o.jsx(Qt,{path:"/projects",element:o.jsx(abe,{})}),o.jsx(Qt,{path:"/projects/:projectId",element:o.jsx(Abe,{})}),o.jsx(Qt,{path:"/projects/:projectId/apps/:appId",element:o.jsx(Pbe,{})}),o.jsx(Qt,{path:"/volumes",element:o.jsx(zbe,{})}),o.jsx(Qt,{path:"/integrations",element:o.jsx(Bbe,{})}),o.jsx(Qt,{path:"/user/profile",element:o.jsx(Hbe,{})}),o.jsx(Qt,{path:"/billing",element:o.jsx(twe,{})}),o.jsx(Qt,{path:"/store",element:o.jsx(JNe,{})}),o.jsx(Qt,{path:"/simple-deployer",element:o.jsx(wRe,{})}),o.jsx(Qt,{path:"/genAI",element:o.jsx(lwe,{})}),o.jsx(Qt,{path:"/tunnels",element:o.jsx(FNe,{})}),o.jsx(Qt,{path:"/postgres",element:o.jsx(s2e,{})}),o.jsx(Qt,{path:"/storage",element:o.jsx(o2e,{})}),o.jsx(Qt,{path:"/apps",element:o.jsx(b2e,{})}),o.jsx(Qt,{path:"/apps/:appId",element:o.jsx(UAe,{})}),o.jsx(Qt,{path:"/managed-volumes",element:o.jsx(VAe,{})}),o.jsx(Qt,{path:"/pull-secrets",element:o.jsx(HAe,{})}),o.jsx(Qt,{path:"/secrets",element:o.jsx(qAe,{})}),o.jsx(Qt,{path:"/teams",element:o.jsx(WAe,{})})]})}const Ox="https://auth.ghaymah.systems",NG=new fue({authUrl:Ox,storageUrl:Ox,graphqlUrl:Ox,functionsUrl:Ox});var hi={},Jk,c$;function kRe(){if(c$)return Jk;c$=1,Jk=t;function t(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}return t.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),n=Math.floor(r*this.jitter*e);e=(Math.floor(r*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},t.prototype.reset=function(){this.attempts=0},t.prototype.setMin=function(e){this.ms=e},t.prototype.setMax=function(e){this.max=e},t.prototype.setJitter=function(e){this.jitter=e},Jk}var eE={exports:{}},u$;function ERe(){return u$||(u$=1,function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(c,d,f){this.fn=c,this.context=d,this.once=f||!1}function i(c,d,f,p,m){if(typeof f!="function")throw new TypeError("The listener must be a function");var g=new s(f,p||c,m),y=r?r+d:d;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],g]:c._events[y].push(g):(c._events[y]=g,c._eventsCount++),c}function a(c,d){--c._eventsCount===0?c._events=new n:delete c._events[d]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,p;if(this._eventsCount===0)return d;for(p in f=this._events)e.call(f,p)&&d.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,p=this._events[f];if(!p)return[];if(p.fn)return[p.fn];for(var m=0,g=p.length,y=new Array(g);m<g;m++)y[m]=p[m].fn;return y},l.prototype.listenerCount=function(d){var f=r?r+d:d,p=this._events[f];return p?p.fn?1:p.length:0},l.prototype.emit=function(d,f,p,m,g,y){var x=r?r+d:d;if(!this._events[x])return!1;var w=this._events[x],_=arguments.length,S,k;if(w.fn){switch(w.once&&this.removeListener(d,w.fn,void 0,!0),_){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,f),!0;case 3:return w.fn.call(w.context,f,p),!0;case 4:return w.fn.call(w.context,f,p,m),!0;case 5:return w.fn.call(w.context,f,p,m,g),!0;case 6:return w.fn.call(w.context,f,p,m,g,y),!0}for(k=1,S=new Array(_-1);k<_;k++)S[k-1]=arguments[k];w.fn.apply(w.context,S)}else{var N=w.length,j;for(k=0;k<N;k++)switch(w[k].once&&this.removeListener(d,w[k].fn,void 0,!0),_){case 1:w[k].fn.call(w[k].context);break;case 2:w[k].fn.call(w[k].context,f);break;case 3:w[k].fn.call(w[k].context,f,p);break;case 4:w[k].fn.call(w[k].context,f,p,m);break;default:if(!S)for(j=1,S=new Array(_-1);j<_;j++)S[j-1]=arguments[j];w[k].fn.apply(w[k].context,S)}}return!0},l.prototype.on=function(d,f,p){return i(this,d,f,p,!1)},l.prototype.once=function(d,f,p){return i(this,d,f,p,!0)},l.prototype.removeListener=function(d,f,p,m){var g=r?r+d:d;if(!this._events[g])return this;if(!f)return a(this,g),this;var y=this._events[g];if(y.fn)y.fn===f&&(!m||y.once)&&(!p||y.context===p)&&a(this,g);else{for(var x=0,w=[],_=y.length;x<_;x++)(y[x].fn!==f||m&&!y[x].once||p&&y[x].context!==p)&&w.push(y[x]);w.length?this._events[g]=w.length===1?w[0]:w:a(this,g)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&a(this,f)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,t.exports=l}(eE)),eE.exports}var Px={},d$;function CRe(){if(d$)return Px;d$=1,Object.defineProperty(Px,"__esModule",{value:!0});function t(e){return typeof e=="string"}return Px.default=t,Px}var Mx={},h$;function NRe(){if(h$)return Mx;h$=1,Object.defineProperty(Mx,"__esModule",{value:!0});function t(e){return e!==null&&typeof e=="object"}return Mx.default=t,Mx}const jRe=z_(Qse),TRe=z_(Zse);function ARe(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var yh;typeof self<"u"?yh=self:typeof window<"u"?yh=window:typeof global<"u"?yh=global:typeof Jg<"u"?yh=Jg:yh=Function("return this")();var RRe=ARe(yh);const DRe=Object.freeze(Object.defineProperty({__proto__:null,default:RRe},Symbol.toStringTag,{value:"Module"})),ORe=z_(DRe);var gu={},f$;function PRe(){if(f$)return gu;f$=1,Object.defineProperty(gu,"__esModule",{value:!0}),gu.GRAPHQL_SUBSCRIPTIONS=gu.GRAPHQL_WS=void 0;var t="graphql-ws";gu.GRAPHQL_WS=t;var e="graphql-subscriptions";return gu.GRAPHQL_SUBSCRIPTIONS=e,gu}var vu={},p$;function MRe(){if(p$)return vu;p$=1,Object.defineProperty(vu,"__esModule",{value:!0}),vu.WS_TIMEOUT=vu.MIN_WS_TIMEOUT=void 0;var t=1e3;vu.MIN_WS_TIMEOUT=t;var e=3e4;return vu.WS_TIMEOUT=e,vu}var Ix={},m$;function IRe(){if(m$)return Ix;m$=1,Object.defineProperty(Ix,"__esModule",{value:!0});var t=function(){function e(){throw new Error("Static Class")}return e.GQL_CONNECTION_INIT="connection_init",e.GQL_CONNECTION_ACK="connection_ack",e.GQL_CONNECTION_ERROR="connection_error",e.GQL_CONNECTION_KEEP_ALIVE="ka",e.GQL_CONNECTION_TERMINATE="connection_terminate",e.GQL_START="start",e.GQL_DATA="data",e.GQL_ERROR="error",e.GQL_COMPLETE="complete",e.GQL_STOP="stop",e.SUBSCRIPTION_START="subscription_start",e.SUBSCRIPTION_DATA="subscription_data",e.SUBSCRIPTION_SUCCESS="subscription_success",e.SUBSCRIPTION_FAIL="subscription_fail",e.SUBSCRIPTION_END="subscription_end",e.INIT="init",e.INIT_SUCCESS="init_success",e.INIT_FAIL="init_fail",e.KEEP_ALIVE="keepalive",e}();return Ix.default=t,Ix}var g$;function LRe(){if(g$)return hi;g$=1;var t=hi&&hi.__assign||function(){return t=Object.assign||function(_){for(var S,k=1,N=arguments.length;k<N;k++){S=arguments[k];for(var j in S)Object.prototype.hasOwnProperty.call(S,j)&&(_[j]=S[j])}return _},t.apply(this,arguments)},e=hi&&hi.__awaiter||function(_,S,k,N){function j(T){return T instanceof k?T:new k(function(D){D(T)})}return new(k||(k=Promise))(function(T,D){function I(Q){try{$(N.next(Q))}catch(M){D(M)}}function L(Q){try{$(N.throw(Q))}catch(M){D(M)}}function $(Q){Q.done?T(Q.value):j(Q.value).then(I,L)}$((N=N.apply(_,S||[])).next())})},r=hi&&hi.__generator||function(_,S){var k={label:0,sent:function(){if(T[0]&1)throw T[1];return T[1]},trys:[],ops:[]},N,j,T,D;return D={next:I(0),throw:I(1),return:I(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function I($){return function(Q){return L([$,Q])}}function L($){if(N)throw new TypeError("Generator is already executing.");for(;k;)try{if(N=1,j&&(T=$[0]&2?j.return:$[0]?j.throw||((T=j.return)&&T.call(j),0):j.next)&&!(T=T.call(j,$[1])).done)return T;switch(j=0,T&&($=[$[0]&2,T.value]),$[0]){case 0:case 1:T=$;break;case 4:return k.label++,{value:$[1],done:!1};case 5:k.label++,j=$[1],$=[0];continue;case 7:$=k.ops.pop(),k.trys.pop();continue;default:if(T=k.trys,!(T=T.length>0&&T[T.length-1])&&($[0]===6||$[0]===2)){k=0;continue}if($[0]===3&&(!T||$[1]>T[0]&&$[1]<T[3])){k.label=$[1];break}if($[0]===6&&k.label<T[1]){k.label=T[1],T=$;break}if(T&&k.label<T[2]){k.label=T[2],k.ops.push($);break}T[2]&&k.ops.pop(),k.trys.pop();continue}$=S.call(_,k)}catch(Q){$=[6,Q],j=0}finally{N=T=0}if($[0]&5)throw $[1];return{value:$[0]?$[1]:void 0,done:!0}}},n=hi&&hi.__spreadArray||function(_,S,k){if(k||arguments.length===2)for(var N=0,j=S.length,T;N<j;N++)(T||!(N in S))&&(T||(T=Array.prototype.slice.call(S,0,N)),T[N]=S[N]);return _.concat(T||Array.prototype.slice.call(S))};Object.defineProperty(hi,"__esModule",{value:!0}),hi.SubscriptionClient=void 0;var s=typeof uc<"u"?uc:typeof window<"u"?window:{},i=s.WebSocket||s.MozWebSocket,a=kRe(),l=ERe(),c=CRe(),d=NRe(),f=jRe,p=TRe,m=ORe,g=PRe(),y=MRe(),x=IRe(),w=function(){function _(S,k,N,j){var T=k||{},D=T.connectionCallback,I=D===void 0?void 0:D,L=T.connectionParams,$=L===void 0?{}:L,Q=T.minTimeout,M=Q===void 0?y.MIN_WS_TIMEOUT:Q,z=T.timeout,R=z===void 0?y.WS_TIMEOUT:z,B=T.reconnect,V=B===void 0?!1:B,F=T.reconnectionAttempts,K=F===void 0?1/0:F,Y=T.lazy,O=Y===void 0?!1:Y,H=T.inactivityTimeout,G=H===void 0?0:H,q=T.wsOptionArguments,J=q===void 0?[]:q;if(this.wsImpl=N||i,!this.wsImpl)throw new Error("Unable to find native implementation, or alternative implementation for WebSocket!");this.wsProtocols=j||g.GRAPHQL_WS,this.connectionCallback=I,this.url=S,this.operations={},this.nextOperationId=0,this.minWsTimeout=M,this.wsTimeout=R,this.unsentMessagesQueue=[],this.reconnect=V,this.reconnecting=!1,this.reconnectionAttempts=K,this.lazy=!!O,this.inactivityTimeout=G,this.closedByUser=!1,this.backoff=new a({jitter:.5}),this.eventEmitter=new l.EventEmitter,this.middlewares=[],this.client=null,this.maxConnectTimeGenerator=this.createMaxConnectTimeGenerator(),this.connectionParams=this.getConnectionParams($),this.wsOptionArguments=J,this.lazy||this.connect()}return Object.defineProperty(_.prototype,"status",{get:function(){return this.client===null?this.wsImpl.CLOSED:this.client.readyState},enumerable:!1,configurable:!0}),_.prototype.close=function(S,k){S===void 0&&(S=!0),k===void 0&&(k=!0),this.clearInactivityTimeout(),this.client!==null&&(this.closedByUser=k,S&&(this.clearCheckConnectionInterval(),this.clearMaxConnectTimeout(),this.clearTryReconnectTimeout(),this.unsubscribeAll(),this.sendMessage(void 0,x.default.GQL_CONNECTION_TERMINATE,null)),this.client.close(),this.client.onopen=null,this.client.onclose=null,this.client.onerror=null,this.client.onmessage=null,this.client=null,this.eventEmitter.emit("disconnected"),S||this.tryReconnect())},_.prototype.request=function(S){var k,N=this.getObserver.bind(this),j=this.executeOperation.bind(this),T=this.unsubscribe.bind(this),D;return this.clearInactivityTimeout(),k={},k[m.default]=function(){return this},k.subscribe=function(I,L,$){var Q=N(I,L,$);return D=j(S,function(M,z){M===null&&z===null?Q.complete&&Q.complete():M?Q.error&&Q.error(M[0]):Q.next&&Q.next(z)}),{unsubscribe:function(){D&&(T(D),D=null)}}},k},_.prototype.on=function(S,k,N){var j=this.eventEmitter.on(S,k,N);return function(){j.off(S,k,N)}},_.prototype.onConnected=function(S,k){return this.on("connected",S,k)},_.prototype.onConnecting=function(S,k){return this.on("connecting",S,k)},_.prototype.onDisconnected=function(S,k){return this.on("disconnected",S,k)},_.prototype.onReconnected=function(S,k){return this.on("reconnected",S,k)},_.prototype.onReconnecting=function(S,k){return this.on("reconnecting",S,k)},_.prototype.onError=function(S,k){return this.on("error",S,k)},_.prototype.unsubscribeAll=function(){var S=this;Object.keys(this.operations).forEach(function(k){S.unsubscribe(k)})},_.prototype.applyMiddlewares=function(S){var k=this;return new Promise(function(N,j){var T=function(D,I){var L=function($){if($)j($);else if(D.length>0){var Q=D.shift();Q&&Q.applyMiddleware.apply(I,[S,L])}else N(S)};L()};T(n([],k.middlewares,!0),k)})},_.prototype.use=function(S){var k=this;return S.map(function(N){if(typeof N.applyMiddleware=="function")k.middlewares.push(N);else throw new Error("Middleware must implement the applyMiddleware function.")}),this},_.prototype.getConnectionParams=function(S){return function(){return new Promise(function(k,N){if(typeof S=="function")try{return k(S.call(null))}catch(j){return N(j)}k(S)})}},_.prototype.executeOperation=function(S,k){var N=this;this.client===null&&this.connect();var j=this.generateOperationId();return this.operations[j]={options:S,handler:k},this.applyMiddlewares(S).then(function(T){N.checkOperationOptions(T,k),N.operations[j]&&(N.operations[j]={options:T,handler:k},N.sendMessage(j,x.default.GQL_START,T))}).catch(function(T){N.unsubscribe(j),k(N.formatErrors(T))}),j},_.prototype.getObserver=function(S,k,N){return typeof S=="function"?{next:function(j){return S(j)},error:function(j){return k&&k(j)},complete:function(){return N&&N()}}:S},_.prototype.createMaxConnectTimeGenerator=function(){var S=this.minWsTimeout,k=this.wsTimeout;return new a({min:S,max:k,factor:1.2})},_.prototype.clearCheckConnectionInterval=function(){this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnectionIntervalId=null)},_.prototype.clearMaxConnectTimeout=function(){this.maxConnectTimeoutId&&(clearTimeout(this.maxConnectTimeoutId),this.maxConnectTimeoutId=null)},_.prototype.clearTryReconnectTimeout=function(){this.tryReconnectTimeoutId&&(clearTimeout(this.tryReconnectTimeoutId),this.tryReconnectTimeoutId=null)},_.prototype.clearInactivityTimeout=function(){this.inactivityTimeoutId&&(clearTimeout(this.inactivityTimeoutId),this.inactivityTimeoutId=null)},_.prototype.setInactivityTimeout=function(){var S=this;this.inactivityTimeout>0&&Object.keys(this.operations).length===0&&(this.inactivityTimeoutId=setTimeout(function(){Object.keys(S.operations).length===0&&S.close()},this.inactivityTimeout))},_.prototype.checkOperationOptions=function(S,k){var N=S.query,j=S.variables,T=S.operationName;if(!N)throw new Error("Must provide a query.");if(!k)throw new Error("Must provide an handler.");if(!(0,c.default)(N)&&!(0,p.getOperationAST)(N,T)||T&&!(0,c.default)(T)||j&&!(0,d.default)(j))throw new Error("Incorrect option types. query must be a string or a document,`operationName` must be a string, and `variables` must be an object.")},_.prototype.buildMessage=function(S,k,N){var j=N&&N.query?t(t({},N),{query:typeof N.query=="string"?N.query:(0,f.print)(N.query)}):N;return{id:S,type:k,payload:j}},_.prototype.formatErrors=function(S){return Array.isArray(S)?S:S&&S.errors?this.formatErrors(S.errors):S&&S.message?[S]:[{name:"FormatedError",message:"Unknown error",originalError:S}]},_.prototype.sendMessage=function(S,k,N){this.sendMessageRaw(this.buildMessage(S,k,N))},_.prototype.sendMessageRaw=function(S){switch(this.status){case this.wsImpl.OPEN:var k=JSON.stringify(S);try{JSON.parse(k)}catch{this.eventEmitter.emit("error",new Error("Message must be JSON-serializable. Got: "+S))}this.client.send(k);break;case this.wsImpl.CONNECTING:this.unsentMessagesQueue.push(S);break;default:this.reconnecting||this.eventEmitter.emit("error",new Error("A message was not sent because socket is not connected, is closing or is already closed. Message was: "+JSON.stringify(S)))}},_.prototype.generateOperationId=function(){return String(++this.nextOperationId)},_.prototype.tryReconnect=function(){var S=this;if(!(!this.reconnect||this.backoff.attempts>=this.reconnectionAttempts)){this.reconnecting||(Object.keys(this.operations).forEach(function(N){S.unsentMessagesQueue.push(S.buildMessage(N,x.default.GQL_START,S.operations[N].options))}),this.reconnecting=!0),this.clearTryReconnectTimeout();var k=this.backoff.duration();this.tryReconnectTimeoutId=setTimeout(function(){S.connect()},k)}},_.prototype.flushUnsentMessagesQueue=function(){var S=this;this.unsentMessagesQueue.forEach(function(k){S.sendMessageRaw(k)}),this.unsentMessagesQueue=[]},_.prototype.checkConnection=function(){if(this.wasKeepAliveReceived){this.wasKeepAliveReceived=!1;return}this.reconnecting||this.close(!1,!0)},_.prototype.checkMaxConnectTimeout=function(){var S=this;this.clearMaxConnectTimeout(),this.maxConnectTimeoutId=setTimeout(function(){S.status!==S.wsImpl.OPEN&&(S.reconnecting=!0,S.close(!1,!0))},this.maxConnectTimeGenerator.duration())},_.prototype.connect=function(){var S,k=this;this.client=new((S=this.wsImpl).bind.apply(S,n([void 0,this.url,this.wsProtocols],this.wsOptionArguments,!1))),this.checkMaxConnectTimeout(),this.client.onopen=function(){return e(k,void 0,void 0,function(){var N,j;return r(this,function(T){switch(T.label){case 0:if(this.status!==this.wsImpl.OPEN)return[3,4];this.clearMaxConnectTimeout(),this.closedByUser=!1,this.eventEmitter.emit(this.reconnecting?"reconnecting":"connecting"),T.label=1;case 1:return T.trys.push([1,3,,4]),[4,this.connectionParams()];case 2:return N=T.sent(),this.sendMessage(void 0,x.default.GQL_CONNECTION_INIT,N),this.flushUnsentMessagesQueue(),[3,4];case 3:return j=T.sent(),this.sendMessage(void 0,x.default.GQL_CONNECTION_ERROR,j),this.flushUnsentMessagesQueue(),[3,4];case 4:return[2]}})})},this.client.onclose=function(){k.closedByUser||k.close(!1,!1)},this.client.onerror=function(N){k.eventEmitter.emit("error",N)},this.client.onmessage=function(N){var j=N.data;k.processReceivedData(j)}},_.prototype.processReceivedData=function(S){var k,N;try{k=JSON.parse(S),N=k.id}catch{throw new Error("Message must be JSON-parseable. Got: "+S)}if([x.default.GQL_DATA,x.default.GQL_COMPLETE,x.default.GQL_ERROR].indexOf(k.type)!==-1&&!this.operations[N]){this.unsubscribe(N);return}switch(k.type){case x.default.GQL_CONNECTION_ERROR:this.connectionCallback&&this.connectionCallback(k.payload);break;case x.default.GQL_CONNECTION_ACK:this.eventEmitter.emit(this.reconnecting?"reconnected":"connected",k.payload),this.reconnecting=!1,this.backoff.reset(),this.maxConnectTimeGenerator.reset(),this.connectionCallback&&this.connectionCallback();break;case x.default.GQL_COMPLETE:var j=this.operations[N].handler;delete this.operations[N],j.call(this,null,null);break;case x.default.GQL_ERROR:this.operations[N].handler(this.formatErrors(k.payload),null),delete this.operations[N];break;case x.default.GQL_DATA:var T=k.payload.errors?t(t({},k.payload),{errors:this.formatErrors(k.payload.errors)}):k.payload;this.operations[N].handler(null,T);break;case x.default.GQL_CONNECTION_KEEP_ALIVE:var D=typeof this.wasKeepAliveReceived>"u";this.wasKeepAliveReceived=!0,D&&this.checkConnection(),this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnection()),this.checkConnectionIntervalId=setInterval(this.checkConnection.bind(this),this.wsTimeout);break;default:throw new Error("Invalid message type!")}},_.prototype.unsubscribe=function(S){this.operations[S]&&(delete this.operations[S],this.setInactivityTimeout(),this.sendMessage(S,x.default.GQL_STOP,void 0))},_}();return hi.SubscriptionClient=w,hi}var v$=LRe(),$Re=function(t){Qi(e,t);function e(r){var n=t.call(this)||this;return r instanceof v$.SubscriptionClient?n.subscriptionClient=r:n.subscriptionClient=new v$.SubscriptionClient(r.uri,r.options,r.webSocketImpl),n}return e.prototype.request=function(r){return this.subscriptionClient.request(r)},e}(vl);function jG(t){return new vl(function(e,r){return new mr(function(n){var s,i,a;try{s=r(e).subscribe({next:function(l){if(l.errors?a=t({graphQLErrors:l.errors,response:l,operation:e,forward:r}):lz(l)&&(a=t({protocolErrors:l.extensions[ob],response:l,operation:e,forward:r})),a){i=a.subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)});return}n.next(l)},error:function(l){if(a=t({operation:e,networkError:l,graphQLErrors:l&&l.result&&l.result.errors||void 0,forward:r}),a){i=a.subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)});return}n.error(l)},complete:function(){a||n.complete.bind(n)()}})}catch(l){t({networkError:l,operation:e,forward:r}),n.error(l)}return function(){s&&s.unsubscribe(),i&&s.unsubscribe()}})})}(function(t){Qi(e,t);function e(r){var n=t.call(this)||this;return n.link=jG(r),n}return e.prototype.request=function(r,n){return this.link.request(r,n)},e})(vl);function tE({children:t}){const{isAuthenticated:e,isLoading:r}=pb();return r?null:e?o.jsx(pj,{to:"/dashboard",replace:!0}):o.jsx(o.Fragment,{children:t})}function BRe(){var _;const[t,e]=E.useState(""),[r,n]=E.useState(!1),s=Yn(),i=Ra(),{toast:a}=br(),{isAuthenticated:l,isLoading:c}=pb(),d=yl(),{sendEmail:f,isLoading:p,isError:m,error:g}=gue(),y=(_=i.state)==null?void 0:_.email,x=d==null?void 0:d.email,w=async()=>{if(!r){n(!0);return}const S=t.trim()||y||"";if(!S){a({title:"Enter your email",description:"We need your email address to resend the link.",variant:"destructive"});return}(await f(S)).isSent&&(n(!1),a({title:"Verification email sent",description:`We sent a fresh link to ${S}. Check your inbox — and your spam folder, just in case.`}))};return E.useEffect(()=>{m&&a({title:"Couldn't send the email",description:Ib(g),variant:"destructive"})},[m,g,a]),c?o.jsx(rE,{children:o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground",children:[o.jsx(kt,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-sm",children:"Checking your verification status…"})]})}):l?o.jsx(rE,{children:o.jsxs($e,{className:"border border-primary/10 shadow-xl bg-background/95 backdrop-blur-sm",children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-emerald-500/10 mb-4",children:o.jsx(Sj,{className:"h-8 w-8 text-emerald-500"})}),o.jsx(dt,{className:"text-2xl font-semibold",children:"Email verified"}),o.jsx(rn,{className:"text-center",children:x?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-medium text-foreground",children:x})," ","is now verified."]}):"Your email address is now verified."})]}),o.jsxs(Be,{className:"space-y-4 text-center",children:[o.jsx("p",{className:"text-muted-foreground text-sm",children:"You're all set. Let's start building."}),o.jsxs(le,{className:"group w-full bg-gradient-to-r from-primary to-primary/90 shadow hover:shadow-md",onClick:()=>s("/dashboard/onboarding",{replace:!0}),children:["Continue to dashboard",o.jsx(ei,{className:"ml-2 h-4 w-4 transition-transform group-hover:translate-x-1"})]})]})]})}):o.jsx(rE,{children:o.jsxs($e,{className:"border border-primary/10 shadow-xl bg-background/95 backdrop-blur-sm",children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-primary/10 mb-4",children:o.jsx(cre,{className:"h-7 w-7 text-primary"})}),o.jsx(dt,{className:"text-2xl font-semibold",children:"Verify your email"}),o.jsx(rn,{className:"text-center",children:"One more step to activate your account."})]}),o.jsxs(Be,{className:"space-y-4",children:[y&&o.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 bg-muted/30 p-3",children:[o.jsx(Sc,{className:"h-4 w-4 shrink-0 text-primary"}),o.jsxs("p",{className:"text-sm",children:["We sent a verification link to"," ",o.jsx("span",{className:"font-medium text-foreground",children:y})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Click the link in the email to verify your account, then come back here — or just refresh this page after clicking it."}),r&&o.jsxs("div",{className:"space-y-2 text-left",children:[o.jsx(Xe,{htmlFor:"email",className:"text-sm font-medium",children:"Email address"}),o.jsxs("div",{className:"relative",children:[o.jsx(Sc,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{id:"email",type:"email",placeholder:"name@example.com",value:t,onChange:S=>e(S.target.value),className:"h-11 pl-10 border-border/70 focus-visible:ring-primary/20"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Didn't get it? Check your inbox and spam folder for the verification link, or request a new one below."}),o.jsxs("div",{className:"flex flex-col space-y-2 pt-2",children:[o.jsxs(le,{className:"w-full bg-gradient-to-r from-primary to-primary/90 shadow hover:shadow-md",onClick:w,disabled:p,children:[p?o.jsx(kt,{className:"h-4 w-4 animate-spin mr-2"}):o.jsx(wn,{className:"mr-2 h-4 w-4"}),p?"Sending…":r?"Send verification email":"Resend verification email"]}),o.jsxs(le,{variant:"outline",className:"w-full border-primary/10 text-primary hover:bg-primary/5",onClick:()=>s("/login"),children:[o.jsx(mo,{className:"mr-2 h-4 w-4"}),"Back to login"]})]}),o.jsx("p",{className:"text-center text-xs text-muted-foreground",children:o.jsx(ba,{to:"/signup",className:"font-medium text-primary hover:underline",children:"Used the wrong email? Sign up again"})})]})]})})}function rE({children:t}){return o.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-gradient-to-br from-background via-primary/5 to-background px-4 py-12",children:[o.jsx("div",{className:"pointer-events-none absolute top-1/3 left-1/4 w-64 h-64 bg-primary/5 rounded-full blur-3xl"}),o.jsx("div",{className:"pointer-events-none absolute bottom-1/3 right-1/4 w-64 h-64 bg-primary/5 rounded-full blur-3xl"}),o.jsx(ws.div,{className:"w-full max-w-md relative z-10",initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:t})]})}function FRe(){const[t,e]=E.useState(""),[r,n]=E.useState(null),s=Yn(),{toast:i}=br(),{resetPassword:a,isLoading:l,isError:c,error:d}=mue(),f=async m=>{(await a(m)).isSent&&(n(m),i({title:"Reset link sent",description:"Check your inbox for a link to reset your password."}))},p=async m=>{m.preventDefault();const g=t.trim();if(!g){i({title:"Enter your email",description:"We need your email address to send the reset link.",variant:"destructive"});return}await f(g)};return E.useEffect(()=>{c&&i({title:"Couldn't send the email",description:Ib(d),variant:"destructive"})},[c,d,i]),r?o.jsx(y$,{children:o.jsxs($e,{className:"border border-primary/10 shadow-xl bg-background/95 backdrop-blur-sm",children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-emerald-500/10 mb-4",children:o.jsx(Sj,{className:"h-8 w-8 text-emerald-500"})}),o.jsx(dt,{className:"text-2xl font-semibold",children:"Check your inbox"}),o.jsxs(rn,{className:"text-center",children:["We sent a password reset link to"," ",o.jsx("span",{className:"font-medium text-foreground",children:r}),"."]})]}),o.jsxs(Be,{className:"space-y-4 text-center",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"The link expires shortly for your security. Didn't get it? Check your spam folder or request a new one."}),o.jsxs("div",{className:"flex flex-col space-y-2",children:[o.jsxs(le,{className:"w-full bg-gradient-to-r from-primary to-primary/90 shadow hover:shadow-md",onClick:()=>f(r),disabled:l,children:[l?o.jsx(kt,{className:"h-4 w-4 animate-spin mr-2"}):o.jsx(wn,{className:"mr-2 h-4 w-4"}),l?"Sending…":"Resend link"]}),o.jsxs(le,{variant:"outline",className:"w-full border-primary/10 text-primary hover:bg-primary/5",onClick:()=>s("/login"),children:[o.jsx(mo,{className:"mr-2 h-4 w-4"}),"Back to login"]})]})]})]})}):o.jsx(y$,{children:o.jsxs($e,{className:"border border-primary/10 shadow-xl bg-background/95 backdrop-blur-sm",children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-primary/10 mb-4",children:o.jsx(Sc,{className:"h-7 w-7 text-primary"})}),o.jsx(dt,{className:"text-2xl font-semibold",children:"Reset your password"}),o.jsx(rn,{className:"text-center",children:"Enter your email and we'll send you a link to choose a new password."})]}),o.jsx(Be,{children:o.jsxs("form",{onSubmit:p,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"email",className:"text-sm font-medium",children:"Email address"}),o.jsxs("div",{className:"relative",children:[o.jsx(Sc,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{id:"email",type:"email",placeholder:"name@example.com",value:t,onChange:m=>e(m.target.value),autoFocus:!0,required:!0,className:"h-11 pl-10 border-border/70 focus-visible:ring-primary/20"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"For security, the link expires after a short time and can only be used once."}),o.jsxs(le,{type:"submit",className:"group h-11 w-full bg-gradient-to-r from-primary to-primary/90 shadow-md hover:shadow-lg transition-shadow",disabled:l,children:[l?o.jsx(kt,{className:"h-4 w-4 animate-spin mr-2"}):null,"Send reset link",!l&&o.jsx(ei,{className:"h-4 w-4 transition-transform group-hover:translate-x-1"})]}),o.jsx("p",{className:"text-center text-sm text-muted-foreground",children:o.jsx(ba,{to:"/login",className:"font-medium text-primary hover:underline",children:"Back to login"})})]})})]})})}function y$({children:t}){return o.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-gradient-to-br from-background via-primary/5 to-background px-4 py-12",children:[o.jsx("div",{className:"pointer-events-none absolute top-1/3 left-1/4 w-64 h-64 bg-primary/5 rounded-full blur-3xl"}),o.jsx("div",{className:"pointer-events-none absolute bottom-1/3 right-1/4 w-64 h-64 bg-primary/5 rounded-full blur-3xl"}),o.jsx(ws.div,{className:"w-full max-w-md relative z-10",initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:t})]})}const nE=[{label:"Too short",color:"bg-destructive",text:"text-destructive"},{label:"Weak",color:"bg-orange-500",text:"text-orange-500"},{label:"Fair",color:"bg-amber-500",text:"text-amber-500"},{label:"Good",color:"bg-emerald-500",text:"text-emerald-500"},{label:"Strong",color:"bg-emerald-600",text:"text-emerald-600"}];function zRe(t){if(!t)return 0;if(t.length<8)return 1;let e=1;return t.length>=12&&e++,/[A-Z]/.test(t)&&e++,/[0-9]/.test(t)&&e++,/[^A-Za-z0-9]/.test(t)&&e++,Math.min(e,4)}function URe(){const[t,e]=E.useState(""),[r,n]=E.useState(""),[s,i]=E.useState(!1),[a,l]=E.useState(!1),[c,d]=E.useState(!1),f=Yn(),{toast:p}=br(),{isAuthenticated:m,isLoading:g}=pb(),{changePassword:y,isLoading:x}=C8(),{signOut:w}=N8(),_=zRe(t),S=async k=>{if(k.preventDefault(),t.length<8){p({title:"Password is too short",description:"Use at least 8 characters.",variant:"destructive"});return}if(t!==r){p({title:"Passwords don't match",description:"Please re-enter both passwords.",variant:"destructive"});return}const N=await y(t);if(N.error){p({title:"Couldn't update your password",description:N.error.message||"Please try again.",variant:"destructive"});return}d(!0),p({title:"Password updated",description:"You can now sign in with your new password."}),await w()};return E.useEffect(()=>{if(!c)return;const k=setTimeout(()=>f("/login",{replace:!0}),2500);return()=>clearTimeout(k)},[c,f]),c?o.jsx(Lx,{children:o.jsxs($e,{className:"border border-primary/10 shadow-xl bg-background/95 backdrop-blur-sm",children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-emerald-500/10 mb-4",children:o.jsx(Sj,{className:"h-8 w-8 text-emerald-500"})}),o.jsx(dt,{className:"text-2xl font-semibold",children:"Password reset"}),o.jsx(rn,{className:"text-center",children:"Your password has been updated. Redirecting you to sign in…"})]}),o.jsx(Be,{className:"space-y-4 text-center",children:o.jsxs(le,{className:"bg-gradient-to-r from-primary to-primary/90 shadow hover:shadow-md",onClick:()=>f("/login",{replace:!0}),children:["Sign in now",o.jsx(ei,{className:"ml-2 h-4 w-4"})]})})]})}):g?o.jsx(Lx,{children:o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground",children:[o.jsx(kt,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-sm",children:"Checking your reset link…"})]})}):m?o.jsx(Lx,{children:o.jsxs($e,{className:"border border-primary/10 shadow-xl bg-background/95 backdrop-blur-sm",children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-primary/10 mb-4",children:o.jsx(gi,{className:"h-7 w-7 text-primary"})}),o.jsx(dt,{className:"text-2xl font-semibold",children:"Choose a new password"}),o.jsx(rn,{className:"text-center",children:"Make sure it's something you'll remember."})]}),o.jsx(Be,{children:o.jsxs("form",{onSubmit:S,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"newPassword",className:"text-sm font-medium",children:"New password"}),o.jsxs("div",{className:"relative",children:[o.jsx(Gn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{id:"newPassword",type:s?"text":"password",placeholder:"At least 8 characters",value:t,onChange:k=>e(k.target.value),autoFocus:!0,required:!0,className:"h-11 pl-10 pr-10 border-border/70 focus-visible:ring-primary/20"}),o.jsx("button",{type:"button",onClick:()=>i(k=>!k),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground","aria-label":s?"Hide password":"Show password",children:s?o.jsx(ol,{className:"h-4 w-4"}):o.jsx(ll,{className:"h-4 w-4"})})]}),t.length>0&&o.jsxs("div",{className:"space-y-1.5 pt-1",children:[o.jsx("div",{className:"flex gap-1.5",children:[0,1,2,3].map(k=>o.jsx("span",{className:we("h-1 flex-1 rounded-full transition-colors",k<_?nE[_].color:"bg-muted")},k))}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:o.jsx("span",{className:nE[_].text,children:nE[_].label})})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"confirmPassword",className:"text-sm font-medium",children:"Confirm new password"}),o.jsxs("div",{className:"relative",children:[o.jsx(Gn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(tt,{id:"confirmPassword",type:a?"text":"password",placeholder:"Re-enter your new password",value:r,onChange:k=>n(k.target.value),required:!0,className:"h-11 pl-10 pr-10 border-border/70 focus-visible:ring-primary/20"}),o.jsx("button",{type:"button",onClick:()=>l(k=>!k),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground","aria-label":a?"Hide password":"Show password",children:a?o.jsx(ol,{className:"h-4 w-4"}):o.jsx(ll,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-border/60 bg-muted/30 p-3",children:[o.jsx(od,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"For security, you'll be signed out and asked to sign in again with your new password."})]}),o.jsxs(le,{type:"submit",className:"group h-11 w-full bg-gradient-to-r from-primary to-primary/90 shadow-md hover:shadow-lg transition-shadow",disabled:x,children:[x?o.jsx(kt,{className:"h-4 w-4 animate-spin mr-2"}):null,"Update password",!x&&o.jsx(ei,{className:"h-4 w-4 transition-transform group-hover:translate-x-1"})]}),o.jsx("p",{className:"text-center text-sm text-muted-foreground",children:o.jsx(ba,{to:"/login",className:"font-medium text-primary hover:underline",children:"Back to login"})})]})})]})}):o.jsx(Lx,{children:o.jsxs($e,{className:"border border-primary/10 shadow-xl bg-background/95 backdrop-blur-sm",children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10 mb-4",children:o.jsx(Ej,{className:"h-8 w-8 text-destructive"})}),o.jsx(dt,{className:"text-2xl font-semibold",children:"This link isn't valid anymore"}),o.jsx(rn,{className:"text-center",children:"Reset links expire for your security. Request a new one and we'll send it straight to your inbox."})]}),o.jsxs(Be,{className:"space-y-3",children:[o.jsxs(le,{className:"w-full bg-gradient-to-r from-primary to-primary/90 shadow hover:shadow-md",onClick:()=>f("/forgot-password"),children:["Request a new link",o.jsx(ei,{className:"ml-2 h-4 w-4"})]}),o.jsxs(le,{variant:"outline",className:"w-full border-primary/10 text-primary hover:bg-primary/5",onClick:()=>f("/login"),children:[o.jsx(mo,{className:"mr-2 h-4 w-4"}),"Back to login"]})]})]})})}function Lx({children:t}){return o.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-gradient-to-br from-background via-primary/5 to-background px-4 py-12",children:[o.jsx("div",{className:"pointer-events-none absolute top-1/3 left-1/4 w-64 h-64 bg-primary/5 rounded-full blur-3xl"}),o.jsx("div",{className:"pointer-events-none absolute bottom-1/3 right-1/4 w-64 h-64 bg-primary/5 rounded-full blur-3xl"}),o.jsx(ws.div,{className:"w-full max-w-md relative z-10",initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:t})]})}function VRe(){if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search).get("type");return t==="passwordReset"||t==="emailVerify"?t:null}const x$=VRe(),HRe=Et`
|
||
subscription GetRowEvents($userId: uuid) {
|
||
ghaymah_cloud_row_event(
|
||
where: {
|
||
user_id: { _eq: $userId }
|
||
}
|
||
) {
|
||
running
|
||
event_date
|
||
app_id
|
||
id
|
||
user_id
|
||
values
|
||
}
|
||
}
|
||
`,qRe=E.createContext(void 0);function WRe({children:t}){const e=yl(),r=bo(),n=e==null?void 0:e.id,[s,i]=E.useState([]),{data:a,loading:l,error:c}=wg(HRe,{variables:{userId:n},skip:!n||!r});E.useEffect(()=>{c&&console.error("Row events subscription error:",c)},[c]),E.useEffect(()=>{a!=null&&a.ghaymah_cloud_row_event&&(jt("Billing",`Received ${a.ghaymah_cloud_row_event.length} row events`,a.ghaymah_cloud_row_event),i(a.ghaymah_cloud_row_event))},[a]),E.useEffect(()=>{r||(jt("Auth","Access token removed, clearing Billing data"),i([]))},[r]);const d={rowEvents:s,loading:l,error:c};return o.jsx(qRe.Provider,{value:d,children:t})}function $x(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var sE={exports:{}};/*!
|
||
|
||
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
||
<http://stuartk.com/jszip>
|
||
|
||
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
||
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
||
|
||
JSZip uses the library pako released under the MIT license :
|
||
https://github.com/nodeca/pako/blob/main/LICENSE
|
||
*/var _$;function GRe(){return _$||(_$=1,function(t,e){(function(r){t.exports=r()})(function(){return function r(n,s,i){function a(d,f){if(!s[d]){if(!n[d]){var p=typeof $x=="function"&&$x;if(!f&&p)return p(d,!0);if(l)return l(d,!0);var m=new Error("Cannot find module '"+d+"'");throw m.code="MODULE_NOT_FOUND",m}var g=s[d]={exports:{}};n[d][0].call(g.exports,function(y){var x=n[d][1][y];return a(x||y)},g,g.exports,r,n,s,i)}return s[d].exports}for(var l=typeof $x=="function"&&$x,c=0;c<i.length;c++)a(i[c]);return a}({1:[function(r,n,s){var i=r("./utils"),a=r("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var d,f,p,m,g,y,x,w=[],_=0,S=c.length,k=S,N=i.getTypeOf(c)!=="string";_<c.length;)k=S-_,p=N?(d=c[_++],f=_<S?c[_++]:0,_<S?c[_++]:0):(d=c.charCodeAt(_++),f=_<S?c.charCodeAt(_++):0,_<S?c.charCodeAt(_++):0),m=d>>2,g=(3&d)<<4|f>>4,y=1<k?(15&f)<<2|p>>6:64,x=2<k?63&p:64,w.push(l.charAt(m)+l.charAt(g)+l.charAt(y)+l.charAt(x));return w.join("")},s.decode=function(c){var d,f,p,m,g,y,x=0,w=0,_="data:";if(c.substr(0,_.length)===_)throw new Error("Invalid base64 input, it looks like a data url.");var S,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(S=a.uint8array?new Uint8Array(0|k):new Array(0|k);x<c.length;)d=l.indexOf(c.charAt(x++))<<2|(m=l.indexOf(c.charAt(x++)))>>4,f=(15&m)<<4|(g=l.indexOf(c.charAt(x++)))>>2,p=(3&g)<<6|(y=l.indexOf(c.charAt(x++))),S[w++]=d,g!==64&&(S[w++]=f),y!==64&&(S[w++]=p);return S}},{"./support":30,"./utils":32}],2:[function(r,n,s){var i=r("./external"),a=r("./stream/DataWorker"),l=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function d(f,p,m,g,y){this.compressedSize=f,this.uncompressedSize=p,this.crc32=m,this.compression=g,this.compressedContent=y}d.prototype={getContentWorker:function(){var f=new a(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),p=this;return f.on("end",function(){if(this.streamInfo.data_length!==p.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),f},getCompressedWorker:function(){return new a(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(f,p,m){return f.pipe(new l).pipe(new c("uncompressedSize")).pipe(p.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",p)},n.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var i=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var i=r("./utils"),a=function(){for(var l,c=[],d=0;d<256;d++){l=d;for(var f=0;f<8;f++)l=1&l?3988292384^l>>>1:l>>>1;c[d]=l}return c}();n.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(d,f,p,m){var g=a,y=m+p;d^=-1;for(var x=m;x<y;x++)d=d>>>8^g[255&(d^f[x])];return-1^d}(0|c,l,l.length,0):function(d,f,p,m){var g=a,y=m+p;d^=-1;for(var x=m;x<y;x++)d=d>>>8^g[255&(d^f.charCodeAt(x))];return-1^d}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var i=null;i=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:i}},{lie:37}],7:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=r("pako"),l=r("./utils"),c=r("./stream/GenericWorker"),d=i?"uint8array":"array";function f(p,m){c.call(this,"FlateWorker/"+p),this._pako=null,this._pakoAction=p,this._pakoOptions=m,this.meta={}}s.magic="\b\0",l.inherits(f,c),f.prototype.processChunk=function(p){this.meta=p.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(d,p.data),!1)},f.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},f.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},f.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var p=this;this._pako.onData=function(m){p.push({data:m,meta:p.meta})}},s.compressWorker=function(p){return new f("Deflate",p)},s.uncompressWorker=function(){return new f("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function i(g,y){var x,w="";for(x=0;x<y;x++)w+=String.fromCharCode(255&g),g>>>=8;return w}function a(g,y,x,w,_,S){var k,N,j=g.file,T=g.compression,D=S!==d.utf8encode,I=l.transformTo("string",S(j.name)),L=l.transformTo("string",d.utf8encode(j.name)),$=j.comment,Q=l.transformTo("string",S($)),M=l.transformTo("string",d.utf8encode($)),z=L.length!==j.name.length,R=M.length!==$.length,B="",V="",F="",K=j.dir,Y=j.date,O={crc32:0,compressedSize:0,uncompressedSize:0};y&&!x||(O.crc32=g.crc32,O.compressedSize=g.compressedSize,O.uncompressedSize=g.uncompressedSize);var H=0;y&&(H|=8),D||!z&&!R||(H|=2048);var G=0,q=0;K&&(G|=16),_==="UNIX"?(q=798,G|=function(te,ve){var he=te;return te||(he=ve?16893:33204),(65535&he)<<16}(j.unixPermissions,K)):(q=20,G|=function(te){return 63&(te||0)}(j.dosPermissions)),k=Y.getUTCHours(),k<<=6,k|=Y.getUTCMinutes(),k<<=5,k|=Y.getUTCSeconds()/2,N=Y.getUTCFullYear()-1980,N<<=4,N|=Y.getUTCMonth()+1,N<<=5,N|=Y.getUTCDate(),z&&(V=i(1,1)+i(f(I),4)+L,B+="up"+i(V.length,2)+V),R&&(F=i(1,1)+i(f(Q),4)+M,B+="uc"+i(F.length,2)+F);var J="";return J+=`
|
||
\0`,J+=i(H,2),J+=T.magic,J+=i(k,2),J+=i(N,2),J+=i(O.crc32,4),J+=i(O.compressedSize,4),J+=i(O.uncompressedSize,4),J+=i(I.length,2),J+=i(B.length,2),{fileRecord:p.LOCAL_FILE_HEADER+J+I+B,dirRecord:p.CENTRAL_FILE_HEADER+i(q,2)+J+i(Q.length,2)+"\0\0\0\0"+i(G,4)+i(w,4)+I+B+Q}}var l=r("../utils"),c=r("../stream/GenericWorker"),d=r("../utf8"),f=r("../crc32"),p=r("../signature");function m(g,y,x,w){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=x,this.encodeFileName=w,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(m,c),m.prototype.push=function(g){var y=g.meta.percent||0,x=this.entriesCount,w=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,c.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:x?(y+100*(x-w-1))/x:100}}))},m.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var y=this.streamFiles&&!g.file.dir;if(y){var x=a(g,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:x.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(g){this.accumulate=!1;var y=this.streamFiles&&!g.file.dir,x=a(g,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(x.dirRecord),y)this.push({data:function(w){return p.DATA_DESCRIPTOR+i(w.crc32,4)+i(w.compressedSize,4)+i(w.uncompressedSize,4)}(g),meta:{percent:100}});else for(this.push({data:x.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var g=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var x=this.bytesWritten-g,w=function(_,S,k,N,j){var T=l.transformTo("string",j(N));return p.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(_,2)+i(_,2)+i(S,4)+i(k,4)+i(T.length,2)+T}(this.dirRecords.length,x,g,this.zipComment,this.encodeFileName);this.push({data:w,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(g){this._sources.push(g);var y=this;return g.on("data",function(x){y.processChunk(x)}),g.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),g.on("error",function(x){y.error(x)}),this},m.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(g){var y=this._sources;if(!c.prototype.error.call(this,g))return!1;for(var x=0;x<y.length;x++)try{y[x].error(g)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var g=this._sources,y=0;y<g.length;y++)g[y].lock()},n.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,s){var i=r("../compressions"),a=r("./ZipFileWorker");s.generateWorker=function(l,c,d){var f=new a(c.streamFiles,d,c.platform,c.encodeFileName),p=0;try{l.forEach(function(m,g){p++;var y=function(S,k){var N=S||k,j=i[N];if(!j)throw new Error(N+" is not a valid compression method !");return j}(g.options.compression,c.compression),x=g.options.compressionOptions||c.compressionOptions||{},w=g.dir,_=g.date;g._compressWorker(y,x).withStreamInfo("file",{name:m,dir:w,date:_,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(f)}),f.entriesCount=p}catch(m){f.error(m)}return f}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new i;for(var l in this)typeof this[l]!="function"&&(a[l]=this[l]);return a}}(i.prototype=r("./object")).loadAsync=r("./load"),i.support=r("./support"),i.defaults=r("./defaults"),i.version="3.10.1",i.loadAsync=function(a,l){return new i().loadAsync(a,l)},i.external=r("./external"),n.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var i=r("./utils"),a=r("./external"),l=r("./utf8"),c=r("./zipEntries"),d=r("./stream/Crc32Probe"),f=r("./nodejsUtils");function p(m){return new a.Promise(function(g,y){var x=m.decompressed.getContentWorker().pipe(new d);x.on("error",function(w){y(w)}).on("end",function(){x.streamInfo.crc32!==m.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}n.exports=function(m,g){var y=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),f.isNode&&f.isStream(m)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",m,!0,g.optimizedBinaryString,g.base64).then(function(x){var w=new c(g);return w.load(x),w}).then(function(x){var w=[a.Promise.resolve(x)],_=x.files;if(g.checkCRC32)for(var S=0;S<_.length;S++)w.push(p(_[S]));return a.Promise.all(w)}).then(function(x){for(var w=x.shift(),_=w.files,S=0;S<_.length;S++){var k=_[S],N=k.fileNameStr,j=i.resolve(k.fileNameStr);y.file(j,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:g.createFolders}),k.dir||(y.file(j).unsafeOriginalName=N)}return w.zipComment.length&&(y.comment=w.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var i=r("../utils"),a=r("../stream/GenericWorker");function l(c,d){a.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(d)}i.inherits(l,a),l.prototype._bindStream=function(c){var d=this;(this._stream=c).pause(),c.on("data",function(f){d.push({data:f,meta:{percent:0}})}).on("error",function(f){d.isPaused?this.generatedError=f:d.error(f)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},l.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var i=r("readable-stream").Readable;function a(l,c,d){i.call(this,c),this._helper=l;var f=this;l.on("data",function(p,m){f.push(p)||f._helper.pause(),d&&d(m)}).on("error",function(p){f.emit("error",p)}).on("end",function(){f.push(null)})}r("../utils").inherits(a,i),a.prototype._read=function(){this._helper.resume()},n.exports=a},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,a);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,a)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var a=new Buffer(i);return a.fill(0),a},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(r,n,s){function i(j,T,D){var I,L=l.getTypeOf(T),$=l.extend(D||{},f);$.date=$.date||new Date,$.compression!==null&&($.compression=$.compression.toUpperCase()),typeof $.unixPermissions=="string"&&($.unixPermissions=parseInt($.unixPermissions,8)),$.unixPermissions&&16384&$.unixPermissions&&($.dir=!0),$.dosPermissions&&16&$.dosPermissions&&($.dir=!0),$.dir&&(j=_(j)),$.createFolders&&(I=w(j))&&S.call(this,I,!0);var Q=L==="string"&&$.binary===!1&&$.base64===!1;D&&D.binary!==void 0||($.binary=!Q),(T instanceof p&&T.uncompressedSize===0||$.dir||!T||T.length===0)&&($.base64=!1,$.binary=!0,T="",$.compression="STORE",L="string");var M=null;M=T instanceof p||T instanceof c?T:y.isNode&&y.isStream(T)?new x(j,T):l.prepareContent(j,T,$.binary,$.optimizedBinaryString,$.base64);var z=new m(j,M,$);this.files[j]=z}var a=r("./utf8"),l=r("./utils"),c=r("./stream/GenericWorker"),d=r("./stream/StreamHelper"),f=r("./defaults"),p=r("./compressedObject"),m=r("./zipObject"),g=r("./generate"),y=r("./nodejsUtils"),x=r("./nodejs/NodejsStreamInputAdapter"),w=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var T=j.lastIndexOf("/");return 0<T?j.substring(0,T):""},_=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},S=function(j,T){return T=T!==void 0?T:f.createFolders,j=_(j),this.files[j]||i.call(this,j,null,{dir:!0,createFolders:T}),this.files[j]};function k(j){return Object.prototype.toString.call(j)==="[object RegExp]"}var N={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(j){var T,D,I;for(T in this.files)I=this.files[T],(D=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&j(D,I)},filter:function(j){var T=[];return this.forEach(function(D,I){j(D,I)&&T.push(I)}),T},file:function(j,T,D){if(arguments.length!==1)return j=this.root+j,i.call(this,j,T,D),this;if(k(j)){var I=j;return this.filter(function($,Q){return!Q.dir&&I.test($)})}var L=this.files[this.root+j];return L&&!L.dir?L:null},folder:function(j){if(!j)return this;if(k(j))return this.filter(function(L,$){return $.dir&&j.test(L)});var T=this.root+j,D=S.call(this,T),I=this.clone();return I.root=D.name,I},remove:function(j){j=this.root+j;var T=this.files[j];if(T||(j.slice(-1)!=="/"&&(j+="/"),T=this.files[j]),T&&!T.dir)delete this.files[j];else for(var D=this.filter(function(L,$){return $.name.slice(0,j.length)===j}),I=0;I<D.length;I++)delete this.files[D[I].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var T,D={};try{if((D=l.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=D.type.toLowerCase(),D.compression=D.compression.toUpperCase(),D.type==="binarystring"&&(D.type="string"),!D.type)throw new Error("No output type specified.");l.checkSupport(D.type),D.platform!=="darwin"&&D.platform!=="freebsd"&&D.platform!=="linux"&&D.platform!=="sunos"||(D.platform="UNIX"),D.platform==="win32"&&(D.platform="DOS");var I=D.comment||this.comment||"";T=g.generateWorker(this,D,I)}catch(L){(T=new c("error")).error(L)}return new d(T,D.type||"string",D.mimeType)},generateAsync:function(j,T){return this.generateInternalStream(j).accumulate(T)},generateNodeStream:function(j,T){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(T)}};n.exports=N},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var i=r("./DataReader");function a(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}r("../utils").inherits(a,i),a.prototype.byteAt=function(l){return this.data[this.zero+l]},a.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),d=l.charCodeAt(1),f=l.charCodeAt(2),p=l.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===c&&this.data[m+1]===d&&this.data[m+2]===f&&this.data[m+3]===p)return m-this.zero;return-1},a.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),d=l.charCodeAt(1),f=l.charCodeAt(2),p=l.charCodeAt(3),m=this.readData(4);return c===m[0]&&d===m[1]&&f===m[2]&&p===m[3]},a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=a},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var i=r("../utils");function a(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,d=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)d=(d<<8)+this.byteAt(c);return this.index+=l,d},readString:function(l){return i.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=a},{"../utils":32}],19:[function(r,n,s){var i=r("./Uint8ArrayReader");function a(l){i.call(this,l)}r("../utils").inherits(a,i),a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var i=r("./DataReader");function a(l){i.call(this,l)}r("../utils").inherits(a,i),a.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},a.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},a.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=a},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var i=r("./ArrayReader");function a(l){i.call(this,l)}r("../utils").inherits(a,i),a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var i=r("../utils"),a=r("../support"),l=r("./ArrayReader"),c=r("./StringReader"),d=r("./NodeBufferReader"),f=r("./Uint8ArrayReader");n.exports=function(p){var m=i.getTypeOf(p);return i.checkSupport(m),m!=="string"||a.uint8array?m==="nodebuffer"?new d(p):a.uint8array?new f(i.transformTo("uint8array",p)):new l(i.transformTo("array",p)):new c(p)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var i=r("./GenericWorker"),a=r("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var i=r("./GenericWorker"),a=r("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var i=r("../utils"),a=r("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(l,a),l.prototype.processChunk=function(c){if(c){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+c.data.length}a.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var i=r("../utils"),a=r("./GenericWorker");function l(c){a.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(f){d.dataIsReady=!0,d.data=f,d.max=f&&f.length||0,d.type=i.getTypeOf(f),d.isPaused||d._tickAndRepeat()},function(f){d.error(f)})}i.inherits(l,a),l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,d);break;case"uint8array":c=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":c=this.data.slice(this.index,d)}return this.index=d,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function i(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,l){return this._listeners[a].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,l){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,l)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var l=this;return a.on("data",function(c){l.processChunk(c)}),a.on("end",function(){l.end()}),a.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,l){return this.extraStreamInfo[a]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},n.exports=i},{}],29:[function(r,n,s){var i=r("../utils"),a=r("./ConvertWorker"),l=r("./GenericWorker"),c=r("../base64"),d=r("../support"),f=r("../external"),p=null;if(d.nodestream)try{p=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(y,x){return new f.Promise(function(w,_){var S=[],k=y._internalType,N=y._outputType,j=y._mimeType;y.on("data",function(T,D){S.push(T),x&&x(D)}).on("error",function(T){S=[],_(T)}).on("end",function(){try{var T=function(D,I,L){switch(D){case"blob":return i.newBlob(i.transformTo("arraybuffer",I),L);case"base64":return c.encode(I);default:return i.transformTo(D,I)}}(N,function(D,I){var L,$=0,Q=null,M=0;for(L=0;L<I.length;L++)M+=I[L].length;switch(D){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for(Q=new Uint8Array(M),L=0;L<I.length;L++)Q.set(I[L],$),$+=I[L].length;return Q;case"nodebuffer":return Buffer.concat(I);default:throw new Error("concat : unsupported type '"+D+"'")}}(k,S),j);w(T)}catch(D){_(D)}S=[]}).resume()})}function g(y,x,w){var _=x;switch(x){case"blob":case"arraybuffer":_="uint8array";break;case"base64":_="string"}try{this._internalType=_,this._outputType=x,this._mimeType=w,i.checkSupport(_),this._worker=y.pipe(new a(_)),y.lock()}catch(S){this._worker=new l("error"),this._worker.error(S)}}g.prototype={accumulate:function(y){return m(this,y)},on:function(y,x){var w=this;return y==="data"?this._worker.on(y,function(_){x.call(w,_.data,_.meta)}):this._worker.on(y,function(){i.delay(x,arguments,w)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new p(this,{objectMode:this._outputType!=="nodebuffer"},y)}},n.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(i),s.blob=a.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var i=r("./utils"),a=r("./support"),l=r("./nodejsUtils"),c=r("./stream/GenericWorker"),d=new Array(256),f=0;f<256;f++)d[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;d[254]=d[254]=1;function p(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(g){return a.nodebuffer?l.newBufferFrom(g,"utf-8"):function(y){var x,w,_,S,k,N=y.length,j=0;for(S=0;S<N;S++)(64512&(w=y.charCodeAt(S)))==55296&&S+1<N&&(64512&(_=y.charCodeAt(S+1)))==56320&&(w=65536+(w-55296<<10)+(_-56320),S++),j+=w<128?1:w<2048?2:w<65536?3:4;for(x=a.uint8array?new Uint8Array(j):new Array(j),S=k=0;k<j;S++)(64512&(w=y.charCodeAt(S)))==55296&&S+1<N&&(64512&(_=y.charCodeAt(S+1)))==56320&&(w=65536+(w-55296<<10)+(_-56320),S++),w<128?x[k++]=w:(w<2048?x[k++]=192|w>>>6:(w<65536?x[k++]=224|w>>>12:(x[k++]=240|w>>>18,x[k++]=128|w>>>12&63),x[k++]=128|w>>>6&63),x[k++]=128|63&w);return x}(g)},s.utf8decode=function(g){return a.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):function(y){var x,w,_,S,k=y.length,N=new Array(2*k);for(x=w=0;x<k;)if((_=y[x++])<128)N[w++]=_;else if(4<(S=d[_]))N[w++]=65533,x+=S-1;else{for(_&=S===2?31:S===3?15:7;1<S&&x<k;)_=_<<6|63&y[x++],S--;1<S?N[w++]=65533:_<65536?N[w++]=_:(_-=65536,N[w++]=55296|_>>10&1023,N[w++]=56320|1023&_)}return N.length!==w&&(N.subarray?N=N.subarray(0,w):N.length=w),i.applyFromCharCode(N)}(g=i.transformTo(a.uint8array?"uint8array":"array",g))},i.inherits(p,c),p.prototype.processChunk=function(g){var y=i.transformTo(a.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var x=y;(y=new Uint8Array(x.length+this.leftOver.length)).set(this.leftOver,0),y.set(x,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var w=function(S,k){var N;for((k=k||S.length)>S.length&&(k=S.length),N=k-1;0<=N&&(192&S[N])==128;)N--;return N<0||N===0?k:N+d[S[N]]>k?N:k}(y),_=y;w!==y.length&&(a.uint8array?(_=y.subarray(0,w),this.leftOver=y.subarray(w,y.length)):(_=y.slice(0,w),this.leftOver=y.slice(w,y.length))),this.push({data:s.utf8decode(_),meta:g.meta})},p.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=p,i.inherits(m,c),m.prototype.processChunk=function(g){this.push({data:s.utf8encode(g.data),meta:g.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var i=r("./support"),a=r("./base64"),l=r("./nodejsUtils"),c=r("./external");function d(x){return x}function f(x,w){for(var _=0;_<x.length;++_)w[_]=255&x.charCodeAt(_);return w}r("setimmediate"),s.newBlob=function(x,w){s.checkSupport("blob");try{return new Blob([x],{type:w})}catch{try{var _=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return _.append(x),_.getBlob(w)}catch{throw new Error("Bug : can't construct the Blob.")}}};var p={stringifyByChunk:function(x,w,_){var S=[],k=0,N=x.length;if(N<=_)return String.fromCharCode.apply(null,x);for(;k<N;)w==="array"||w==="nodebuffer"?S.push(String.fromCharCode.apply(null,x.slice(k,Math.min(k+_,N)))):S.push(String.fromCharCode.apply(null,x.subarray(k,Math.min(k+_,N)))),k+=_;return S.join("")},stringifyByChar:function(x){for(var w="",_=0;_<x.length;_++)w+=String.fromCharCode(x[_]);return w},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function m(x){var w=65536,_=s.getTypeOf(x),S=!0;if(_==="uint8array"?S=p.applyCanBeUsed.uint8array:_==="nodebuffer"&&(S=p.applyCanBeUsed.nodebuffer),S)for(;1<w;)try{return p.stringifyByChunk(x,_,w)}catch{w=Math.floor(w/2)}return p.stringifyByChar(x)}function g(x,w){for(var _=0;_<x.length;_++)w[_]=x[_];return w}s.applyFromCharCode=m;var y={};y.string={string:d,array:function(x){return f(x,new Array(x.length))},arraybuffer:function(x){return y.string.uint8array(x).buffer},uint8array:function(x){return f(x,new Uint8Array(x.length))},nodebuffer:function(x){return f(x,l.allocBuffer(x.length))}},y.array={string:m,array:d,arraybuffer:function(x){return new Uint8Array(x).buffer},uint8array:function(x){return new Uint8Array(x)},nodebuffer:function(x){return l.newBufferFrom(x)}},y.arraybuffer={string:function(x){return m(new Uint8Array(x))},array:function(x){return g(new Uint8Array(x),new Array(x.byteLength))},arraybuffer:d,uint8array:function(x){return new Uint8Array(x)},nodebuffer:function(x){return l.newBufferFrom(new Uint8Array(x))}},y.uint8array={string:m,array:function(x){return g(x,new Array(x.length))},arraybuffer:function(x){return x.buffer},uint8array:d,nodebuffer:function(x){return l.newBufferFrom(x)}},y.nodebuffer={string:m,array:function(x){return g(x,new Array(x.length))},arraybuffer:function(x){return y.nodebuffer.uint8array(x).buffer},uint8array:function(x){return g(x,new Uint8Array(x.length))},nodebuffer:d},s.transformTo=function(x,w){if(w=w||"",!x)return w;s.checkSupport(x);var _=s.getTypeOf(w);return y[_][x](w)},s.resolve=function(x){for(var w=x.split("/"),_=[],S=0;S<w.length;S++){var k=w[S];k==="."||k===""&&S!==0&&S!==w.length-1||(k===".."?_.pop():_.push(k))}return _.join("/")},s.getTypeOf=function(x){return typeof x=="string"?"string":Object.prototype.toString.call(x)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(x)?"nodebuffer":i.uint8array&&x instanceof Uint8Array?"uint8array":i.arraybuffer&&x instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(x){if(!i[x.toLowerCase()])throw new Error(x+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(x){var w,_,S="";for(_=0;_<(x||"").length;_++)S+="\\x"+((w=x.charCodeAt(_))<16?"0":"")+w.toString(16).toUpperCase();return S},s.delay=function(x,w,_){setImmediate(function(){x.apply(_||null,w||[])})},s.inherits=function(x,w){function _(){}_.prototype=w.prototype,x.prototype=new _},s.extend=function(){var x,w,_={};for(x=0;x<arguments.length;x++)for(w in arguments[x])Object.prototype.hasOwnProperty.call(arguments[x],w)&&_[w]===void 0&&(_[w]=arguments[x][w]);return _},s.prepareContent=function(x,w,_,S,k){return c.Promise.resolve(w).then(function(N){return i.blob&&(N instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(N))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,T){var D=new FileReader;D.onload=function(I){j(I.target.result)},D.onerror=function(I){T(I.target.error)},D.readAsArrayBuffer(N)}):N}).then(function(N){var j=s.getTypeOf(N);return j?(j==="arraybuffer"?N=s.transformTo("uint8array",N):j==="string"&&(k?N=a.decode(N):_&&S!==!0&&(N=function(T){return f(T,i.uint8array?new Uint8Array(T.length):new Array(T.length))}(N))),N):c.Promise.reject(new Error("Can't read the data of '"+x+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var i=r("./reader/readerFor"),a=r("./utils"),l=r("./signature"),c=r("./zipEntry"),d=r("./support");function f(p){this.files=[],this.loadOptions=p}f.prototype={checkSignature:function(p){if(!this.reader.readAndCheckSignature(p)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(m)+", expected "+a.pretty(p)+")")}},isSignature:function(p,m){var g=this.reader.index;this.reader.setIndex(p);var y=this.reader.readString(4)===m;return this.reader.setIndex(g),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var p=this.reader.readData(this.zipCommentLength),m=d.uint8array?"uint8array":"array",g=a.transformTo(m,p);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var p,m,g,y=this.zip64EndOfCentralSize-44;0<y;)p=this.reader.readInt(2),m=this.reader.readInt(4),g=this.reader.readData(m),this.zip64ExtensibleData[p]={id:p,length:m,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var p,m;for(p=0;p<this.files.length;p++)m=this.files[p],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var p;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(p=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(p);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var p=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(p<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(p);var m=p;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(p=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(p),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var y=m-g;if(0<y)this.isSignature(m,l.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(p){this.reader=i(p)},load:function(p){this.prepareReader(p),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=f},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var i=r("./reader/readerFor"),a=r("./utils"),l=r("./compressedObject"),c=r("./crc32"),d=r("./utf8"),f=r("./compressions"),p=r("./support");function m(g,y){this.options=g,this.loadOptions=y}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var y,x;if(g.skip(22),this.fileNameLength=g.readInt(2),x=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(x),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=function(w){for(var _ in f)if(Object.prototype.hasOwnProperty.call(f,_)&&f[_].magic===w)return f[_];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,y,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var y=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(y),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var y,x,w,_=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<_;)y=g.readInt(2),x=g.readInt(2),w=g.readData(x),this.extraFields[y]={id:y,length:x,value:w};g.setIndex(_)},handleUTF8:function(){var g=p.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var x=a.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(x)}var w=this.findExtraFieldUnicodeComment();if(w!==null)this.fileCommentStr=w;else{var _=a.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(_)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var y=i(g.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:d.utf8decode(y.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var y=i(g.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:d.utf8decode(y.readData(g.length-5))}return null}},n.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function i(y,x,w){this.name=y,this.dir=w.dir,this.date=w.date,this.comment=w.comment,this.unixPermissions=w.unixPermissions,this.dosPermissions=w.dosPermissions,this._data=x,this._dataBinary=w.binary,this.options={compression:w.compression,compressionOptions:w.compressionOptions}}var a=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),d=r("./compressedObject"),f=r("./stream/GenericWorker");i.prototype={internalStream:function(y){var x=null,w="string";try{if(!y)throw new Error("No output type specified.");var _=(w=y.toLowerCase())==="string"||w==="text";w!=="binarystring"&&w!=="text"||(w="string"),x=this._decompressWorker();var S=!this._dataBinary;S&&!_&&(x=x.pipe(new c.Utf8EncodeWorker)),!S&&_&&(x=x.pipe(new c.Utf8DecodeWorker))}catch(k){(x=new f("error")).error(k)}return new a(x,w,"")},async:function(y,x){return this.internalStream(y).accumulate(x)},nodeStream:function(y,x){return this.internalStream(y||"nodebuffer").toNodejsStream(x)},_compressWorker:function(y,x){if(this._data instanceof d&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var w=this._decompressWorker();return this._dataBinary||(w=w.pipe(new c.Utf8EncodeWorker)),d.createWorkerFrom(w,y,x)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof f?this._data:new l(this._data)}};for(var p=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<p.length;g++)i.prototype[p[g]]=m;n.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(i){var a,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var d=0,f=new c(y),p=i.document.createTextNode("");f.observe(p,{characterData:!0}),a=function(){p.data=d=++d%2}}else if(i.setImmediate||i.MessageChannel===void 0)a="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var x=i.document.createElement("script");x.onreadystatechange=function(){y(),x.onreadystatechange=null,x.parentNode.removeChild(x),x=null},i.document.documentElement.appendChild(x)}:function(){setTimeout(y,0)};else{var m=new i.MessageChannel;m.port1.onmessage=y,a=function(){m.port2.postMessage(0)}}var g=[];function y(){var x,w;l=!0;for(var _=g.length;_;){for(w=g,g=[],x=-1;++x<_;)w[x]();_=g.length}l=!1}n.exports=function(x){g.push(x)!==1||l||a()}}).call(this,typeof uc<"u"?uc:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var i=r("immediate");function a(){}var l={},c=["REJECTED"],d=["FULFILLED"],f=["PENDING"];function p(_){if(typeof _!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,_!==a&&x(this,_)}function m(_,S,k){this.promise=_,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function g(_,S,k){i(function(){var N;try{N=S(k)}catch(j){return l.reject(_,j)}N===_?l.reject(_,new TypeError("Cannot resolve promise with itself")):l.resolve(_,N)})}function y(_){var S=_&&_.then;if(_&&(typeof _=="object"||typeof _=="function")&&typeof S=="function")return function(){S.apply(_,arguments)}}function x(_,S){var k=!1;function N(D){k||(k=!0,l.reject(_,D))}function j(D){k||(k=!0,l.resolve(_,D))}var T=w(function(){S(j,N)});T.status==="error"&&N(T.value)}function w(_,S){var k={};try{k.value=_(S),k.status="success"}catch(N){k.status="error",k.value=N}return k}(n.exports=p).prototype.finally=function(_){if(typeof _!="function")return this;var S=this.constructor;return this.then(function(k){return S.resolve(_()).then(function(){return k})},function(k){return S.resolve(_()).then(function(){throw k})})},p.prototype.catch=function(_){return this.then(null,_)},p.prototype.then=function(_,S){if(typeof _!="function"&&this.state===d||typeof S!="function"&&this.state===c)return this;var k=new this.constructor(a);return this.state!==f?g(k,this.state===d?_:S,this.outcome):this.queue.push(new m(k,_,S)),k},m.prototype.callFulfilled=function(_){l.resolve(this.promise,_)},m.prototype.otherCallFulfilled=function(_){g(this.promise,this.onFulfilled,_)},m.prototype.callRejected=function(_){l.reject(this.promise,_)},m.prototype.otherCallRejected=function(_){g(this.promise,this.onRejected,_)},l.resolve=function(_,S){var k=w(y,S);if(k.status==="error")return l.reject(_,k.value);var N=k.value;if(N)x(_,N);else{_.state=d,_.outcome=S;for(var j=-1,T=_.queue.length;++j<T;)_.queue[j].callFulfilled(S)}return _},l.reject=function(_,S){_.state=c,_.outcome=S;for(var k=-1,N=_.queue.length;++k<N;)_.queue[k].callRejected(S);return _},p.resolve=function(_){return _ instanceof this?_:l.resolve(new this(a),_)},p.reject=function(_){var S=new this(a);return l.reject(S,_)},p.all=function(_){var S=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=_.length,N=!1;if(!k)return this.resolve([]);for(var j=new Array(k),T=0,D=-1,I=new this(a);++D<k;)L(_[D],D);return I;function L($,Q){S.resolve($).then(function(M){j[Q]=M,++T!==k||N||(N=!0,l.resolve(I,j))},function(M){N||(N=!0,l.reject(I,M))})}},p.race=function(_){var S=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=_.length,N=!1;if(!k)return this.resolve([]);for(var j=-1,T=new this(a);++j<k;)D=_[j],S.resolve(D).then(function(I){N||(N=!0,l.resolve(T,I))},function(I){N||(N=!0,l.reject(T,I))});var D;return T}},{immediate:36}],38:[function(r,n,s){var i={};(0,r("./lib/utils/common").assign)(i,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var i=r("./zlib/deflate"),a=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/messages"),d=r("./zlib/zstream"),f=Object.prototype.toString,p=0,m=-1,g=0,y=8;function x(_){if(!(this instanceof x))return new x(_);this.options=a.assign({level:m,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},_||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(k!==p)throw new Error(c[k]);if(S.header&&i.deflateSetHeader(this.strm,S.header),S.dictionary){var N;if(N=typeof S.dictionary=="string"?l.string2buf(S.dictionary):f.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(k=i.deflateSetDictionary(this.strm,N))!==p)throw new Error(c[k]);this._dict_set=!0}}function w(_,S){var k=new x(S);if(k.push(_,!0),k.err)throw k.msg||c[k.err];return k.result}x.prototype.push=function(_,S){var k,N,j=this.strm,T=this.options.chunkSize;if(this.ended)return!1;N=S===~~S?S:S===!0?4:0,typeof _=="string"?j.input=l.string2buf(_):f.call(_)==="[object ArrayBuffer]"?j.input=new Uint8Array(_):j.input=_,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new a.Buf8(T),j.next_out=0,j.avail_out=T),(k=i.deflate(j,N))!==1&&k!==p)return this.onEnd(k),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||N!==4&&N!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(j.output,j.next_out))):this.onData(a.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&k!==1);return N===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===p):N!==2||(this.onEnd(p),!(j.avail_out=0))},x.prototype.onData=function(_){this.chunks.push(_)},x.prototype.onEnd=function(_){_===p&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=_,this.msg=this.strm.msg},s.Deflate=x,s.deflate=w,s.deflateRaw=function(_,S){return(S=S||{}).raw=!0,w(_,S)},s.gzip=function(_,S){return(S=S||{}).gzip=!0,w(_,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var i=r("./zlib/inflate"),a=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/constants"),d=r("./zlib/messages"),f=r("./zlib/zstream"),p=r("./zlib/gzheader"),m=Object.prototype.toString;function g(x){if(!(this instanceof g))return new g(x);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},x||{});var w=this.options;w.raw&&0<=w.windowBits&&w.windowBits<16&&(w.windowBits=-w.windowBits,w.windowBits===0&&(w.windowBits=-15)),!(0<=w.windowBits&&w.windowBits<16)||x&&x.windowBits||(w.windowBits+=32),15<w.windowBits&&w.windowBits<48&&(15&w.windowBits)==0&&(w.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var _=i.inflateInit2(this.strm,w.windowBits);if(_!==c.Z_OK)throw new Error(d[_]);this.header=new p,i.inflateGetHeader(this.strm,this.header)}function y(x,w){var _=new g(w);if(_.push(x,!0),_.err)throw _.msg||d[_.err];return _.result}g.prototype.push=function(x,w){var _,S,k,N,j,T,D=this.strm,I=this.options.chunkSize,L=this.options.dictionary,$=!1;if(this.ended)return!1;S=w===~~w?w:w===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof x=="string"?D.input=l.binstring2buf(x):m.call(x)==="[object ArrayBuffer]"?D.input=new Uint8Array(x):D.input=x,D.next_in=0,D.avail_in=D.input.length;do{if(D.avail_out===0&&(D.output=new a.Buf8(I),D.next_out=0,D.avail_out=I),(_=i.inflate(D,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&L&&(T=typeof L=="string"?l.string2buf(L):m.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,_=i.inflateSetDictionary(this.strm,T)),_===c.Z_BUF_ERROR&&$===!0&&(_=c.Z_OK,$=!1),_!==c.Z_STREAM_END&&_!==c.Z_OK)return this.onEnd(_),!(this.ended=!0);D.next_out&&(D.avail_out!==0&&_!==c.Z_STREAM_END&&(D.avail_in!==0||S!==c.Z_FINISH&&S!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(D.output,D.next_out),N=D.next_out-k,j=l.buf2string(D.output,k),D.next_out=N,D.avail_out=I-N,N&&a.arraySet(D.output,D.output,k,N,0),this.onData(j)):this.onData(a.shrinkBuf(D.output,D.next_out)))),D.avail_in===0&&D.avail_out===0&&($=!0)}while((0<D.avail_in||D.avail_out===0)&&_!==c.Z_STREAM_END);return _===c.Z_STREAM_END&&(S=c.Z_FINISH),S===c.Z_FINISH?(_=i.inflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===c.Z_OK):S!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(D.avail_out=0))},g.prototype.onData=function(x){this.chunks.push(x)},g.prototype.onEnd=function(x){x===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},s.Inflate=g,s.inflate=y,s.inflateRaw=function(x,w){return(w=w||{}).raw=!0,y(x,w)},s.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var f=d.shift();if(f){if(typeof f!="object")throw new TypeError(f+"must be non-object");for(var p in f)f.hasOwnProperty(p)&&(c[p]=f[p])}}return c},s.shrinkBuf=function(c,d){return c.length===d?c:c.subarray?c.subarray(0,d):(c.length=d,c)};var a={arraySet:function(c,d,f,p,m){if(d.subarray&&c.subarray)c.set(d.subarray(f,f+p),m);else for(var g=0;g<p;g++)c[m+g]=d[f+g]},flattenChunks:function(c){var d,f,p,m,g,y;for(d=p=0,f=c.length;d<f;d++)p+=c[d].length;for(y=new Uint8Array(p),d=m=0,f=c.length;d<f;d++)g=c[d],y.set(g,m),m+=g.length;return y}},l={arraySet:function(c,d,f,p,m){for(var g=0;g<p;g++)c[m+g]=d[f+g]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,a)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(i)},{}],42:[function(r,n,s){var i=r("./common"),a=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new i.Buf8(256),d=0;d<256;d++)c[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function f(p,m){if(m<65537&&(p.subarray&&l||!p.subarray&&a))return String.fromCharCode.apply(null,i.shrinkBuf(p,m));for(var g="",y=0;y<m;y++)g+=String.fromCharCode(p[y]);return g}c[254]=c[254]=1,s.string2buf=function(p){var m,g,y,x,w,_=p.length,S=0;for(x=0;x<_;x++)(64512&(g=p.charCodeAt(x)))==55296&&x+1<_&&(64512&(y=p.charCodeAt(x+1)))==56320&&(g=65536+(g-55296<<10)+(y-56320),x++),S+=g<128?1:g<2048?2:g<65536?3:4;for(m=new i.Buf8(S),x=w=0;w<S;x++)(64512&(g=p.charCodeAt(x)))==55296&&x+1<_&&(64512&(y=p.charCodeAt(x+1)))==56320&&(g=65536+(g-55296<<10)+(y-56320),x++),g<128?m[w++]=g:(g<2048?m[w++]=192|g>>>6:(g<65536?m[w++]=224|g>>>12:(m[w++]=240|g>>>18,m[w++]=128|g>>>12&63),m[w++]=128|g>>>6&63),m[w++]=128|63&g);return m},s.buf2binstring=function(p){return f(p,p.length)},s.binstring2buf=function(p){for(var m=new i.Buf8(p.length),g=0,y=m.length;g<y;g++)m[g]=p.charCodeAt(g);return m},s.buf2string=function(p,m){var g,y,x,w,_=m||p.length,S=new Array(2*_);for(g=y=0;g<_;)if((x=p[g++])<128)S[y++]=x;else if(4<(w=c[x]))S[y++]=65533,g+=w-1;else{for(x&=w===2?31:w===3?15:7;1<w&&g<_;)x=x<<6|63&p[g++],w--;1<w?S[y++]=65533:x<65536?S[y++]=x:(x-=65536,S[y++]=55296|x>>10&1023,S[y++]=56320|1023&x)}return f(S,y)},s.utf8border=function(p,m){var g;for((m=m||p.length)>p.length&&(m=p.length),g=m-1;0<=g&&(192&p[g])==128;)g--;return g<0||g===0?m:g+c[p[g]]>m?g:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(i,a,l,c){for(var d=65535&i|0,f=i>>>16&65535|0,p=0;l!==0;){for(l-=p=2e3<l?2e3:l;f=f+(d=d+a[c++]|0)|0,--p;);d%=65521,f%=65521}return d|f<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var i=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();n.exports=function(a,l,c,d){var f=i,p=d+c;a^=-1;for(var m=d;m<p;m++)a=a>>>8^f[255&(a^l[m])];return-1^a}},{}],46:[function(r,n,s){var i,a=r("../utils/common"),l=r("./trees"),c=r("./adler32"),d=r("./crc32"),f=r("./messages"),p=0,m=4,g=0,y=-2,x=-1,w=4,_=2,S=8,k=9,N=286,j=30,T=19,D=2*N+1,I=15,L=3,$=258,Q=$+L+1,M=42,z=113,R=1,B=2,V=3,F=4;function K(P,ne){return P.msg=f[ne],ne}function Y(P){return(P<<1)-(4<P?9:0)}function O(P){for(var ne=P.length;0<=--ne;)P[ne]=0}function H(P){var ne=P.state,X=ne.pending;X>P.avail_out&&(X=P.avail_out),X!==0&&(a.arraySet(P.output,ne.pending_buf,ne.pending_out,X,P.next_out),P.next_out+=X,ne.pending_out+=X,P.total_out+=X,P.avail_out-=X,ne.pending-=X,ne.pending===0&&(ne.pending_out=0))}function G(P,ne){l._tr_flush_block(P,0<=P.block_start?P.block_start:-1,P.strstart-P.block_start,ne),P.block_start=P.strstart,H(P.strm)}function q(P,ne){P.pending_buf[P.pending++]=ne}function J(P,ne){P.pending_buf[P.pending++]=ne>>>8&255,P.pending_buf[P.pending++]=255&ne}function te(P,ne){var X,W,Z=P.max_chain_length,re=P.strstart,ae=P.prev_length,fe=P.nice_match,oe=P.strstart>P.w_size-Q?P.strstart-(P.w_size-Q):0,Ae=P.window,Ne=P.w_mask,Le=P.prev,pe=P.strstart+$,De=Ae[re+ae-1],qe=Ae[re+ae];P.prev_length>=P.good_match&&(Z>>=2),fe>P.lookahead&&(fe=P.lookahead);do if(Ae[(X=ne)+ae]===qe&&Ae[X+ae-1]===De&&Ae[X]===Ae[re]&&Ae[++X]===Ae[re+1]){re+=2,X++;do;while(Ae[++re]===Ae[++X]&&Ae[++re]===Ae[++X]&&Ae[++re]===Ae[++X]&&Ae[++re]===Ae[++X]&&Ae[++re]===Ae[++X]&&Ae[++re]===Ae[++X]&&Ae[++re]===Ae[++X]&&Ae[++re]===Ae[++X]&&re<pe);if(W=$-(pe-re),re=pe-$,ae<W){if(P.match_start=ne,fe<=(ae=W))break;De=Ae[re+ae-1],qe=Ae[re+ae]}}while((ne=Le[ne&Ne])>oe&&--Z!=0);return ae<=P.lookahead?ae:P.lookahead}function ve(P){var ne,X,W,Z,re,ae,fe,oe,Ae,Ne,Le=P.w_size;do{if(Z=P.window_size-P.lookahead-P.strstart,P.strstart>=Le+(Le-Q)){for(a.arraySet(P.window,P.window,Le,Le,0),P.match_start-=Le,P.strstart-=Le,P.block_start-=Le,ne=X=P.hash_size;W=P.head[--ne],P.head[ne]=Le<=W?W-Le:0,--X;);for(ne=X=Le;W=P.prev[--ne],P.prev[ne]=Le<=W?W-Le:0,--X;);Z+=Le}if(P.strm.avail_in===0)break;if(ae=P.strm,fe=P.window,oe=P.strstart+P.lookahead,Ae=Z,Ne=void 0,Ne=ae.avail_in,Ae<Ne&&(Ne=Ae),X=Ne===0?0:(ae.avail_in-=Ne,a.arraySet(fe,ae.input,ae.next_in,Ne,oe),ae.state.wrap===1?ae.adler=c(ae.adler,fe,Ne,oe):ae.state.wrap===2&&(ae.adler=d(ae.adler,fe,Ne,oe)),ae.next_in+=Ne,ae.total_in+=Ne,Ne),P.lookahead+=X,P.lookahead+P.insert>=L)for(re=P.strstart-P.insert,P.ins_h=P.window[re],P.ins_h=(P.ins_h<<P.hash_shift^P.window[re+1])&P.hash_mask;P.insert&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[re+L-1])&P.hash_mask,P.prev[re&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=re,re++,P.insert--,!(P.lookahead+P.insert<L)););}while(P.lookahead<Q&&P.strm.avail_in!==0)}function he(P,ne){for(var X,W;;){if(P.lookahead<Q){if(ve(P),P.lookahead<Q&&ne===p)return R;if(P.lookahead===0)break}if(X=0,P.lookahead>=L&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+L-1])&P.hash_mask,X=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),X!==0&&P.strstart-X<=P.w_size-Q&&(P.match_length=te(P,X)),P.match_length>=L)if(W=l._tr_tally(P,P.strstart-P.match_start,P.match_length-L),P.lookahead-=P.match_length,P.match_length<=P.max_lazy_match&&P.lookahead>=L){for(P.match_length--;P.strstart++,P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+L-1])&P.hash_mask,X=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart,--P.match_length!=0;);P.strstart++}else P.strstart+=P.match_length,P.match_length=0,P.ins_h=P.window[P.strstart],P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+1])&P.hash_mask;else W=l._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++;if(W&&(G(P,!1),P.strm.avail_out===0))return R}return P.insert=P.strstart<L-1?P.strstart:L-1,ne===m?(G(P,!0),P.strm.avail_out===0?V:F):P.last_lit&&(G(P,!1),P.strm.avail_out===0)?R:B}function xe(P,ne){for(var X,W,Z;;){if(P.lookahead<Q){if(ve(P),P.lookahead<Q&&ne===p)return R;if(P.lookahead===0)break}if(X=0,P.lookahead>=L&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+L-1])&P.hash_mask,X=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),P.prev_length=P.match_length,P.prev_match=P.match_start,P.match_length=L-1,X!==0&&P.prev_length<P.max_lazy_match&&P.strstart-X<=P.w_size-Q&&(P.match_length=te(P,X),P.match_length<=5&&(P.strategy===1||P.match_length===L&&4096<P.strstart-P.match_start)&&(P.match_length=L-1)),P.prev_length>=L&&P.match_length<=P.prev_length){for(Z=P.strstart+P.lookahead-L,W=l._tr_tally(P,P.strstart-1-P.prev_match,P.prev_length-L),P.lookahead-=P.prev_length-1,P.prev_length-=2;++P.strstart<=Z&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+L-1])&P.hash_mask,X=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),--P.prev_length!=0;);if(P.match_available=0,P.match_length=L-1,P.strstart++,W&&(G(P,!1),P.strm.avail_out===0))return R}else if(P.match_available){if((W=l._tr_tally(P,0,P.window[P.strstart-1]))&&G(P,!1),P.strstart++,P.lookahead--,P.strm.avail_out===0)return R}else P.match_available=1,P.strstart++,P.lookahead--}return P.match_available&&(W=l._tr_tally(P,0,P.window[P.strstart-1]),P.match_available=0),P.insert=P.strstart<L-1?P.strstart:L-1,ne===m?(G(P,!0),P.strm.avail_out===0?V:F):P.last_lit&&(G(P,!1),P.strm.avail_out===0)?R:B}function ke(P,ne,X,W,Z){this.good_length=P,this.max_lazy=ne,this.nice_length=X,this.max_chain=W,this.func=Z}function Oe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*D),this.dyn_dtree=new a.Buf16(2*(2*j+1)),this.bl_tree=new a.Buf16(2*(2*T+1)),O(this.dyn_ltree),O(this.dyn_dtree),O(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(I+1),this.heap=new a.Buf16(2*N+1),O(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*N+1),O(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function He(P){var ne;return P&&P.state?(P.total_in=P.total_out=0,P.data_type=_,(ne=P.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?M:z,P.adler=ne.wrap===2?0:1,ne.last_flush=p,l._tr_init(ne),g):K(P,y)}function Ye(P){var ne=He(P);return ne===g&&function(X){X.window_size=2*X.w_size,O(X.head),X.max_lazy_match=i[X.level].max_lazy,X.good_match=i[X.level].good_length,X.nice_match=i[X.level].nice_length,X.max_chain_length=i[X.level].max_chain,X.strstart=0,X.block_start=0,X.lookahead=0,X.insert=0,X.match_length=X.prev_length=L-1,X.match_available=0,X.ins_h=0}(P.state),ne}function lt(P,ne,X,W,Z,re){if(!P)return y;var ae=1;if(ne===x&&(ne=6),W<0?(ae=0,W=-W):15<W&&(ae=2,W-=16),Z<1||k<Z||X!==S||W<8||15<W||ne<0||9<ne||re<0||w<re)return K(P,y);W===8&&(W=9);var fe=new Oe;return(P.state=fe).strm=P,fe.wrap=ae,fe.gzhead=null,fe.w_bits=W,fe.w_size=1<<fe.w_bits,fe.w_mask=fe.w_size-1,fe.hash_bits=Z+7,fe.hash_size=1<<fe.hash_bits,fe.hash_mask=fe.hash_size-1,fe.hash_shift=~~((fe.hash_bits+L-1)/L),fe.window=new a.Buf8(2*fe.w_size),fe.head=new a.Buf16(fe.hash_size),fe.prev=new a.Buf16(fe.w_size),fe.lit_bufsize=1<<Z+6,fe.pending_buf_size=4*fe.lit_bufsize,fe.pending_buf=new a.Buf8(fe.pending_buf_size),fe.d_buf=1*fe.lit_bufsize,fe.l_buf=3*fe.lit_bufsize,fe.level=ne,fe.strategy=re,fe.method=X,Ye(P)}i=[new ke(0,0,0,0,function(P,ne){var X=65535;for(X>P.pending_buf_size-5&&(X=P.pending_buf_size-5);;){if(P.lookahead<=1){if(ve(P),P.lookahead===0&&ne===p)return R;if(P.lookahead===0)break}P.strstart+=P.lookahead,P.lookahead=0;var W=P.block_start+X;if((P.strstart===0||P.strstart>=W)&&(P.lookahead=P.strstart-W,P.strstart=W,G(P,!1),P.strm.avail_out===0)||P.strstart-P.block_start>=P.w_size-Q&&(G(P,!1),P.strm.avail_out===0))return R}return P.insert=0,ne===m?(G(P,!0),P.strm.avail_out===0?V:F):(P.strstart>P.block_start&&(G(P,!1),P.strm.avail_out),R)}),new ke(4,4,8,4,he),new ke(4,5,16,8,he),new ke(4,6,32,32,he),new ke(4,4,16,16,xe),new ke(8,16,32,32,xe),new ke(8,16,128,128,xe),new ke(8,32,128,256,xe),new ke(32,128,258,1024,xe),new ke(32,258,258,4096,xe)],s.deflateInit=function(P,ne){return lt(P,ne,S,15,8,0)},s.deflateInit2=lt,s.deflateReset=Ye,s.deflateResetKeep=He,s.deflateSetHeader=function(P,ne){return P&&P.state?P.state.wrap!==2?y:(P.state.gzhead=ne,g):y},s.deflate=function(P,ne){var X,W,Z,re;if(!P||!P.state||5<ne||ne<0)return P?K(P,y):y;if(W=P.state,!P.output||!P.input&&P.avail_in!==0||W.status===666&&ne!==m)return K(P,P.avail_out===0?-5:y);if(W.strm=P,X=W.last_flush,W.last_flush=ne,W.status===M)if(W.wrap===2)P.adler=0,q(W,31),q(W,139),q(W,8),W.gzhead?(q(W,(W.gzhead.text?1:0)+(W.gzhead.hcrc?2:0)+(W.gzhead.extra?4:0)+(W.gzhead.name?8:0)+(W.gzhead.comment?16:0)),q(W,255&W.gzhead.time),q(W,W.gzhead.time>>8&255),q(W,W.gzhead.time>>16&255),q(W,W.gzhead.time>>24&255),q(W,W.level===9?2:2<=W.strategy||W.level<2?4:0),q(W,255&W.gzhead.os),W.gzhead.extra&&W.gzhead.extra.length&&(q(W,255&W.gzhead.extra.length),q(W,W.gzhead.extra.length>>8&255)),W.gzhead.hcrc&&(P.adler=d(P.adler,W.pending_buf,W.pending,0)),W.gzindex=0,W.status=69):(q(W,0),q(W,0),q(W,0),q(W,0),q(W,0),q(W,W.level===9?2:2<=W.strategy||W.level<2?4:0),q(W,3),W.status=z);else{var ae=S+(W.w_bits-8<<4)<<8;ae|=(2<=W.strategy||W.level<2?0:W.level<6?1:W.level===6?2:3)<<6,W.strstart!==0&&(ae|=32),ae+=31-ae%31,W.status=z,J(W,ae),W.strstart!==0&&(J(W,P.adler>>>16),J(W,65535&P.adler)),P.adler=1}if(W.status===69)if(W.gzhead.extra){for(Z=W.pending;W.gzindex<(65535&W.gzhead.extra.length)&&(W.pending!==W.pending_buf_size||(W.gzhead.hcrc&&W.pending>Z&&(P.adler=d(P.adler,W.pending_buf,W.pending-Z,Z)),H(P),Z=W.pending,W.pending!==W.pending_buf_size));)q(W,255&W.gzhead.extra[W.gzindex]),W.gzindex++;W.gzhead.hcrc&&W.pending>Z&&(P.adler=d(P.adler,W.pending_buf,W.pending-Z,Z)),W.gzindex===W.gzhead.extra.length&&(W.gzindex=0,W.status=73)}else W.status=73;if(W.status===73)if(W.gzhead.name){Z=W.pending;do{if(W.pending===W.pending_buf_size&&(W.gzhead.hcrc&&W.pending>Z&&(P.adler=d(P.adler,W.pending_buf,W.pending-Z,Z)),H(P),Z=W.pending,W.pending===W.pending_buf_size)){re=1;break}re=W.gzindex<W.gzhead.name.length?255&W.gzhead.name.charCodeAt(W.gzindex++):0,q(W,re)}while(re!==0);W.gzhead.hcrc&&W.pending>Z&&(P.adler=d(P.adler,W.pending_buf,W.pending-Z,Z)),re===0&&(W.gzindex=0,W.status=91)}else W.status=91;if(W.status===91)if(W.gzhead.comment){Z=W.pending;do{if(W.pending===W.pending_buf_size&&(W.gzhead.hcrc&&W.pending>Z&&(P.adler=d(P.adler,W.pending_buf,W.pending-Z,Z)),H(P),Z=W.pending,W.pending===W.pending_buf_size)){re=1;break}re=W.gzindex<W.gzhead.comment.length?255&W.gzhead.comment.charCodeAt(W.gzindex++):0,q(W,re)}while(re!==0);W.gzhead.hcrc&&W.pending>Z&&(P.adler=d(P.adler,W.pending_buf,W.pending-Z,Z)),re===0&&(W.status=103)}else W.status=103;if(W.status===103&&(W.gzhead.hcrc?(W.pending+2>W.pending_buf_size&&H(P),W.pending+2<=W.pending_buf_size&&(q(W,255&P.adler),q(W,P.adler>>8&255),P.adler=0,W.status=z)):W.status=z),W.pending!==0){if(H(P),P.avail_out===0)return W.last_flush=-1,g}else if(P.avail_in===0&&Y(ne)<=Y(X)&&ne!==m)return K(P,-5);if(W.status===666&&P.avail_in!==0)return K(P,-5);if(P.avail_in!==0||W.lookahead!==0||ne!==p&&W.status!==666){var fe=W.strategy===2?function(oe,Ae){for(var Ne;;){if(oe.lookahead===0&&(ve(oe),oe.lookahead===0)){if(Ae===p)return R;break}if(oe.match_length=0,Ne=l._tr_tally(oe,0,oe.window[oe.strstart]),oe.lookahead--,oe.strstart++,Ne&&(G(oe,!1),oe.strm.avail_out===0))return R}return oe.insert=0,Ae===m?(G(oe,!0),oe.strm.avail_out===0?V:F):oe.last_lit&&(G(oe,!1),oe.strm.avail_out===0)?R:B}(W,ne):W.strategy===3?function(oe,Ae){for(var Ne,Le,pe,De,qe=oe.window;;){if(oe.lookahead<=$){if(ve(oe),oe.lookahead<=$&&Ae===p)return R;if(oe.lookahead===0)break}if(oe.match_length=0,oe.lookahead>=L&&0<oe.strstart&&(Le=qe[pe=oe.strstart-1])===qe[++pe]&&Le===qe[++pe]&&Le===qe[++pe]){De=oe.strstart+$;do;while(Le===qe[++pe]&&Le===qe[++pe]&&Le===qe[++pe]&&Le===qe[++pe]&&Le===qe[++pe]&&Le===qe[++pe]&&Le===qe[++pe]&&Le===qe[++pe]&&pe<De);oe.match_length=$-(De-pe),oe.match_length>oe.lookahead&&(oe.match_length=oe.lookahead)}if(oe.match_length>=L?(Ne=l._tr_tally(oe,1,oe.match_length-L),oe.lookahead-=oe.match_length,oe.strstart+=oe.match_length,oe.match_length=0):(Ne=l._tr_tally(oe,0,oe.window[oe.strstart]),oe.lookahead--,oe.strstart++),Ne&&(G(oe,!1),oe.strm.avail_out===0))return R}return oe.insert=0,Ae===m?(G(oe,!0),oe.strm.avail_out===0?V:F):oe.last_lit&&(G(oe,!1),oe.strm.avail_out===0)?R:B}(W,ne):i[W.level].func(W,ne);if(fe!==V&&fe!==F||(W.status=666),fe===R||fe===V)return P.avail_out===0&&(W.last_flush=-1),g;if(fe===B&&(ne===1?l._tr_align(W):ne!==5&&(l._tr_stored_block(W,0,0,!1),ne===3&&(O(W.head),W.lookahead===0&&(W.strstart=0,W.block_start=0,W.insert=0))),H(P),P.avail_out===0))return W.last_flush=-1,g}return ne!==m?g:W.wrap<=0?1:(W.wrap===2?(q(W,255&P.adler),q(W,P.adler>>8&255),q(W,P.adler>>16&255),q(W,P.adler>>24&255),q(W,255&P.total_in),q(W,P.total_in>>8&255),q(W,P.total_in>>16&255),q(W,P.total_in>>24&255)):(J(W,P.adler>>>16),J(W,65535&P.adler)),H(P),0<W.wrap&&(W.wrap=-W.wrap),W.pending!==0?g:1)},s.deflateEnd=function(P){var ne;return P&&P.state?(ne=P.state.status)!==M&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==z&&ne!==666?K(P,y):(P.state=null,ne===z?K(P,-3):g):y},s.deflateSetDictionary=function(P,ne){var X,W,Z,re,ae,fe,oe,Ae,Ne=ne.length;if(!P||!P.state||(re=(X=P.state).wrap)===2||re===1&&X.status!==M||X.lookahead)return y;for(re===1&&(P.adler=c(P.adler,ne,Ne,0)),X.wrap=0,Ne>=X.w_size&&(re===0&&(O(X.head),X.strstart=0,X.block_start=0,X.insert=0),Ae=new a.Buf8(X.w_size),a.arraySet(Ae,ne,Ne-X.w_size,X.w_size,0),ne=Ae,Ne=X.w_size),ae=P.avail_in,fe=P.next_in,oe=P.input,P.avail_in=Ne,P.next_in=0,P.input=ne,ve(X);X.lookahead>=L;){for(W=X.strstart,Z=X.lookahead-(L-1);X.ins_h=(X.ins_h<<X.hash_shift^X.window[W+L-1])&X.hash_mask,X.prev[W&X.w_mask]=X.head[X.ins_h],X.head[X.ins_h]=W,W++,--Z;);X.strstart=W,X.lookahead=L-1,ve(X)}return X.strstart+=X.lookahead,X.block_start=X.strstart,X.insert=X.lookahead,X.lookahead=0,X.match_length=X.prev_length=L-1,X.match_available=0,P.next_in=fe,P.input=oe,P.avail_in=ae,X.wrap=re,g},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,n,s){n.exports=function(i,a){var l,c,d,f,p,m,g,y,x,w,_,S,k,N,j,T,D,I,L,$,Q,M,z,R,B;l=i.state,c=i.next_in,R=i.input,d=c+(i.avail_in-5),f=i.next_out,B=i.output,p=f-(a-i.avail_out),m=f+(i.avail_out-257),g=l.dmax,y=l.wsize,x=l.whave,w=l.wnext,_=l.window,S=l.hold,k=l.bits,N=l.lencode,j=l.distcode,T=(1<<l.lenbits)-1,D=(1<<l.distbits)-1;e:do{k<15&&(S+=R[c++]<<k,k+=8,S+=R[c++]<<k,k+=8),I=N[S&T];t:for(;;){if(S>>>=L=I>>>24,k-=L,(L=I>>>16&255)===0)B[f++]=65535&I;else{if(!(16&L)){if((64&L)==0){I=N[(65535&I)+(S&(1<<L)-1)];continue t}if(32&L){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}$=65535&I,(L&=15)&&(k<L&&(S+=R[c++]<<k,k+=8),$+=S&(1<<L)-1,S>>>=L,k-=L),k<15&&(S+=R[c++]<<k,k+=8,S+=R[c++]<<k,k+=8),I=j[S&D];r:for(;;){if(S>>>=L=I>>>24,k-=L,!(16&(L=I>>>16&255))){if((64&L)==0){I=j[(65535&I)+(S&(1<<L)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(Q=65535&I,k<(L&=15)&&(S+=R[c++]<<k,(k+=8)<L&&(S+=R[c++]<<k,k+=8)),g<(Q+=S&(1<<L)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(S>>>=L,k-=L,(L=f-p)<Q){if(x<(L=Q-L)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(z=_,(M=0)===w){if(M+=y-L,L<$){for($-=L;B[f++]=_[M++],--L;);M=f-Q,z=B}}else if(w<L){if(M+=y+w-L,(L-=w)<$){for($-=L;B[f++]=_[M++],--L;);if(M=0,w<$){for($-=L=w;B[f++]=_[M++],--L;);M=f-Q,z=B}}}else if(M+=w-L,L<$){for($-=L;B[f++]=_[M++],--L;);M=f-Q,z=B}for(;2<$;)B[f++]=z[M++],B[f++]=z[M++],B[f++]=z[M++],$-=3;$&&(B[f++]=z[M++],1<$&&(B[f++]=z[M++]))}else{for(M=f-Q;B[f++]=B[M++],B[f++]=B[M++],B[f++]=B[M++],2<($-=3););$&&(B[f++]=B[M++],1<$&&(B[f++]=B[M++]))}break}}break}}while(c<d&&f<m);c-=$=k>>3,S&=(1<<(k-=$<<3))-1,i.next_in=c,i.next_out=f,i.avail_in=c<d?d-c+5:5-(c-d),i.avail_out=f<m?m-f+257:257-(f-m),l.hold=S,l.bits=k}},{}],49:[function(r,n,s){var i=r("../utils/common"),a=r("./adler32"),l=r("./crc32"),c=r("./inffast"),d=r("./inftrees"),f=1,p=2,m=0,g=-2,y=1,x=852,w=592;function _(M){return(M>>>24&255)+(M>>>8&65280)+((65280&M)<<8)+((255&M)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(M){var z;return M&&M.state?(z=M.state,M.total_in=M.total_out=z.total=0,M.msg="",z.wrap&&(M.adler=1&z.wrap),z.mode=y,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new i.Buf32(x),z.distcode=z.distdyn=new i.Buf32(w),z.sane=1,z.back=-1,m):g}function N(M){var z;return M&&M.state?((z=M.state).wsize=0,z.whave=0,z.wnext=0,k(M)):g}function j(M,z){var R,B;return M&&M.state?(B=M.state,z<0?(R=0,z=-z):(R=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15<z)?g:(B.window!==null&&B.wbits!==z&&(B.window=null),B.wrap=R,B.wbits=z,N(M))):g}function T(M,z){var R,B;return M?(B=new S,(M.state=B).window=null,(R=j(M,z))!==m&&(M.state=null),R):g}var D,I,L=!0;function $(M){if(L){var z;for(D=new i.Buf32(512),I=new i.Buf32(32),z=0;z<144;)M.lens[z++]=8;for(;z<256;)M.lens[z++]=9;for(;z<280;)M.lens[z++]=7;for(;z<288;)M.lens[z++]=8;for(d(f,M.lens,0,288,D,0,M.work,{bits:9}),z=0;z<32;)M.lens[z++]=5;d(p,M.lens,0,32,I,0,M.work,{bits:5}),L=!1}M.lencode=D,M.lenbits=9,M.distcode=I,M.distbits=5}function Q(M,z,R,B){var V,F=M.state;return F.window===null&&(F.wsize=1<<F.wbits,F.wnext=0,F.whave=0,F.window=new i.Buf8(F.wsize)),B>=F.wsize?(i.arraySet(F.window,z,R-F.wsize,F.wsize,0),F.wnext=0,F.whave=F.wsize):(B<(V=F.wsize-F.wnext)&&(V=B),i.arraySet(F.window,z,R-B,V,F.wnext),(B-=V)?(i.arraySet(F.window,z,R-B,B,0),F.wnext=B,F.whave=F.wsize):(F.wnext+=V,F.wnext===F.wsize&&(F.wnext=0),F.whave<F.wsize&&(F.whave+=V))),0}s.inflateReset=N,s.inflateReset2=j,s.inflateResetKeep=k,s.inflateInit=function(M){return T(M,15)},s.inflateInit2=T,s.inflate=function(M,z){var R,B,V,F,K,Y,O,H,G,q,J,te,ve,he,xe,ke,Oe,He,Ye,lt,P,ne,X,W,Z=0,re=new i.Buf8(4),ae=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!M||!M.state||!M.output||!M.input&&M.avail_in!==0)return g;(R=M.state).mode===12&&(R.mode=13),K=M.next_out,V=M.output,O=M.avail_out,F=M.next_in,B=M.input,Y=M.avail_in,H=R.hold,G=R.bits,q=Y,J=O,ne=m;e:for(;;)switch(R.mode){case y:if(R.wrap===0){R.mode=13;break}for(;G<16;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if(2&R.wrap&&H===35615){re[R.check=0]=255&H,re[1]=H>>>8&255,R.check=l(R.check,re,2,0),G=H=0,R.mode=2;break}if(R.flags=0,R.head&&(R.head.done=!1),!(1&R.wrap)||(((255&H)<<8)+(H>>8))%31){M.msg="incorrect header check",R.mode=30;break}if((15&H)!=8){M.msg="unknown compression method",R.mode=30;break}if(G-=4,P=8+(15&(H>>>=4)),R.wbits===0)R.wbits=P;else if(P>R.wbits){M.msg="invalid window size",R.mode=30;break}R.dmax=1<<P,M.adler=R.check=1,R.mode=512&H?10:12,G=H=0;break;case 2:for(;G<16;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if(R.flags=H,(255&R.flags)!=8){M.msg="unknown compression method",R.mode=30;break}if(57344&R.flags){M.msg="unknown header flags set",R.mode=30;break}R.head&&(R.head.text=H>>8&1),512&R.flags&&(re[0]=255&H,re[1]=H>>>8&255,R.check=l(R.check,re,2,0)),G=H=0,R.mode=3;case 3:for(;G<32;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}R.head&&(R.head.time=H),512&R.flags&&(re[0]=255&H,re[1]=H>>>8&255,re[2]=H>>>16&255,re[3]=H>>>24&255,R.check=l(R.check,re,4,0)),G=H=0,R.mode=4;case 4:for(;G<16;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}R.head&&(R.head.xflags=255&H,R.head.os=H>>8),512&R.flags&&(re[0]=255&H,re[1]=H>>>8&255,R.check=l(R.check,re,2,0)),G=H=0,R.mode=5;case 5:if(1024&R.flags){for(;G<16;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}R.length=H,R.head&&(R.head.extra_len=H),512&R.flags&&(re[0]=255&H,re[1]=H>>>8&255,R.check=l(R.check,re,2,0)),G=H=0}else R.head&&(R.head.extra=null);R.mode=6;case 6:if(1024&R.flags&&(Y<(te=R.length)&&(te=Y),te&&(R.head&&(P=R.head.extra_len-R.length,R.head.extra||(R.head.extra=new Array(R.head.extra_len)),i.arraySet(R.head.extra,B,F,te,P)),512&R.flags&&(R.check=l(R.check,B,te,F)),Y-=te,F+=te,R.length-=te),R.length))break e;R.length=0,R.mode=7;case 7:if(2048&R.flags){if(Y===0)break e;for(te=0;P=B[F+te++],R.head&&P&&R.length<65536&&(R.head.name+=String.fromCharCode(P)),P&&te<Y;);if(512&R.flags&&(R.check=l(R.check,B,te,F)),Y-=te,F+=te,P)break e}else R.head&&(R.head.name=null);R.length=0,R.mode=8;case 8:if(4096&R.flags){if(Y===0)break e;for(te=0;P=B[F+te++],R.head&&P&&R.length<65536&&(R.head.comment+=String.fromCharCode(P)),P&&te<Y;);if(512&R.flags&&(R.check=l(R.check,B,te,F)),Y-=te,F+=te,P)break e}else R.head&&(R.head.comment=null);R.mode=9;case 9:if(512&R.flags){for(;G<16;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if(H!==(65535&R.check)){M.msg="header crc mismatch",R.mode=30;break}G=H=0}R.head&&(R.head.hcrc=R.flags>>9&1,R.head.done=!0),M.adler=R.check=0,R.mode=12;break;case 10:for(;G<32;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}M.adler=R.check=_(H),G=H=0,R.mode=11;case 11:if(R.havedict===0)return M.next_out=K,M.avail_out=O,M.next_in=F,M.avail_in=Y,R.hold=H,R.bits=G,2;M.adler=R.check=1,R.mode=12;case 12:if(z===5||z===6)break e;case 13:if(R.last){H>>>=7&G,G-=7&G,R.mode=27;break}for(;G<3;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}switch(R.last=1&H,G-=1,3&(H>>>=1)){case 0:R.mode=14;break;case 1:if($(R),R.mode=20,z!==6)break;H>>>=2,G-=2;break e;case 2:R.mode=17;break;case 3:M.msg="invalid block type",R.mode=30}H>>>=2,G-=2;break;case 14:for(H>>>=7&G,G-=7&G;G<32;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if((65535&H)!=(H>>>16^65535)){M.msg="invalid stored block lengths",R.mode=30;break}if(R.length=65535&H,G=H=0,R.mode=15,z===6)break e;case 15:R.mode=16;case 16:if(te=R.length){if(Y<te&&(te=Y),O<te&&(te=O),te===0)break e;i.arraySet(V,B,F,te,K),Y-=te,F+=te,O-=te,K+=te,R.length-=te;break}R.mode=12;break;case 17:for(;G<14;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if(R.nlen=257+(31&H),H>>>=5,G-=5,R.ndist=1+(31&H),H>>>=5,G-=5,R.ncode=4+(15&H),H>>>=4,G-=4,286<R.nlen||30<R.ndist){M.msg="too many length or distance symbols",R.mode=30;break}R.have=0,R.mode=18;case 18:for(;R.have<R.ncode;){for(;G<3;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}R.lens[ae[R.have++]]=7&H,H>>>=3,G-=3}for(;R.have<19;)R.lens[ae[R.have++]]=0;if(R.lencode=R.lendyn,R.lenbits=7,X={bits:R.lenbits},ne=d(0,R.lens,0,19,R.lencode,0,R.work,X),R.lenbits=X.bits,ne){M.msg="invalid code lengths set",R.mode=30;break}R.have=0,R.mode=19;case 19:for(;R.have<R.nlen+R.ndist;){for(;ke=(Z=R.lencode[H&(1<<R.lenbits)-1])>>>16&255,Oe=65535&Z,!((xe=Z>>>24)<=G);){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if(Oe<16)H>>>=xe,G-=xe,R.lens[R.have++]=Oe;else{if(Oe===16){for(W=xe+2;G<W;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if(H>>>=xe,G-=xe,R.have===0){M.msg="invalid bit length repeat",R.mode=30;break}P=R.lens[R.have-1],te=3+(3&H),H>>>=2,G-=2}else if(Oe===17){for(W=xe+3;G<W;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}G-=xe,P=0,te=3+(7&(H>>>=xe)),H>>>=3,G-=3}else{for(W=xe+7;G<W;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}G-=xe,P=0,te=11+(127&(H>>>=xe)),H>>>=7,G-=7}if(R.have+te>R.nlen+R.ndist){M.msg="invalid bit length repeat",R.mode=30;break}for(;te--;)R.lens[R.have++]=P}}if(R.mode===30)break;if(R.lens[256]===0){M.msg="invalid code -- missing end-of-block",R.mode=30;break}if(R.lenbits=9,X={bits:R.lenbits},ne=d(f,R.lens,0,R.nlen,R.lencode,0,R.work,X),R.lenbits=X.bits,ne){M.msg="invalid literal/lengths set",R.mode=30;break}if(R.distbits=6,R.distcode=R.distdyn,X={bits:R.distbits},ne=d(p,R.lens,R.nlen,R.ndist,R.distcode,0,R.work,X),R.distbits=X.bits,ne){M.msg="invalid distances set",R.mode=30;break}if(R.mode=20,z===6)break e;case 20:R.mode=21;case 21:if(6<=Y&&258<=O){M.next_out=K,M.avail_out=O,M.next_in=F,M.avail_in=Y,R.hold=H,R.bits=G,c(M,J),K=M.next_out,V=M.output,O=M.avail_out,F=M.next_in,B=M.input,Y=M.avail_in,H=R.hold,G=R.bits,R.mode===12&&(R.back=-1);break}for(R.back=0;ke=(Z=R.lencode[H&(1<<R.lenbits)-1])>>>16&255,Oe=65535&Z,!((xe=Z>>>24)<=G);){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if(ke&&(240&ke)==0){for(He=xe,Ye=ke,lt=Oe;ke=(Z=R.lencode[lt+((H&(1<<He+Ye)-1)>>He)])>>>16&255,Oe=65535&Z,!(He+(xe=Z>>>24)<=G);){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}H>>>=He,G-=He,R.back+=He}if(H>>>=xe,G-=xe,R.back+=xe,R.length=Oe,ke===0){R.mode=26;break}if(32&ke){R.back=-1,R.mode=12;break}if(64&ke){M.msg="invalid literal/length code",R.mode=30;break}R.extra=15&ke,R.mode=22;case 22:if(R.extra){for(W=R.extra;G<W;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}R.length+=H&(1<<R.extra)-1,H>>>=R.extra,G-=R.extra,R.back+=R.extra}R.was=R.length,R.mode=23;case 23:for(;ke=(Z=R.distcode[H&(1<<R.distbits)-1])>>>16&255,Oe=65535&Z,!((xe=Z>>>24)<=G);){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if((240&ke)==0){for(He=xe,Ye=ke,lt=Oe;ke=(Z=R.distcode[lt+((H&(1<<He+Ye)-1)>>He)])>>>16&255,Oe=65535&Z,!(He+(xe=Z>>>24)<=G);){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}H>>>=He,G-=He,R.back+=He}if(H>>>=xe,G-=xe,R.back+=xe,64&ke){M.msg="invalid distance code",R.mode=30;break}R.offset=Oe,R.extra=15&ke,R.mode=24;case 24:if(R.extra){for(W=R.extra;G<W;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}R.offset+=H&(1<<R.extra)-1,H>>>=R.extra,G-=R.extra,R.back+=R.extra}if(R.offset>R.dmax){M.msg="invalid distance too far back",R.mode=30;break}R.mode=25;case 25:if(O===0)break e;if(te=J-O,R.offset>te){if((te=R.offset-te)>R.whave&&R.sane){M.msg="invalid distance too far back",R.mode=30;break}ve=te>R.wnext?(te-=R.wnext,R.wsize-te):R.wnext-te,te>R.length&&(te=R.length),he=R.window}else he=V,ve=K-R.offset,te=R.length;for(O<te&&(te=O),O-=te,R.length-=te;V[K++]=he[ve++],--te;);R.length===0&&(R.mode=21);break;case 26:if(O===0)break e;V[K++]=R.length,O--,R.mode=21;break;case 27:if(R.wrap){for(;G<32;){if(Y===0)break e;Y--,H|=B[F++]<<G,G+=8}if(J-=O,M.total_out+=J,R.total+=J,J&&(M.adler=R.check=R.flags?l(R.check,V,J,K-J):a(R.check,V,J,K-J)),J=O,(R.flags?H:_(H))!==R.check){M.msg="incorrect data check",R.mode=30;break}G=H=0}R.mode=28;case 28:if(R.wrap&&R.flags){for(;G<32;){if(Y===0)break e;Y--,H+=B[F++]<<G,G+=8}if(H!==(4294967295&R.total)){M.msg="incorrect length check",R.mode=30;break}G=H=0}R.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;case 32:default:return g}return M.next_out=K,M.avail_out=O,M.next_in=F,M.avail_in=Y,R.hold=H,R.bits=G,(R.wsize||J!==M.avail_out&&R.mode<30&&(R.mode<27||z!==4))&&Q(M,M.output,M.next_out,J-M.avail_out)?(R.mode=31,-4):(q-=M.avail_in,J-=M.avail_out,M.total_in+=q,M.total_out+=J,R.total+=J,R.wrap&&J&&(M.adler=R.check=R.flags?l(R.check,V,J,M.next_out-J):a(R.check,V,J,M.next_out-J)),M.data_type=R.bits+(R.last?64:0)+(R.mode===12?128:0)+(R.mode===20||R.mode===15?256:0),(q==0&&J===0||z===4)&&ne===m&&(ne=-5),ne)},s.inflateEnd=function(M){if(!M||!M.state)return g;var z=M.state;return z.window&&(z.window=null),M.state=null,m},s.inflateGetHeader=function(M,z){var R;return M&&M.state?(2&(R=M.state).wrap)==0?g:((R.head=z).done=!1,m):g},s.inflateSetDictionary=function(M,z){var R,B=z.length;return M&&M.state?(R=M.state).wrap!==0&&R.mode!==11?g:R.mode===11&&a(1,z,B,0)!==R.check?-3:Q(M,z,B,B)?(R.mode=31,-4):(R.havedict=1,m):g},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var i=r("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(f,p,m,g,y,x,w,_){var S,k,N,j,T,D,I,L,$,Q=_.bits,M=0,z=0,R=0,B=0,V=0,F=0,K=0,Y=0,O=0,H=0,G=null,q=0,J=new i.Buf16(16),te=new i.Buf16(16),ve=null,he=0;for(M=0;M<=15;M++)J[M]=0;for(z=0;z<g;z++)J[p[m+z]]++;for(V=Q,B=15;1<=B&&J[B]===0;B--);if(B<V&&(V=B),B===0)return y[x++]=20971520,y[x++]=20971520,_.bits=1,0;for(R=1;R<B&&J[R]===0;R++);for(V<R&&(V=R),M=Y=1;M<=15;M++)if(Y<<=1,(Y-=J[M])<0)return-1;if(0<Y&&(f===0||B!==1))return-1;for(te[1]=0,M=1;M<15;M++)te[M+1]=te[M]+J[M];for(z=0;z<g;z++)p[m+z]!==0&&(w[te[p[m+z]]++]=z);if(D=f===0?(G=ve=w,19):f===1?(G=a,q-=257,ve=l,he-=257,256):(G=c,ve=d,-1),M=R,T=x,K=z=H=0,N=-1,j=(O=1<<(F=V))-1,f===1&&852<O||f===2&&592<O)return 1;for(;;){for(I=M-K,$=w[z]<D?(L=0,w[z]):w[z]>D?(L=ve[he+w[z]],G[q+w[z]]):(L=96,0),S=1<<M-K,R=k=1<<F;y[T+(H>>K)+(k-=S)]=I<<24|L<<16|$|0,k!==0;);for(S=1<<M-1;H&S;)S>>=1;if(S!==0?(H&=S-1,H+=S):H=0,z++,--J[M]==0){if(M===B)break;M=p[m+w[z]]}if(V<M&&(H&j)!==N){for(K===0&&(K=V),T+=R,Y=1<<(F=M-K);F+K<B&&!((Y-=J[F+K])<=0);)F++,Y<<=1;if(O+=1<<F,f===1&&852<O||f===2&&592<O)return 1;y[N=H&j]=V<<24|F<<16|T-x|0}}return H!==0&&(y[T+H]=M-K<<24|64<<16|0),_.bits=V,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,n,s){var i=r("../utils/common"),a=0,l=1;function c(Z){for(var re=Z.length;0<=--re;)Z[re]=0}var d=0,f=29,p=256,m=p+1+f,g=30,y=19,x=2*m+1,w=15,_=16,S=7,k=256,N=16,j=17,T=18,D=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],I=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Q=new Array(2*(m+2));c(Q);var M=new Array(2*g);c(M);var z=new Array(512);c(z);var R=new Array(256);c(R);var B=new Array(f);c(B);var V,F,K,Y=new Array(g);function O(Z,re,ae,fe,oe){this.static_tree=Z,this.extra_bits=re,this.extra_base=ae,this.elems=fe,this.max_length=oe,this.has_stree=Z&&Z.length}function H(Z,re){this.dyn_tree=Z,this.max_code=0,this.stat_desc=re}function G(Z){return Z<256?z[Z]:z[256+(Z>>>7)]}function q(Z,re){Z.pending_buf[Z.pending++]=255&re,Z.pending_buf[Z.pending++]=re>>>8&255}function J(Z,re,ae){Z.bi_valid>_-ae?(Z.bi_buf|=re<<Z.bi_valid&65535,q(Z,Z.bi_buf),Z.bi_buf=re>>_-Z.bi_valid,Z.bi_valid+=ae-_):(Z.bi_buf|=re<<Z.bi_valid&65535,Z.bi_valid+=ae)}function te(Z,re,ae){J(Z,ae[2*re],ae[2*re+1])}function ve(Z,re){for(var ae=0;ae|=1&Z,Z>>>=1,ae<<=1,0<--re;);return ae>>>1}function he(Z,re,ae){var fe,oe,Ae=new Array(w+1),Ne=0;for(fe=1;fe<=w;fe++)Ae[fe]=Ne=Ne+ae[fe-1]<<1;for(oe=0;oe<=re;oe++){var Le=Z[2*oe+1];Le!==0&&(Z[2*oe]=ve(Ae[Le]++,Le))}}function xe(Z){var re;for(re=0;re<m;re++)Z.dyn_ltree[2*re]=0;for(re=0;re<g;re++)Z.dyn_dtree[2*re]=0;for(re=0;re<y;re++)Z.bl_tree[2*re]=0;Z.dyn_ltree[2*k]=1,Z.opt_len=Z.static_len=0,Z.last_lit=Z.matches=0}function ke(Z){8<Z.bi_valid?q(Z,Z.bi_buf):0<Z.bi_valid&&(Z.pending_buf[Z.pending++]=Z.bi_buf),Z.bi_buf=0,Z.bi_valid=0}function Oe(Z,re,ae,fe){var oe=2*re,Ae=2*ae;return Z[oe]<Z[Ae]||Z[oe]===Z[Ae]&&fe[re]<=fe[ae]}function He(Z,re,ae){for(var fe=Z.heap[ae],oe=ae<<1;oe<=Z.heap_len&&(oe<Z.heap_len&&Oe(re,Z.heap[oe+1],Z.heap[oe],Z.depth)&&oe++,!Oe(re,fe,Z.heap[oe],Z.depth));)Z.heap[ae]=Z.heap[oe],ae=oe,oe<<=1;Z.heap[ae]=fe}function Ye(Z,re,ae){var fe,oe,Ae,Ne,Le=0;if(Z.last_lit!==0)for(;fe=Z.pending_buf[Z.d_buf+2*Le]<<8|Z.pending_buf[Z.d_buf+2*Le+1],oe=Z.pending_buf[Z.l_buf+Le],Le++,fe===0?te(Z,oe,re):(te(Z,(Ae=R[oe])+p+1,re),(Ne=D[Ae])!==0&&J(Z,oe-=B[Ae],Ne),te(Z,Ae=G(--fe),ae),(Ne=I[Ae])!==0&&J(Z,fe-=Y[Ae],Ne)),Le<Z.last_lit;);te(Z,k,re)}function lt(Z,re){var ae,fe,oe,Ae=re.dyn_tree,Ne=re.stat_desc.static_tree,Le=re.stat_desc.has_stree,pe=re.stat_desc.elems,De=-1;for(Z.heap_len=0,Z.heap_max=x,ae=0;ae<pe;ae++)Ae[2*ae]!==0?(Z.heap[++Z.heap_len]=De=ae,Z.depth[ae]=0):Ae[2*ae+1]=0;for(;Z.heap_len<2;)Ae[2*(oe=Z.heap[++Z.heap_len]=De<2?++De:0)]=1,Z.depth[oe]=0,Z.opt_len--,Le&&(Z.static_len-=Ne[2*oe+1]);for(re.max_code=De,ae=Z.heap_len>>1;1<=ae;ae--)He(Z,Ae,ae);for(oe=pe;ae=Z.heap[1],Z.heap[1]=Z.heap[Z.heap_len--],He(Z,Ae,1),fe=Z.heap[1],Z.heap[--Z.heap_max]=ae,Z.heap[--Z.heap_max]=fe,Ae[2*oe]=Ae[2*ae]+Ae[2*fe],Z.depth[oe]=(Z.depth[ae]>=Z.depth[fe]?Z.depth[ae]:Z.depth[fe])+1,Ae[2*ae+1]=Ae[2*fe+1]=oe,Z.heap[1]=oe++,He(Z,Ae,1),2<=Z.heap_len;);Z.heap[--Z.heap_max]=Z.heap[1],function(qe,mt){var Ot,wr,Xn,Tt,Sr,si,qt=mt.dyn_tree,jr=mt.max_code,As=mt.stat_desc.static_tree,Uf=mt.stat_desc.has_stree,Vf=mt.stat_desc.extra_bits,Eo=mt.stat_desc.extra_base,bi=mt.stat_desc.max_length,Ws=0;for(Tt=0;Tt<=w;Tt++)qe.bl_count[Tt]=0;for(qt[2*qe.heap[qe.heap_max]+1]=0,Ot=qe.heap_max+1;Ot<x;Ot++)bi<(Tt=qt[2*qt[2*(wr=qe.heap[Ot])+1]+1]+1)&&(Tt=bi,Ws++),qt[2*wr+1]=Tt,jr<wr||(qe.bl_count[Tt]++,Sr=0,Eo<=wr&&(Sr=Vf[wr-Eo]),si=qt[2*wr],qe.opt_len+=si*(Tt+Sr),Uf&&(qe.static_len+=si*(As[2*wr+1]+Sr)));if(Ws!==0){do{for(Tt=bi-1;qe.bl_count[Tt]===0;)Tt--;qe.bl_count[Tt]--,qe.bl_count[Tt+1]+=2,qe.bl_count[bi]--,Ws-=2}while(0<Ws);for(Tt=bi;Tt!==0;Tt--)for(wr=qe.bl_count[Tt];wr!==0;)jr<(Xn=qe.heap[--Ot])||(qt[2*Xn+1]!==Tt&&(qe.opt_len+=(Tt-qt[2*Xn+1])*qt[2*Xn],qt[2*Xn+1]=Tt),wr--)}}(Z,re),he(Ae,De,Z.bl_count)}function P(Z,re,ae){var fe,oe,Ae=-1,Ne=re[1],Le=0,pe=7,De=4;for(Ne===0&&(pe=138,De=3),re[2*(ae+1)+1]=65535,fe=0;fe<=ae;fe++)oe=Ne,Ne=re[2*(fe+1)+1],++Le<pe&&oe===Ne||(Le<De?Z.bl_tree[2*oe]+=Le:oe!==0?(oe!==Ae&&Z.bl_tree[2*oe]++,Z.bl_tree[2*N]++):Le<=10?Z.bl_tree[2*j]++:Z.bl_tree[2*T]++,Ae=oe,De=(Le=0)===Ne?(pe=138,3):oe===Ne?(pe=6,3):(pe=7,4))}function ne(Z,re,ae){var fe,oe,Ae=-1,Ne=re[1],Le=0,pe=7,De=4;for(Ne===0&&(pe=138,De=3),fe=0;fe<=ae;fe++)if(oe=Ne,Ne=re[2*(fe+1)+1],!(++Le<pe&&oe===Ne)){if(Le<De)for(;te(Z,oe,Z.bl_tree),--Le!=0;);else oe!==0?(oe!==Ae&&(te(Z,oe,Z.bl_tree),Le--),te(Z,N,Z.bl_tree),J(Z,Le-3,2)):Le<=10?(te(Z,j,Z.bl_tree),J(Z,Le-3,3)):(te(Z,T,Z.bl_tree),J(Z,Le-11,7));Ae=oe,De=(Le=0)===Ne?(pe=138,3):oe===Ne?(pe=6,3):(pe=7,4)}}c(Y);var X=!1;function W(Z,re,ae,fe){J(Z,(d<<1)+(fe?1:0),3),function(oe,Ae,Ne,Le){ke(oe),q(oe,Ne),q(oe,~Ne),i.arraySet(oe.pending_buf,oe.window,Ae,Ne,oe.pending),oe.pending+=Ne}(Z,re,ae)}s._tr_init=function(Z){X||(function(){var re,ae,fe,oe,Ae,Ne=new Array(w+1);for(oe=fe=0;oe<f-1;oe++)for(B[oe]=fe,re=0;re<1<<D[oe];re++)R[fe++]=oe;for(R[fe-1]=oe,oe=Ae=0;oe<16;oe++)for(Y[oe]=Ae,re=0;re<1<<I[oe];re++)z[Ae++]=oe;for(Ae>>=7;oe<g;oe++)for(Y[oe]=Ae<<7,re=0;re<1<<I[oe]-7;re++)z[256+Ae++]=oe;for(ae=0;ae<=w;ae++)Ne[ae]=0;for(re=0;re<=143;)Q[2*re+1]=8,re++,Ne[8]++;for(;re<=255;)Q[2*re+1]=9,re++,Ne[9]++;for(;re<=279;)Q[2*re+1]=7,re++,Ne[7]++;for(;re<=287;)Q[2*re+1]=8,re++,Ne[8]++;for(he(Q,m+1,Ne),re=0;re<g;re++)M[2*re+1]=5,M[2*re]=ve(re,5);V=new O(Q,D,p+1,m,w),F=new O(M,I,0,g,w),K=new O(new Array(0),L,0,y,S)}(),X=!0),Z.l_desc=new H(Z.dyn_ltree,V),Z.d_desc=new H(Z.dyn_dtree,F),Z.bl_desc=new H(Z.bl_tree,K),Z.bi_buf=0,Z.bi_valid=0,xe(Z)},s._tr_stored_block=W,s._tr_flush_block=function(Z,re,ae,fe){var oe,Ae,Ne=0;0<Z.level?(Z.strm.data_type===2&&(Z.strm.data_type=function(Le){var pe,De=4093624447;for(pe=0;pe<=31;pe++,De>>>=1)if(1&De&&Le.dyn_ltree[2*pe]!==0)return a;if(Le.dyn_ltree[18]!==0||Le.dyn_ltree[20]!==0||Le.dyn_ltree[26]!==0)return l;for(pe=32;pe<p;pe++)if(Le.dyn_ltree[2*pe]!==0)return l;return a}(Z)),lt(Z,Z.l_desc),lt(Z,Z.d_desc),Ne=function(Le){var pe;for(P(Le,Le.dyn_ltree,Le.l_desc.max_code),P(Le,Le.dyn_dtree,Le.d_desc.max_code),lt(Le,Le.bl_desc),pe=y-1;3<=pe&&Le.bl_tree[2*$[pe]+1]===0;pe--);return Le.opt_len+=3*(pe+1)+5+5+4,pe}(Z),oe=Z.opt_len+3+7>>>3,(Ae=Z.static_len+3+7>>>3)<=oe&&(oe=Ae)):oe=Ae=ae+5,ae+4<=oe&&re!==-1?W(Z,re,ae,fe):Z.strategy===4||Ae===oe?(J(Z,2+(fe?1:0),3),Ye(Z,Q,M)):(J(Z,4+(fe?1:0),3),function(Le,pe,De,qe){var mt;for(J(Le,pe-257,5),J(Le,De-1,5),J(Le,qe-4,4),mt=0;mt<qe;mt++)J(Le,Le.bl_tree[2*$[mt]+1],3);ne(Le,Le.dyn_ltree,pe-1),ne(Le,Le.dyn_dtree,De-1)}(Z,Z.l_desc.max_code+1,Z.d_desc.max_code+1,Ne+1),Ye(Z,Z.dyn_ltree,Z.dyn_dtree)),xe(Z),fe&&ke(Z)},s._tr_tally=function(Z,re,ae){return Z.pending_buf[Z.d_buf+2*Z.last_lit]=re>>>8&255,Z.pending_buf[Z.d_buf+2*Z.last_lit+1]=255&re,Z.pending_buf[Z.l_buf+Z.last_lit]=255&ae,Z.last_lit++,re===0?Z.dyn_ltree[2*ae]++:(Z.matches++,re--,Z.dyn_ltree[2*(R[ae]+p+1)]++,Z.dyn_dtree[2*G(re)]++),Z.last_lit===Z.lit_bufsize-1},s._tr_align=function(Z){J(Z,2,3),te(Z,k,Q),function(re){re.bi_valid===16?(q(re,re.bi_buf),re.bi_buf=0,re.bi_valid=0):8<=re.bi_valid&&(re.pending_buf[re.pending++]=255&re.bi_buf,re.bi_buf>>=8,re.bi_valid-=8)}(Z)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(i){(function(a,l){if(!a.setImmediate){var c,d,f,p,m=1,g={},y=!1,x=a.document,w=Object.getPrototypeOf&&Object.getPrototypeOf(a);w=w&&w.setTimeout?w:a,c={}.toString.call(a.process)==="[object process]"?function(N){process.nextTick(function(){S(N)})}:function(){if(a.postMessage&&!a.importScripts){var N=!0,j=a.onmessage;return a.onmessage=function(){N=!1},a.postMessage("","*"),a.onmessage=j,N}}()?(p="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",k,!1):a.attachEvent("onmessage",k),function(N){a.postMessage(p+N,"*")}):a.MessageChannel?((f=new MessageChannel).port1.onmessage=function(N){S(N.data)},function(N){f.port2.postMessage(N)}):x&&"onreadystatechange"in x.createElement("script")?(d=x.documentElement,function(N){var j=x.createElement("script");j.onreadystatechange=function(){S(N),j.onreadystatechange=null,d.removeChild(j),j=null},d.appendChild(j)}):function(N){setTimeout(S,0,N)},w.setImmediate=function(N){typeof N!="function"&&(N=new Function(""+N));for(var j=new Array(arguments.length-1),T=0;T<j.length;T++)j[T]=arguments[T+1];var D={callback:N,args:j};return g[m]=D,c(m),m++},w.clearImmediate=_}function _(N){delete g[N]}function S(N){if(y)setTimeout(S,0,N);else{var j=g[N];if(j){y=!0;try{(function(T){var D=T.callback,I=T.args;switch(I.length){case 0:D();break;case 1:D(I[0]);break;case 2:D(I[0],I[1]);break;case 3:D(I[0],I[1],I[2]);break;default:D.apply(l,I)}})(j)}finally{_(N),y=!1}}}}function k(N){N.source===a&&typeof N.data=="string"&&N.data.indexOf(p)===0&&S(+N.data.slice(p.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof uc<"u"?uc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(sE)),sE.exports}var KRe=GRe();const YRe=ml(KRe),QRe=Et`
|
||
mutation GenerateStaticConfig($framework: String!, $phpVersion: String) {
|
||
generateStaticConfig(arg1: { framework: $framework, phpVersion: $phpVersion }) {
|
||
nginxConfig
|
||
appConfig
|
||
}
|
||
}
|
||
`,XRe=Et`
|
||
mutation CreateStaticUploadURL(
|
||
$deploymentId: String!
|
||
$fileName: String!
|
||
$contentType: String!
|
||
) {
|
||
createStaticUploadURL(
|
||
arg1: {
|
||
deploymentId: $deploymentId
|
||
fileName: $fileName
|
||
contentType: $contentType
|
||
}
|
||
) {
|
||
url
|
||
objectKey
|
||
bucket
|
||
endpoint
|
||
expiresIn
|
||
}
|
||
}
|
||
`,ZRe=Et`
|
||
mutation CreateStaticApp($input: StaticAppInput!) {
|
||
createStaticApp(arg1: $input) {
|
||
id
|
||
name
|
||
image
|
||
status
|
||
url
|
||
ports {
|
||
name
|
||
number
|
||
hostname
|
||
}
|
||
instances
|
||
hibernated
|
||
ephemeral
|
||
}
|
||
}
|
||
`,JRe=Et`
|
||
mutation UpdateStaticApp($input: StaticUpdateInput!) {
|
||
updateStaticApp(arg1: $input) {
|
||
id
|
||
name
|
||
image
|
||
status
|
||
url
|
||
ports {
|
||
name
|
||
number
|
||
hostname
|
||
}
|
||
instances
|
||
hibernated
|
||
ephemeral
|
||
}
|
||
}
|
||
`,eDe=Et`
|
||
mutation ListStaticApps {
|
||
listStaticApps {
|
||
id
|
||
name
|
||
image
|
||
status
|
||
url
|
||
ports {
|
||
name
|
||
number
|
||
hostname
|
||
}
|
||
instances
|
||
hibernated
|
||
ephemeral
|
||
}
|
||
}
|
||
`,tDe=Et`
|
||
mutation DeleteStaticApp($appId: String!) {
|
||
deleteStaticApp(arg1: { appId: $appId }) {
|
||
output
|
||
}
|
||
}
|
||
`;async function Ff(t,e,r,n){var i;const s=await t.mutate({mutation:e,variables:n});if(s.errors&&s.errors.length>0)throw new Error(s.errors[0].message);return(i=s.data)==null?void 0:i[r]}async function rDe(t,e,r){return Ff(t,QRe,"generateStaticConfig",{framework:e,phpVersion:r})}async function iE(t,e,r,n){return Ff(t,XRe,"createStaticUploadURL",{deploymentId:e,fileName:r,contentType:n})}async function nDe(t,e){return Ff(t,ZRe,"createStaticApp",{input:e})}async function sDe(t,e){return Ff(t,JRe,"updateStaticApp",{input:e})}async function iDe(t){return Ff(t,eDe,"listStaticApps")??[]}async function aDe(t,e){return Ff(t,tDe,"deleteStaticApp",{appId:e})}function TG(t){const e=t.trim().toLowerCase();let r="",n=!1;for(const s of e)/[a-z0-9]/.test(s)?(r+=s,n=!1):n||(r+="-",n=!0);return r=r.replace(/^-+|-+$/g,""),r||"site"}function oDe(){const t=new Uint8Array(12);return crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}async function aE(t,e,r){const n=await fetch(t,{method:"PUT",headers:{"Content-Type":r},body:e});if(!n.ok)throw new Error(`Upload failed (${n.status}). Please try again.`)}async function lDe(t,e){var g,y;const r=e.phpVersion?"php":"static",n=e.phpVersion??null,s=oDe(),i=TG(e.siteName),a=await rDe(t,r,n),[l,c,d]=await Promise.all([iE(t,s,"app.zip","application/zip"),iE(t,s,"nginx.conf","text/plain"),iE(t,s,"app.conf","text/plain")]);await aE(l.url,e.zipFile,"application/zip"),await aE(c.url,new Blob([a.nginxConfig],{type:"text/plain"}),"text/plain"),await aE(d.url,new Blob([a.appConfig],{type:"text/plain"}),"text/plain");const f={name:i,deploymentId:s},p=e.appId?await sDe(t,{appId:e.appId,...f}):await nDe(t,f),m=p.url??((y=(g=p.ports)==null?void 0:g[0])==null?void 0:y.hostname)??"";return{site:p,url:m}}const cDe=[{value:"none",label:"No PHP",desc:"Static HTML/CSS/JS"},{value:"8.3",label:"PHP 8.3",desc:"Latest"},{value:"8.2",label:"PHP 8.2",desc:"Stable"},{value:"8.1",label:"PHP 8.1",desc:"Stable"},{value:"8.0",label:"PHP 8.0",desc:"Stable"},{value:"7.4",label:"PHP 7.4",desc:"Legacy"}],lm=[{label:"Preparing config",p:16},{label:"Requesting upload URLs",p:36},{label:"Uploading files",p:58},{label:"Creating the app",p:82},{label:"Finalizing",p:92}],uDe=["Generating nginx + app config...","Presigning S3 upload URLs...","Uploading site archive + config...","Creating app via the Cumin API...","Finalizing deployment..."];function dDe(t){return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`:"—"}function hDe(t){const e=(t==null?void 0:t.toLowerCase())??"";return["healthy","running","active","live","complete","completed"].includes(e)?{label:"Live",className:"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300",icon:is}:["pending","building","deploying","queued","processing","starting","initializing","recovering"].includes(e)?{label:"Deploying",className:"bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-950 dark:text-amber-300",icon:Vu}:["error","failed","dead"].includes(e)?{label:"Failed",className:"bg-red-50 text-red-700 border-red-200 dark:bg-red-950 dark:text-red-300",icon:os}:e==="degraded"?{label:"Degraded",className:"bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-950 dark:text-orange-300",icon:os}:["hibernated","sleeping"].includes(e)?{label:"Sleeping",className:"bg-slate-50 text-slate-700 border-slate-200 dark:bg-slate-950 dark:text-slate-300",icon:Vu}:["removed","deleted"].includes(e)?{label:"Removed",className:"bg-muted text-muted-foreground border-muted",icon:os}:{label:"Inactive",className:"bg-muted text-muted-foreground border-muted",icon:Vu}}function fDe(t){var e,r;return t.url||((r=(e=t.ports)==null?void 0:e[0])==null?void 0:r.hostname)||""}function pDe(){const{toast:t}=br(),e=yl(),r=bo(),n=Zj(),s=(e==null?void 0:e.id)||null,[i,a]=E.useState("sites"),[l,c]=E.useState([]),[d,f]=E.useState(!0),[p,m]=E.useState(null),[g,y]=E.useState(""),[x,w]=E.useState("none"),[_,S]=E.useState(null),[k,N]=E.useState(!1),[j,T]=E.useState(!1),[D,I]=E.useState(0),[L,$]=E.useState(""),[Q,M]=E.useState([]),[z,R]=E.useState(""),[B,V]=E.useState(null),[F,K]=E.useState(null),[Y,O]=E.useState(!1),H=E.useRef(null),G=E.useCallback(async(ae=!1)=>{if(!(!s||!r)){ae||f(!0);try{const fe=await iDe(n);c(fe??[])}catch(fe){ae||t({title:"Failed to load sites",description:fe instanceof Error?fe.message:"We couldn't fetch your sites. Please try again.",variant:"destructive"})}finally{ae||f(!1)}}},[n,s,r,t]);E.useEffect(()=>{G()},[G]);const q=l.some(ae=>{var oe;const fe=((oe=ae.status)==null?void 0:oe.toLowerCase())??"";return["pending","building","deploying","queued","processing","starting","initializing","recovering"].includes(fe)});E.useEffect(()=>{if(!q)return;const ae=setInterval(()=>G(!0),5e3);return()=>clearInterval(ae)},[q,G]);const J=()=>{m(null),y(""),w("none"),S(null),N(!1),I(0),$(""),M([]),R(""),V(null)},te=()=>{J(),a("deploy")},ve=ae=>{J(),V(ae),y(ae.name||""),a("deploy")},he=async ae=>{try{const fe=await YRe.loadAsync(ae),oe=Object.keys(fe.files).filter(Le=>!Le.endsWith("/")),Ae=oe.some(Le=>Le.toLowerCase().endsWith(".php")),Ne=oe.some(Le=>Le.toLowerCase().endsWith("package.json"));Ae?(S("PHP"),w(Le=>Le==="none"?"8.3":Le)):S(Ne?"SPA":"Static")}catch{S(null)}},xe=async ae=>{if(!ae.name.toLowerCase().endsWith(".zip")){t({title:"Invalid file",description:"Please upload a ZIP file containing your site.",variant:"destructive"});return}if(ae.size>100*1024*1024){t({title:"File too large",description:"The maximum upload size is 100 MB.",variant:"destructive"});return}m(ae);const fe=TG(ae.name.replace(/\.zip$/i,""));y(oe=>oe||fe),await he(ae)},ke=ae=>{ae.preventDefault(),ae.stopPropagation(),N(ae.type==="dragenter"||ae.type==="dragover")},Oe=async ae=>{var fe;ae.preventDefault(),ae.stopPropagation(),N(!1),(fe=ae.dataTransfer.files)!=null&&fe[0]&&await xe(ae.dataTransfer.files[0])},He=async ae=>{var fe;(fe=ae.target.files)!=null&&fe[0]&&await xe(ae.target.files[0])},Ye=async()=>{if(!p){t({title:"No file selected",description:"Drop your ZIP file first.",variant:"destructive"});return}if(!s||!r){t({title:"Not signed in",description:"Please sign in to deploy.",variant:"destructive"});return}a("progress"),T(!0),I(0),$("Preparing"),M([]);let ae=0;const fe=setInterval(()=>{ae<lm.length&&($(lm[ae].label),I(lm[ae].p),M(oe=>[...oe,uDe[ae]]),ae+=1)},850);try{const oe=await lDe(n,{zipFile:p,siteName:g,phpVersion:x!=="none"?x:null,appId:B==null?void 0:B.id});clearInterval(fe),I(100),$("Deploy complete"),M(Ae=>[...Ae,"Deploy complete — your site is live."]),R(oe.url),await G(),window.setTimeout(()=>{T(!1),a("success")},700)}catch(oe){clearInterval(fe),T(!1);const Ae=oe instanceof Error?oe.message:"Something went wrong";t({title:"Deploy failed",description:Ae,variant:"destructive"}),a("deploy")}},lt=async()=>{try{await navigator.clipboard.writeText(z),t({title:"Copied",description:"Site URL copied to clipboard."})}catch{t({title:"Copy failed",variant:"destructive"})}},P=async()=>{if(F){O(!0);try{await aDe(n,F.id),c(ae=>ae.filter(fe=>fe.id!==F.id)),t({title:"Site deleted",description:`${F.name} was deleted.`}),K(null)}catch(ae){const fe=ae instanceof Error?ae.message:"Something went wrong";t({title:"Delete failed",description:fe,variant:"destructive"})}finally{O(!1)}}},ne=()=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Sites"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Deploy static sites in seconds"})]}),o.jsx("div",{className:"flex items-center gap-2",children:i!=="sites"?o.jsxs(le,{variant:"outline",onClick:()=>{J(),a("sites")},children:[o.jsx(mo,{className:"mr-2 h-4 w-4"})," Back to sites"]}):o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",size:"icon",onClick:()=>G(!0),disabled:d,title:"Refresh sites",children:o.jsx(wn,{className:we("h-4 w-4",d&&"animate-spin")})}),o.jsxs(le,{onClick:te,className:"bg-gradient-to-r from-primary to-primary/90",children:[o.jsx(nr,{className:"mr-2 h-4 w-4"})," Deploy new site"]})]})})]}),X=()=>{const ae=l.filter(fe=>{var oe;return["running","active","live"].includes(((oe=fe.status)==null?void 0:oe.toLowerCase())??"")}).length;return o.jsx("div",{className:"space-y-6",children:d?o.jsx($e,{children:o.jsx(Be,{className:"divide-y",children:Array.from({length:4}).map((fe,oe)=>o.jsxs("div",{className:"flex items-center gap-4 py-4",children:[o.jsx(Gr,{className:"h-10 w-10 rounded-lg"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx(Gr,{className:"h-4 w-40"}),o.jsx(Gr,{className:"h-3 w-56"})]}),o.jsx(Gr,{className:"h-6 w-16 rounded-full"})]},oe))})}):l.length===0?o.jsx($e,{className:"border-dashed",children:o.jsxs(Be,{className:"py-16 text-center",children:[o.jsx("div",{className:"mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(Hu,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"Deploy your first site"}),o.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Drag and drop a ZIP of your static site and we'll have it live in seconds."}),o.jsxs(le,{className:"mt-6 bg-gradient-to-r from-primary to-primary/90",onClick:te,children:[o.jsx(xS,{className:"mr-2 h-4 w-4"})," Deploy a site"]})]})}):o.jsxs($e,{children:[o.jsxs(ot,{className:"flex flex-row items-center justify-between border-b px-6 py-4",children:[o.jsx(dt,{className:"text-base",children:"All sites"}),o.jsxs(Lt,{variant:"secondary",className:"gap-1",children:[o.jsx(is,{className:"h-3 w-3 text-emerald-500"}),ae," live"]})]}),o.jsx(Be,{className:"p-0",children:o.jsx("div",{className:"divide-y",children:l.map(fe=>{const oe=hDe(fe.status),Ae=oe.icon,Ne=fDe(fe);return o.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 transition-colors hover:bg-accent/40",children:[o.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(qh,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate font-medium",children:fe.name}),o.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:Ne})]}),o.jsxs(Lt,{variant:"outline",className:we("gap-1",oe.className),children:[o.jsx(Ae,{className:"h-3 w-3"}),oe.label]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Visit site",onClick:()=>Ne&&window.open(Ne,"_blank"),children:o.jsx(al,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Deploy new version",onClick:()=>ve(fe),children:o.jsx(wn,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",title:"Delete site",onClick:()=>K(fe),children:o.jsx(ds,{className:"h-4 w-4"})})]})]},fe.id)})})})]})})},W=()=>o.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[o.jsxs($e,{children:[o.jsxs(ot,{className:"text-center",children:[o.jsx(dt,{className:"text-xl",children:B?`Deploy new version — ${B.name}`:"Deploy a static site"}),o.jsx(rn,{children:B?"Upload a new ZIP to update your site.":"Upload a ZIP folder of your static site and it'll be live in seconds."})]}),o.jsx(Be,{children:o.jsxs("div",{className:we("relative flex cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed px-6 py-14 text-center transition-all",k?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/30"),onDragEnter:ke,onDragLeave:ke,onDragOver:ke,onDrop:Oe,onClick:()=>{var ae;return(ae=H.current)==null?void 0:ae.click()},children:[o.jsx("input",{ref:H,type:"file",accept:".zip",className:"hidden",onChange:He}),p?o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(xm,{className:"h-8 w-8 text-primary"})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-semibold",children:p.name}),o.jsx("p",{className:"text-sm text-muted-foreground",children:dDe(p.size)})]}),o.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-emerald-600",children:[o.jsx(is,{className:"h-4 w-4"})," Ready to deploy"]}),_&&o.jsxs(Lt,{variant:"secondary",className:"gap-1",children:[o.jsx(ti,{className:"h-3 w-3"})," ",_," detected"]})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-muted",children:o.jsx(xS,{className:"h-8 w-8 text-muted-foreground"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-lg font-semibold",children:"Drag and drop your site here"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"or click to browse — ZIP up to 100 MB"})]}),o.jsxs(le,{variant:"outline",className:"pointer-events-none",children:[o.jsx(xS,{className:"mr-2 h-4 w-4"})," Browse files"]})]})]})})]}),p&&o.jsxs($e,{children:[o.jsx(ot,{children:o.jsx(dt,{className:"text-base",children:"Deploy settings"})}),o.jsxs(Be,{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{htmlFor:"site-name",children:"Site name"}),o.jsx(tt,{id:"site-name",value:g,onChange:ae=>y(ae.target.value),placeholder:"my-site"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{children:"Runtime"}),o.jsxs(ja,{value:x,onValueChange:w,children:[o.jsx(Wi,{className:"w-full",children:o.jsx(Ta,{placeholder:"Select runtime"})}),o.jsx(Gi,{children:cDe.map(ae=>o.jsxs(bn,{value:ae.value,children:[o.jsx("span",{className:"font-medium",children:ae.label}),o.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:ae.desc})]},ae.value))})]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-emerald-500/20 bg-emerald-50 px-3 py-2 dark:bg-emerald-950/20",children:[o.jsx(wa,{className:"h-4 w-4 text-emerald-500"}),o.jsx("span",{className:"text-xs text-emerald-700 dark:text-emerald-300",children:"Free HTTPS included on every site"})]}),o.jsxs(le,{className:"w-full bg-gradient-to-r from-primary to-primary/90",size:"lg",onClick:Ye,disabled:j||!p,children:[o.jsx($r,{className:"mr-2 h-4 w-4"}),B?"Deploy update":"Deploy site"]})]})]})]}),Z=()=>{const ae=lm.findIndex(fe=>fe.p>D);return o.jsxs("div",{className:"mx-auto max-w-3xl space-y-6",children:[o.jsxs($e,{children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto mb-3 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:o.jsx(kt,{className:"h-7 w-7 animate-spin text-primary"})}),o.jsxs(dt,{className:"text-xl",children:["Deploying ",g||"your site"]}),o.jsx(rn,{children:L})]}),o.jsxs(Be,{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(tR,{value:D,className:"h-2"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsxs("span",{children:[D,"%"]}),o.jsx("span",{children:B?"Updating":"Deploying"})]})]}),o.jsx("div",{className:"space-y-2",children:lm.map((fe,oe)=>{const Ae=D>=fe.p,Ne=!Ae&&oe===ae;return o.jsxs("div",{className:we("flex items-center gap-3 rounded-md px-3 py-2 text-sm",Ae&&"text-emerald-600",Ne&&"bg-primary/5 text-primary",!Ae&&!Ne&&"text-muted-foreground"),children:[Ae?o.jsx(is,{className:"h-4 w-4 shrink-0"}):Ne?o.jsx(kt,{className:"h-4 w-4 shrink-0 animate-spin"}):o.jsx(Vu,{className:"h-4 w-4 shrink-0"}),fe.label]},fe.label)})})]})]}),o.jsx($e,{className:"border-zinc-800 bg-zinc-950",children:o.jsxs(Be,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-zinc-800 pb-2 text-xs text-zinc-500",children:[o.jsxs("span",{className:"flex gap-1.5",children:[o.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-red-500/80"}),o.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-amber-500/80"}),o.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500/80"})]}),o.jsx("span",{className:"ml-2 font-mono",children:"deploy log"})]}),o.jsxs("div",{className:"max-h-48 space-y-1 overflow-y-auto pt-3 font-mono text-xs text-emerald-400",children:[Q.length===0&&o.jsx("p",{className:"text-zinc-600",children:"Starting deploy..."}),Q.map((fe,oe)=>o.jsxs("p",{children:[o.jsx("span",{className:"text-zinc-600",children:"$ "}),fe]},oe)),o.jsx("p",{className:"animate-pulse text-zinc-600",children:"▊"})]})]})})]})},re=()=>o.jsx("div",{className:"mx-auto max-w-2xl space-y-6",children:o.jsxs($e,{children:[o.jsxs(ot,{className:"text-center",children:[o.jsx("div",{className:"mx-auto mb-3 flex h-16 w-16 items-center justify-center rounded-full bg-emerald-100 dark:bg-emerald-950/40",children:o.jsx(is,{className:"h-9 w-9 text-emerald-500"})}),o.jsx(dt,{className:"text-2xl",children:"Your site is live"}),o.jsx(rn,{children:"It may take a few seconds to propagate."})]}),o.jsxs(Be,{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Xe,{children:"Site URL"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(tt,{value:z,readOnly:!0,className:"font-mono"}),o.jsx(le,{variant:"outline",size:"icon",onClick:lt,children:o.jsx(cn,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[o.jsxs(le,{className:"flex-1 bg-gradient-to-r from-primary to-primary/90",onClick:()=>window.open(z,"_blank"),children:[o.jsx(al,{className:"mr-2 h-4 w-4"})," Visit site"]}),o.jsxs(le,{variant:"outline",onClick:te,children:[o.jsx(nr,{className:"mr-2 h-4 w-4"})," Deploy another site"]})]})]})]})});return o.jsxs("div",{className:"space-y-6",children:[ne(),i==="sites"&&X(),i==="deploy"&&W(),i==="progress"&&Z(),i==="success"&&re(),o.jsx(hs,{open:!!F,onOpenChange:ae=>!ae&&K(null),children:o.jsxs(un,{className:"max-w-md",children:[o.jsxs(Dn,{children:[o.jsx(On,{children:"Delete site"}),o.jsxs(fs,{children:["This will permanently delete ",o.jsx("span",{className:"font-medium",children:F==null?void 0:F.name}),". This action cannot be undone."]})]}),o.jsxs(Ki,{children:[o.jsx(le,{variant:"outline",onClick:()=>K(null),children:"Cancel"}),o.jsxs(le,{variant:"destructive",onClick:P,disabled:Y,children:[Y?o.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(ds,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]})}const mDe="15145064526",gDe=`https://wa.me/${mDe}?text=${encodeURIComponent("Hello Ghaymah Cloud, I need some help.")}`;function vDe({className:t}){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:t,children:o.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})})}function yDe(){return o.jsxs("a",{href:gDe,target:"_blank",rel:"noreferrer","aria-label":"Chat with us on WhatsApp",className:"group fixed bottom-5 right-5 z-50 flex items-center gap-0 overflow-hidden rounded-full bg-[#25D366] text-white shadow-lg shadow-black/20 transition-all duration-300 hover:gap-3 hover:bg-[#1eb958] hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[o.jsxs("span",{className:"relative flex h-14 w-14 items-center justify-center",children:[o.jsx("span",{className:"absolute inset-0 animate-ping rounded-full bg-[#25D366] opacity-30"}),o.jsx(vDe,{className:"relative h-7 w-7"})]}),o.jsx("span",{className:"max-w-0 whitespace-nowrap pr-0 text-sm font-semibold opacity-0 transition-all duration-300 group-hover:max-w-[12rem] group-hover:pr-5 group-hover:opacity-100",children:"Chat with us"})]})}const xDe="mohamad_ghaymah",_De=`https://t.me/${xDe}`;function bDe({className:t}){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:t,children:o.jsx("path",{d:"M11.944 0A12 12 0 000 12a12 12 0 0012 12 12 12 0 0012-12A12 12 0 0012 0a12 12 0 00-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 01.171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})})}function wDe(){return o.jsxs("a",{href:_De,target:"_blank",rel:"noreferrer","aria-label":"Chat with us on Telegram",className:"group fixed bottom-[5.75rem] right-5 z-50 flex items-center gap-0 overflow-hidden rounded-full bg-[#229ED9] text-white shadow-lg shadow-black/20 transition-all duration-300 hover:gap-3 hover:bg-[#1c8fc7] hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[o.jsxs("span",{className:"relative flex h-14 w-14 items-center justify-center",children:[o.jsx("span",{className:"absolute inset-0 animate-ping rounded-full bg-[#229ED9] opacity-30"}),o.jsx(bDe,{className:"relative h-7 w-7"})]}),o.jsx("span",{className:"max-w-0 whitespace-nowrap pr-0 text-sm font-semibold opacity-0 transition-all duration-300 group-hover:max-w-[12rem] group-hover:pr-5 group-hover:opacity-100",children:"Chat with us"})]})}function AG(){const t={},e=NG.auth.getAccessToken();return e?t.authorization=`Bearer ${e}`:t["x-hasura-default-role"]="public",t}const SDe=new dz({uri:"https://graphql.ghaymah.systems/v1/graphql",fetch:(t,e)=>(e&&(e.headers=AG()),fetch(t,e||{}))}),kDe=jG(t=>{}),EDe=new $Re({uri:"wss://graphql.ghaymah.systems/v1/graphql",options:{reconnect:!0,lazy:!0,timeout:3e4,inactivityTimeout:3e4,connectionParams:()=>({headers:AG()})}}),CDe=new Pz({cache:new Rz,link:kDe.concat(kae(({query:t})=>{const e=Nf(t);return e.kind==="OperationDefinition"&&e.operation==="subscription"},EDe,SDe))});function NDe(){return o.jsx(_de,{attribute:"class",defaultTheme:"system",enableSystem:!0,value:{light:"light",dark:"dark",amber:"amber"},children:o.jsx(pue,{nhost:NG,children:o.jsx(Ioe,{client:CDe,children:o.jsx(WRe,{children:o.jsx(nwe,{children:o.jsx(Xue,{children:o.jsx(nde,{children:o.jsxs(AJ,{children:[o.jsx(Eme,{}),o.jsx(yDe,{}),o.jsx(wDe,{}),o.jsxs(dB,{children:[o.jsx(Qt,{path:"/",element:o.jsx(pj,{to:x$==="passwordReset"?"/reset-password":x$==="emailVerify"?"/verify-email":"/dashboard",replace:!0})}),o.jsx(Qt,{path:"/login",element:o.jsx(tE,{children:o.jsx(q0e,{})})}),o.jsx(Qt,{path:"/signup/:ref_by?",element:o.jsx(tE,{children:o.jsx(W0e,{})})}),o.jsx(Qt,{path:"/verify-email",element:o.jsx(BRe,{})}),o.jsx(Qt,{path:"/forgot-password",element:o.jsx(tE,{children:o.jsx(FRe,{})})}),o.jsx(Qt,{path:"/reset-password",element:o.jsx(URe,{})}),o.jsxs(Qt,{element:o.jsx(kme,{}),children:[o.jsx(Qt,{path:"/dashboard/*",element:o.jsx(c3,{children:o.jsx(HNe,{children:o.jsx(SRe,{})})})}),o.jsx(Qt,{path:"/dashboard/static-deploy",element:o.jsx(c3,{children:o.jsx(pDe,{})})})]})]}),o.jsx(mF,{})]})})})})})})})})}const me="u">typeof window?window:void 0,js="u">typeof globalThis?globalThis:me,Tn=js==null?void 0:js.navigator,Ce=js==null?void 0:js.document,Dr=js==null?void 0:js.location,Vg=js==null?void 0:js.fetch,mR=js!=null&&js.XMLHttpRequest&&"withCredentials"in new js.XMLHttpRequest?js.XMLHttpRequest:void 0,b$=js==null?void 0:js.AbortController,jDe=js==null?void 0:js.CompressionStream,Ms=Tn==null?void 0:Tn.userAgent;function RG(){return!(!me||me.navigator.onLine===!1)}const cm=typeof globalThis<"u"?globalThis:me;cm&&typeof self>"u"&&(cm.self=cm),cm&&typeof File>"u"&&(cm.File=function(){});const rt=me??{},TDe="0.9.0",el={DEBUG:!1,LIB_VERSION:TDe,LIB_NAME:"browser-common"};var eo=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),A2=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const ADe=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],RDe=["token"];function ht(t,e){return t.indexOf(e)!==-1}const Qb=function(t){return t.trim()},R2=function(t){return t.replace(/^\$/,"")};function DG(t){var e;const r=[];return(e=JSON.stringify(t,function(n,s){if(typeof s=="bigint")return s.toString();if(typeof s!="function"&&typeof s!="symbol"){if(s instanceof Error)return{name:s.name,message:s.message,stack:s.stack};if(s&&typeof s=="object"){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(s))return"[Circular]";r.push(s)}return s}}))!==null&&e!==void 0?e:"null"}const OG=Object.prototype,gR=OG.hasOwnProperty,Xb=OG.toString,ut=Array.isArray||function(t){return Xb.call(t)==="[object Array]"},jn=t=>typeof t=="function",Ct=t=>t===Object(t)&&!ut(t),Xs=t=>{if(Ct(t)){for(const e in t)if(gR.call(t,e))return!1;return!0}return!1},Se=t=>t===void 0,St=t=>Xb.call(t)=="[object String]",ng=t=>St(t)&&t.trim().length===0,Or=t=>t===null,vt=t=>Se(t)||Or(t),Fr=t=>Xb.call(t)=="[object Number]"&&t==t,Go=t=>Fr(t)&&t>0,$s=t=>Xb.call(t)==="[object Boolean]",DDe=t=>ht(ADe,t),ODe=t=>ht(RDe,t);function PG(t){return t===null||typeof t!="object"}function w_(t,e){return{}.toString.call(t)===`[object ${e}]`}function zf(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return MG(t,Error)}}function vR(t){return"u">typeof Event&&MG(t,Event)}function MG(t,e){try{return t instanceof e}catch{return!1}}const PDe=[!0,"true",1,"1","yes"],oE=t=>ht(PDe,t),MDe=[!1,"false",0,"0","no"];function w$(t,e,r,n,s,i,a){try{var l=t[i](a),c=l.value}catch(d){return void r(d)}l.done?e(c):Promise.resolve(c).then(n,s)}function xr(t){return function(){var e=this,r=arguments;return new Promise(function(n,s){var i=t.apply(e,r);function a(c){w$(i,n,s,a,l,"next",c)}function l(c){w$(i,n,s,a,l,"throw",c)}a(void 0)})}}const IDe=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],S$=function(t,e=[]){if(!t)return!1;const r=t.toLowerCase();return IDe.concat(e).some(n=>{const s=n.toLowerCase();return r.indexOf(s)!==-1})};function oo(t,e,r,n,s){return e>r&&(n.warn("min cannot be greater than max."),e=r),Fr(t)?t>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),oo(s??r,e,r,n))}var LDe=class{constructor(t){this.C={},this.I=t.I,this.R=oo(t.bucketSize,0,100,t.$),this.A=oo(t.refillRate,0,this.R,t.$),this.O=oo(t.refillInterval,0,864e5,t.$)}F(t,e){const r=Math.floor((e-t.lastAccess)/this.O);r>0&&(t.tokens=Math.min(t.tokens+r*this.A,this.R),t.lastAccess=t.lastAccess+r*this.O)}consumeRateLimit(t){var e;const r=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,r):(s={tokens:this.R,lastAccess:r},this.C[n]=s),s.tokens===0||(s.tokens--,s.tokens===0&&((e=this.I)===null||e===void 0||e.call(this,t)),s.tokens===0)}stop(){this.C={}}};const lf="Mobile",Hg="Android",S_="Tablet",IG="Android Tablet",LG="iPad",$G="Apple Watch",N0="Safari",Zb="BlackBerry",BG="Samsung Internet",j0="Chrome",FG="Chrome iOS",zG="Internet Explorer",UG="Internet Explorer Mobile",VG="Opera",HG="Microsoft Edge",T0="Firefox",qG="Firefox iOS",k_="Nintendo",E_="PlayStation",Jb="Xbox",WG="Android Mobile",GG="Mobile Safari",lE="Windows",KG="Windows Phone",k$="Nokia",D2="Ouya",$De="Generic "+lf.toLowerCase(),YG="Generic "+S_.toLowerCase(),O2="Konqueror",QG="Oculus Browser",XG="Vivaldi",ZG="Yandex",JG="Whale",eK="DuckDuckGo",tK="Pale Moon",rK="Waterfox",P2="Brave",nK="Claude",sK="Codex",iK="ChatGPT",aK="Google Search App",cE=new RegExp("Version/(\\d+(\\.\\d+)?)"),uE=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),BDe=new RegExp(Jb,"i"),FDe=new RegExp("PlayStation \\w+","i"),zDe=new RegExp("Nintendo \\w+","i"),yR=new RegExp("BlackBerry|PlayBook|BB10","i"),UDe={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},oK=function(t,e,r,n){return e=e||"",function(i){return i!=null&&i.brave?P2:null}(r)||(n!=null&&n.detectGoogleSearchApp&&ht(t,"GSA/")?aK:ht(t," OPR/")&&ht(t,"Mini")?"Opera Mini":ht(t," OPR/")?VG:yR.test(t)?Zb:ht(t,"IEMobile")||ht(t,"WPDesktop")?UG:ht(t,"OculusBrowser")?QG:ht(t,"SamsungBrowser")?BG:ht(t,"Edge")||ht(t,"Edg/")?HG:ht(t,"Vivaldi/")?XG:ht(t,"YaBrowser/")?ZG:ht(t,"Whale/")?JG:ht(t,"DuckDuckGo/")||ht(t,"Ddg/")?eK:ht(t,"Claude/")?nK:ht(t,"Codex/")?sK:ht(t,"ChatGPT/")?iK:ht(t,"FBIOS")?"Facebook Mobile":ht(t,"UCWEB")||ht(t,"UCBrowser")?"UC Browser":ht(t,"CriOS")?FG:ht(t,"CrMo")||ht(t,j0)?j0:ht(t,Hg)&&ht(t,N0)?WG:ht(t,"FxiOS")?qG:ht(t.toLowerCase(),O2.toLowerCase())?O2:ht(t,"Brave/")?P2:((i,a)=>a&&ht(a,"Apple")||function(l){return ht(l,N0)&&!ht(l,j0)&&!ht(l,Hg)}(i))(t,e)?ht(t,lf)?GG:N0:ht(t,"PaleMoon/")?tK:ht(t,"Waterfox/")?rK:ht(t,T0)?T0:ht(t,"MSIE")||ht(t,"Trident/")?zG:ht(t,"Gecko")?T0:"")},VDe={[UG]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[HG]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[j0]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[FG]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[N0]:[cE],[GG]:[cE],[VG]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[T0]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[qG]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[O2]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Zb]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),cE],[WG]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[BG]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[QG]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[XG]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[ZG]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[JG]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[P2]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[nK]:[uE],[sK]:[uE],[iK]:[uE],[eK]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[tK]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[rK]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[aK]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[zG]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},HDe=function(t,e,r,n){const s=oK(t,e,r,n),i=VDe[s];if(Se(i))return null;for(let a=0;i.length>a;a++){const l=t.match(i[a]);if(l)return parseFloat(l[l.length-2])}return null},E$=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[Jb,t&&t[1]||""]],[new RegExp(k_,"i"),[k_,""]],[new RegExp(E_,"i"),[E_,""]],[yR,[Zb,""]],[new RegExp(lE,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[KG,""];if(new RegExp(lf).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const r=/Windows NT ([0-9.]+)/i.exec(e);if(r&&r[1]){let n=UDe[r[1]]||"";return/arm/i.test(e)&&(n="RT"),[lE,n]}return[lE,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Se(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Hg,[t[2],t[3],t[4]||"0"].join(".")]:[Hg,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],lK=function(t){for(let e=0;E$.length>e;e++){const[r,n]=E$[e],s=r.exec(t),i=s&&(jn(n)?n(s,t):n);if(i)return i}return["",""]},cK=function(t){return zDe.test(t)?k_:FDe.test(t)?E_:BDe.test(t)?Jb:new RegExp(D2,"i").test(t)?D2:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?KG:/iPad/.test(t)?LG:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?$G:yR.test(t)?Zb:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(k$,"i").test(t)?k$:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(lf).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Hg:IG:new RegExp("(pda|Mobile)","i").test(t)?$De:new RegExp(S_,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?YG:""},qDe=function(t,e){var r;const n=cK(t);return n===LG||n===IG||n==="Kobo"||n==="Kindle Fire"||n===YG?S_:n===k_||n===Jb||n===E_||n===D2?"Console":n===$G?"Wearable":n?lf:(e==null?void 0:e.userAgentDataPlatform)==="Android"&&((r=e==null?void 0:e.maxTouchPoints)!==null&&r!==void 0?r:0)>0?600>Math.min((s=e==null?void 0:e.screenWidth)!==null&&s!==void 0?s:0,(i=e==null?void 0:e.screenHeight)!==null&&i!==void 0?i:0)/((a=e==null?void 0:e.devicePixelRatio)!==null&&a!==void 0?a:1)?lf:S_:"Desktop";var s,i,a},dE=/\bFBAV\/(\d+(?:\.\d+)*)/i,C$=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",dE],[/\bFBAN\/EMA\b/i,"Facebook Lite",dE],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",dE],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],M2="[Truncated]",Rv="[Unserializable]";function zh(t){let e="";for(let r=0;t.length>r;r++){const n=t.charCodeAt(r);if(55296>n||n>56319)e+=56320>n||n>57343?t[r]:"�";else{const s=t.charCodeAt(r+1);56320>s||s>57343?e+="�":(e+=t[r]+t[r+1],r++)}}return e}function uK(t,e){if(!e)return t;let r=[];try{r=Object.keys(e)}catch{r=[]}for(const n of r){let s;try{s=e[n]}catch{s=Rv}Object.defineProperty(t,n,{value:s,enumerable:!0,writable:!0,configurable:!0})}return t}const A0=3e5;var dK=class{record(t){if(t.kind==="too-large")return;if(t.kind!=="retry-later")return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),r=Date.now(),n=Math.min(t.retryAfterMs,A0);if(!e)return this.ts=r,void(this.es=r+n);this.es=Math.max(this.es,Math.min(r+n,this.ts+A0))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const e=Math.min(A0,Math.max(0,this.es-t));return e===0&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const WDe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function N$(t,e){return typeof(r=t)=="string"&&WDe.test(r)?t:e();var r}function hK(t,e){const r=new Error(e);try{Object.defineProperty(r,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}return r}function Mc(t){return t&&t.split("#")[0]}function j$(t){try{return t()}catch{return}}function fK(t,e){const r=setTimeout(t,e);return r!=null&&r.unref&&(r==null||r.unref()),r}function T$(t,e,r){return pK.apply(this,arguments)}function pK(){return(pK=xr(function*(t,e,r){let n;try{return yield Promise.race([t,new Promise((s,i)=>{n=fK(()=>{try{r==null||r(),s()}catch(a){i(a)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let Bx,A$,hE;function GDe(t){const e=globalThis._posthogChunkIds;if(!e)return;const r=Object.keys(e);return hE&&r.length===A$||(A$=r.length,hE=r.reduce((n,s)=>{Bx||(Bx={});const i=Bx[s];if(i)n[i[0]]=i[1];else{const a=t(s);for(let l=a.length-1;l>=0;l--){const c=a[l],d=c==null?void 0:c.filename,f=e[s];if(d&&f){n[d]=f,Bx[s]=[d,f];break}}}return n},{})),hE}function sg(t){return sg=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},sg(t)}function KDe(t,e,r){return(e=function(n){var s=function(i){if(sg(i)!="object"||!i)return i;var a=i[Symbol.toPrimitive];if(a!==void 0){var l=a.call(i,"string");if(sg(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}(n);return sg(s)=="symbol"?s:s+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function R$(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;arguments.length>e;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?R$(Object(r),!0).forEach(function(n){KDe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):R$(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var YDe=class{constructor(t,e,r=[]){this.coercers=t,this.stackParser=e,this.modifiers=r}buildFromUnknown(t,e={}){const r=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(r,e,0).apply(t),s=this.buildParsingContext(e),i=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(i,r),$exception_level:"error"}}modifyFrames(t){var e=this;return xr(function*(){for(const r of t)r.stacktrace&&r.stacktrace.frames&&ut(r.stacktrace.frames)&&(r.stacktrace.frames=yield e.applyModifiers(r.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:(e=t.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r;let n,s;if(t.cause!=null&&(n=this.parseStacktrace(t.cause,e)),t.stack!=""&&t.stack!=null)try{s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)}catch{}return ie(ie({},t),{},{cause:n,stack:s,errors:(r=t.errors)===null||r===void 0?void 0:r.map(i=>this.parseStacktrace(i,e))})}applyChunkIds(t,e){return t.map(r=>(r.filename&&e&&(r.chunk_id=e[r.filename]),r))}applyCoercers(t,e){for(const r of this.coercers)if(r.match(t))return r.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return xr(function*(){let r=t;for(const n of e.modifiers)r=yield n(r);return r})()}convertToExceptionList(t,e){const r=[],n=(s,i,a)=>{var l;const c=r.length,d=i===void 0?ie(ie({type:typeof e.type=="string"&&e.type.length>0?e.type:"generic"},typeof e.handled=="boolean"?{handled:e.handled}:e.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof e.synthetic=="boolean"?e.synthetic:s.synthetic,exception_id:c}):{type:"chained",source:a,synthetic:s.synthetic,exception_id:c,parent_id:i},f={type:s.type,value:s.value,mechanism:d};s.stack&&(f.stacktrace={type:"raw",frames:s.stack}),r.push(f),s.cause&&n(s.cause,c,"cause");for(const p of(l=s.errors)!==null&&l!==void 0?l:[])n(p,c,"member")};return n(t),r}buildParsingContext(t){var e;return{chunkIdMap:GDe(this.stackParser),skipFirstLines:(e=t.skipFirstLines)!==null&&e!==void 0?e:1}}getAggregateErrors(t){try{if(zf(t)){let r=Object.getPrototypeOf(t);for(let n=0;r&&100>n;n++){var e;const s=(e=Object.getOwnPropertyDescriptor(r,"constructor"))===null||e===void 0?void 0:e.value;if(typeof s=="function"&&s.name==="AggregateError"){const i=t.errors;return ut(i)?i:void 0}r=Object.getPrototypeOf(r)}}}catch{}}buildCoercingContext(t,e,r=0){let n=0,s=0,i=!1;const a=new Set,l=[],c={},d=(m,g,y=0)=>{const x=f(g,y),w=x.apply;if(x.apply=T=>{l.push(m);try{return w(T)}finally{l.pop()}},y>4||y>0&&l.indexOf(m)!==-1)return this.coerceFallback(x);const _=typeof m=="object"&&m!==null||typeof m=="function";if(y===0&&n>=50||_&&a.has(m))return;_&&a.add(m),y===0&&n++;const S=this.getAggregateErrors(m);let k,N;i||(i=!!S);try{if(k=this.applyCoercers(m,x),!k)throw c}catch(T){if(T===c)return void(y===0&&n--);if(!i)throw T;k=this.coerceFallback(x)}if(!S||n>=50)return k;try{N=S.length}catch{return k}if(!Number.isInteger(N)||0>N||N>4294967295)return k;const j=[];for(let T=0;50>n&&1e3>s&&N>T;T++){let D;s++;try{D=x.next(S[T])}catch{n++,D=this.coerceFallback(f(g+1))}D&&j.push(D)}return ie(ie({},k),{},{errors:j})},f=(m,g=0)=>ie(ie({},e),{},{syntheticException:m==0?e.syntheticException:void 0,mechanism:m==0?t:{},apply(y){const x=d(y,m,g+1);if(!x)throw c;return x},next:y=>d(y,m+1)}),p=f(r);return ie(ie({},p),{},{apply:m=>{var g;return(g=d(m,r))!==null&&g!==void 0?g:this.coerceFallback(p)}})}};const QDe=/^([a-z][a-z0-9.+-]+):/i,XDe=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function ZDe(t){if(!t||t==="<anonymous>")return!1;const e=QDe.exec(t);return!e||XDe.includes(e[1].toLowerCase())}function I2(t,e,r,n,s){const i={platform:t,filename:e,function:r==="<anonymous>"?"?":r,in_app:ZDe(e)};return Se(n)||(i.lineno=n),Se(s)||(i.colno=s),i}const mK=(t,e)=>{const r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:"?",r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},JDe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,eOe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tOe=/\((\S*)(?::(\d+))(?::(\d+))\)/,rOe=(t,e)=>{const r=JDe.exec(t);if(r){const[,s,i,a]=r;return I2(e,s,"?",+i,+a)}const n=eOe.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const a=tOe.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}const[s,i]=mK(n[1]||"?",n[2]);return I2(e,i,s,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},nOe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,sOe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,iOe=(t,e)=>{const r=nOe.exec(t);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){const i=sOe.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}let n=r[3],s=r[1]||"?";return[s,n]=mK(s,n),I2(e,n,s,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},D$=/\(error: (.*)\)/;function xR(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function aOe(t){for(let e=1;10>=e;e++){const r=t.length-2*e;if(0>r)break;let n=!0;for(let s=0;e>s;s++)if(!xR(t[r+s],t[r+e+s])){n=!1;break}if(n){for(let s=0;e>s;s++)t[r+s]=t[r+e+s];return t.length=r+e,{start:r,length:e}}}}function oOe(t,e){const r=e.start+e.length,n=vK(t,e);n&&t.splice(r+n===t.length?r:e.start,n)}function gK(t,e){let r=e.start;for(;r>0&&xR(t[r-1],t[r-1+e.length]);)r--;return e.start-r}function vK(t,e){const r=e.start+e.length;let n=r;for(;t.length>n&&xR(t[n],t[n-e.length]);)n++;return n-r}function lOe(t,e){const r=e[0];let n=t.length-(r?gK(t,r):0);for(const s of e)n-=vK(t,s);return n}function cOe(t,e,r){for(let n=0;t.length>n;n++){const s=t[(e+n)%t.length],i=t[(r+n)%t.length];if(s!==i)return i>s}return!1}var uOe=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const r=St(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${e}: ${t.message}`:e}isDOMException(t){return w_(t,"DOMException")}isDOMError(t){return w_(t,"DOMError")}},dOe=class{match(t){return zf(t)}coerce(t,e){var r;const n=this.getStack(t),s=n===void 0?(r=e.syntheticException)===null||r===void 0?void 0:r.stack:void 0,i=!!s;return{type:this.getType(t),value:this.getMessage(t,e),stack:n??s,cause:t.cause?e.next(t.cause):void 0,synthetic:i}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){try{const e=t.stacktrace;if(typeof e=="string"&&e.length>0)return e;const r=t.stack;return typeof r=="string"&&r.length>0?r:void 0}catch{return}}},hOe=class{match(t){return!!w_(t,"ErrorEvent")&&(t.error!=null||this.ur(t))}coerce(t,e){var r;if(t.error!=null)return e.apply(t.error);const n=e.apply(t.message);return ie(ie({},n),{},{stack:(r=this.cr(t))!==null&&r!==void 0?r:n.stack,synthetic:!0})}ur(t){return St(t.message)&&t.message.length>0}cr(t){var e,r;const n=t,s=(e=n.lineno)!==null&&e!==void 0?e:0,i=(r=n.colno)!==null&&r!==void 0?r:0;if(St(n.filename)&&n.filename.length!==0&&s!==0)return`Error
|
||
at ${n.filename}:${s}:${i}`}};const fOe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var pOe=class{match(t){return typeof t=="string"}coerce(t,e){var r;const[n,s]=this.getInfos(t);return{type:n??"Error",value:s??t,stack:(r=e.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}getInfos(t){let e="Error",r=t;const n=t.match(fOe);return n&&(e=n[1],r=n[2]),[e,r]}};const mOe=["fatal","error","warning","log","info","debug"];function yK(t,e=40){const r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){const s=r.slice(0,n).join(", ");if(e>=s.length)return n===r.length?s:s.length>e?`${s.slice(0,e)}...`:s}return""}var gOe=class{match(t){return typeof t=="object"&&t!==null}coerce(t,e){var r,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:(r=this.getStack(t))!==null&&r!==void 0?r:(n=e.syntheticException)===null||n===void 0?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(vR(t))return t.constructor.name;const e="name"in t?t.name:void 0;return St(e)&&!ng(e)?e:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let r=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(r+=` with message: '${t.message}'`),r}if("message"in t&&typeof t.message=="string")return t.message;const e=this.getObjectClassName(t);return`${e&&e!=="Object"?`'${e}'`:"Object"} captured as exception with keys: ${yK(t)}`}isSeverityLevel(t){return St(t)&&!ng(t)&&mOe.indexOf(t)>=0}getStack(t){try{return St(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:St(t.stack)&&t.stack.length>0?t.stack:void 0}catch{return}}getErrorPropertyFromObject(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const r=t[e];if(zf(r))return r}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{return}}},vOe=class{match(t){return vR(t)}coerce(t,e){var r;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${yK(t)}`,stack:(r=e.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}},yOe=class{match(t){return PG(t)}coerce(t,e){var r;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:(r=e.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}},xOe=class{match(t){return w_(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!vR(t))return!1;try{const e=t.detail;return e!=null&&typeof e=="object"&&"reason"in e}catch{return!1}}coerce(t,e){var r;const n=this.getUnhandledRejectionReason(t);return PG(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:(r=e.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}:e.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}};const C_="$message",N_="$timestamp",_Oe=new Set([C_,N_]),fE={enabled:!0,max_bytes:32768};function j_(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:fE.enabled,max_bytes:wOe(t.max_bytes,fE.max_bytes)}:ie({},fE)}var bOe=class{constructor(t){this.ns=[],this.ss=0,this.Rr=j_(t)}setConfig(t){this.Rr=j_(t),this.rs()}add(t){const e=function(n){let s;try{s=DG(n)}catch{return}try{const i=JSON.parse(s);if(!Ct(i))return;const a=i,l=a[C_],c=a[N_];return!St(l)||l.trim().length===0||!St(c)&&!Fr(c)?void 0:{step:a,json:s}}catch{return}}(t);if(!e)return;const r=function(n){if("u">typeof TextEncoder)return new TextEncoder().encode(n).length;const s=encodeURIComponent(n);let i=0;for(let a=0;s.length>a;a++)s[a]==="%"?(i+=1,a+=2):i+=1;return i}(e.json);r>this.Rr.max_bytes||(this.ns.push({step:e.step,bytes:r}),this.ss+=r,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Rr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function wOe(t,e){if(!Fr(t)||t===1/0||t===-1/0)return e;const r=Math.floor(t);return 0>r?e:r}const O$=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function P$(t){return typeof t=="string"||t}function M$(t){return typeof t=="string"?t:void 0}const SOe=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],xK="NativeGzipValidationError",L2=t=>t.length>=2&&t[0]===31&&t[1]===139,I$=(t,e)=>t===A2.GZipJS||e===A2.GZipJS||e==="gzip",L$=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let um;const Fx=t=>{throw hK(xK,`Native gzip produced invalid output: ${t}`)},kOe=($$=xr(function*(t,e){18>t.size&&Fx("too-short");const r=new Uint8Array(yield t.slice(0,10).arrayBuffer());L2(r)&&r[2]===8||Fx("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(i=>{const a=(()=>{if(um)return um;um=[];for(let c=0;256>c;c++){let d=c;for(let f=0;8>f;f++)d=1&d?3988292384^d>>>1:d>>>1;um[c]=d>>>0}return um})();let l=4294967295;for(let c=0;i.length>c;c++)l=a[255&(l^i[c])]^l>>>8;return(4294967295^l)>>>0})(e)&&Fx("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&Fx("invalid-size")}),function(t,e){return $$.apply(this,arguments)});var $$;function $2(){return $2=xr(function*(t,e=!0,r){try{const s=new TextEncoder().encode(t),i=new globalThis.CompressionStream("gzip"),a=i.writable.getWriter(),l=a.write(s).then(()=>a.close()).catch((n=xr(function*(f){try{yield a.abort(f)}catch{}throw f}),function(f){return n.apply(this,arguments)})),c=new Response(i.readable).blob(),[d]=yield Promise.all([c,l]);return yield kOe(d,s),d}catch(s){if(r!=null&&r.rethrow)throw s;return e&&console.error("Failed to gzip compress data",s),null}var n}),$2.apply(this,arguments)}function _K(t,e){if(t==null)return{};var r,n,s=function(a,l){if(a==null)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(l.includes(d))continue;c[d]=a[d]}return c}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;i.length>n;n++)e.includes(r=i[n])||{}.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const EOe={}.propertyIsEnumerable;function T_(t,e){try{return bK(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function _R(t,e,r,n){if(0>=r.remainingNodes)return{stringValue:M2};if(r.remainingNodes--,$s(t))return{boolValue:t};if(typeof t=="bigint")return function(s,i){const a=s.toString(),l=BigInt("9223372036854775808");return s>=l||-l>s?(i==null||i.debug(`Attribute ${a} is outside the int64 range; encoding it as a string`),{stringValue:a}):{intValue:a}}(t,e);if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const s=BigInt(t).toString();return t>=9223372036854776e3||-9223372036854776e3>t?(e==null||e.debug(`Attribute ${s} is outside the int64 range; encoding it as a string`),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:zh(t)};if(typeof t=="function")return{stringValue:"[Function]"};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(r.ancestors.has(t))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:M2};if(t instanceof Date){const s=t.getTime(),i=Number.isFinite(s)?t.toISOString():String(t);return{stringValue:typeof i=="string"?zh(i):String(i)}}r.ancestors.add(t);try{try{const s=t.toJSON;if(typeof s=="function")return _R(s.call(t),e,r,n+1)}catch{}return ut(t)?{arrayValue:{values:COe(t,e,r,n+1)}}:{kvlistValue:{values:bK(t,e,r,n+1)}}}finally{r.ancestors.delete(t)}}return{stringValue:zh(String(t))}}function COe(t,e,r,n){const s=[],i=Math.min(t.length,1e3);let a=0;for(;i>a&&r.remainingNodes>0;a++)try{const l=a in t?t[a]:void 0;if(vt(l))continue;s.push(_R(l,e,r,n))}catch{s.push({stringValue:Rv})}return t.length>a&&s.push({stringValue:M2}),s}function bK(t,e,r,n){const s=[];for(const i in t)if(EOe.call(t,i)){if(!i){e==null||e.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=r.remainingNodes){e==null||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const a=t[i];if(Or(a)||Se(a))continue;s.push({key:zh(i),value:_R(a,e,r,n)})}catch{s.push({key:zh(i),value:{stringValue:Rv}})}}return s}function wK(t,e,r){return ie(ie(ie(ie({},uK({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}const NOe=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function SK(t,e){const r=uK({},t),n={};for(const s of NOe)({}).hasOwnProperty.call(r,s)&&(n[s]=r[s],delete r[s]);return[...T_(r,e),...T_(n,e)]}const B$={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},kK={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},jOe=kK.info;function TOe(t){try{return zh(String(t))}catch{return Rv}}function AOe(t,e,r,n){const s=t.level||"info",{text:i,number:a}=kK[s]||jOe,l=function(m=Date.now()){return String(m)+"000000"}(Fr(n)?n:void 0),c={};e.distinctId&&(c.posthogDistinctId=e.distinctId),e.sessionId&&(c.sessionId=e.sessionId),e.windowId&&(c["window.id"]=e.windowId),vt(e.sessionStartTimestamp)||(c.sessionStartTimestamp=String(e.sessionStartTimestamp)),vt(e.lastActivityTimestamp)||(c.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(c["url.full"]=e.currentUrl),e.screenName&&(c["screen.name"]=e.screenName),e.appState&&(c["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(c.feature_flags=e.activeFeatureFlags);const d=ie({},c),f=t.attributes;if(f){let m=[];try{m=Object.keys(f)}catch{m=[]}for(const g of m){let y;try{y=f[g]}catch{y=Rv}Object.defineProperty(d,g,{value:y,enumerable:!0,writable:!0,configurable:!0})}}const p={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:a,severityText:i,body:{stringValue:TOe(t.body)},attributes:T_(d,r)};return t.trace_id&&(p.traceId=t.trace_id),t.span_id&&(p.spanId=t.span_id),Se(t.trace_flags)||(p.flags=t.trace_flags),p}function EK(t,e,r){return wK(t,e,r)}function CK(t,e,r,n){return{resourceLogs:[{resource:{attributes:SK(e)},scopeLogs:[{scope:{name:r,version:n},logRecords:t}]}]}}var NK=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=fK(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function jK(){return .75+.5*Math.random()}function TK(t,e,r,n){const s=Math.min(Math.max(0,e-1),6),i=t*Math.pow(2,s);return Math.round(Math.min(i,Math.max(n,t))*r)}var ROe=class{constructor(t,e,r,n,s,i=()=>Promise.resolve(),a){var l;this._instance=t,this.Rr=e,this.$=r,this.cs=n,this.ds=s,this.vs=i,this.fs=a,this.ps=new NK(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new dK,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=e.maxBufferSize,this.Is=Math.max((l=e.maxQueueSize)!==null&&l!==void 0?l:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(eo.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var r;if(this._instance.isDisabled||this._instance.optedOut||!(t!=null&&t.body))return;const n=this.Os(t);if(n===null)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:AOe(n,(r=e==null?void 0:e.context)!==null&&r!==void 0?r:this.cs(),this.$,e==null?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Rr.beforeSend;if(!e)return t;const r=ut(e)?e:[e];let n=t;for(const s of r)try{const i=s(n);if(!i)return this.$.info("Log was rejected in beforeSend function"),null;n=i}catch(i){return this.$.error("Error in beforeSend function for log:",i),null}return n}Ds(){if(this.Rs===void 0)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return xr(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return xr(function*(){var e;t.ps.clear();let r=(e=t._instance.getPersistedProperty(eo.LogsQueue))!==null&&e!==void 0?e:[];if(r.length===0)return;const n=r.length;let s=0;for(;r.length>0&&n>s;){var i,a;const l=t._s;t.bs=0;const c=Math.min(r.length,t.Es),d=r.slice(0,c),f=CK(d.map(m=>m.record),t.qs(),(i=t.fs)!==null&&i!==void 0?i:t._instance.getLibraryId(),t._instance.getLibraryVersion()),p=yield t._instance.js(f);if(t._s!==l)return;if(p.kind==="too-large"&&d.length>1)t.Es=Math.max(1,Math.floor(d.length/2)),t.$.warn(`Logs batch of size ${d.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else if(t.ws.record(p),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),p.kind==="retry-later"||(p.kind==="too-large"?t.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):p.kind==="ok"&&t.Rr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Rr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(d.length),r=(a=t._instance.getPersistedProperty(eo.LogsQueue))!==null&&a!==void 0?a:[],s+=d.length,p.kind==="fatal"))throw p.error}})()}Bs(t){var e=this;return xr(function*(){var r;const n=Math.max(0,t-e.bs),s=(r=e._instance.getPersistedProperty(eo.LogsQueue))!==null&&r!==void 0?r:[];e._instance.setPersistedProperty(eo.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return EK(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const r=(e=this._instance.getPersistedProperty(eo.LogsQueue))!==null&&e!==void 0?e:[];this.Is>r.length||(r.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),r.push(t),this._instance.setPersistedProperty(eo.LogsQueue,r),this.Ts>r.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(TK(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(eo.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return xr(function*(){e.ps.clear();const r=e.flush().catch(()=>{});t!==void 0?yield T$(r,t):yield r})()}flushWithTimeout(t){var e=this;return xr(function*(){const r=e.flush();yield T$(r,t,()=>{r.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=jK(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const pE=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function F$(t){return String(t)+"000000"}function z$(t,e,r,n){let s="";return n&&(s=Object.keys(n).sort().map(i=>`${JSON.stringify(i)}:${JSON.stringify(n[i])}`).join(",")),`${t}\0${e}\0${r??""}\0${s}`}var DOe=class{constructor(t,e,r){this._instance=t,this.Rr=e,this.$=r,this.zs=new Map,this.ps=new NK(()=>this.flush().catch(n=>{this.$.error("Metrics flush failed:",n)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new dK,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,r){this.Zs({name:t,type:"count",value:e,unit:r==null?void 0:r.unit,attributes:r==null?void 0:r.attributes})}gauge(t,e,r){this.Zs({name:t,type:"gauge",value:e,unit:r==null?void 0:r.unit,attributes:r==null?void 0:r.attributes})}histogram(t,e,r){this.Zs({name:t,type:"histogram",value:e,unit:r==null?void 0:r.unit,attributes:r==null?void 0:r.attributes})}flush(){var t=this;const e=this.ys,r=function(){var n=xr(function*(){e&&(yield e.catch(()=>{})),yield t.Qs()});return function(){return n.apply(this,arguments)}}()().finally(()=>{this.ys===r&&(this.ys=null)});return this.ys=r,r}drainWindow(){if(this.zs.size===0)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(e===null)return;if(!e.name||typeof e.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof e.value!="number"||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if(e.type==="count"&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let r,n;try{r=e.attributes?ie({},e.attributes):void 0,n=z$(e.type,e.name,e.unit,r)}catch(a){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,a)}let s=this.zs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.zs.set(n,s)}const i=this.Ws.get(e.name);i===void 0?this.Ws.set(e.name,e.type):i===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${i}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var r;t.total=((r=t.total)!==null&&r!==void 0?r:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(pE.length+1).fill(0)});const n=t.hist;n.count+=1,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e),n.bucketCounts[function(s,i){for(let a=0;i.length>a;a++)if(i[a]>=s)return a;return i.length}(e,pE)]+=1;break}}}Os(t){const e=this.Rr.beforeSend;if(!e)return t;const r=ut(e)?e:[e];let n=t;for(const s of r)try{const i=s(n);if(!i)return this.$.info("Metric was rejected in beforeSend function"),null;n=i}catch(i){return this.$.error("Error in beforeSend function for metric:",i),null}return n}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(TK(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return xr(function*(){if(t.ps.clear(),t.zs.size===0)return;const e=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const r=t.Gs,n=yield t._instance.Ys(t.Js(e));if(r===t.Gs)switch(t.ws.record(n),n.kind==="retry-later"?(t.ks++,t.Ss=jK()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),n.kind){case"ok":return;case"retry-later":return t.ho(e),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.vo(t),r=function(i,a,l){return wK(i,a,l)}(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:SK(r)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,r,n,s}vo(t){const e=F$(Date.now()),r=new Map;for(const a of t.values()){var n;const l=z$(a.type,a.name,a.unit,void 0);let c=r.get(l);c||(c=ie({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},r.set(l,c));const d=T_((n=a.attributes)!==null&&n!==void 0?n:{},this.$),f=F$(a.windowStartMs);if(a.type==="count"){var s;const p={attributes:d,startTimeUnixNano:f,timeUnixNano:e,asDouble:(s=a.total)!==null&&s!==void 0?s:0};c.sum.dataPoints.push(p)}else if(a.type==="gauge"){var i;const p={attributes:d,timeUnixNano:e,asDouble:(i=a.last)!==null&&i!==void 0?i:0};c.gauge.dataPoints.push(p)}else a.hist&&c.histogram.dataPoints.push({attributes:d,startTimeUnixNano:f,timeUnixNano:e,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:pE})}return Array.from(r.values())}ho(t){for(const[n,s]of t){const i=this.zs.get(n);if(i)switch(i.windowStartMs=Math.min(i.windowStartMs,s.windowStartMs),i.type){case"count":var e,r;i.total=((e=i.total)!==null&&e!==void 0?e:0)+((r=s.total)!==null&&r!==void 0?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(i.hist){i.hist.count+=s.hist.count,i.hist.sum+=s.hist.sum,i.hist.min=Math.min(i.hist.min,s.hist.min),i.hist.max=Math.max(i.hist.max,s.hist.max);for(let a=0;i.hist.bucketCounts.length>a;a++)i.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else i.hist=s.hist}else this.Ks()&&this.zs.set(n,s)}}};const AK=(t,{debugEnabled:e}={})=>{const r={N(n,...s){me&&(el.DEBUG||me.POSTHOG_DEBUG||e)&&!Se(me.console)&&me.console&&("__rrweb_original__"in me.console[n]?me.console[n].__rrweb_original__:me.console[n])(t,...s)},debug(...n){r.N("debug",...n)},info(...n){r.N("log",...n)},warn(...n){r.N("warn",...n)},error(...n){r.N("error",...n)},critical(...n){console.error(t,...n)},uninitializedWarning(n){r.error(`You must initialize PostHog before calling ${n}`)},createLogger:(n,s)=>AK(`${t} ${n}`,s)};return r},ze=AK("[PostHog.js]"),Mr=ze.createLogger,OOe=Mr("[ExternalScriptsLoader]"),A_=t=>{const e=Ce==null?void 0:Ce.querySelectorAll("script");if(e){for(let r=0;e.length>r;r++)if(e[r].src===t||e[r].getAttribute("src")===t)return e[r]}},Nu=(t,e,r)=>{if(t.config.disable_external_dependency_loading)return OOe.warn(`${e} was requested but loading of external scripts is disabled.`),r("Loading of external scripts is disabled");const n=A_(e);if(n){if(n.__posthog_loading_callback_fired)return r();const i=n.__posthog_loading_error;return i?r(i):(n.addEventListener("load",a=>{n.__posthog_loading_callback_fired=!0,r(void 0,a)}),void n.addEventListener("error",a=>{n.__posthog_loading_error=a,r(a)}))}const s=()=>{if(!Ce)return r("document not found");if(A_(e))return Nu(t,e,r);let i=Ce.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=e,i.onload=l=>{i.__posthog_loading_callback_fired=!0,r(void 0,l)},i.onerror=l=>{i.__posthog_loading_error=l,r(l)},t.config.prepare_external_dependency_script&&(i=t.config.prepare_external_dependency_script(i)),!i)return r("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")Ce.head.appendChild(i);else{const l=Ce.querySelectorAll("body > script");var a;l.length>0?(a=l[0].parentNode)===null||a===void 0||a.insertBefore(i,l[0]):Ce.body.appendChild(i)}};Ce!=null&&Ce.body?s():Ce==null||Ce.addEventListener("DOMContentLoaded",s)},mE={},U$=(t,e)=>{let r=`/static/${e}.js?v=${t.version}`;return e==="toolbar"&&(r=`${r}&t=${Math.floor(Date.now()/3e5)*3e5}`),t.requestRouter.endpointFor("assets",r)};rt.__PosthogExtensions__=rt.__PosthogExtensions__||{},rt.__PosthogExtensions__.loadExternalDependency=(t,e,r)=>{if(e==="remote-config"){const s=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Nu(t,s,r)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),i=mE[s];if(n==="fallback"&&i){if(A_(i))return void Nu(t,i,r);delete mE[s]}return void Nu(t,s,n==="fallback"?(a,l)=>{if(a)if(typeof a=="string")r(a);else{var c;const d=U$(t,e);mE[s]=d;const f=A_(s);f==null||(c=f.parentNode)===null||c===void 0||c.removeChild(f),Nu(t,d,r)}else r(void 0,l)}:r)}Nu(t,U$(t,e),r)},rt.__PosthogExtensions__.loadSiteApp=(t,e,r)=>{const n=t.requestRouter.endpointFor("api",e);Nu(t,n,r)},el.DEBUG=!1,el.LIB_VERSION="1.434.15",el.LIB_NAME="web";var xn=el;const POe="$people_distinct_id",ia="distinct_id",bR="$device_id",gE="$device_model",R_="__alias",MOe="__cmpns",V$="$fbc",Uh="$fbc_persistence",H$="$fbp",ig="$fbp_persistence",B2="__timers",RK="$autocapture_disabled_server_side",F2="$heatmaps_enabled_server_side",z2="$exception_capture_enabled_server_side",DK="$error_tracking_suppression_rules",U2="$error_tracking_capture_extension_exceptions",V2="$web_vitals_enabled_server_side",wR="$dead_clicks_enabled_server_side",SR="$product_tours_enabled_server_side",OK="$logs_capture_enabled_server_side",PK="$web_vitals_allowed_metrics",ag="$session_recording_remote_config",IOe="$session_recording_enabled_server_side",LOe="$replay_sample_rate",$Oe="$replay_override_sampling",BOe="$replay_override_linked_flag",FOe="$replay_override_url_trigger",zOe="$replay_override_event_trigger",Th="$sesid",MK="$session_is_sampled",UOe="$session_past_minimum_duration",VOe="$session_recording_url_trigger_activated_session",HOe="$session_recording_event_trigger_activated_session",qOe="$debug_first_full_snapshot_timestamp",WOe="$sess_rec_flush_size",ha="$enabled_feature_flags",Qo="$active_feature_flags",H2="$early_access_features",Yu="$feature_flag_details",pc="$feature_flag_payloads",Qu="$feature_flag_request_id",og="$minimal_flag_called_events",Za="$override_feature_flags",ju="$override_feature_flag_payloads",mc="$stored_person_properties",gc="$stored_group_properties",IK="$groups",q2="$surveys",D_="$surveys_loaded_at",LK="$surveys_activated",$K="$surveys_activated_session",BK="$surveys_activated_timestamps",W2="ph_product_tours",GOe="$product_tours_activated",KOe="$product_tours_activated_session",YOe="$conversations_widget_session_id",QOe="$conversations_ticket_id",XOe="$conversations_widget_state",ZOe="$conversations_user_traits",vc="$flag_call_reported",Bm="$flag_call_reported_session_id",qg="$feature_flag_errors",wc="$feature_flag_evaluated_at",Is="$user_state",G2="$client_session_props",JOe="$capture_rate_limit",FK="$initial_campaign_params",zK="$initial_referrer_info",Ah="$initial_person_info",kR="$epp",vE="$posthog_cookieless",UK="$cookieless_mode",VK="$sdk_debug_extensions_init_method",HK="$sdk_debug_extensions_init_time_ms",qK="$sdk_debug_recording_script_not_loaded",WK="$sdk_debug_replay_stale_config",ePe="$sdk_debug_replay_event_trigger_status",tPe="$sdk_debug_replay_linked_flag_trigger_status",rPe="$sdk_debug_replay_matched_recording_trigger_groups",nPe="$sdk_debug_replay_pending_trigger_conditions",sPe="$sdk_debug_replay_remote_trigger_matching_config",iPe="$sdk_debug_replay_trigger_groups_count",aPe="$sdk_debug_replay_url_trigger_status",oPe="$session_recording_start_reason",ER="PostHog loadExternalDependency extension not found.",Xo="anonymous",R0="identified",GK="identified_only",Wg="visibilitychange",O_="beforeunload",CR="$pageview",q$="$pageleave",KK="$identify",W$="$groupidentify";function Rh(t,e){ut(t)&&t.forEach(e)}function Xt(t,e){if(!vt(t))if(ut(t))t.forEach(e);else if((r=>r instanceof FormData)(t))t.forEach((r,n)=>e(r,n));else for(const r in t)gR.call(t,r)&&e(t[r],r)}const pr=function(t,...e){for(const r of e)for(const n in r)r[n]!==void 0&&(t[n]=r[n]);return t};function D0(t){const e=Object.keys(t);let r=e.length;const n=new Array(r);for(;r--;)n[r]=[e[r],t[e[r]]];return n}const lPe=function(t){return function(...e){try{return t.apply(this,e)}catch(r){ze.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ze.critical(r)}}},NR=function(t){const e={};return Xt(t,function(r,n){(St(r)&&r.length>0||Fr(r))&&(e[n]=r)}),e};function YK(t){const e=ie({},t);for(const r of["name","message","stack","cause","errors"])try{r in t&&(e[r]=t[r])}catch{}return e}const cPe=["herokuapp.com","vercel.app","netlify.app"];function uPe(t){const e=t==null?void 0:t.hostname;if(!St(e))return!1;const r=e.split(".").slice(-2).join(".");for(const n of cPe)if(r===n)return!1;return!0}function Gt(t,e,r,n){const{capture:s=!1,passive:i=!0}=n??{};t==null||t.addEventListener(e,r,{capture:s,passive:i})}function K2(t){return t.name==="ph_toolbar_internal"}const lg=t=>{if(Ce){try{const e=t+"=",r=Ce.cookie.split(";").filter(n=>n.length);for(let n=0;r.length>n;n++){let s=r[n];for(;s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Fr(t)&&isFinite(t)&&Math.floor(t)===t});var dPe=class Y2{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,s){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(s)||0>e||0>r||0>n||0>s||e>0xffffffffffff||r>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/256,i[5]=e,i[6]=112|r>>>8,i[7]=r,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new Y2(i)}toString(){let e="";for(let r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Y2(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let r=0;16>r;r++){const n=this.bytes[r]-e.bytes[r];if(n!==0)return Math.sign(n)}return 0}},hPe=class{generate(){const t=this.generateOrAbort();if(!Se(t))return t;{this.Ct=0;const e=this.generateOrAbort();if(Se(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const t=(()=>{const e=Date.now();return Fr(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return dPe.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new fPe}};let QK=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};me&&!Se(me.crypto)&&crypto.getRandomValues&&(QK=t=>crypto.getRandomValues(t));var fPe=class{nextUint32(){return this.Rt.length>this.$t||(QK(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let G$;const ma=()=>pPe().toString(),pPe=()=>(G$||(G$=new hPe)).generate();let dm="";const mPe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let ah=null;const Ar={Et(){if(!Or(ah))return ah;if(ah=!1,Ce)try{const t=`__ph_cookie_support_${ma()}`;Ar.At(t,"xyz"),ah=lg(t)==='"xyz"',Ar.Lt(t)}catch{ah=!1}return ah},Pt(t){ze.error("cookieStore error: "+t)},Ot:lg,Dt(t){let e;try{e=JSON.parse(Ar.Ot(t))||{}}catch{}return e},At(t,e,r,n,s){if(!Ce)return!1;try{let i="",a="";const l=function(d,f){if(f){let p=function(m,g=Ce){if(dm)return dm;if(!g||["localhost","127.0.0.1"].includes(m))return"";const y=m.split(".");let x=Math.min(y.length,8);const w="dmn_chk_"+ma();for(;!dm&&x--;){const _=y.slice(x).join("."),S=w+"=1;domain=."+_+";path=/";g.cookie=S+";max-age=3",g.cookie.includes(w)&&(g.cookie=S+";max-age=0",dm=_)}return dm}(d);if(!p){const m=(g=>{const y=g.match(mPe);return y?y[0]:""})(d);m!==p&&ze.info("Warning: cookie subdomain discovery mismatch",m,p),p=m}return p?"; domain=."+p:""}return""}(Ce.location.hostname,n);if(r){const d=new Date;d.setTime(d.getTime()+864e5*r),i="; expires="+d.toUTCString()}s&&(a="; secure");const c=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&ze.warn("cookieStore warning: large cookie, len="+c.length),Ce.cookie=c,!0}catch{return!1}},Lt(t,e){if(Ce!=null&&Ce.cookie&&(!e||!Or(lg(t))))try{Ar.At(t,"",-1,e)}catch{return}}};let yE=null;const Mt={Et(){if(!Or(yE))return yE;let t=!0;if(Se(me))t=!1;else try{const e="__mplssupport__";Mt.At(e,"xyz"),Mt.Ot(e)!=='"xyz"'&&(t=!1),Mt.Lt(e)}catch{t=!1}return t||ze.error("localStorage unsupported; falling back to cookie store"),yE=t,t},Pt(t){ze.error("localStorage error: "+t)},Ot(t){try{return me==null?void 0:me.localStorage.getItem(t)}catch(e){Mt.Pt(e)}return null},Dt(t){try{return JSON.parse(Mt.Ot(t))||{}}catch{}return null},At(t,e){try{return me==null||me.localStorage.setItem(t,JSON.stringify(e)),!0}catch(r){Mt.Pt(r)}return!1},Lt(t){try{me==null||me.localStorage.removeItem(t)}catch(e){Mt.Pt(e)}}},xE=[mc,Qo,ha,Yu,pc,Qu,wc,qg,vc],Tu=[bR,ia,Th,MK,kR,Ah,Uh,Is],P_=t=>t+"_cpm",gPe=["__proto__","constructor","prototype"],_E=t=>{if(!Ct(t))return{};const e={};return Object.keys(t).forEach(r=>{gPe.indexOf(r)===-1&&(e[r]=t[r])}),e},bE=(t,e=[])=>{const r={};return[...Tu,...e].forEach(n=>{const s=t[n];Se(s)||Or(s)||s===""||(r[n]=s)}),r},XK=t=>{let e=5381,r=2166136261;for(let n=0;t.length>n;n++){const s=t.charCodeAt(n);e=33*e^s,r=Math.imul(r^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(r>>>0).toString(36)},K$=(t,e)=>({p:e,f:XK(JSON.stringify(t))}),Y$=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const r=Ar.Dt(P_(t)),n=(r==null?void 0:r.f)===XK(e)&&ut(r.p);return{properties:n?r.p:[],isValid:n}}catch{return{properties:[],isValid:!1}}},wE=(t,e)=>e+"|"+(Ar.Ot(P_(t))||""),oh={},Q2={Et:()=>!0,Pt(t){ze.error("memoryStorage error: "+t)},Ot:t=>t in oh?oh[t]:null,Dt:t=>t in oh?oh[t]:null,At:(t,e)=>(oh[t]=e,!0),Lt(t){delete oh[t]}};let yu=null;const cr={Et(){if(!Or(yu))return yu;if(yu=!0,Se(me))yu=!1;else try{const t="__support__";cr.At(t,"xyz"),cr.Ot(t)!=='"xyz"'&&(yu=!1),cr.Lt(t)}catch{yu=!1}return yu},Pt(t){ze.error("sessionStorage error: ",t)},Ot(t){try{return me==null?void 0:me.sessionStorage.getItem(t)}catch(e){cr.Pt(e)}return null},Dt(t){try{return JSON.parse(cr.Ot(t))||null}catch{}return null},At(t,e){try{return me==null||me.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(r){cr.Pt(r)}return!1},Lt(t){try{me==null||me.sessionStorage.removeItem(t)}catch(e){cr.Pt(e)}}};var vPe=class{constructor(t){this._instance=t}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(t){this.qo.At(this.jo,t?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:r}=this._instance.config;return r||(e?e+t:"__ph_opt_in_out_"+t)}get No(){const t=this.qo.Ot(this.jo);return oE(t)?1:ht(MDe,t)?0:-1}get qo(){const t=this.Rr.opt_out_capturing_persistence_type,e=t==="localStorage"?Mt:Ar,r=e.Et()?e:Q2;if(!this.Bo||this.Bo!==r){this.Bo=r;const n=t==="localStorage"?Ar:Mt;n.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(oE(n.Ot(this.jo))),n.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[Tn==null?void 0:Tn.doNotTrack,Tn==null?void 0:Tn.msDoNotTrack,rt.doNotTrack,Tn==null?void 0:Tn.globalPrivacyControl].some(t=>oE(t))}};function ZK(t,e){var r;const n=t==null||(r=t.config)===null||r===void 0?void 0:r.get_current_url;if(!jn(n))return e;try{const s=n(e);return St(s)&&s?s:e}catch(s){return ze.error("Error in get_current_url, falling back to window.location.href",s),e}}function Q$(t){var e;return t instanceof Element&&(t.id==="__POSTHOG_TOOLBAR__"||!!(!((e=t.closest)===null||e===void 0)&&e.call(t,".toolbar-global-fade-container")))}function xo(t){return!!t&&t.nodeType===1}function as(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function JK(t){return!!t&&t.nodeType===3}function jR(t){return!!t&&t.nodeType===11&&xo(t.host)}function TR(t){return t?Qb(t).split(/\s+/):[]}function X$(t,e){const r=function(n){var s;const i=me==null||(s=me.location)===null||s===void 0?void 0:s.href;return Se(i)?void 0:ZK(n,i)}(e);return!!(r&&t&&t.some(n=>r.match(n)))}function cf(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return TR(e)}function eY(t){return vt(t)?null:Qb(t).split(/(\s+)/).filter(e=>ug(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Gg(t){let e="";return Vh(t)&&!Kg(t)&&t.childNodes&&t.childNodes.length&&Xt(t.childNodes,function(r){var n;JK(r)&&r.textContent&&(e+=(n=eY(r.textContent))!==null&&n!==void 0?n:"")}),Qb(e)}function cg(t){var e;return Se(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const AR=["a","button","form","input","select","textarea","label"];function X2(t,e){const r=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!r&&r.call(t,e)}catch{return!1}}function Z2(t,e){if(Se(e))return!0;for(const r of t)if(e.some(n=>X2(r,n)))return!0;return!1}function tY(t){const e=t.parentNode;return!(!e||!xo(e))&&e}const SE=[".ph-no-autocapture","[data-ph-no-autocapture]"],rY=["next","previous","prev",">","<"],yPe=[...rY,"+","-","−","–"],Z$=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,J$=[".ph-no-rageclick",".ph-no-capture"],xPe=["","text","search","email","password","url","tel","number"];function nY(t,e){if(!me||RR(t))return!1;let r,n,s;var i,a;if($s(e)?(r=!!e&&J$,n=void 0,s=!1):(r=(i=e==null?void 0:e.css_selector_ignorelist)!==null&&i!==void 0?i:J$,n=e==null?void 0:e.content_ignorelist,s=(a=e==null?void 0:e.ignore_text_selection)!==null&&a!==void 0&&a),r===!1||s&&function(c){return!(!c||!xo(c))&&(!!as(c,"textarea")||(as(c,"input")?ht(xPe,(c.getAttribute("type")||"").toLowerCase()):function(d){var f;if(d.isContentEditable)return!0;const p=(f=d.getAttribute)===null||f===void 0?void 0:f.call(d,"contenteditable");return p==="true"||p===""}(c)))}(t))return!1;const{targetElementList:l}=sY(t,!1);return!function(c,d){if(c===!1||Se(c))return!1;let f;if(c===!0)f=rY;else{if(!ut(c))return!1;if(c.length>10)return ze.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;f=c.map(p=>p.toLowerCase())}return d.some(({safeText:p,ariaLabel:m})=>f.some(g=>Z$(p,g)||Z$(m,g)))}(n,l.map(c=>{var d;return{safeText:Gg(c).toLowerCase(),ariaLabel:((d=c.getAttribute("aria-label"))===null||d===void 0?void 0:d.toLowerCase().trim())||""}}))&&!Z2(l,r)}const RR=t=>!t||as(t,"html")||!xo(t),sY=(t,e)=>{if(!me||RR(t))return{parentIsUsefulElement:!1,targetElementList:[]};let r=!1;const n=[t];let s=t;for(;s.parentNode&&!as(s,"body");){if(jR(s.parentNode)){n.push(s.parentNode.host),s=s.parentNode.host;continue}const i=tY(s);if(!i)break;if(e||AR.indexOf(i.tagName.toLowerCase())>-1)r=!0;else try{const a=me.getComputedStyle(i);a&&a.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}n.push(i),s=i}return{parentIsUsefulElement:r,targetElementList:n}};function Vh(t){const e=new Set;let r=0;for(let i=t;i.parentNode&&!as(i,"body");i=i.parentNode){if(r++>=1e3||e.has(i))return!1;e.add(i);const a=cf(i);if(ht(a,"ph-sensitive")||ht(a,"ph-no-capture"))return!1}if(ht(cf(t),"ph-include"))return!0;const n=t.type||"";if(St(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!St(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Kg(t){return!!(as(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||as(t,"select")||as(t,"textarea")||t.getAttribute("contenteditable")==="true")}const e6=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),t6=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,_Pe=[16,15,14,13],bPe=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),r6=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),n6=/[0-9A-Za-z_]/;function wPe(t){let e=0,r=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;r&&(s*=2,s>9&&(s-=9)),e+=s,r=!r}return e%10==0}function ug(t,e=!0){return!(vt(t)||St(t)&&(t=Qb(t),(e?e6.test((t||"").replace(/[- ]/g,"")):function(r){let n;for(t6.lastIndex=0;n=t6.exec(r);){const s=n[2];if(!s)continue;const i=s.replace(/[- ]/g,"");for(let a=0;i.length>a;a++)for(const l of _Pe){const c=a+l;if(i.length>=c){const d=i.slice(a,c);if(e6.test(d)&&wPe(d))return!0}}}return!1}(t))||(e?bPe.test(t):function(r){let n;for(r6.lastIndex=0;n=r6.exec(r);){const s=n[1],i=n[3];if(!(s&&i&&n6.test(s)&&n6.test(i)))return!0}return!1}(t))))}function s6(t){let e=Gg(t);return e=`${e} ${iY(t)}`.trim(),ug(e)?e:""}function iY(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Xt(t.childNodes,function(r){var n;if(r&&((n=r.tagName)===null||n===void 0?void 0:n.toLowerCase())==="span")try{const s=Gg(r);e=`${e} ${s}`.trim(),r.childNodes&&r.childNodes.length&&(e=`${e} ${iY(r)}`.trim())}catch(s){ze.error("[AutoCapture]",s)}}),e}function i6(t){return t.replace(/"|\\"/g,'\\"')}function SPe(t){const e=t.attr__class;if(e)return ut(e)?e:TR(e)}const zx=Mr("[Dead Clicks]"),kPe=()=>!0,EPe=t=>{var e;const r=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(wR)),n=t.instance.config.capture_dead_clicks;return $s(n)?n:!!Ct(n)||r};var a6=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(t,e,r){this.instance=t,this.isEnabled=e,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[wR]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(t){var e,r,n;!((e=rt.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture?t():(r=rt.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"dead-clicks-autocapture",s=>{s?zx.error("failed to load script",s):t()})}Uo(){var t;if(Ce){if(!this.Ho&&(!((t=rt.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture)){const e=Ct(this.instance.config.capture_dead_clicks)?ie({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Ho=rt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Ho.start(Ce),zx.info("starting...")}}else zx.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,zx.info("stopping..."))}};const hm=Mr("[SegmentIntegration]");function o6(t,e,r=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:i}=(l=>jn(l.register))(a=n)?{analytics:a}:a;var a;(function(l,c,d,f){const p=g=>{const y=()=>g.anonymousId()||ma();l.config.get_device_id=y,f&&g.id()&&(l.register({distinct_id:g.id(),$device_id:y()}),l.persistence.set_property(Is,R0)),d(f?void 0:g.anonymousId()||void 0)},m=c.user();"then"in m&&jn(m.then)?m.then(p):p(m)})(t,s,l=>{s.register(((c,d,{filterProperties:f}={})=>{typeof Promise<"u"&&Promise.resolve||hm.warn("This browser does not have Promise support, and can not use the segment integration");const p=(m,g)=>{if(!g)return m;const y=!!d&&m.event.anonymousId===d&&!m.event.userId;y||m.event.userId||m.event.anonymousId===c.get_distinct_id()||(hm.info("No userId set, resetting PostHog"),c.reset()),y||(d=void 0),m.event.userId&&m.event.userId!==c.get_distinct_id()&&(hm.info("UserId set, identifying with PostHog"),c.identify(m.event.userId));let x=c.calculateEventProperties(g,m.event.properties);if(!vt(f)){const w=m.event.properties||{},_={};for(const k of Object.keys(x))gR.call(w,k)||(_[k]=x[k]);const S=((k,N)=>{const j=ut(k)?k:[k];let T=ie({},N);for(const D of j)try{if(T=D(T),vt(T))return null}catch(I){return hm.error("Error in Segment filterProperties:",I),null}return T})(f,_);if(vt(S))return m;x=S}return m.event.properties=Object.assign({},x,m.event.properties),m};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(m){return p(m,m.event.event)},page(m){return p(m,CR)},identify(m){return p(m,KK)},screen(m){return p(m,"$screen")}}})(t,l,{filterProperties:i})).then(()=>{e()},c=>{hm.error("Failed to register the Segment integration",c),e()})},r)}const aY="posthog-js";function oY(t,{organization:e,projectId:r,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:i=!0}={}){return a=>{var l,c,d,f,p;if(s!=="*"&&!s.includes(a.level)||!t.__loaded)return a;a.tags||(a.tags={});const m=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);a.tags["PostHog Person URL"]=m,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const g=((l=a.exception)===null||l===void 0?void 0:l.values)||[],y=g.map(_=>ie(ie({},_),{},{stacktrace:_.stacktrace?ie(ie({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(S=>ie(ie({},S),{},{platform:"web:javascript"}))}):void 0})),x={$exception_message:((c=g[0])===null||c===void 0?void 0:c.value)||a.message,$exception_type:(d=g[0])===null||d===void 0?void 0:d.type,$exception_level:a.level,$exception_list:y,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((f=g[0])===null||f===void 0?void 0:f.value)||a.message,$sentry_exception_type:(p=g[0])===null||p===void 0?void 0:p.type,$sentry_tags:a.tags};var w;return e&&r&&(x.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+a.event_id),i&&((w=t.exceptions)===null||w===void 0||w.sendExceptionEvent(x)),a}}var CPe=class{constructor(t,e,r,n,s,i){this.name=aY,this.setupOnce=function(a){a(oY(t,{organization:e,projectId:r,prefix:n,severityAllowList:s,sendExceptionsToPostHog:i==null||i}))}}},l6=class{constructor(t){this.Wo=(e,r,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength||n.crossTabAdoption)&&(ze.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:n}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Go()}Go(){var t;this.Zo=(t=this._instance.sessionManager)===null||t===void 0?void 0:t.onSessionId(this.Wo)}destroy(){var t;(t=this.Zo)===null||t===void 0||t.call(this),this.Zo=void 0}doPageView(t,e){var r;const n=this.Qo(t,e);return this.Vo={pathname:(r=me==null?void 0:me.location.pathname)!==null&&r!==void 0?r:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(t){var e;return this.Qo(t,(e=this.Vo)===null||e===void 0?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Vo)===null||t===void 0?void 0:t.pageViewId}}Qo(t,e){const r=this.Vo;if(!r)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:r.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:i,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:d,maxContentY:f}=s;if(!(Se(i)||Se(a)||Se(l)||Se(c)||Se(d)||Se(f))){i=Math.ceil(i),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),d=Math.ceil(d),f=Math.ceil(f);const p=i>1?oo(a/i,0,1,ze):1,m=i>1?oo(l/i,0,1,ze):1,g=c>1?oo(d/c,0,1,ze):1,y=c>1?oo(f/c,0,1,ze):1;n=pr(n,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:m,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:y})}}return r.pathname&&(n.$prev_pageview_pathname=r.pathname),r.timestamp&&(n.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),n}};const fm=["flags","surveys"],NPe={[POe]:{exposure:"hidden"},[R_]:{exposure:"hidden"},[MOe]:{exposure:"hidden"},[B2]:{exposure:"hidden"},[Uh]:{exposure:"hidden"},[ig]:{exposure:"hidden"},[RK]:{exposure:"event"},[F2]:{exposure:"hidden"},[OK]:{exposure:"hidden"},[z2]:{exposure:"event"},[DK]:{exposure:"hidden"},[U2]:{exposure:"event"},[V2]:{exposure:"event"},[wR]:{exposure:"event"},[SR]:{exposure:"hidden"},[PK]:{exposure:"event"},[ag]:{exposure:"hidden"},[IOe]:{exposure:"hidden"},[Th]:{exposure:"hidden"},[MK]:{exposure:"event"},[LOe]:{exposure:"event",shouldSkipFromEventProperties:t=>Or(t)},[UOe]:{exposure:"event"},[VOe]:{exposure:"event"},[HOe]:{exposure:"event"},[qOe]:{exposure:"event"},[WOe]:{exposure:"hidden"},[ha]:{exposure:"hidden",storageGroup:"flags"},[Qo]:{exposure:"hidden",storageGroup:"flags"},[H2]:{exposure:"hidden"},[Yu]:{exposure:"hidden",storageGroup:"flags"},[pc]:{exposure:"hidden",storageGroup:"flags"},[Qu]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[og]:{exposure:"hidden",storageGroup:"flags"},[Za]:{exposure:"hidden"},[ju]:{exposure:"hidden"},[mc]:{exposure:"hidden"},[gc]:{exposure:"hidden"},[q2]:{exposure:"hidden",storageGroup:"surveys"},[D_]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[LK]:{exposure:"event"},[$K]:{exposure:"hidden"},[BK]:{exposure:"hidden"},[W2]:{exposure:"hidden"},[GOe]:{exposure:"hidden"},[KOe]:{exposure:"hidden"},[YOe]:{exposure:"event"},[QOe]:{exposure:"event"},[XOe]:{exposure:"event"},[ZOe]:{exposure:"event"},[vc]:{exposure:"hidden"},[Bm]:{exposure:"hidden"},[IK]:{exposure:"event"},[qg]:{exposure:"hidden"},[wc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Is]:{exposure:"hidden"},[G2]:{exposure:"hidden"},[JOe]:{exposure:"hidden"},[FK]:{exposure:"hidden"},[zK]:{exposure:"hidden"},[Ah]:{exposure:"hidden"},[kR]:{exposure:"hidden"},[$Oe]:{exposure:"event"},[BOe]:{exposure:"event"},[FOe]:{exposure:"event"},[zOe]:{exposure:"event"},[VK]:{exposure:"event"},[HK]:{exposure:"event"},[qK]:{exposure:"event"},[WK]:{exposure:"event"},[ePe]:{exposure:"event"},[tPe]:{exposure:"event"},[rPe]:{exposure:"event"},[nPe]:{exposure:"event"},[sPe]:{exposure:"event"},[iPe]:{exposure:"event"},[aPe]:{exposure:"event"},[oPe]:{exposure:"event"}},jPe=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Fn=t=>{const e=NPe[t];if(e)return e;for(const[r,n]of jPe)if(t.indexOf(r)===0)return n},Dh=(t,e)=>{try{let r;return JSON.stringify(t,(n,s)=>{var i;return zf(s)?((i=r)!==null&&i!==void 0||(r=new WeakMap),r.has(s)||r.set(s,YK(s)),r.get(s)):typeof s=="bigint"?s.toString():s},e)}catch{return DG(t)}},pl=t=>{const e=Ce==null?void 0:Ce.createElement("a");return Se(e)?null:(e.href=t,e)},uf=function(t,e){const r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let s=0;r.length>s;s++){const i=r[s].split("=");if(i[0]===e){n=i;break}}if(!ut(n)||2>n.length)return"";{let s=n[1];try{s=decodeURIComponent(s)}catch{ze.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")}},Yg=function(t,e,r){if(!t||!e||!e.length)return t;const n=t.split("#"),s=n[1],i=(n[0]||"").split("?"),a=i[1],l=i[0],c=(a||"").split("&"),d=[];for(let p=0;c.length>p;p++){const m=c[p].split("=");ut(m)&&(e.includes(m[0])?d.push(m[0]+"="+r):d.push(c[p]))}let f=l;return a!=null&&(f+="?"+d.join("&")),s!=null&&(f+="#"+s),f},M_=function(t,e){const r=t.match(new RegExp(e+"=([^&]*)"));return r?r[1]:null},lY=(t,e)=>t>=e&&RG(),cY=(t,e,r,n)=>{if(t===0){if(RG()){const s=e+1;return s===r&&n(),s}return e}return 0},df=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],TPe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...df],Qg="<masked>",APe=["li_fat_id"];function uY(t,e,r){if(!Ce)return{};const n=e?[...df,...r||[]]:[],s=dY(Yg(Ce.URL,n,Qg),t),i=function(){const a={};return Xt(APe,function(l){const c=lg(l);a[l]=c||null}),a}();return pr(i,s)}function dY(t,e){const r=TPe.concat(e||[]),n={};return Xt(r,function(s){const i=uf(t,s);n[s]=i||null}),n}function hY(t){const e=function(s){return s?s.search("https?://(.*)google.([^/?]*)")===0?"google":s.search("https?://(.*)bing.com")===0?"bing":s.search("https?://(.*)yahoo.com")===0?"yahoo":s.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null}(t),r=e!="yahoo"?"q":"p",n={};if(!Or(e)){n.$search_engine=e;const s=Ce?uf(Ce.referrer,r):"";s.length&&(n.ph_keyword=s)}return n}function fY(){return navigator.language||navigator.userLanguage}function RPe(){const t=fY();return typeof t=="string"?t.split("-")[0]:void 0}const I_="$direct";function pY(){return(Ce==null?void 0:Ce.referrer)||I_}function mY(t,e,r=!1){const n=t?[...df,...e||[]]:[],s=r?Mc(Dr==null?void 0:Dr.href):Dr==null?void 0:Dr.href,i=s==null?void 0:s.substring(0,1e3);return{r:pY().substring(0,1e3),u:i?Yg(i,n,Qg):void 0}}function gY(t,e=!1){var r;const{r:n,u:s}=t,i=e?Mc(s):s,a={$referrer:n,$referring_domain:n==null?void 0:n==I_?I_:(r=pl(n))===null||r===void 0?void 0:r.host};if(i){a.$current_url=i;const l=pl(i);a.$host=l==null?void 0:l.host,a.$pathname=l==null?void 0:l.pathname;const c=dY(i);pr(a,c)}if(n){const l=hY(n);pr(a,l)}return a}function vY(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function DPe(){try{return new Date().getTimezoneOffset()}catch{return}}const OPe={flags:wc,surveys:D_},PPe=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ux=t=>`${t}_cookie_identity_change_pending`,Vx=t=>{let e="",r=0;for(const n of t){const s=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(r+s>1e3)break;e+=n,r+=s}return e},mn="main",Ko=[ha,Qo,Yu,pc,Qu,wc,og,mc],kE=t=>Ko.indexOf(t)!==-1,yY=[Uh,ig],c6=t=>yY.indexOf(t)!==-1,Zl=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},lh=t=>{if(!t)return{};const e=JSON.parse(t);return Ct(e)?e:{}},u6=(t,e)=>{Xt(t,(r,n)=>{const s=Fn(n);s&&s.exposure!=="event"||{}.hasOwnProperty.call(e,n)||delete t[n]})};var EE=class{constructor(t,e,r=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=t,this.la=r,this.props={},this.ua=void 0,this.ha=(n=>{let s="";return n.token&&(s=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+s+"_posthog"})(t),this.qo=this.ca(t),this.Yo=this.da(t),this.load(),this.va(),t.debug&&ze.info("Persistence loaded",t.persistence,ie({},this.props)),this.update_config(t,t,e),this.save(),me){const n=()=>this.flush();Gt(me,"beforeunload",n,{capture:!1}),Gt(me,"pagehide",n,{capture:!1}),this.fa=s=>{if(this.Ko&&(!s.storageArea||s.storageArea===(me==null?void 0:me.localStorage))&&s.key)if(s.key!==this.ha){if(this.Yo){const i=fm.find(a=>s.key===this.pa(a));i&&this.ga(s.key,i)}}else this.ga(s.key,mn)},Gt(me,"storage",this.fa)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([e,r])=>{const n=this.ia.get(e);if(!kE(e)||n===!0)return;if(r===!0)return void this.ma(e,!0);const s=new Set(n||[]);r.forEach(i=>s.add(i)),s.size&&this.ma(e,s)})}onCrossTabFeatureFlagChange(t){return this.aa.add(t),()=>this.aa.delete(t)}destroy(){this.fa&&me&&(me.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(t,e,r=!0){if(this.mi)return!1;let n,s;try{if(s=Mt.Ot(t),Or(s)){const l=this.ya(e);return l.storageValue=null,e!==mn&&(l.persisted=!1),!1}n=lh(s)}catch{return!1}const i=e===mn?n:Mt.Dt(this.ha);if(i&&this.ba(i))return!1;const a=this._a(n,e,r);return e===mn&&this.Yo&&!Zl(this.wa().main,n)||this.ka(n,e,!0,s),a}ba(t){const e=this.props[ia],r=t[ia];return!Se(e)&&!Se(r)&&e!==r}ka(t,e,r,n){const s=this.ya(e);s.storageValue=n,e!==mn&&(s.persisted=r);try{s.fingerprint=this.Sa(t,e)}catch{s.fingerprint=void 0}}_a(t,e,r){let n=!1;return Ko.forEach(s=>{var i;const a=(i=Fn(s))===null||i===void 0?void 0:i.storageGroup;if(e===mn&&this.Yo&&a||e!==mn&&a!==e)return;const l=s in t,c=this.xa(s,l?t[s]:void 0),d=this.ia.has(s)?s in this.props:l;d===s in this.props&&Zl(c,this.props[s])||(d?this.Ca(s,c,!1):this.$a(s,!1),n=!0)}),n&&r&&this.aa.forEach(s=>s()),n}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const t=Mt.Ot(this.ha),e=this.ya(mn);let r,n=!1,s=!1;if(t!==e.storageValue)if(Or(t))e.storageValue=null;else{if(r=lh(t),this.ra=!this.sa&&this.ba(r),this.ra)return!1;s=this._a(r,mn,!1),!this.Yo||Zl(this.wa().main,r)?this.ka(r,mn,!0,t):e.storageValue=t,n=!0}return this.Yo&&fm.forEach(i=>{const a=Mt.Ot(this.pa(i)),l=this.ya(i),c=r||{},d=n&&Ko.some(p=>{var m;return((m=Fn(p))===null||m===void 0?void 0:m.storageGroup)===i&&p in c});if(a===l.storageValue&&!d)return;if(Or(a))return l.storageValue=null,l.persisted=!1,void(d&&(s=this._a(c,i,!1)||s));const f=lh(a);s=this._a(f,i,!1)||s,this.ka(f,i,!0,a)}),s}catch{return!1}}ma(t,e){this.ia.set(t,e);const r=Fn(t);r!=null&&r.volatile||(this.ya((this.Yo?r==null?void 0:r.storageGroup:void 0)||mn).fingerprint=void 0,this.Ia(t))}Ma(){Ko.forEach(t=>this.ia.set(t,!0))}va(){if(this.Ko)try{const t=Mt.Ot(this.ha),e=lh(t);this.ya(mn).storageValue=t,Ko.forEach(r=>{var n;const s=this.Yo?(n=Fn(r))===null||n===void 0?void 0:n.storageGroup:void 0,i=s?Mt.Ot(this.pa(s)):null;if(s){const l=this.ya(s);l.storageValue=i,l.persisted=!Or(i)}const a=s&&!Or(i)?lh(i):e;r in this.props?this.Ea(r,a[r],this.props[r]):r in a&&this.ma(r,!0)})}catch{}}xa(t,e){const r=this.ia.get(t);if(!r)return e;if(r===!0)return this.props[t];if(t==="$active_feature_flags"){const i=new Set(ut(e)?e:[]),a=new Set(ut(this.props[t])?this.props[t]:[]);return r.forEach(l=>a.has(l)?i.add(l):i.delete(l)),Array.from(i)}const n=Ct(e)?ie({},e):{},s=Ct(this.props[t])?this.props[t]:{};return r.forEach(i=>{i in s?n[i]=s[i]:delete n[i]}),n}Ea(t,e,r){if(!kE(t))return;const n=this.ia.get(t);if(n===!0)return;let s=e;if(this.Ko)try{var i;const l=this.Yo?(i=Fn(t))===null||i===void 0?void 0:i.storageGroup:void 0,c=l?this.pa(l):this.ha;s=lh(Mt.Ot(c))[t]}catch{}const a=new Set(n||[]);if(t==="$active_feature_flags"){if(!Se(e)&&!ut(e)||!Se(s)&&!ut(s)||!ut(r))return void this.ma(t,!0);const l=new Set(e||[]),c=new Set(s||[]),d=new Set(r);new Set([...l,...d]).forEach(f=>{l.has(f)!==d.has(f)&&a.add(f)}),a.forEach(f=>{c.has(f)===d.has(f)&&a.delete(f)})}else{if(!Ct(r))return void(Zl(s,r)?this.ia.delete(t):this.ma(t,!0));{if(!Se(e)&&!Ct(e)||Se(e)&&Xs(r)&&Se(s))return void this.ma(t,!0);const l=Ct(e)?e:{},c=Ct(s)?s:{};new Set([...Object.keys(l),...Object.keys(r)]).forEach(d=>{d in l==d in r&&Zl(l[d],r[d])||a.add(d)}),a.forEach(d=>{d in c==d in r&&Zl(c[d],r[d])&&a.delete(d)})}}a.size?this.ma(t,a):this.ia.delete(t)}Pa(){var t;const e=(t=this.Rr)===null||t===void 0?void 0:t.persistence_save_debounce_ms;return Fr(e)&&e>0?e:0}Ra(t){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(t)try{const e=bE(t,this.Rr.cookie_persisted_properties||[]),r=K$(e,this.Rr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(r),s=Ar.Ot(this.ha)||void 0;s&&wE(this.ha,s)===n&&(this.Aa=n,this.Fa=s)}catch{}else try{const e=Ar.Ot(this.ha)||void 0;this.Aa=e?wE(this.ha,e):void 0,this.Fa=e}catch{}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(t,e=!1){if(this.mi&&!e||this.ea||!t.cookieWinsOnConflict||t.persistence.toLowerCase()!=="localstorage+cookie")return!1;let r;try{r=Ar.Ot(this.ha)||void 0}catch{}if(!r||r===this.Fa)return!1;const n=wE(this.ha,r);let s;try{s=_E(JSON.parse(r))}catch{return!1}if((Ar.Ot(this.ha)||void 0)!==r)return!1;this.Aa=n,this.Fa=r;const i=Y$(this.ha,r),a=[...Tu,...i.properties],l={};if(Object.keys(s).forEach(x=>{const w=s[x];(Se(w)||Or(w)||w===""||x==="$user_state"&&w!=="anonymous"&&w!=="identified")&&(l[x]=!0,delete s[x])}),Xs(s))return!1;const c="distinct_id"in s||s.$user_state==="anonymous"||s.$user_state==="identified",d=this.props,f=d[ia],p=d[Is],m=pr({},d);[...Tu,...t.cookie_persisted_properties||[]].forEach(x=>{if(a.indexOf(x)!==-1&&!(x in s)&&!l[x]&&(c||x!=="distinct_id"&&x!=="$user_state")){const w=m[x];(i.isValid||Tu.indexOf(x)===-1||w!==!1&&w!==0)&&delete m[x]}}),this.props=pr(m,s),Ko.forEach(x=>{const w=x in this.props;x in d===w&&Zl(d[x],this.props[x])||(w?this.Ea(x,d[x],this.props[x]):this.ma(x,!0))}),!c||"$user_state"in s||"$user_state"in this.props||this.Ca(Is,Xo);const g=this.props[ia],y=this.props[Is];return!c||g===f&&y===p||(this.sa=!0,this.ta=!0,cr.At(Ux(this.ha),!0),this.$a(mc),this.$a(Qo),this.$a(ha),this.$a(Yu),this.$a(pc),this.$a(Qu),this.$a(wc),this.$a(qg),this.$a(vc),y!=="anonymous"||p!=="identified"&&s.$user_state!=="anonymous"&&(Se(f)||g===f)||(u6(this.props,s),this.$a(gc)),y==="identified"?this.props.$user_id=g:delete this.props.$user_id,this.$a(R_)),!0}consumeCookieIdentityChange(){const t=Ux(this.ha),e=this.ta||!!cr.Ot(t);return this.ta=!1,e&&cr.Lt(t),e}Da(t=!1){return!(this.ea||this.mi&&!t||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(Se(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[mn],this.qa(!0))}ja(t=!0){if(this.ea)try{t?this.La():Se(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(t){PPe.indexOf(t.persistence.toLowerCase())===-1&&(ze.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const e=((a=[],l=!1)=>{const c=[...Tu,...a];return ie(ie({},Mt),{},{Dt(d){try{let p,m={};try{p=Ar.Ot(d)||void 0,m=p?_E(JSON.parse(p)):{}}catch{}const g=JSON.parse(Mt.Ot(d)||"{}");let y;if(l){const x=Y$(d,p),w=[...Tu,...x.properties],_={};Object.keys(m).forEach(k=>{const N=m[k];Or(N)||N===""||k==="$user_state"&&N!=="anonymous"&&N!=="identified"||(_[k]=N)});const S="distinct_id"in _||_.$user_state==="anonymous"||_.$user_state==="identified";if(Object.keys(_).length>0){var f;const k=g[ia],N=(f=g.$user_state)!==null&&f!==void 0?f:Xo;c.forEach(j=>{if(w.indexOf(j)!==-1&&!(j in m)&&(S||j!=="distinct_id"&&j!=="$user_state")){const T=g[j];(x.isValid||Tu.indexOf(j)===-1||T!==!1&&T!==0)&&delete g[j]}}),!S||"$user_state"in m||"$user_state"in g||(g[Is]=Xo),!S||("distinct_id"in _?_[ia]:g[ia])===k&&("$user_state"in _?_[Is]:g[Is])===N||(xE.forEach(j=>delete g[j]),_.$user_state==="identified"&&"distinct_id"in _?g.$user_id=_[ia]:delete g.$user_id,_.$user_state!=="identified"&&(delete g[IK],delete g[gc]),delete g.__alias)}y=pr(g,_)}else y=pr(m,g);return Mt.At(d,y),y}catch{}return null},At(d,f,p,m,g,y){const x=Mt.At(d,f,void 0,void 0,y);try{const w=bE(f,a);if(Object.keys(w).length){if(l){const _=P_(d),S=K$(w,a);if(Ar.At(_,S,p,m,g,y),Ar.Ot(_)!==JSON.stringify(S)){Ar.Lt(_,m);const k=bE(f);return Ar.At(d,k,p,m,g,y),x}}Ar.At(d,w,p,m,g,y)}}catch(w){Mt.Pt(w)}return x},Lt(d,f){try{me==null||me.localStorage.removeItem(d),Ar.Lt(d,f),Ar.Lt(P_(d),f)}catch(p){Mt.Pt(p)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict);let r,n=!1,s=!1;const i=t.persistence.toLowerCase();return i==="localstorage"&&Mt.Et()?(r=Mt,s=!0):i==="localstorage+cookie"&&e.Et()?(r=e,s=!0,n=!0):i==="sessionstorage"&&cr.Et()?r=cr:i==="memory"?r=Q2:i==="cookie"&&Ar.Et()?(r=Ar,n=!0):e.Et()?(r=e,s=!0,n=!0):Ar.Et()?(r=Ar,n=!0):r=Q2,this.Ko=s,this.Xo=n,r}pa(t){return`${this.ha}__${t}`}da(t){return this.Ko&&!!t.split_storage}properties(){const t={};return Xt(this.props,(e,r)=>{const n=Fn(r);if(!n||n.exposure==="event"){var s;if(!(n==null||(s=n.shouldSkipFromEventProperties)===null||s===void 0)&&s.call(n,e))return;t[r]=e}}),t}load(t=!1){if(this.mi&&!t)return;const e=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie",r=e?Mt.Dt(this.ha):null;let n={};if(e)try{n=_E(Ar.Dt(this.ha)),Xt(n,(l,c)=>{(Se(l)||Or(l)||l==="")&&delete n[c]})}catch{}const s=this.qo.Dt(this.ha);if(s&&(this.props=pr({},s)),this.Yo&&this.Ba(),e&&s){var i,a;const l=r==null?void 0:r[ia],c=(i=r==null?void 0:r.$user_state)!==null&&i!==void 0?i:Xo,d=s[ia],f=(a=s.$user_state)!==null&&a!==void 0?a:Xo;if(d!==l||f!==c){this.ta=!0,cr.At(Ux(this.ha),!0);const p=pr({},this.props);xE.forEach(g=>delete p[g]),f!=="anonymous"||c!=="identified"&&n.$user_state!=="anonymous"&&(Se(l)||d===l)||(u6(p,n),delete p[gc]),this.props=p;const m=new Set;xE.forEach(g=>{var y;const x=(y=Fn(g))===null||y===void 0?void 0:y.storageGroup;x&&m.add(x)}),m.forEach(g=>{const y={};Xt(this.props,(x,w)=>{var _;((_=Fn(w))===null||_===void 0?void 0:_.storageGroup)===g&&(y[w]=x)}),Xs(y)?(Mt.Lt(this.pa(g)),this.Jo[g]={}):Mt.At(this.pa(g),y)&&(this.Jo[g]={persisted:!0,fingerprint:this.Sa(y,g)})})}}cr.Ot(Ux(this.ha))&&(this.ta=!0)}Ba(){for(const t of fm){const e=Mt.Dt(this.pa(t));if(e&&!Xs(e)){const r=this.ya(t);r.persisted=!0,this.Ha(t)||(r.fingerprint=this.Sa(e,t)),this.za(t,e)||pr(this.props,e)}}}Ha(t){return Object.keys(this.props).some(e=>{var r;return((r=Fn(e))===null||r===void 0?void 0:r.storageGroup)===t})}za(t,e){const r=OPe[t];if(!r)return!1;const n=e[r],s=this.props[r];return Fr(n)&&Fr(s)&&s>n}refreshKey(t){var e;if(this.mi||this.oa.has(t))return;const r=this.Yo?(e=Fn(t))===null||e===void 0?void 0:e.storageGroup:void 0,n=r?Mt.Dt(this.pa(r)):this.qo.Dt(this.ha);if(n&&t in n)this.Ca(t,n[t],!1);else{if(r){const s=this.qo.Dt(this.ha);if(s&&t in s)return void this.Ca(t,s[t],!1)}this.$a(t,!1)}}save(){if(this.mi)return;const t=this.Pa();t>0?Se(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},t)):this.qa()}flush(){Se(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(t=!1){if(this.mi||this.ea&&!t)return;t||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||yY.forEach(s=>this.refreshKey(s)));const e=!t&&!this.na;e||(this.ra=!1);const r=!!e&&this.Ta();if(this.ra)return void(this.Rr.debug&&ze.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(r&&this.aa.forEach(s=>s()));const n=this.Wa(this.qo,this.ha,this.props,mn);n==="written"&&this.Ra(this.props),n!=="failed"&&(this.ia.clear(),this.sa=!1,this.oa.clear()),r&&this.aa.forEach(s=>s())}Ua(){const{main:t,groups:e}=this.wa(),r=this.Wa(this.qo,this.ha,t,mn);r==="written"&&this.Ra(t),r!=="failed"&&(this.sa=!1,this.oa.clear(),Ko.forEach(s=>{var i;!((i=Fn(s))===null||i===void 0)&&i.storageGroup||this.ia.delete(s)}));for(const s of fm){var n;const i=e[s];if(Xs(i)&&!(!((n=this.Jo[s])===null||n===void 0)&&n.persisted)){Ko.forEach(l=>{var c;((c=Fn(l))===null||c===void 0?void 0:c.storageGroup)===s&&this.ia.delete(l)});continue}const a=this.Wa(Mt,this.pa(s),i,s);a!=="failed"&&Ko.forEach(l=>{const c=Fn(l);(c==null?void 0:c.storageGroup)!==s||a!=="written"&&c.volatile||this.ia.delete(l)})}}wa(){const t={},e={flags:{},surveys:{}};return Xt(this.props,(r,n)=>{var s;const i=(s=Fn(n))===null||s===void 0?void 0:s.storageGroup;i?e[i][n]=r:t[n]=r}),{main:t,groups:e}}Sa(t,e){if(e===mn)return JSON.stringify(t)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const r={};return Xt(t,(n,s)=>{var i;r[s]=!((i=Fn(s))===null||i===void 0)&&i.volatile?"__volatile__":n}),JSON.stringify(r)}Wa(t,e,r,n){const s=this.ya(n);if(n!==mn&&!s.dirty&&!Se(s.fingerprint))return"skipped";let i;try{if(i=this.Sa(r,n),i===s.fingerprint)return s.dirty=!1,"skipped"}catch{i=void 0}return t.At(e,r,this.Va,this.Ga,this.Za,this.Rr.debug)?(s.dirty=!1,n!==mn&&(s.persisted=!0),Se(i)||(s.fingerprint=i),this.Ko&&(s.storageValue=Mt.Ot(e)),"written"):(this.Rr.debug&&ze.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Ma(),Se(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!t&&this.la)for(const e of fm)Mt.Lt(this.pa(e));t?delete this.Jo[mn]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(t,e,r){if(Ct(t)){this.syncCookieProperties(),Se(e)&&(e="None"),this.Va=Se(r)?this.Qa:r;let n=!1;if(Xt(t,(s,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ca(i,s),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if(Ct(t)){this.syncCookieProperties(),this.Va=Se(e)?this.Qa:e;let r=!1;if(Xt(t,(n,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==n||Ct(n)||ut(n))&&(this.Ca(s,n),r=!0)}),r)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e=typeof t=="string"?[t]:t;let r=!1;for(const n of e)n in this.props&&(this.$a(n),r=!0);r&&this.save()}update_campaign_params(){const t=Ce==null?void 0:Ce.URL;if(t===this.ua)return;const e=uY(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),r=!Xs(NR(e));return r&&this.register(e),this.ua=t,r?e:void 0}update_search_keyword(){this.register(function(){const t=Ce==null?void 0:Ce.referrer;return t?hY(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:pY(),$referring_domain:(Ce==null?void 0:Ce.referrer)&&((t=pl(Ce.referrer))===null||t===void 0?void 0:t.host)||I_},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=mY(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[Ah]:this.Xo?{r:Vx(t.r),u:t.u?Vx(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Xt([zK,FK],r=>{const n=this.props[r];n&&Xt(n,function(s,i){t["$initial_"+R2(i)]=s})});const e=this.props[Ah];if(e){const r=function(n,s=!1){const i=gY(n,s),a={};return Xt(i,function(l,c){a[`$initial_${R2(c)}`]=l}),a}(e,this.Rr.disable_capture_url_hashes);pr(t,r)}return t}safe_merge(t){return Xt(this.props,function(e,r){r in t||(t[r]=e)}),t}update_config(t,e,r){const n=t.persistence!==e.persistence,s=!((g,y)=>{if(g.length!==y.length)return!1;const x=[...g].sort(),w=[...y].sort();return x.every((_,S)=>_===w[S])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),i=n||s,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!r,c=!!this.mi&&!l;l||this.Oa(e,c),this.Rr=t,!l&&(n||s||a)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(ie(ie({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),c));const d=i||a?this.ca(t):this.qo;this.Ja();const f=this.da(t),p=i||f!==this.Yo,m=!l&&(p||t.cross_subdomain_cookie!==this.Ga||t.secure_cookie!==this.Za)&&this.Da(c);this.na=p;try{if(this.Qa=this.Va=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),p){const g=this.props;this.clear(),this.qo=d,this.Yo=f,this.props=g,this.save()}else a&&(this.qo=d,l||(delete this.Jo[mn],this.qa()))}finally{this.na=!1,m&&this.ja()}}Ja(){const t=this.props[Ah];if(!this.Xo||!Ct(t)||typeof t.r!="string")return;const e=Vx(t.r),r=typeof t.u=="string"?Vx(t.u):t.u;e===t.r&&r===t.u||this.Ca(Ah,ie(ie({},t),{},{r:e,u:r}))}set_disabled(t){this.mi=t,this.mi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ga&&(this.Ga=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Za&&(this.Za=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const r=this.props.__timers||{};r[t]=e,this.Ca(B2,r),this.save()}remove_event_timer(t){const e=this.props.__timers||{},r=e[t];return Se(r)||(delete e[t],this.Ca(B2,e),this.save()),r}get_property(t){return this.props[t]}set_property(t,e){this.Ca(t,e),this.save()}Ca(t,e,r=!0){var n;const s=this.props[t];this.props[t]=e,r&&(t!=="distinct_id"&&t!=="$user_state"||s===e||(this.sa=!0),c6(t)&&!Zl(s,e)&&this.oa.add(t),this.Ea(t,s,e),!((n=Fn(t))===null||n===void 0)&&n.volatile||this.Ia(t))}$a(t,e=!0){delete this.props[t],e&&(kE(t)&&this.ma(t,!0),c6(t)&&this.oa.add(t),this.Ia(t))}Ia(t){var e;const r=(e=Fn(t))===null||e===void 0?void 0:e.storageGroup;r&&(this.ya(r).dirty=!0)}ya(t){return this.Jo[t]||(this.Jo[t]={})}};const mi={GZipJS:"gzip-js",Base64:"base64"},pm={Activation:"events",Cancellation:"cancelEvents"},CE={Popover:"popover",API:"api",Widget:"widget"},Zo={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},NE={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},J2={Popover:"popover",Inline:"inline"};function Hx(t){let e=!0;return{dispose(){if(e){e=!1;const r=t();r&&jn(r.then)&&r.then(void 0,()=>{})}}}}const MPe={SHOWN:"product tour shown"},d6={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},h6=Mr("[RateLimiter]");var IPe=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{const r=e.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(n=>{h6.info(`${n||"events"} is quota limited.`),this.serverLimits[n]=new Date().getTime()+6e4})}catch(n){return void h6.warn(`could not rate limit - continuing. Error: "${n==null?void 0:n.message}"`,{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)===null||t===void 0?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)===null||t===void 0?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var e,r,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:i}=this,a=new Date().getTime(),l=(e=(r=this.instance.persistence)===null||r===void 0?void 0:r.get_property("$capture_rate_limit"))!==null&&e!==void 0?e:{tokens:s,last:a};l.tokens+=(a-l.last)/1e3*i,l.last=a,l.tokens>s&&(l.tokens=s);const c=1>l.tokens;if(c||t||(l.tokens=Math.max(0,l.tokens-1)),c&&!t){const d=(Fr(l.dropped)?l.dropped:0)+1;l.dropped=d,!this.lastEventRateLimited&&this.Ka(d)&&(l.dropped=0)}return this.lastEventRateLimited=c,(n=this.instance.persistence)===null||n===void 0||n.set_property("$capture_rate_limit",l),{isRateLimited:c,remainingTokens:l.tokens}}Xa(t){const e=this.instance.config.property_denylist;return!ut(e)||!e.includes(t)}Ya(){var t;if(this.Xa("$current_url")&&this.Xa("$pathname")&&(Dr!=null&&Dr.pathname))return`${(t=Dr.origin)!==null&&t!==void 0?t:""}${Dr.pathname}`}Ka(t){var e,r;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,i=this.Ya(),a=this.Xa("$session_id")?(e=(r=this.instance).get_session_id)===null||e===void 0?void 0:e.call(r):void 0,l=[`${t} event(s) dropped since the last warning`,i?`triggered on ${i}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return e!==!1&&new Date().getTime()<e}};const Jl=Mr("[RemoteConfig]");var xY=class{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=rt._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(t=t[this._instance.config.token])===null||t===void 0?void 0:t.config}tl(t){var e,r,n;!((e=rt.__PosthogExtensions__)===null||e===void 0)&&e.loadExternalDependency?(r=rt.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}el(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return Jl.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void Jl.warn("Remote config is disabled. Falling back to local config.");this.tl(t=>{if(!t)return Jl.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(e=>{this.il(e.json,e)});this.il(t)})}catch(t){Jl.error("Error loading remote config",t),this.il()}}il(t,e){!t&&e&&(e.statusCode===0?e.error||Jl.warn("Failed to fetch remote config from PostHog."):Jl.error("Failed to fetch remote config from PostHog."));try{this._instance.il(t?{ok:!0,config:t}:{ok:!1})}catch(n){Jl.error("Error applying remote config",n)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)===null||r===void 0||r.ensureFlagsLoaded()}catch(n){Jl.error("Error loading feature flags",n)}}},qi=Uint8Array,Js=Uint16Array,hf=Uint32Array,DR=new qi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),OR=new qi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),f6=new qi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_Y=function(t,e){for(var r=new Js(31),n=0;31>n;++n)r[n]=e+=1<<t[n-1];var s=new hf(r[30]);for(n=1;30>n;++n)for(var i=r[n];r[n+1]>i;++i)s[i]=i-r[n]<<5|n;return[r,s]},bY=_Y(DR,2),ej=bY[1];bY[0][28]=258,ej[258]=28;for(var p6=_Y(OR,0)[1],wY=new Js(32768),Pr=0;32768>Pr;++Pr){var ch=(43690&Pr)>>>1|(21845&Pr)<<1;wY[Pr]=((65280&(ch=(61680&(ch=(52428&ch)>>>2|(13107&ch)<<2))>>>4|(3855&ch)<<4))>>>8|(255&ch)<<8)>>>1}var dg=function(t,e,r){for(var n=t.length,s=0,i=new Js(e);n>s;++s)++i[t[s]-1];var a,l=new Js(e);for(s=0;e>s;++s)l[s]=l[s-1]+i[s-1]<<1;for(a=new Js(n),s=0;n>s;++s)a[s]=wY[l[t[s]-1]++]>>>15-t[s];return a},ad=new qi(288);for(Pr=0;144>Pr;++Pr)ad[Pr]=8;for(Pr=144;256>Pr;++Pr)ad[Pr]=9;for(Pr=256;280>Pr;++Pr)ad[Pr]=7;for(Pr=280;288>Pr;++Pr)ad[Pr]=8;var L_=new qi(32);for(Pr=0;32>Pr;++Pr)L_[Pr]=5;var LPe=dg(ad,9),$Pe=dg(L_,5),SY=function(t){return(t/8|0)+(7&t&&1)},kY=function(t,e,r){(r==null||r>t.length)&&(r=t.length);var n=new(t instanceof Js?Js:t instanceof hf?hf:qi)(r-e);return n.set(t.subarray(e,r)),n},qo=function(t,e,r){var n=e/8|0;t[n]|=r<<=7&e,t[n+1]|=r>>>8},mm=function(t,e,r){var n=e/8|0;t[n]|=r<<=7&e,t[n+1]|=r>>>8,t[n+2]|=r>>>16},jE=function(t,e){for(var r=[],n=0;t.length>n;++n)t[n]&&r.push({s:n,f:t[n]});var s=r.length,i=r.slice();if(!s)return[new qi(0),0];if(s==1){var a=new qi(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(j,T){return j.f-T.f}),r.push({s:-1,f:25001});var l=r[0],c=r[1],d=0,f=1,p=2;for(r[0]={s:-1,f:l.f+c.f,l,r:c};f!=s-1;)l=r[r[p].f>r[d].f?d++:p++],c=r[d!=f&&r[p].f>r[d].f?d++:p++],r[f++]={s:-1,f:l.f+c.f,l,r:c};var m=i[0].s;for(n=1;s>n;++n)i[n].s>m&&(m=i[n].s);var g=new Js(m+1),y=tj(r[f-1],g,0);if(y>e){n=0;var x=0,w=y-e,_=1<<w;for(i.sort(function(j,T){return g[T.s]-g[j.s]||j.f-T.f});s>n;++n){var S=i[n].s;if(e>=g[S])break;x+=_-(1<<y-g[S]),g[S]=e}for(x>>>=w;x>0;){var k=i[n].s;e>g[k]?x-=1<<e-g[k]++-1:++n}for(;n>=0&&x;--n){var N=i[n].s;g[N]==e&&(--g[N],++x)}y=e}return[new qi(g),y]},tj=function(t,e,r){return t.s==-1?Math.max(tj(t.l,e,r+1),tj(t.r,e,r+1)):e[t.s]=r},m6=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new Js(++e),n=0,s=t[0],i=1,a=function(c){r[n++]=c},l=1;e>=l;++l)if(t[l]==s&&l!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(s),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(s);i=1,s=t[l]}return[r.subarray(0,n),e]},gm=function(t,e){for(var r=0,n=0;e.length>n;++n)r+=t[n]*e[n];return r},rj=function(t,e,r){var n=r.length,s=SY(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var i=0;n>i;++i)t[s+i+4]=r[i];return 8*(s+4+n)},g6=function(t,e,r,n,s,i,a,l,c,d,f){qo(e,f++,r),++s[256];for(var p=jE(s,15),m=p[0],g=p[1],y=jE(i,15),x=y[0],w=y[1],_=m6(m),S=_[0],k=_[1],N=m6(x),j=N[0],T=N[1],D=new Js(19),I=0;S.length>I;++I)D[31&S[I]]++;for(I=0;j.length>I;++I)D[31&j[I]]++;for(var L=jE(D,7),$=L[0],Q=L[1],M=19;M>4&&!$[f6[M-1]];--M);var z,R,B,V,F=d+5<<3,K=gm(s,ad)+gm(i,L_)+a,Y=gm(s,m)+gm(i,x)+a+14+3*M+gm(D,$)+(2*D[16]+3*D[17]+7*D[18]);if(K>=F&&Y>=F)return rj(e,f,t.subarray(c,c+d));if(qo(e,f,1+(K>Y)),f+=2,K>Y){z=dg(m,g),R=m,B=dg(x,w),V=x;var O=dg($,Q);for(qo(e,f,k-257),qo(e,f+5,T-1),qo(e,f+10,M-4),f+=14,I=0;M>I;++I)qo(e,f+3*I,$[f6[I]]);f+=3*M;for(var H=[S,j],G=0;2>G;++G){var q=H[G];for(I=0;q.length>I;++I)qo(e,f,O[J=31&q[I]]),f+=$[J],J>15&&(qo(e,f,q[I]>>>5&127),f+=q[I]>>>12)}}else z=LPe,R=ad,B=$Pe,V=L_;for(I=0;l>I;++I)if(n[I]>255){var J;mm(e,f,z[257+(J=n[I]>>>18&31)]),f+=R[J+257],J>7&&(qo(e,f,n[I]>>>23&31),f+=DR[J]);var te=31&n[I];mm(e,f,B[te]),f+=V[te],te>3&&(mm(e,f,n[I]>>>5&8191),f+=OR[te])}else mm(e,f,z[n[I]]),f+=R[n[I]];return mm(e,f,z[256]),f+R[256]},BPe=new hf([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),FPe=function(){for(var t=new hf(256),e=0;256>e;++e){for(var r=e,n=9;--n;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),TE=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8};function zPe(t,e){e===void 0&&(e={});var r=function(){var p=4294967295;return{p(m){for(var g=p,y=0;m.length>y;++y)g=FPe[255&g^m[y]]^g>>>8;p=g},d(){return 4294967295^p}}}(),n=t.length;r.p(t);var s,i,a,l,c,d=(l=10+((s=e).filename&&s.filename.length+1||0),c=8,function(p,m,g,y,x,w){var _=p.length,S=new qi(y+_+5*(1+Math.floor(_/7e3))+x),k=S.subarray(y,S.length-x),N=0;if(!m||8>_)for(var j=0;_>=j;j+=65535){var T=j+65535;_>T?N=rj(k,N,p.subarray(j,T)):(k[j]=w,N=rj(k,N,p.subarray(j,_)))}else{for(var D=BPe[m-1],I=D>>>13,L=8191&D,$=(1<<g)-1,Q=new Js(32768),M=new Js($+1),z=Math.ceil(g/3),R=2*z,B=function(Ae){return(p[Ae]^p[Ae+1]<<z^p[Ae+2]<<R)&$},V=new hf(25e3),F=new Js(288),K=new Js(32),Y=0,O=0,H=(j=0,0),G=0,q=0;_>j;++j){var J=B(j),te=32767&j,ve=M[J];if(Q[te]=ve,M[J]=te,j>=G){var he=_-j;if((Y>7e3||H>24576)&&he>423){N=g6(p,k,0,V,F,K,O,H,q,j-q,N),H=Y=O=0,q=j;for(var xe=0;286>xe;++xe)F[xe]=0;for(xe=0;30>xe;++xe)K[xe]=0}var ke=2,Oe=0,He=L,Ye=te-ve&32767;if(he>2&&J==B(j-Ye))for(var lt=Math.min(I,he)-1,P=Math.min(32767,j),ne=Math.min(258,he);P>=Ye&&--He&&te!=ve;){if(p[j+ke]==p[j+ke-Ye]){for(var X=0;ne>X&&p[j+X]==p[j+X-Ye];++X);if(X>ke){if(ke=X,Oe=Ye,X>lt)break;var W=Math.min(Ye,X-2),Z=0;for(xe=0;W>xe;++xe){var re=j-Ye+xe+32768&32767,ae=re-Q[re]+32768&32767;ae>Z&&(Z=ae,ve=re)}}}Ye+=(te=ve)-(ve=Q[te])+32768&32767}if(Oe){V[H++]=268435456|ej[ke]<<18|p6[Oe];var fe=31&ej[ke],oe=31&p6[Oe];O+=DR[fe]+OR[oe],++F[257+fe],++K[oe],G=j+ke,++Y}else V[H++]=p[j],++F[p[j]]}}N=g6(p,k,w,V,F,K,O,H,q,j-q,N)}return kY(S,0,y+SY(N)+x)}(i=t,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+a.mem,l,c,!0)),f=d.length;return function(p,m){var g=m.filename;if(p[0]=31,p[1]=139,p[2]=8,p[8]=2>m.level?4:m.level==9?2:0,p[9]=3,m.mtime!=0&&TE(p,4,Math.floor(new Date(m.mtime||Date.now())/1e3)),g){p[3]=8;for(var y=0;g.length>=y;++y)p[y+10]=g.charCodeAt(y)}}(d,e),TE(d,f-8,r.d()),TE(d,f-4,n),d}const UPe=!!mR||!!Vg,EY=new WeakMap,CY="text/plain";let AE=0,O0=!1;const NY=(t,e)=>{const[r,n]=t.split("#"),[s,i]=r.split("?");if(!i)return t;const a=i.split("&").filter(l=>l.split("=")[0]!==e).join("&");return`${s}${a?`?${a}`:""}${n?`#${n}`:""}`},Dv=(t,e,r=!0)=>{var n;const[s,i]=t.split("?"),a=ie({},e),l=(n=i==null?void 0:i.split("&").map(d=>{var f;const[p,m]=d.split("="),g=r&&(f=a[p])!==null&&f!==void 0?f:m;return delete a[p],`${p}=${g}`}))!==null&&n!==void 0?n:[],c=function(d,f="&"){let p,m;const g=[];return Xt(d,function(y,x){Se(y)||Se(x)||x==="undefined"||(p=encodeURIComponent((w=>w instanceof File)(y)?y.name:y.toString()),m=encodeURIComponent(x),g[g.length]=m+"="+p)}),g.join(f)}(a);return c&&l.push(c),l.length>0?`${s}?${l.join("&")}`:s},RE=t=>{if(t.sl)return t.sl;const{data:e,compression:r}=t;if(!e)return;if(r===mi.GZipJS){const s=zPe(function(i){var a=i.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(i);for(var l=new qi(i.length+(i.length>>>1)),c=0,d=function(g){l[c++]=g},f=0;a>f;++f){if(c+5>l.length){var p=new qi(c+8+(a-f<<1));p.set(l),l=p}var m=i.charCodeAt(f);128>m?d(m):2048>m?(d(192|m>>>6),d(128|63&m)):m>55295&&57344>m?(d(240|(m=65536+(1047552&m)|1023&i.charCodeAt(++f))>>>18),d(128|m>>>12&63),d(128|m>>>6&63),d(128|63&m)):(d(224|m>>>12),d(128|m>>>6&63),d(128|63&m))}return kY(l,0,c)}(Dh(e)),{mtime:0});return{contentType:CY,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(r===mi.Base64){const s=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(l,c)=>String.fromCharCode(parseInt(c,16))))}(Dh(e)),i=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Dh(a)))(s);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=Dh(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},jY=t=>{const e=()=>t.transport==="sendBeacon"?{url:Dv(t.url,{compression:mi.Base64}),encodedBody:RE(ie(ie({},t),{},{compression:mi.Base64,sl:void 0}))}:{url:NY(t.url,"compression"),encodedBody:RE(ie(ie({},t),{},{compression:void 0,sl:void 0}))};let r;try{r=RE(t)}catch(s){if(I$(t.compression,uf(t.url,"compression")))return ze.error("Failed to gzip request body, sending uncompressed payload",s),e();throw s}return r&&I$(t.compression,uf(t.url,"compression"))&&!((n=r.body)instanceof ArrayBuffer?L2(new Uint8Array(n)):ArrayBuffer.isView(n)&&L2(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(O0=!0,e()):{url:t.url,encodedBody:r};var n},TY=t=>{try{return jY(t)}catch(r){var e;return ze.error(r),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:r}))}},VPe=function(){var t=xr(function*(e){const r=yield function(s){return $2.apply(this,arguments)}(Dh(e.data),xn.DEBUG,{rethrow:!0});if(!r)return e;const n=yield r.arrayBuffer();return ie(ie({},e),{},{sl:{contentType:CY,body:n,estimatedSize:n.byteLength}})});return function(e){return t.apply(this,arguments)}}(),HPe=/Failed to fetch|NetworkError|Load failed/i,AY=t=>(t==null?void 0:t.name)==="TypeError"&&HPe.test((t==null?void 0:t.message)||""),RY=t=>{try{const e=function(r,n=Date.now()){if(typeof r!="string"||!r)return;const s=r.trim(),i=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(i)){const c=1e3*Math.min(Number(i),300);return c>0?c:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(i))return;const a=/^\w{3} \w{3} /.test(i)?i+" GMT":i,l=Date.parse(a)-n;return Number.isFinite(l)&&l>0?Math.min(l,A0):void 0}(t());return Se(e)?void 0:Math.min(e,3e4)}catch{return}},DY=t=>{const e=TY(t);if(!e)return;const r=new mR;EY.set(r,!0);const{url:n,encodedBody:s}=e;r.open(t.method||"GET",n,!0);const{contentType:i,body:a}=s??{};Xt(t.headers,function(l,c){r.setRequestHeader(c,l)}),i&&r.setRequestHeader("Content-Type",i),t.timeout&&(r.timeout=t.timeout),r.onreadystatechange=()=>{if(r.readyState===4){var l;const c={statusCode:r.status,text:r.responseText};if(r.status===200)try{c.json=JSON.parse(r.responseText)}catch{}(l=t.callback)===null||l===void 0||l.call(t,c,RY(()=>r.getResponseHeader("Retry-After")))}},r.send(a)},OY=t=>{const e=TY(t);if(!e)return;const{url:r,encodedBody:n}=e,{contentType:s,body:i,estimatedSize:a}=n??{},l=new Headers;Xt(t.headers,function(y,x){l.append(x,y)}),s&&l.append("Content-Type",s);let c=null,d=!1;if(b$){const y=new b$;c={signal:y.signal,timeout:setTimeout(()=>{d=!0;try{y.abort(hK("AbortError","PostHog request timed out"+((x=t.timeout)?` after ${x}ms`:"")))}catch(w){p(w)}var x},t.timeout)}}let f=!1;const p=y=>{var x;f||(f=!0,d&&(y==null?void 0:y.name)==="AbortError"||AY(y)?ze.warn(y):ze.error(y),(x=t.callback)===null||x===void 0||x.call(t,{statusCode:0,error:y}))};let m=0;const g=()=>{AE-=m,m=0,c&&clearTimeout(c.timeout)};try{const y=ie({method:(t==null?void 0:t.method)||"GET",headers:l,referrerPolicy:"strict-origin",body:i,signal:c==null?void 0:c.signal},t.fetchOptions),x=a??(Se(i)?0:void 0);y.keepalive=y.method==="POST"&&!t.rl&&y.keepalive!==!1&&y.body===i&&!Se(x)&&x>=0&&52428.8>AE+x,y.keepalive&&(m=x,AE+=m),Vg(r,y).then(w=>w.text().then(_=>{var S;if(f)return;const k={statusCode:w.status,text:_};if(w.status===200)try{k.json=JSON.parse(_)}catch(N){ze.error(N)}f=!0,g(),(S=t.callback)===null||S===void 0||S.call(t,k,RY(()=>w.headers.get("Retry-After")))})).catch(w=>{g(),p(w)}).finally(g)}catch(y){g(),p(y)}},nj=t=>{try{var e;const{url:r,encodedBody:n}=jY(t),{contentType:s,body:i,estimatedSize:a}=n??{};if(!i)return;const l=i instanceof Blob?i:new Blob([i],{type:s});if(Tn.sendBeacon(r,l))return;const c=ut(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(ut(c)&&c.length>1&&(a??0)>16384){const d=Math.ceil(c.length/2),f=p=>ut(t.data)?p:ie(ie({},t.data),{},{batch:p});return nj(ie(ie({},t),{},{data:f(c.slice(0,d))})),void nj(ie(ie({},t),{},{data:f(c.slice(d))}))}ze.warn(`Beacon of ~${a??0} bytes was rejected by the browser, falling back to ${Vg?"fetch":"XHR"}`),Vg?OY(ie(ie({},t),{},{rl:!0})):DY(t)}catch(r){ze.warn("Beacon send failed",r)}},v6=(t,e,r,n)=>{const s=n==="query"?e==="POST"?"sent_at":"_":void 0;return Dv(r===mi.GZipJS?NY(t,"compression"):t,ie(ie({},s?{[s]:Date.now().toString()}:{}),r===mi.GZipJS?{}:{compression:r}))},qPe=(()=>{const t=[];return Vg&&t.push({transport:"fetch",method:OY}),mR&&t.push({transport:"XHR",method:DY}),Tn!=null&&Tn.sendBeacon&&t.push({transport:"sendBeacon",method:nj}),t})();let PY=!UPe&&(Ms==null?void 0:Ms.indexOf("MSIE"))===-1&&(Ms==null?void 0:Ms.indexOf("Mozilla"))===-1;function MY(t,e,r){var n,s,i;r&&(e=ie(ie({},e),{},{callback:a=>r(a)})),t.__loaded?PY?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&((s=e.callback)===null||s===void 0||s.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=ie(ie({},t.config.request_headers),e.headers),e.compression=e.compression==="best-available"?(n=t.compression)!==null&&n!==void 0?n:e.compressionFallback:e.compression,(Se(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((a,l)=>{var c,d,f;const p=ie(ie({},a),{},{callback:l??(w=>{var _;return(_=a.callback)===null||_===void 0?void 0:_.call(a,w)})});p.timeout=p.timeout||6e4;const m=(c=p.transport)!==null&&c!==void 0?c:"fetch";m==="sendBeacon"&&Se(p.compression)&&p.data&&(p.compression=mi.Base64),p.method==="POST"&&p.data&&(p.timestampMode==="capture-body"?p.data=(w=>{var _,S;const k=(ut(w)?w:[w]).map(j=>ie(ie({},j),j.timestamp instanceof Date&&!isNaN(j.timestamp.getTime())?{timestamp:j.timestamp.toISOString()}:{})),N=k[0];return{api_key:(_=N==null||(S=N.properties)===null||S===void 0?void 0:S.token)!==null&&_!==void 0?_:N==null?void 0:N.token,batch:k,sent_at:new Date().toISOString()}})(p.data):p.timestampMode==="body"&&(p.data=((w,_=new Date().toISOString())=>ut(w)?w.map(S=>ie(ie({},S),{},{sent_at:_})):ie(ie({},w),{},{sent_at:_}))(p.data))),p.url=v6(p.url,p.method,p.compression,p.timestampMode);const g=qPe.filter(w=>!p.disableTransport||!w.transport||!p.disableTransport.includes(w.transport)),y=(d=(f=function(w,_){for(let S=0;w.length>S;S++)if(_(w[S]))return w[S]}(g,w=>w.transport===m))===null||f===void 0?void 0:f.method)!==null&&d!==void 0?d:g[0].method;if(!y)throw new Error("No available transport method");const x=w=>{try{y(w)}catch(S){var _;AY(S)?ze.warn(S):ze.error(S),(_=p.callback)===null||_===void 0||_.call(p,{statusCode:0,error:S})}};m!=="sendBeacon"&&!p.preferSyncCompression&&p.data&&p.compression===mi.GZipJS&&jDe&&typeof Promise<"u"&&!O0?VPe(p).then(w=>{x(w)}).catch(w=>{if(L$(w))return O0=!0,void x(ie(ie({},p),{},{compression:void 0,url:v6(a.url,a.method,void 0,a.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const S="name"in _?String(_.name):"";return L$(_)||S===xK})(w)&&(O0=!0),x(p)}):x(p)})(e,(a,l)=>{var c,d,f;t.rateLimiter.checkForLimiting(a),400>a.statusCode||(c=(d=t.config).on_request_error)===null||c===void 0||c.call(d,a),r?r(a,l):(f=e.callback)===null||f===void 0||f.call(e,a)})):e.fireCallbackOnDrop&&((i=e.callback)===null||i===void 0||i.call(e,{statusCode:0}))}var WPe=class{constructor(t,e){this.ol=!0,this.al=[],this.ll=oo((e==null?void 0:e.flush_interval_ms)||3e3,250,5e3,ze.createLogger("flush interval"),3e3),this.ul=t}enqueue(t){this.al.push(t),this.hl||this.cl()}unload(){this.dl();const t=this.al.length>0?this.vl():{},e=Object.values(t);[...e.filter(r=>r.url.indexOf("/e")===0),...e.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.fl(r,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const t=this.vl();for(const e in t)this.fl(t[e])}},this.ll))}fl(t,e){try{this.ul(t,e)}catch(r){ze.error(r)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const t={};return Xt(this.al,e=>{var r;const n=e,s=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");Se(t[s])&&(t[s]=ie(ie({},n),{},{data:[]})),(r=t[s].data)===null||r===void 0||r.push(n.data)}),this.al=[],t}};const GPe=["retriesPerformedSoFar"];var KPe=class{constructor(t){this._instance=t,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Se(me)&&"onLine"in me.navigator){if(this.ml=me.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},Gt(me,"online",this.yl),Gt(me,"offline",this._l)}}get length(){return this.al.length}retriableRequest(t,e){let{retriesPerformedSoFar:r}=t,n=_K(t,GPe);Go(r)&&(n.url=Dv(n.url,{retry_count:r})),MY(this._instance,e?ie(ie({},n),{},{transport:e}):n,(s,i)=>{var a;if(s.statusCode!==200&&(400>s.statusCode||s.statusCode>=500)){if((s.statusCode===0?3:10)>(r??0))return void this.Ls(ie({retriesPerformedSoFar:r},n),i);s.statusCode===0&&ze.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${r??0} retries.`)}(a=n.callback)===null||a===void 0||a.call(n,s)})}Ls(t,e){const r=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=r+1;const n=Math.max(function(a){const l=3e3*Math.pow(2,a),c=l/2,d=Math.min(18e5,l),f=(Math.random()-.5)*(d-c);return Math.ceil(d+f)}(r),e??0),s=Date.now()+n;this.al.push({retryAt:s,requestOptions:t});let i=`Enqueued failed request for retry in ${n}`;navigator.onLine||(i+=" (Browser is offline)"),ze.warn(i),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){const t=Date.now(),e=[],r=this.al.filter(n=>t>n.retryAt||(e.push(n),!1));if(this.al=e,r.length>0)for(const{requestOptions:n}of r)this.retriableRequest(n)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,Se(me)||(this.yl&&(me.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(me.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:t}of this.al)try{this._instance._send_request(ie(ie({},t),{},{transport:"sendBeacon"}))}catch(e){ze.error(e)}this.al=[]}},YPe=class{constructor(t){this._instance=t,this.Sl=()=>{var e,r,n,s;this.xl||(this.xl={});const i=this.scrollElement(),a=this.scrollY(),l=i?Math.max(0,i.scrollHeight-i.clientHeight):0,c=a+((i==null?void 0:i.clientHeight)||0),d=(i==null?void 0:i.scrollHeight)||0;this.xl.lastScrollY=Math.ceil(a),this.xl.maxScrollY=Math.max(a,(e=this.xl.maxScrollY)!==null&&e!==void 0?e:0),this.xl.maxScrollHeight=Math.max(l,(r=this.xl.maxScrollHeight)!==null&&r!==void 0?r:0),this.xl.lastContentY=c,this.xl.maxContentY=Math.max(c,(n=this.xl.maxContentY)!==null&&n!==void 0?n:0),this.xl.maxContentHeight=Math.max(d,(s=this.xl.maxContentHeight)!==null&&s!==void 0?s:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const t=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),t}startMeasuringScrollPosition(){Gt(me,"scroll",this.Sl,{capture:!0}),Gt(me,"scrollend",this.Sl,{capture:!0}),Gt(me,"resize",this.Sl)}scrollElement(){if(this.Cl){const r=ut(this.Cl)?this.Cl:[this.Cl];for(const n of r){var t;const s=me==null||(t=me.document)===null||t===void 0?void 0:t.querySelector(n);if(s)return s}return}var e;return me==null||(e=me.document)===null||e===void 0?void 0:e.documentElement}$l(t){var e,r;const n=t==="y"?"scrollTop":"scrollLeft";if(this.Cl){const s=this.scrollElement();return s&&s[n]||0}return me?t==="y"?me.scrollY||me.pageYOffset||((e=me.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.scrollTop)||0:me.scrollX||me.pageXOffset||((r=me.document)===null||r===void 0||(r=r.documentElement)===null||r===void 0?void 0:r.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const QPe=t=>mY(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties,t==null?void 0:t.config.disable_capture_url_hashes);var y6=class{constructor(t,e,r,n){this.Be=s=>{const i=this.Tl();if(i&&i.sessionId===s)return;const a={sessionId:s,props:this.Il(this._instance)};this.Ml.register({[G2]:a})},this._instance=t,this.El=e,this.Ml=r,this.Il=n||QPe,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[G2]}getSetOnceProps(){var t;const e=(t=this.Tl())===null||t===void 0?void 0:t.props;return e?"r"in e?gY(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Xt(NR(this.getSetOnceProps()),(e,r)=>{r==="$current_url"&&(r="url"),t[`$session_entry_${R2(r)}`]=e}),t}},$_=class{on(t,e){return this.Pl[t]||(this.Pl[t]=[]),this.Pl[t].push(e),()=>{this.Pl[t]=this.Pl[t].filter(r=>r!==e)}}emit(t,e){for(const r of this.Pl[t]||[])r(e);for(const r of this.Pl["*"]||[])r(t,e)}constructor(){this.Pl={}}};const uh=Mr("[SessionId]"),x6=864e5;var _6=class{on(t,e){return this.Rl.on(t,e)}constructor(t,e,r){var n;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new $_,this.Nl=(i,a)=>!(!Go(i)||!Go(a))&&Math.abs(i-a)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=t.config,this.Ml=t.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=e||ma,this.Bl=r||ma;const s=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*oo(this.Rr.session_idle_timeout_seconds||1800,60,36e3,uh.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+s+"_window_id",this.Ul="ph_"+s+"_primary_window_exists",this.Wl()){const i=cr.Dt(this.zl),a=cr.Dt(this.Ul);i&&!a?this.He=i:cr.Lt(this.zl),cr.At(this.Ul,!0)}!((n=this.Rr.bootstrap)===null||n===void 0)&&n.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Se(this.Ol)&&(this.Ol=[]),this.Ol.push(t),this.Xt&&t(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(e=>e!==t)}}Wl(){return this.Rr.persistence!=="memory"&&!this.Ml.mi&&cr.Et()}Gl(t){t!==this.He&&(this.He=t,this.Wl()&&cr.At(this.zl,t))}Zl(){return this.He?this.He:this.Wl()?cr.Dt(this.zl):null}Ql(t){const e=this.Al;return!Or(e)&&!Or(t)&&5e3>Math.abs(t-e)}Jl(t,e,r){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ql(e)||(this.Al=e,this.Ml.register({[Th]:[e,t,r]}))}Kl(){var t;const e=(t=this.Rr)===null||t===void 0?void 0:t.persistence_save_debounce_ms;return Go(e)&&e>0}Xl(){this.Kl()?this.Ml.refreshKey(Th):(this.Ml.flush(),this.Ml.load())}Yl(){var t;if(Or(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,e,r]=this.tu();e===this.Xt&&r===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[Th]:[this._sessionActivityTimestamp,(t=this.Xt)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[t]=this.tu(),e=Go(t)?t:0,r=Go(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,r)}iu(t){return this.Xl(),this.Nl(t,this.eu())}tu(){const t=this.Ml.props[Th];return ut(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(t,e=!1){const r=((n,s=new Date().getTime())=>{try{const i=(a=>{const l=a.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(n);return i>s+6e4?void uh.error("Bootstrap sessionID cannot be in the future"):i}catch(i){return void uh.error("Invalid sessionID in bootstrap",i)}})(t);return!Se(r)&&(e?this.ql={sessionId:t,sessionStartTimestamp:r}:this.Jl(t,new Date().getTime(),r),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&me&&(me.removeEventListener(O_,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&cr.Lt(this.Ul)},Gt(me,O_,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,r=!1){if(this.Rr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||new Date().getTime(),s=this.Xt;if(r)this.Fl=n;else if(Or(this.Fl)||this.Fl>n||n-this.Fl>=1e3){var i,a;(i=(a=this.Ml).syncCookieProperties)===null||i===void 0||i.call(a),this.Fl=n}let[,l,c]=this.tu();const d=!Se(s)&&l!==s,f=this.eu();let p=this.Zl();const m=this.ql,g=!!m&&(m.sessionStartTimestamp>n+6e4||n-m.sessionStartTimestamp>x6),y=m?g:Go(c)&&Math.abs(n-c)>x6;let x=!1,w=d,_=!l||!!m;const S=l;let k=!_&&!t&&this.Nl(n,f);if(k&&(k=this.iu(n),k||uh.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,c]=this.tu(),k||(_=!l||!!m)),_||k||y){w=!1;const D=m&&!g;l=D?m.sessionId:this.jl(),p=this.Bl(),uh.info("new session ID assigned",{sessionId:l,windowId:p,bootstrapped:!!D,changeReason:{noSessionId:_,activityTimeout:k,sessionPastMaximumLength:y}}),c=D?m.sessionStartTimestamp:n,this.ql=void 0,x=!0}else p||(p=this.Bl(),x=!0),w=w||l!==S,w&&(uh.info("adopted cross-tab session id",{sessionId:l,windowId:p}),x=!0);const N=Go(f)&&t&&!y?f:n,j=Go(c)?c:new Date().getTime();this.Gl(p),this.Jl(l,N,j),t||this.Hl();const T={noSessionId:_,activityTimeout:k,sessionPastMaximumLength:y,crossTabAdoption:w};return x&&this.Ol.forEach(D=>D(l,p,T)),{sessionId:l,windowId:p,sessionStartTimestamp:j,changeReason:x?T:void 0,lastActivityTimestamp:f}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu(new Date().getTime())){const t=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:t})}else this.Hl()},1.1*this.sessionTimeoutMs))}};const IY=function(t,e){if(!t)return!1;const r=t.userAgent;if(r&&S$(r,e))return!0;try{const n=t==null?void 0:t.userAgentData;if(n!=null&&n.brands&&n.brands.some(s=>S$(s==null?void 0:s.brand,e)))return!0}catch{}return!!t.webdriver};function LY(){return(LY=xr(function*(){const t=Tn==null?void 0:Tn.userAgentData;if(t!=null&&t.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),r=e==null?void 0:e.model;return St(r)&&r.length>0?r:void 0}catch(e){return void ze.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function XPe(t,e){let r=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(r=`$survey_${e}/${t.id}/${t.current_iteration}`),r}function $Y(t){var e;return!!(!((e=t.conditions)===null||e===void 0||(e=e.events)===null||e===void 0||(e=e.values)===null||e===void 0)&&e.length)}const B_=(t,e)=>{if(!(r=>{try{new RegExp(r)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}},qx=t=>t.toLowerCase(),BY={exact:(t,e)=>e.some(r=>t.some(n=>r===n)),is_not:(t,e)=>e.every(r=>t.every(n=>r!==n)),regex:(t,e)=>e.some(r=>t.some(n=>B_(r,n))),not_regex:(t,e)=>e.every(r=>t.every(n=>!B_(r,n))),icontains:(t,e)=>e.map(qx).some(r=>t.map(qx).some(n=>r.includes(n))),not_icontains:(t,e)=>e.map(qx).every(r=>t.map(qx).every(n=>!r.includes(n))),gt:(t,e)=>e.some(r=>{const n=parseFloat(r);return!isNaN(n)&&t.some(s=>n>parseFloat(s))}),lt:(t,e)=>e.some(r=>{const n=parseFloat(r);return!isNaN(n)&&t.some(s=>n<parseFloat(s))})};function FY(t,e){return!t||Object.entries(t).every(([r,n])=>{const s=e==null?void 0:e[r];if(s==null)return!1;const i=BY[n.operator];return!!i&&i(n.values.map(String),[String(s)])})}function DE(t,e,r){return Dh({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:r})}const sj="custom",b6="i.posthog.com",ZPe=/^\/static\//,JPe=["/s/","/e/","/i/"];var eMe=class{constructor(t){this.su={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=(t=this.instance.config.ui_host)===null||t===void 0?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${b6}`,".posthog.com")),e==="https://app.posthog.com"?"https://us.posthog.com":e}get region(){return this.su[this.apiHost]||(this.su[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":sj),this.su[this.apiHost]}ru(t){if(!ZPe.test(t))return;const e=this.instance.config.asset_host;return typeof e=="string"&&e.trim().replace(/\/$/,"")||void 0}ou(t){const e=pl(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}au(t,e,r){if(t==="ui")return r;let n=r;const s=this.instance.config.rewriteRequestPath;if(s){var i;const a=((i=pl(r))===null||i===void 0?void 0:i.href)||r;n=s(new URL(a)).toString()}if(s&&t==="api"&&JPe.some(a=>e.indexOf(a)===0)){const a=this.ou(n);if(a){const l=this.apiHost;let c=this.lu;(c==null?void 0:c.apiHost)===l&&c.rewriteRequestPath===s||(c={apiHost:l,rewriteRequestPath:s,urls:new Set},this.lu=c),c.urls.add(a)}}return n}isIngestionEndpoint(t){const e=this.lu,r=this.ou(t);return(e==null?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&e.urls.has(r)}endpointFor(t,e=""){if(e&&(e=e[0]==="/"?e:`/${e}`),t==="ui")return this.au(t,e,this.uiHost+e);if(t==="flags")return this.au(t,e,this.flagsApiHost+e);if(t==="assets"){const n=this.ru(e);if(n)return this.au(t,e,`${n}${e}`)}if(this.region===sj)return this.au(t,e,this.apiHost+e);const r=b6+e;switch(t){case"assets":return this.au(t,e,`https://${this.region}-assets.${r}`);case"api":return this.au(t,e,`https://${this.region}.${r}`)}}};const Yt=Mr("[Surveys]"),zY=t=>{try{const e=(r=>((n,s)=>`seenSurvey_${function(i){return i.current_iteration&&i.current_iteration>0?`${i.id}_${i.current_iteration}`:i.id}(s)}`)(0,r))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){Yt.error("Failed to persist survey seen state",e)}},tMe=[CE.Popover,CE.Widget,CE.API],rMe={ignoreConditions:!1,ignoreDelay:!1,displayType:J2.Popover},nMe=Mr("[PostHog ExternalIntegrations]"),sMe={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var iMe=class{constructor(t){this._instance=t}zo(t,e){var r,n;(r=rt.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,t,s=>{if(s)return nMe.error("failed to load script",s);e()})}startIfEnabledOrStop(){var t;for(const[s,i]of Object.entries((t=this._instance.config.integrations)!==null&&t!==void 0?t:{})){var e,r,n;i&&!(!((e=rt.__PosthogExtensions__)===null||e===void 0||(e=e.integrations)===null||e===void 0)&&e[s])&&this.zo(sMe[s],()=>{var a;(a=rt.__PosthogExtensions__)===null||a===void 0||(a=a.integrations)===null||a===void 0||(a=a[s])===null||a===void 0||a.start(this._instance)}),!i&&(!((r=rt.__PosthogExtensions__)===null||r===void 0||(r=r.integrations)===null||r===void 0)&&r[s])&&((n=rt.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0||(n=n[s])===null||n===void 0||n.stop())}}},aMe=class{constructor(t,e){this.$=t,this.wo=e,this.uu=new Map,this.Io=!1}add(t){var e=this;return xr(function*(){if(e.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.uu.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.uu.set(t.name,t);try{const r=t.setup(e.wo);r&&(yield r)}catch(r){const n=e.uu.get(t.name)===t;n&&e.uu.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,r),n&&e.hu(t)}})()}getExtension(t){return this.uu.get(t)}dispose(){if(this.Io)return;this.Io=!0;const t=Array.from(this.uu.values()).reverse();this.uu.clear();for(const e of t)this.hu(e)}hu(t){try{var e;const r=(e=t.dispose)===null||e===void 0?void 0:e.call(t);r&&jn(r.then)&&r.then(void 0,n=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,n)})}catch(r){this.$.error(`Failed to dispose browser extension "${t.name}"`,r)}}},oMe=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if(typeof t=="string")return e==null?void 0:e.get_property(t);const r={};for(const n of t){const s=e==null?void 0:e.get_property(n);Se(s)||(r[n]=s)}return r}set(t,e){var r;(r=this._instance.persistence)===null||r===void 0||r.register(typeof t=="string"?{[t]:e}:t)}remove(t){var e;(e=this._instance.persistence)===null||e===void 0||e.unregister(t)}};const w6="extensionsRemoteConfig";var lMe=class{constructor(t){this.instance=t,this.Io=!1,this.$=ze,this.cu=t.du,this.kv=new oMe(t),this.onEvent=e=>Hx(this.instance.on("eventCaptured",r=>{try{e({event:r.event,properties:r.properties})}catch(n){this.$.error("Browser extension event listener failed",n)}})),this.onRemoteConfig=e=>{if(this.Io)return Hx(()=>{});const r=s=>{try{e(s)}catch(i){this.$.error("Browser extension remote config listener failed",i)}},n=this.instance.vu.on(w6,r);return this.cu&&r(this.cu),Hx(n)},this.fu=new aMe(ze.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property("$device_id"))!==null&&t!==void 0?t:this.distinctId}get deviceId(){const t=this.instance.get_property(bR);return typeof t=="string"?t:void 0}get library(){return{name:xn.LIB_NAME,version:xn.LIB_VERSION}}get initialPersonProperties(){var t,e;return(t=(e=this.instance.persistence)===null||e===void 0?void 0:e.get_initial_props())!==null&&t!==void 0?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,r,n;const s=(t=this.instance.sessionManager)===null||t===void 0?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(e=s==null?void 0:s.sessionId)!==null&&e!==void 0?e:"",windowId:(r=s==null?void 0:s.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(n=s==null?void 0:s.sessionStartTimestamp)!==null&&n!==void 0?n:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.fu.add(t)}getExtension(t){return this.fu.getExtension(t)}capture(t,e,r){r?this.instance.capture(t,e,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):this.instance.capture(t,e)}registerDynamicEventProperties(t){return Hx(this.instance.pu(t))}handleRemoteConfig(t){this.Io||(this.cu=t,this.instance.vu.emit(w6,t))}sendRequest(t){var e=this;return xr(function*(r,n={}){var s;const i=e.instance.requestRouter.endpointFor((s=n.target)!==null&&s!==void 0?s:"api",r),a={method:n.method,url:n.query?Dv(i,n.query):i,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:n.target==="flags"&&n.compression==="best-available"?A2.Base64:void 0,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(e.instance._send_request(a),{statusCode:202}):new Promise(l=>{a.callback=l,e.instance._send_request(a)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const hg={};let OE=0;const fg=()=>{},S6='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',vm="Surveys module not available",k6="sanitize_properties is deprecated. Use before_send instead",UY="Invalid value for property_denylist config: ",cMe=/^[A-Za-z0-9_-]{1,400}$/,E6=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,C6=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,uMe=["token","distinct_id",UK],Fm="posthog",dMe=t=>{const e={};return t&&t!=="unset"&&("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0)),e},PE=t=>{var e;return ie({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:uPe(Ce==null?void 0:Ce.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:fg,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Dr&&St(Dr==null?void 0:Dr.search)&&Dr.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(me==null||(e=me.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(r){ze.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:GK,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:fg},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:yPe,ignore_text_selection:!0}:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:dMe(r),external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:r&&r>="2026-05-30"?250:0,split_storage:!(!r||"2026-05-30">r),detect_google_search_app:!(!r||"2026-05-30">r),disable_capture_url_hashes:!(!r||"2026-06-25">r),cookieWinsOnConflict:!(!r||r==="unset"||"2026-08-29">r)}))(t))},hMe=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],N6=t=>{const e={};for(const[s,i]of hMe)Se(t[s])||(e[i]=t[s]);const r=pr({},e,t),n=t.__preview_external_dependency_versioned_paths;return Se(n)||(Se(t.strict_script_versioning)&&(r.strict_script_versioning=!!n),St(n)&&Se(t.asset_host)&&(r.asset_host=n)),ut(t.property_blacklist)&&(Se(t.property_denylist)?r.property_denylist=t.property_blacklist:ut(t.property_denylist)?r.property_denylist=[...t.property_blacklist,...t.property_denylist]:ze.error(UY+t.property_denylist)),r};var fMe=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(t){ze.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},pg=class nc{mu(e){if(!e)return;const r=this.uu.indexOf(e);r!==-1&&this.uu.splice(r,1)}yu(e,r){var n;return this.mu(e),this.uu.push(r),(n=r.initialize)===null||n===void 0||n.call(r),r}bu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.ku)return;let r,n,s;e?(r=`persistence is set to '${this.config.persistence}'`,n=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(r="persistence is disabled (disable_persistence is true)",n="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${r} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${n}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}Su(){if(this.bu()||this.get_distinct_id()!=="$posthog_cookieless")return;const e=this.persistence;if(!e)return;this.xu()||e.load(!0);const r=this.get_distinct_id();if(!r||r==="$posthog_cookieless"){const n=this.config.get_device_id(ma());this.register({distinct_id:n,$device_id:n}),e.set_property(Is,Xo)}this.Cu()}get decideEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)===null||r===void 0?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)===null||r===void 0?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.$u=!1,this.Tu=!1,this.webPerformance=new fMe,this.Iu=!1,this.version=xn.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new $_,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=PE(),this.SentryIntegration=CPe,this.sentryIntegration=n=>function(s,i){const a=oY(s,i);return{name:aY,processEvent:l=>a(l)}}(this,n),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new YPe(this),this.pageViewManager=new l6(this),this.rateLimiter=new IPe(this),this.requestRouter=new eMe(this),this.consent=new vPe(this),this.externalIntegrations=new iMe(this);const r=(e=nc.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(n,s,i)=>{const a=St(n)?{[n]:s}:n;this.setPersonProperties(a),i==null||i({})},set_once:(n,s,i)=>{const a=St(n)?{[n]:s}:n;this.setPersonProperties(void 0,a),i==null||i({})}},this.on("eventCaptured",n=>ze.info(`send "${n==null?void 0:n.event}"`,n))}init(e,r,n){if(n&&n!==Fm){var s;const i=(s=hg[n])!==null&&s!==void 0?s:new nc;return i._init(e,r,n),hg[n]=i,hg[Fm][n]=i,i}return this._init(e,r,n)}_init(e,r={},n){var s,i,a;const l=St(e)?e.trim():"";if(!l)return ze.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var c;if(this.__loaded)return l!==((c=this.config)===null||c===void 0?void 0:c.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=PE(r.defaults),r.debug=this.Du(r.debug),this.Lu=r,this.Nu=[],r.person_profiles?this.Fu=r.person_profiles:r.process_person&&(this.Fu=r.process_person);const d=PE(r.defaults),f=N6(r),p=pr({},d,f,{name:n,token:l});Ct(d.rageclick)&&Ct(f.rageclick)&&(p.rageclick=pr({},d.rageclick,f.rageclick)),Ct(d.session_recording)&&Ct(f.session_recording)&&(p.session_recording=pr({},d.session_recording,f.session_recording)),this.set_config(p),this.config.on_xhr_error&&ze.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:mi.GZipJS;const m=this.xu();if(this.persistence=new EE(this.config,m),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new EE(ie(ie({},this.config),{},{persistence:"sessionStorage"}),m,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!m&&cr.Et()){const _=cr.Dt(this.Eu);ut(_)&&_.forEach(S=>{St(S)&&this.Mu.add(S)})}else cr.Lt(this.Eu);const g=ie({},this.persistence.props),y=ie({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new WPe((_,S)=>this.ju(_,S),this.config.request_queue_config),this.Bu=new KPe(this),this.__request_queue=[];const x=this.bu();x||(this.sessionManager=new _6(this),this.sessionPropsManager=new y6(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,S,k)=>{(k!=null&&k.activityTimeout||k!=null&&k.sessionPastMaximumLength||k!=null&&k.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(ze.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(x)},0)):(ze.info("Initializing extensions synchronously"),this.Uu(x)),xn.DEBUG=xn.DEBUG||this.config.debug,xn.DEBUG&&ze.info("Starting in debug mode",{this:this,config:r,thisC:ie({},this.config),p:g,s:y}),this.config.identity_distinct_id&&!(!((s=r.bootstrap)===null||s===void 0)&&s.distinctID)&&(r.bootstrap=ie(ie({},r.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const w=(i=r.bootstrap)===null||i===void 0?void 0:i.distinctID;if(this.ku=!!w&&!ng(w),(a=r.bootstrap)===null||a===void 0?void 0:a.distinctID){const _=r.bootstrap.distinctID,S=this.get_distinct_id(),k=this.persistence.get_property(Is);if(r.bootstrap.isIdentifiedID&&S!=null&&S!==_&&k==="anonymous")this.identify(_);else if(r.bootstrap.isIdentifiedID&&S!=null&&S!==_&&k==="identified")ze.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const N=this.config.get_device_id(ma()),j=r.bootstrap.isIdentifiedID?N:_;this.persistence.set_property(Is,r.bootstrap.isIdentifiedID?R0:Xo),this.register({distinct_id:_,$device_id:j})}}if(x)this.register_once({distinct_id:vE,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(ma());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(Is,Xo)}return Gt(me,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Gt(me,"pageshow",()=>{var _;this.$u=!1,this.Tu||(_=this.Bu)===null||_===void 0||_.resume()}),r.segment?o6(this,()=>this.Wu()):this.Wu(),jn(this.config._onCapture)&&this.config._onCapture!==fg&&(ze.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&ze.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return LY.apply(this,arguments)}().then(_=>{_&&this.register({[gE]:_})}).catch(fg),this}Vu(e){const r=e;return St(r.name)&&jn(r.setup)}Gu(e,r){this.Vu(e)?r.push(()=>{this.Zu().add(e).catch(()=>{var n;return(n=e.dispose)===null||n===void 0?void 0:n.call(e)}).catch(n=>{ze.error(`Failed to dispose browser extension "${e.name}"`,n)})}):this.uu.push(e)}zu(){var e,r,n;const s=(e=(r=this.config.__extensionClasses)===null||r===void 0?void 0:r.featureFlags)!==null&&e!==void 0?e:(n=nc.__defaultExtensionClasses)===null||n===void 0?void 0:n.featureFlags;var i,a,l;s&&(this.featureFlags&&this.featureFlags instanceof s||((i=this.Qu)===null||i===void 0||i.call(this),this.Qu=void 0,this.featureFlags=new s(this)),jn(this.featureFlags.onReloading)&&jn(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(a=(l=this.featureFlags).initialize)===null||a===void 0||a.call(l))}Uu(e){const r=performance.now(),n=ie(ie({},nc.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var i,a,l,c,d,f,p;n.exceptions&&this.uu.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new n.exceptions(this)),n.historyAutocapture&&this.uu.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.uu.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.uu.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!e&&this.uu.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Gu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Gu(this.surveys=(a=this.surveys)!==null&&a!==void 0?a:new n.surveys(this),s),n.logs&&this.Gu(this.logs=(l=this.logs)!==null&&l!==void 0?l:new n.logs(this),s),n.metrics&&this.uu.push(this.metrics=(c=this.metrics)!==null&&c!==void 0?c:new n.metrics(this)),n.conversations&&this.uu.push(this.conversations=(d=this.conversations)!==null&&d!==void 0?d:new n.conversations(this)),n.productTours&&this.uu.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.uu.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.uu.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,EPe)),n.toolbar&&this.uu.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new n.toolbar(this)),n.experiments&&this.uu.push(this.experiments=(p=this.experiments)!==null&&p!==void 0?p:new n.experiments(this)),this.uu.forEach(m=>{m.initialize&&s.push(()=>{var g;(g=m.initialize)===null||g===void 0||g.call(m)})}),s.push(()=>{if(this.Ju){const m=this.Ju;this.Ju=void 0,this.uu.forEach(g=>{var y;return(y=g.onRemoteConfig)===null||y===void 0?void 0:y.call(g,m)})}}),this.Ku(s,r)}Ku(e,r){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&e.length>0)return void setTimeout(()=>{this.Ku(e,r)},0);const s=e.shift();if(s)try{s()}catch(i){ze.error("Error initializing extension:",i)}}const n=Math.round(performance.now()-r);this.register_for_session({[VK]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[HK]:n}),this.config.__preview_deferred_init_extensions&&ze.info(`PostHog extensions initialized (${n}ms)`)}il(e){var r;if(!Ce||!Ce.body)return ze.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.du=e,this.compression=void 0,e.ok){var n;const s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=ht(s.supportedCompression,mi.GZipJS)?mi.GZipJS:ht(s.supportedCompression,mi.Base64)?mi.Base64:void 0),!((n=s.analytics)===null||n===void 0)&&n.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:GK}),(r=this.Xu)===null||r===void 0||r.handleRemoteConfig(e),this.uu.forEach(s=>{var i;return(i=s.onRemoteConfig)===null||i===void 0?void 0:i.call(s,e)})}Wu(){try{this.config.loaded(this)}catch(e){ze.critical("`loaded` function failed",e)}if(this.Yu(),this.config.internal_or_test_user_hostname&&(Dr==null?void 0:Dr.hostname)){const e=Dr.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?e===r:r.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new xY(this),this.eh.load()}Yu(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.qu)===null||e===void 0||e.enable())}_dom_loaded(){this.is_capturing()&&Rh(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,r,n,s,i,a;this.$u=!0,(e=this.surveys)===null||e===void 0||(r=e.handlePageUnload)===null||r===void 0||r.call(e),(n=this.metrics)===null||n===void 0||n.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(q$),(s=this.logs)===null||s===void 0||s.flushLogs("sendBeacon"),(i=this.qu)===null||i===void 0||i.unload(),(a=this.Bu)===null||a===void 0||a.unload()):this.ih()&&this.capture(q$,null,{transport:"sendBeacon"})}_send_request(e){MY(this,e)}ju(e,r){this.Bu?this.Bu.retriableRequest(e,r):this._send_request(r?ie(ie({},e),{},{transport:r}):e)}_execute_array(e){OE++;try{let r;const n=[],s=[],i=[];Rh(e,l=>{if(l)if(r=l[0],ut(r))i.push(l);else if(jn(l))try{l.call(this)}catch(c){ze.error("Error executing queued PostHog call",l,c)}else ut(l)&&r==="alias"?n.push(l):ut(l)&&r.indexOf("capture")!==-1&&jn(this[r])?i.push(l):s.push(l)});const a=function(l,c){Rh(l,function(d){try{if(ut(d[0])){let f=c;Xt(d,function(p){f=f[p[0]].apply(f,p.slice(1))})}else c[d[0]].apply(c,d.slice(1))}catch(f){ze.error("Error executing queued PostHog call",d,f)}})};a(n,this),a(s,this),a(i,this)}finally{OE--}}push(e){if(OE>0&&ut(e)&&St(e[0])){const r=nc.prototype[e[0]];return void(jn(r)&&r.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:V$,persistenceKey:Uh,cookieName:"_fbc",pattern:E6,register:(e,r)=>{var n;return(n=this.persistence)===null||n===void 0?void 0:n.register({[Uh]:{value:e,delivered:r}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(Uh)}}}get sh(){return{property:H$,persistenceKey:ig,cookieName:"_fbp",pattern:C6,register:(e,r)=>{var n;return(n=this.persistence)===null||n===void 0?void 0:n.register({[ig]:{value:e,delivered:r}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(ig)}}}rh(e){var r;const n=(r=this.persistence)===null||r===void 0?void 0:r.get_property(e.persistenceKey);return St(n)&&e.pattern.test(n)?{value:n,delivered:!1}:Ct(n)&&St(n.value)&&e.pattern.test(n.value)?{value:n.value,delivered:n.delivered===!0}:void 0}oh(e,r,n){return r===(n==null?void 0:n.value)?{value:r,pending:!n.delivered}:(e.register(r,!1),{value:r,pending:!0})}ah(e){if(!this.config.save_campaign_params||this.bu())return;const r=lg(e.cookieName);return St(r)&&e.pattern.test(r)?r:void 0}uh(e,r,n,s){if(!this.persistence)return;const i=this.nh;this.persistence.refreshKey(i.persistenceKey);const a=this.rh(i);if(s)return void i.unregister();if(n)return St(r)&&E6.test(r)?this.oh(i,r,a):void i.unregister();const l=St(e)&&cMe.test(e)?e:void 0,c=this.ah(i);return c&&((d,f,p)=>{const m=d.split(".");if(f)return m[3]===f;if(!p)return!0;const g=p.value.split(".");return m[3]===g[3]||Number(m[2])>Number(g[2])})(c,l,a)?this.oh(i,c,a):l?(a==null?void 0:a.value.split(".")[3])===l?{value:a.value,pending:!a.delivered}:this.oh(i,`fb.1.${Date.now()}.${l}`,a):a?{value:a.value,pending:!a.delivered}:void 0}hh(e,r,n){if(!this.persistence)return;const s=this.sh;this.persistence.refreshKey(s.persistenceKey);const i=this.rh(s);if(n)return void s.unregister();if(r)return St(e)&&C6.test(e)?this.oh(s,e,i):void s.unregister();const a=this.ah(s);return a?this.oh(s,a,i):i?{value:i.value,pending:!i.delivered}:void 0}dh(e,r){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const n=this.rh(e);(n==null?void 0:n.value)!==r||n.delivered||e.register(r,!0)}capture(e,r,n){var s,i;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void ze.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Se(e)||!St(e))return void ze.error("No event name provided to posthog.capture");this.Su();const a=!this.config.opt_out_useragent_filter&&this._is_bot();if(a&&!this.config.__preview_capture_bot_pageviews)return;const l=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(l!=null&&l.isRateLimited)return void ze.critical("This capture call is ignored due to client rate limiting.");let c;r!=null&&r.$current_url&&!St(r==null?void 0:r.$current_url)&&(ze.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),e!=="$exception"||n!=null&&n.fh||ze.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const d=new Date,f=(n==null?void 0:n.timestamp)||d,p=N$(n==null?void 0:n.uuid,ma);let m={uuid:p,event:e,properties:this.calculateEventProperties(e,r||{},f,p)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&a&&(m.event="$bot_pageview",m.properties.$browser_type="bot"),l&&(m.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);const g=e==="$feature_flag_called"&&m.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;n!=null&&n.$set&&!g&&(m.$set=n==null?void 0:n.$set);const y=Ct(r==null?void 0:r.$set)?r.$set:void 0,x=ut(r==null?void 0:r.$unset)?r.$unset:[],w=(n==null?void 0:n.$unset)||[],_=R=>{var B;const V=!!(n!=null&&n.$set)&&R in n.$set;return{hasProvided:V||!!y&&R in y,provided:V?n==null||(B=n.$set)===null||B===void 0?void 0:B[R]:y==null?void 0:y[R],unset:x.indexOf(R)!==-1||w.indexOf(R)!==-1}},S=_(V$),k=_(H$),N=[{channel:this.nh,hasProvided:S.hasProvided,update:this.uh(c==null?void 0:c.fbclid,S.provided,S.hasProvided,S.unset)},{channel:this.sh,hasProvided:k.hasProvided,update:this.hh(k.provided,k.hasProvided,k.unset)}];for(const{channel:R,hasProvided:B,update:V}of N)V&&m.properties.$process_person_profile===!0&&V.pending&&!B&&!g&&(m.$set=ie({[R.property]:V.value},m.$set));const j=n==null?void 0:n.$unset;j&&(m.$unset=j);const T=g?void 0:this.ph(n==null?void 0:n.$set_once,e!==W$,e===KK);if(T&&(m.$set_once=T),n!=null&&n._noTruncate||(D=this.config.properties_string_max_length,m=function(R,B){const V=new Set;return function F(K,Y){if(K!==Object(K))return B?B(K):K;if(V.has(K))return;let O;if(V.add(K),ut(K))O=[],Rh(K,H=>{O.push(F(H))});else{const H={};Xt(zf(K)?YK(K):K,(G,q)=>{V.has(G)||(H[q]=F(G))}),O=H}return O}(R)}(m,R=>St(R)?R.slice(0,D):R)),m.timestamp=f,Se(n==null?void 0:n.timestamp)||(m.properties.$event_time_override_provided=!0,m.properties.$event_time_override_system_time=d),g&&(m.properties=((R,B=[])=>{const V={},F=K=>{R[K]!==void 0&&(V[K]=R[K])};return SOe.forEach(F),B.forEach(F),V})(m.properties,uMe)),e===Zo.DISMISSED||e===Zo.SENT){const R=r==null?void 0:r[NE.SURVEY_ID],B=r==null?void 0:r[NE.SURVEY_ITERATION];zY({id:R,current_iteration:B}),m.$set=ie(ie({},m.$set),{},{[XPe({id:R,current_iteration:B},e===Zo.SENT?"responded":"dismissed")]:!0})}else e===Zo.SHOWN&&(m.$set=ie(ie({},m.$set),{},{[NE.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var D;if(e===MPe.SHOWN){const R=r==null?void 0:r[d6.TOUR_TYPE];R&&(m.$set=ie(ie({},m.$set),{},{[`${d6.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const I=ie(ie({},m.properties.$set),m.$set);if(Xs(I)||this.setPersonPropertiesForFlags(I),!vt(this.config.before_send)){const R=this.Os(m);if(!R)return;m=R,m.uuid=N$(m.uuid,ma)}const L=N.filter(({channel:R,update:B})=>{var V,F,K;const Y=(V=(F=m.$set)===null||F===void 0?void 0:F[R.property])!==null&&V!==void 0?V:Ct((K=m.properties)===null||K===void 0?void 0:K.$set)?m.properties.$set[R.property]:void 0;return(B==null?void 0:B.pending)&&Y===B.value});this.vu.emit("eventCaptured",m);const $=(s=n==null?void 0:n._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),Q=(n==null?void 0:n._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test($),M=ie(ie(ie({method:"POST",url:$,data:m,compression:"best-available",preferSyncCompression:n==null?void 0:n.send_instantly,timestampMode:Q?"body":"capture-body",batchKey:n==null?void 0:n._batchKey},Q&&(!((i=m.properties)===null||i===void 0)&&i.$session_id)?{batchGroup:m.properties.$session_id+(m.properties.$window_id?`-${m.properties.$window_id}`:"")}:{}),n!=null&&n.transport?{transport:n.transport}:{}),L.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:B,update:V}of L)this.dh(B,V.value)}}:{});if(!this.config.request_batching||n&&!(n!=null&&n._batchKey)||n!=null&&n.send_instantly||L.length){var z;let R;!M.transport&&!M.callback&&Xs((z=this.config.request_headers)!==null&&z!==void 0?z:{})&&this.$u&&(R="sendBeacon"),this.ju(M,R)}else this.qu.enqueue(M);return m}_addCaptureHook(e){return this.on("eventCaptured",r=>e(r.event,r))}getExtension(e){var r;return(r=this.Xu)===null||r===void 0?void 0:r.getExtension(e)}Zu(){var e;return(e=this.Xu)!==null&&e!==void 0?e:this.Xu=new lMe(this)}pu(e){this.Pu.push(e);let r=!0;return()=>{if(!r)return;r=!1;const n=this.Pu.indexOf(e);n!==-1&&this.Pu.splice(n,1)}}gh(e=!0){var r,n,s;return!!(!((r=this.persistence)===null||r===void 0)&&r.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((s=this.sessionPersistence)===null||s===void 0||s.clear(),this.Mu.clear(),this.mh()),(n=this.featureFlags)===null||n===void 0||n.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,r,n,s,i){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return r;this.persistence.syncCookieProperties(),this.gh();const a=i?void 0:this.persistence.remove_event_timer(e);let l=ie({},r);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.bu()&&(l[UK]=!0),e==="$snapshot"){const S=ie(ie({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=S.distinct_id,(!St(l.distinct_id)&&!Fr(l.distinct_id)||ng(l.distinct_id))&&ze.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}const c=function(S,k,N,j=!1){var T,D,I,L;if(!Ms)return{};const $=S?[...df,...k||[]]:[],[Q,M]=lK(Ms),[z,R]=function(J){for(let te=0;C$.length>te;te++){const[ve,he,xe]=C$[te],ke=J.match(ve);if(ke){const Oe=xe&&J.match(xe)||ke;return[he,(Oe==null?void 0:Oe[1])||""]}}return["",""]}(Ms),B=function(){const J="u">typeof navigator?navigator:void 0;return J!=null&&J.brave?{brave:!0}:{}}(),V={};Se(N)||(V.detectGoogleSearchApp=N);const F={},K=(T=navigator)===null||T===void 0||(T=T.userAgentData)===null||T===void 0?void 0:T.platform,Y=(D=navigator)===null||D===void 0?void 0:D.maxTouchPoints,O=me==null||(I=me.screen)===null||I===void 0?void 0:I.width,H=me==null||(L=me.screen)===null||L===void 0?void 0:L.height,G=me==null?void 0:me.devicePixelRatio;Se(K)||(F.userAgentDataPlatform=K),Se(Y)||(F.maxTouchPoints=Y),Se(O)||(F.screenWidth=O),Se(H)||(F.screenHeight=H),Se(G)||(F.devicePixelRatio=G);const q=pr(NR({$os:Q,$os_version:M,$browser:oK(Ms,navigator.vendor,B,V),$webview_app:z,$webview_app_version:R,$device:cK(Ms),$device_type:qDe(Ms,F),$timezone:vY(),$timezone_offset:DPe()}),{$current_url:Yg(j?Mc(Dr==null?void 0:Dr.href):Dr==null?void 0:Dr.href,$,Qg),$host:Dr==null?void 0:Dr.host,$pathname:Dr==null?void 0:Dr.pathname,$raw_user_agent:Ms.length>1e3?Ms.substring(0,997)+"...":Ms,$browser_version:HDe(Ms,navigator.vendor,B,V),$browser_language:fY(),$browser_language_prefix:RPe(),$screen_height:me==null?void 0:me.screen.height,$screen_width:me==null?void 0:me.screen.width,$viewport_height:me==null?void 0:me.innerHeight,$viewport_width:me==null?void 0:me.innerWidth,$lib:el.LIB_NAME,$lib_version:el.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return el.SDK_DIST_CHANNEL&&(q.$sdk_dist_channel=el.SDK_DIST_CHANNEL),q}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:S,windowId:k}=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime(),!0);l.$session_id=S,l.$window_id=k}this.sessionPropsManager&&pr(l,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&pr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(d=this.Bu)===null||d===void 0?void 0:d.length}catch(S){l.$sdk_debug_error_capturing_properties=String(S)}let f;if(this.requestRouter.region===sj&&(l.$lib_custom_api_host=this.config.api_host),f=e!=="$pageview"||i?e!=="$pageleave"||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,s),l=pr(l,f),e==="$pageview"&&Ce&&(l.title=Ce.title),!Se(a)){const S=n.getTime()-a;l.$duration=parseFloat((S/1e3).toFixed(3))}Ms&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");const p=this.persistence.properties(),m=this.sessionPersistence.properties(),g=l.$groups,y=p.$groups;Ct(g)&&!Xs(g)&&(l.$groups=ie(ie({},Ct(y)?y:{}),g)),Xt(["$referrer","$referring_domain"],S=>{S in p&&delete m[S]});const x={};if(this.Pu.length>0)for(const S of this.Pu.slice())try{pr(x,S())}catch(k){ze.error("Failed to produce browser extension event properties",k)}l=pr({},c,p,m,ie(ie({},x),l)),l.$is_identified=this._isIdentified(),ut(this.config.property_denylist)?Xt(this.config.property_denylist,function(S){delete l[S]}):ze.error(UY+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const w=this.config.sanitize_properties;w&&(ze.error(k6),l=w(l,e));const _=this.yh();return l.$process_person_profile=_,_&&!i&&this.bh("_calculate_event_properties"),l}ph(e,r=!0,n=!1){var s;if(!this.persistence||!this.yh()||this.Iu&&!n)return e;const i=this.persistence.get_initial_props(),a=(s=this.sessionPropsManager)===null||s===void 0?void 0:s.getSetOnceProps();let l=pr({},i,a||{},e||{});const c=this.config.sanitize_properties;return c&&(ze.error(k6),l=c(l,"$set_once")),r&&(this.Iu=!0),Xs(l)?void 0:l}register(e,r){var n;(n=this.persistence)===null||n===void 0||n.register(e,r)}register_once(e,r,n){var s;(s=this.persistence)===null||s===void 0||s.register_once(e,r,n)}register_for_session(e){var r,n;(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.gh(),(n=this.sessionPersistence)===null||n===void 0||n.register(e),Object.keys(e).forEach(s=>this.Mu.add(s)),this.mh()}unregister(e){var r;(r=this.persistence)===null||r===void 0||r.unregister(e)}unregister_for_session(e){var r;(r=this.sessionPersistence)===null||r===void 0||r.unregister(e),this.Mu.delete(e),this.mh()}_h(e,r){this.register({[e]:r})}Hu(){this.Mu.forEach(e=>{var r;(r=this.sessionPersistence)===null||r===void 0||r.unregister(e)}),this.Mu.clear(),this.mh()}mh(){var e;if(!this.Eu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.mi||!cr.Et())return void cr.Lt(this.Eu);const r=[];this.Mu.forEach(n=>r.push(n)),r.length>0?cr.At(this.Eu,r):cr.Lt(this.Eu)}getFeatureFlag(e,r){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlag(e,r)}getFeatureFlagPayload(e){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getFeatureFlagPayload(e)}getFeatureFlagResult(e,r){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagResult(e,r)}getAllFeatureFlags(){var e,r;return(e=(r=this.featureFlags)===null||r===void 0?void 0:r.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,r){var n,s;return(n=(s=this.featureFlags)===null||s===void 0?void 0:s.isFeatureEnabled(e,r))!==null&&n!==void 0?n:r==null?void 0:r.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,r,n){var s;(s=this.featureFlags)===null||s===void 0||s.updateFlags(e,r,n)}updateEarlyAccessFeatureEnrollment(e,r,n){var s;(s=this.featureFlags)===null||s===void 0||s.updateEarlyAccessFeatureEnrollment(e,r,n)}getEarlyAccessFeatures(e,r=!1,n){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getEarlyAccessFeatures(e,r,n)}on(e,r){return this.vu.on(e,r)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:vm}),()=>{})}onSessionId(e){var r,n;return(r=(n=this.sessionManager)===null||n===void 0?void 0:n.onSessionId(e))!==null&&r!==void 0?r:()=>{}}getSurveys(e,r=!1){this.surveys?this.surveys.getSurveys(e,r):e([],{isLoaded:!1,error:vm})}getActiveMatchingSurveys(e,r=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,r):e([],{isLoaded:!1,error:vm})}renderSurvey(e,r){var n;(n=this.surveys)===null||n===void 0||n.renderSurvey(e,r)}displaySurvey(e,r=rMe){var n;(n=this.surveys)===null||n===void 0||n.displaySurvey(e,r)}cancelPendingSurvey(e){var r;(r=this.surveys)===null||r===void 0||r.cancelPendingSurvey(e)}canRenderSurvey(e){var r,n;return(r=(n=this.surveys)===null||n===void 0?void 0:n.canRenderSurvey(e))!==null&&r!==void 0?r:{visible:!1,disabledReason:vm}}canRenderSurveyAsync(e,r=!1){var n,s;return(n=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurveyAsync(e,r))!==null&&n!==void 0?n:Promise.resolve({visible:!1,disabledReason:vm})}wh(e){return!e||ng(e)?(ze.critical("Unique user id has not been set in posthog.identify"),!1):e==="$posthog_cookieless"?(ze.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(ze.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,r,n){if(!this.__loaded||!this.persistence)return ze.uninitializedWarning("posthog.identify");if(Fr(e)&&(e=e.toString(),ze.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(e)||!this.bh("posthog.identify"))return;this.Su();const s=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,a=this.gh(!1),l=this.persistence.Da();let c=!1;try{const f=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:f},""),e!==f&&e!==this.get_property("__alias")&&(this.unregister(R_),this.register({distinct_id:e}));const p=(this.persistence.get_property("$user_state")||"anonymous")===Xo,m=e!==f,g=!m&&p;if(m&&p){var d;const y=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:f};this.persistence.set_property(Is,R0),this.setPersonPropertiesForFlags({$set:r||{},$set_once:n||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",y,{$set:r||{},$set_once:n||{}})&&(this.Ou=DE(e,r,n)),(d=this.featureFlags)===null||d===void 0||d.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:f)}else if(g){this.persistence.set_property(Is,R0);const y=r||{},x=n||{};this.setPersonPropertiesForFlags({$set:y,$set_once:x},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:y,$set_once:x})&&(this.Ou=DE(e,r,n))}else(r||n)&&this.setPersonProperties(r,n);m||i||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(vc)):g&&(r||n)&&this.reloadFeatureFlags(),c=!0}finally{l&&this.persistence.ja(c)}}setPersonProperties(e,r){if(!e&&!r||!this.bh("posthog.setPersonProperties"))return;const n=DE(this.get_distinct_id(),e,r);this.Ou!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:r||{}},!0),this.capture("$set",{$set:e||{},$set_once:r||{}})&&(this.Ou=n)):ze.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var r;const n=(ut(e)?e:[e]).filter(s=>St(s)&&s.length>0);n.length!==0&&this.bh("posthog.unsetPersonProperties")&&((r=this.featureFlags)===null||r===void 0||r.unsetPersonPropertiesForFlags(n,!0),this.capture("$set",{$unset:n}),this.Ou=null)}group(e,r,n){var s;if(!e||!r)return void ze.error("posthog.group requires a group type and group key");(s=this.persistence)===null||s===void 0||s.syncCookieProperties(),this.gh();const i=this.getGroups(),a=i[e]!==r;if(a&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ie(ie({},i),{},{[e]:r})}),(a||n)&&this.yh()){const l={$group_type:e,$group_key:r};n&&(l.$group_set=n),this.capture(W$,l)}n&&this.setGroupPropertiesForFlags({[e]:n}),a&&!n&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,r=!0){var n;(n=this.featureFlags)===null||n===void 0||n.setPersonPropertiesForFlags(e,r)}resetPersonPropertiesForFlags(e=!0){var r;(r=this.featureFlags)===null||r===void 0||r.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,r=!0){var n;this.bh("posthog.setGroupPropertiesForFlags")&&((n=this.featureFlags)===null||n===void 0||n.setGroupPropertiesForFlags(e,r))}resetGroupPropertiesForFlags(e){var r;(r=this.featureFlags)===null||r===void 0||r.resetGroupPropertiesForFlags(e)}reset(e){const r=$s(e)?e:e==null?void 0:e.resetDeviceID,n=$s(e)||e==null?void 0:e.bootstrap;this.kh(r,!1,n)}kh(e,r=!1,n){var s,i,a,l,c,d;if(ze.info("reset"),!this.__loaded)return ze.uninitializedWarning("posthog.reset");const f=n==null?void 0:n.sessionID;this.config.bootstrap=n||((s=this.Lu)===null||s===void 0?void 0:s.bootstrap)||{},(i=this.featureFlags)===null||i===void 0||(a=i.updateConfig)===null||a===void 0||a.call(i,this.config,this.nl());const p=this.get_property(bR),m=this.get_property(gE),g=this.get_property(ag);(l=this.sessionRecording)===null||l===void 0||l.flushBeforeIdentityReset();const y=this.is_capturing();this.consent.reset(),r||!y||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const x=(c=this.persistence)===null||c===void 0||(d=c.Da)===null||d===void 0?void 0:d.call(c);let w=!1;try{var _,S,k,N,j,T,D,I,L,$,Q,M,z;if((_=this.persistence)===null||_===void 0||_.clear(),(S=this.sessionPersistence)===null||S===void 0||S.clear(),this.Mu.clear(),this.mh(),Se(g)||($=this.persistence)===null||$===void 0||$.register({$session_recording_remote_config:g}),(k=this.surveys)===null||k===void 0||k.reset(),(N=this.featureFlags)===null||N===void 0||N.reset(),(j=this.conversations)===null||j===void 0||j.reset(),(T=this.logs)===null||T===void 0||T.reset(),(D=this.metrics)===null||D===void 0||D.reset(),(I=this.persistence)===null||I===void 0||I.set_property("$user_state","anonymous"),(L=this.sessionManager)===null||L===void 0||L.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:vE,$device_id:null},"");else{const V=this.config.get_device_id(ma());this.register_once({distinct_id:V,$device_id:e?V:p},""),e||Se(m)||this.register({[gE]:m})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),n&&(n.distinctID&&!this.bu()&&((z=this.persistence)===null||z===void 0||z.set_property("$user_state",n.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.distinctID})),(Q=this.featureFlags)===null||Q===void 0||Q.initialize(),!vt(f)&&!(!((M=this.sessionManager)===null||M===void 0)&&M.setBootstrapSessionId(f,!0)))){const V=ie({},n);delete V.sessionID,this.config.bootstrap=V}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,w=!0}finally{var R,B;x&&((R=this.persistence)===null||R===void 0||(B=R.ja)===null||B===void 0||B.call(R,w))}this.reloadFeatureFlags()}shutdown(e){var r=this;return xr(function*(){var n,s,i,a,l,c,d,f;if(r.__loaded){r.Tu=!0,r.Zu().dispose(),(n=r.sessionRecording)===null||n===void 0||n.dispose(),(s=r.logs)===null||s===void 0||s.flushLogs("sendBeacon"),(i=r.metrics)===null||i===void 0||i.flush("sendBeacon"),(a=r.metrics)===null||a===void 0||a.dispose(),(l=r.qu)===null||l===void 0||l.unload(),(c=r.Bu)===null||c===void 0||c.unload();try{var p;(p=r.featureFlags)===null||p===void 0||p.destroy()}catch(m){ze.error("Error while destroying feature flags",m)}(d=r.persistence)===null||d===void 0||d.destroy(),(f=r.sessionPersistence)===null||f===void 0||f.destroy()}else ze.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,r){var n;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=r,this.alias(e),(n=this.conversations)===null||n===void 0||n.Sh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)===null||e===void 0||e.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,r;return(e=(r=this.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:r,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${r}`);if(e!=null&&e.withTimestamp&&n){var i;const a=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!n)return s;s+=`?t=${Math.max(Math.floor((new Date().getTime()-n)/1e3)-a,0)}`}return s}alias(e,r){return e===this.get_property("$people_distinct_id")?(ze.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(Se(r)&&(r=this.get_distinct_id()),e!==r?(this._h(R_,e),this.capture("$create_alias",{alias:e,distinct_id:r})):(ze.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const r=ie({},this.config);if(Ct(e)){var n,s,i,a,l,c,d,f,p,m,g,y,x,w;pr(this.config,N6(e));const S=this.xu();(n=this.persistence)===null||n===void 0||n.update_config(this.config,r,S),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new EE(ie(ie({},this.config),{},{persistence:"sessionStorage"}),S,!1);const k=this.Du(this.config.debug);var _;$s(k)&&(this.config.debug=k),$s(this.config.debug)&&(this.config.debug?(xn.DEBUG=!0,Mt.Et()&&Mt.At("ph_debug",!0),ze.info("set_config",{config:e,oldConfig:r,newConfig:ie({},this.config)})):(xn.DEBUG=!1,Mt.Et()&&Mt.Lt("ph_debug"))),(s=this.featureFlags)===null||s===void 0||(i=s.updateConfig)===null||i===void 0||i.call(s,this.config,this.nl()),(a=this.exceptionObserver)===null||a===void 0||a.onConfigChange(),(l=this.exceptions)===null||l===void 0||l.onConfigChange(),(c=this.metrics)===null||c===void 0||c.onConfigChange(),(d=this.sessionRecording)===null||d===void 0||d.startIfEnabledOrStop(),(f=this.tracingHeaders)===null||f===void 0||f.startIfEnabledOrStop(),(p=this.autocapture)===null||p===void 0||p.startIfEnabled(),(m=this.heatmaps)===null||m===void 0||m.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((_=this.historyAutocapture)===null||_===void 0||_.startIfEnabledOrStop()),(g=this.exceptionObserver)===null||g===void 0||g.startIfEnabledOrStop(),(y=this.deadClicksAutocapture)===null||y===void 0||y.startIfEnabledOrStop(),(x=this.surveys)===null||x===void 0||x.loadIfEnabled(),this.Cu(),(w=this.externalIntegrations)===null||w===void 0||w.startIfEnabledOrStop(),!r.segment&&this.config.segment&&this.persistence&&o6(this,fg,!1)}}_overrideSDKInfo(e,r){xn.LIB_NAME=e,xn.LIB_VERSION=r}startSessionRecording(e){const r=e===!0,n={sampling:r||!!(e!=null&&e.sampling),linked_flag:r||!!(e!=null&&e.linked_flag),url_trigger:r||!!(e!=null&&e.url_trigger),event_trigger:r||!!(e!=null&&e.event_trigger)};var s,i,a,l,c;Object.values(n).some(Boolean)&&((s=this.sessionManager)===null||s===void 0||s.checkAndGetSessionAndWindowId(),n.sampling&&((i=this.sessionRecording)===null||i===void 0||i.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)===null||a===void 0||a.overrideLinkedFlag()),n.url_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("url")),n.event_trigger&&((c=this.sessionRecording)===null||c===void 0||c.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(!((e=this.sessionRecording)===null||e===void 0)&&e.started)}captureException(e,r){try{if(!this.exceptions)return;const n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ie(ie({},n),r))}catch{return}}addExceptionStep(e,r){var n;(n=this.exceptions)===null||n===void 0||n.addExceptionStep(e,r)}captureLog(e){var r;(r=this.logs)===null||r===void 0||r.captureLog(e)}get logger(){var e,r;return(e=(r=this.logs)===null||r===void 0?void 0:r.logger)!==null&&e!==void 0?e:nc.Ch}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var r,n;return(r=(n=this.toolbar)===null||n===void 0?void 0:n.loadToolbar(e))!==null&&r!==void 0&&r}get_property(e){var r;return(r=this.persistence)===null||r===void 0?void 0:r.props[e]}getSessionProperty(e){var r;return(r=this.sessionPersistence)===null||r===void 0?void 0:r.props[e]}toString(){var e;let r=(e=this.config.name)!==null&&e!==void 0?e:Fm;return r!==Fm&&(r="posthog."+r),r}_isIdentified(){var e,r;return((e=this.persistence)===null||e===void 0?void 0:e.get_property("$user_state"))==="identified"||((r=this.sessionPersistence)===null||r===void 0?void 0:r.get_property("$user_state"))==="identified"}yh(){var e,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Xs(this.getGroups())&&!(!((e=this.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e.__alias)&&!(!((r=this.persistence)===null||r===void 0||(r=r.props)===null||r===void 0)&&r.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(e){return this.config.person_profiles==="never"?(ze.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(kR,!0),!0)}xu(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}Cu(){var e,r;const n=this.xu();var s,i,a;return this.is_capturing()||(s=this.logs)===null||s===void 0||s.$h(),((e=this.persistence)===null||e===void 0?void 0:e.mi)!==n&&((i=this.persistence)===null||i===void 0||i.set_disabled(n)),((r=this.sessionPersistence)===null||r===void 0?void 0:r.mi)!==n&&((a=this.sessionPersistence)===null||a===void 0||a.set_disabled(n)),n&&(this.Mu.clear(),this.mh()),n}opt_in_capturing(e){var r;if(this.config.cookieless_mode!=="always"){if(this.bu()){var n,s,i,a,l,c;(n=this.sessionRecording)===null||n===void 0||n.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(s=this.sessionManager)===null||s===void 0||s.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=new _6(this),this.pageViewManager=new l6(this),this.persistence&&(this.sessionPropsManager=new y6(this,this.sessionManager,this.persistence));const g=(a=(l=this.config.__extensionClasses)===null||l===void 0?void 0:l.sessionRecording)!==null&&a!==void 0?a:(c=nc.__defaultExtensionClasses)===null||c===void 0?void 0:c.sessionRecording;var d,f;g&&(this.sessionRecording=this.yu(this.sessionRecording,new g(this)),this.du&&((d=this.sessionRecording)===null||d===void 0||(f=d.onRemoteConfig)===null||f===void 0||f.call(d,this.du)))}var p,m;this.consent.optInOut(!0),this.Cu(),this.Yu(),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((p=this.surveys)===null||p===void 0||p.loadIfEnabled()),(Se(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((m=e==null?void 0:e.captureEventName)!==null&&m!==void 0?m:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else ze.warn(S6)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void ze.warn(S6);const e=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var r,n;e==null||e.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:vE,$device_id:null}),this.mu(e),this.sessionRecording=void 0,(r=this.sessionManager)===null||r===void 0||r.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Cu()}_is_bot(){return Tn?IY(Tn,this.config.custom_blocked_useragents):void 0}th(){Ce&&(Ce.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(CR,{title:Ce.title},{send_instantly:!0}),this.Au&&(Ce.removeEventListener(Wg,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),Gt(Ce,Wg,this.Au)))}debug(e){e===!1?(me==null||me.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(me==null||me.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}nl(){const e=this.Lu||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(ze.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(r,n,s,i,a){const l=n in r&&!vt(r[n]),c=s in r&&!vt(r[s]);return l?r[n]:!!c&&(a&&a.warn(`Config field '${s}' is deprecated. Please use '${n}' instead. The old field will be removed in a future major version.`),r[s])}(e,"advanced_disable_flags","advanced_disable_decide",0,ze)}Os(e){var r;if(vt(this.config.before_send))return e;const n=Object.keys((r=e.properties)!==null&&r!==void 0?r:{}).filter(ODe),s=ut(this.config.before_send)?this.config.before_send:[this.config.before_send];let i=e;for(const a of s)try{if(i=a(i),vt(i)){const l=`Event '${e.event}' was rejected in beforeSend function`;return DDe(e.event)?ze.warn(`${l}. This can cause unexpected behavior.`):ze.info(l),null}i.properties&&!Xs(i.properties)||ze.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(l){return ze.error(`Error in beforeSend function for event '${e.event}':`,l),null}for(const a of n)if(i.properties&&vt(i.properties[a]))return ze.warn(`Event '${e.event}' had its '${a}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return i}getPageViewId(){var e;return(e=this.pageViewManager.Vo)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,r){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:r})}captureTraceMetric(e,r,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:r,$ai_metric_value:String(n)})}Du(e){const r=$s(e)&&!e,n=Mt.Et()&&Mt.Ot("ph_debug")==="true";return!r&&(!!n||e)}};pg.__defaultExtensionClasses={},pg.Ch=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let r=0;e.length>r;r++)t.prototype[e[r]]=lPe(t.prototype[e[r]])}(pg,["identify"]);var VY=class{constructor(t){this.disabled=t===!1;const e=Ct(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,r){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>r-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:r}];return!1}};const ME="$copy_autocapture",IE=Mr("[AutoCapture]");function LE(t,e){return e.length>t?e.slice(0,t)+"...":e}function pMe(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!xo(e));return e}function mMe(t,{e,maskAllElementAttributes:r,maskAllText:n,elementAttributeIgnoreList:s,elementsChainAsString:i,disableCaptureUrlHashes:a}){var l,c;if(!xo(t))return{props:{}};const d=[t],f=new Set([t]);let p=t;for(;p.parentNode&&!as(p,"body")&&1e3>d.length;){if(jR(p.parentNode)){const T=p.parentNode.host;if(f.has(T))break;f.add(T),d.push(T),p=T;continue}if(!xo(p.parentNode)||f.has(p.parentNode))break;f.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}const m=e.type==="click"&&t.namespaceURI==="http://www.w3.org/2000/svg"?d.findIndex(T=>as(T,"button")||as(T,"a")):-1;m>0&&(n=n||d.slice(0,m+1).some(T=>!Vh(T)||Kg(T)));const g=[],y={};let x,w=!1,_=!1;if(Xt(d,T=>{const D=Vh(T);if(as(T,"a")&&!r&&!(s!=null&&s.includes("href"))){const I=T.getAttribute("href");w=!!(D&&I&&ug(I))&&(a?Mc(I):I)}ht(cf(T),"ph-no-capture")&&(_=!0),g.push(function(I,L,$,Q,M=!1){const z=I.tagName.toLowerCase(),R={tag_name:z};AR.indexOf(z)>-1&&!$&&(R.$el_text=z.toLowerCase()==="a"||z.toLowerCase()==="button"?LE(1024,s6(I)):LE(1024,Gg(I)));const B=cf(I);L||Q!=null&&Q.includes("class")||0>=B.length||(R.classes=B.filter(function(Y){return Y!==""})),Xt(I.attributes,function(Y){var O;if((!Kg(I)||["name","id","class","aria-label"].indexOf(Y.name)!==-1)&&!(Q!=null&&Q.includes(Y.name))&&!L&&ug(Y.value)&&(!St(O=Y.name)||O.substring(0,10)!=="_ngcontent"&&O.substring(0,7)!=="_nghost")){let H=Y.value;Y.name==="class"&&(H=TR(H).join(" ")),R["attr__"+Y.name]=LE(1024,Y.name==="href"&&M?Mc(H):H)}});let V=1,F=1,K=I;for(;K=pMe(K);)V++,K.tagName===I.tagName&&F++;return R.nth_child=V,R.nth_of_type=F,R}(T,r,n,s,a)),Xt(function(I){if(!Vh(I))return{};const L={};return Xt(I.attributes,function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){const Q=$.name.replace("data-ph-capture-attribute-",""),M=$.value;Q&&M&&ug(M)&&(L[Q]=M)}}),L}(T),(I,L)=>{({}).hasOwnProperty.call(y,L)||(y[L]=I)})}),_)return{props:{},explicitNoCapture:_};if(m>0&&(t=d[m],g.splice(0,m)),n||(g[0].$el_text=as(t,"a")||as(t,"button")?s6(t):Gg(t)),w){var S,k;g[0].attr__href=w;const T=(S=pl(w))===null||S===void 0?void 0:S.host,D=me==null||(k=me.location)===null||k===void 0?void 0:k.host;T&&D&&T!==D&&(x=w)}return{props:pr((j=e.type,{$event_type:j,$ce_version:1}),i?{}:{$elements:g},{$elements_chain:(N=g,ut(N)?function(T){return T.map(D=>{var I,L;let $="";if(D.tag_name&&($+=D.tag_name),D.attr_class){D.attr_class.sort();for(const z of D.attr_class)$+=`.${z.replace(/"/g,"")}`}const Q=ie(ie(ie(ie({},D.text?{text:D.text}:{}),{},{"nth-child":(I=D.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":(L=D.nth_of_type)!==null&&L!==void 0?L:0},D.href?{href:D.href}:{}),D.attr_id?{attr_id:D.attr_id}:{}),D.attributes),M={};return D0(Q).sort(([z],[R])=>function(B,V){return V>B?-1:B>V?1:0}(z,R)).forEach(([z,R])=>M[i6(z.toString())]=i6(R.toString())),$+=":",$+=D0(M).map(([z,R])=>`${z}="${R}"`).join(""),$}).join(";")}(function(T){return T.map(D=>{var I,L;const $={text:(I=D.$el_text)===null||I===void 0?void 0:I.slice(0,400),tag_name:D.tag_name,href:(L=D.attr__href)===null||L===void 0?void 0:L.slice(0,2048),attr_class:SPe(D),attr_id:D.attr__id,nth_child:D.nth_child,nth_of_type:D.nth_of_type,attributes:{}};return D0(D).filter(([Q])=>Q.indexOf("attr__")===0).forEach(([Q,M])=>$.attributes[Q]=M),$})}(N)):"")},!((l=g[0])===null||l===void 0)&&l.$el_text?{$el_text:(c=g[0])===null||c===void 0?void 0:c.$el_text}:{},x&&e.type==="click"?{$external_click_url:x}:{},y),target:t};var N,j}var gMe=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(t){var e;if(!Vh(t))return!0;const r=(e=this.bo().css_selector_ignorelist)!==null&&e!==void 0?e:SE,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const i=s,a=cf(i);if(ht(a,"ph-no-capture")||ht(a,"ph-sensitive")||Kg(i)||r.some(c=>X2(i,c)))return!0;const l=s.parentNode;s=jR(l)?l.host:l&&xo(l)?l:null}return!1}_o(t){if(!this.isEnabled||t.type==="pointercancel")return void this.fo();if(t.type==="pointerdown"){this.fo();const n=cg(t);var e;return void(t.isPrimary&&t.button===0&&!t.ctrlKey&&n&&xo(n)&&(this.po={target:n,excluded:this.yo(n),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:(e=this.wo)===null||e===void 0?void 0:e.distinctId}))}const r=this.po;r&&(t.pointerId!==r.id||Math.abs(t.clientX-r.x)>5||Math.abs(t.clientY-r.y)>5?this.fo():t.type==="pointerup"&&(r.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(t){var e;const r=this.po;this.fo();const n=cg(t);if(r!=null&&r.released&&r.target.isConnected&&r.distinctId===((e=this.wo)===null||e===void 0?void 0:e.distinctId)&&t.pointerId===r.id&&(t.detail>0||t.pointerType==="touch"||t.pointerType==="pen")&&t.button===0&&5>=Math.abs(t.clientX-r.x)&&5>=Math.abs(t.clientY-r.y)&&n&&(as(n,"html")||as(n,"body"))){var s;if(r.excluded)return null;const i=(s=this.bo().css_selector_ignorelist)!==null&&s!==void 0?s:SE;return[n,Ce==null?void 0:Ce.documentElement,Ce==null?void 0:Ce.body].some(a=>{if(!a)return!1;const l=cf(a);return ht(l,"ph-no-capture")||ht(l,"ph-sensitive")||!Vh(a)||Kg(a)||i.some(c=>X2(a,c))})?null:r.target}}constructor(t){this.So=t,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new VY(this.Rr.rageclick),this.Mo=null}setup(t){this.Eo(),this.wo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?e.dispose():(this.Po=e,this.startIfEnabled())}dispose(){var t;this.Io||(this.Io=!0,this.wo=void 0,(t=this.Po)===null||t===void 0||t.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var t,e;return this.bo(),this.Rr.url_allowlist=(t=this.Rr.url_allowlist)===null||t===void 0?void 0:t.map(r=>new RegExp(r)),this.Rr.url_ignorelist=(e=this.Rr.url_ignorelist)===null||e===void 0?void 0:e.map(r=>new RegExp(r)),this.Rr}Ao(){if(!this.isBrowserSupported())return void IE.info("Disabling Automatic Event Collection because this browser is not supported");if(!me||!Ce)return;const t=this.Fo=e=>{e=e||(me==null?void 0:me.event);try{if(e.type==="blur")return void this.fo();if(e.type.indexOf("pointer")===0)return void this._o(e);const r=e.type==="click"?this.ko(e):void 0;if(Or(r))return;this.Oo(e,"$autocapture",r)}catch(r){IE.error("Failed to capture event",r)}};if(Gt(me,"blur",t),Gt(Ce,"submit",t,{capture:!0}),Gt(Ce,"change",t,{capture:!0}),Gt(Ce,"click",t,{capture:!0}),Xt(["pointerdown","pointermove","pointerup","pointercancel"],e=>{Gt(Ce,e,t,{capture:!0})}),this.bo().capture_copied_text){const e=this.Do=r=>{r=r||(me==null?void 0:me.event);try{this.Oo(r,ME)}catch(n){IE.error("Failed to capture clipboard event",n)}};Gt(Ce,"copy",e,{capture:!0}),Gt(Ce,"cut",e,{capture:!0}),Gt(Ce,"paste",e,{capture:!0})}}Ro(){this.fo(),this.Fo&&(me==null||me.removeEventListener("blur",this.Fo),Xt(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Ce==null||Ce.removeEventListener(t,this.Fo,!0)}),Ce==null||Ce.removeEventListener("submit",this.Fo,!0),Ce==null||Ce.removeEventListener("change",this.Fo,!0),Ce==null||Ce.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(Ce==null||Ce.removeEventListener("copy",this.Do,!0),Ce==null||Ce.removeEventListener("cut",this.Do,!0),Ce==null||Ce.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(t){if(this.Io)return;if(this.$o=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.To=e.elementsChainAsString);const r=e.autocapture_opt_out;var n;$s(r)&&((n=this.wo)===null||n===void 0||n.kv.set("$autocapture_disabled_server_side",r),this.Co=r),this.startIfEnabled()}setElementSelectors(t){this.Mo=t}getElementSelectors(t,e){var r;const n=[];return(r=this.Mo)===null||r===void 0||r.forEach(s=>{const i=Ce==null?void 0:Ce.querySelectorAll(s);i==null||i.forEach(a=>{t!==a&&e!==a||ht(n,s)||n.push(s)})}),n}get isEnabled(){var t,e;if(this.Io)return!1;const r=(t=this.wo)===null||t===void 0?void 0:t.kv.get(RK),n=this.Co,s=this.bo();if(!s.remoteRequestsDisabled&&!this.$o)return!1;const i=s.remoteRequestsDisabled&&!this.$o;if(Or(n)&&!$s(r)&&!i)return!1;const a=(e=this.Co)!==null&&e!==void 0?e:!!r;return!!s.enabled&&!a}Oo(t,e="$autocapture",r){if(!this.isEnabled)return void this.fo();let n=r||cg(t);JK(n)&&(n=n.parentNode||null);const s=this.Eo();var i;e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&s.rageclick&&(!((i=this.rageclicks)===null||i===void 0)&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime()))&&nY(n,s.rageclick)&&this.Oo(t,"$rageclick",r);const a=e===ME,l=a?ie(ie({},s),{},{dom_event_allowlist:void 0}):s;if(n&&function(p,m,g,y,x,w){var _;if(!me||RR(p)||g!=null&&g.url_allowlist&&!X$(g.url_allowlist,w)||g!=null&&g.url_ignorelist&&X$(g.url_ignorelist,w))return!1;if(g!=null&&g.dom_event_allowlist){const j=g.dom_event_allowlist;if(j&&!j.some(T=>m.type===T))return!1}const{parentIsUsefulElement:S,targetElementList:k}=sY(p,y);if(!function(j,T){const D=T==null?void 0:T.element_allowlist;if(Se(D))return!0;for(const I of j)if(D.some(L=>I.tagName.toLowerCase()===L))return!0;return!1}(k,g)||!Z2(k,g==null?void 0:g.css_selector_allowlist)||Z2(k,(_=g==null?void 0:g.css_selector_ignorelist)!==null&&_!==void 0?_:SE))return!1;try{const j=me.getComputedStyle(p);if(j&&j.getPropertyValue("cursor")==="pointer"&&m.type==="click")return!0}catch{}const N=p.tagName.toLowerCase();switch(N){case"html":return!1;case"form":return(x||["submit"]).indexOf(m.type)>=0;case"input":case"select":case"textarea":return(x||["change","click"]).indexOf(m.type)>=0;default:return S?(x||["click"]).indexOf(m.type)>=0:(x||["click"]).indexOf(m.type)>=0&&(AR.indexOf(N)>-1||p.getAttribute("contenteditable")==="true")}}(n,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var c;const{props:p,explicitNoCapture:m,target:g}=mMe(n,{e:t,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:s.disableCaptureUrlHashes});if(m)return!1;const y=this.getElementSelectors(n,g);if(y&&y.length>0&&(p.$element_selectors=y),e===ME){const x=t.type||"clipboard";if(x!=="paste"){var d,f;const w=me==null||(d=me.getSelection())===null||d===void 0?void 0:d.toString(),_=eY(w);if(!_)return!1;p.$selected_content=_,p.$clipboard_text_length=(f=w==null?void 0:w.length)!==null&&f!==void 0?f:0}p.$copy_type=x}return(c=this.wo)===null||c===void 0||c.capture(e,p),!0}}isBrowserSupported(){return jn(Ce==null?void 0:Ce.querySelectorAll)}},vMe=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,r=Ct(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.nl(),t.url_allowlist=r==null?void 0:r.url_allowlist,t.url_ignorelist=r==null?void 0:r.url_ignorelist,t.dom_event_allowlist=r==null?void 0:r.dom_event_allowlist,t.element_allowlist=r==null?void 0:r.element_allowlist,t.css_selector_allowlist=r==null?void 0:r.css_selector_allowlist,t.css_selector_ignorelist=r==null?void 0:r.css_selector_ignorelist,t.element_attribute_ignorelist=r==null?void 0:r.element_attribute_ignorelist,t.capture_copied_text=r==null?void 0:r.capture_copied_text}};const ym=Mr("[ExceptionAutocapture]"),j6=()=>{},T6=t=>{var e;if(jn(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function Xg(t,e,r){try{if(!(e in t))return j6;const n={next:t[e]},s=r(function(...i){return n.next.apply(this,i)});return jn(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=n.next);let i=t[e],a=T6(i);for(;a;){if(a.next===s)return void(a.next=n.next);i=a.next,a=T6(i)}}}catch{return j6}}const yMe=Mr("[TracingHeaders]"),xu=Mr("[Web Vitals]"),A6=9e5,R6=["CLS","FCP","INP","LCP"],xMe=["INP","LCP"],_Me=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],$E="disabled",D6="lazy_loading",Wo=Mr("[SessionRecording]"),bMe=Mr("[Heatmaps]");function BE(t){return Ct(t)&&"clientX"in t&&"clientY"in t&&Fr(t.clientX)&&Fr(t.clientY)}const Wx=Mr("[Product Tours]"),FE=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(SR))},wMe=["$set_once","$set"],Ya=Mr("[SiteApps]"),O6="Error while initializing PostHog app with config id ",HY=(t,e)=>t!=null&&t.then?t.then(e):e(t),dh="SDK is not enabled or survey functionality is not yet loaded",P6="Disabled. Not loading surveys.";var SMe=class{constructor(t,e){this.So=t,this.Th=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=r=>{if(this.Io||this.Rr.disableSurveys)return;if(!r.ok)return Yt.warn("Remote config unavailable. Not loading surveys.");const n=r.config.surveys;if(vt(n))return Yt.warn("Flags not loaded yet. Not loading surveys.");this.Ah=$s(n)?n:n.length>0,Yt.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(t){if(!this.Io)return this.Fh=t,HY(t.kv.initialize(),()=>{if(this.Fh!==t||this.Io)return;this.Fh=void 0,this.wo=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.Io?e.dispose():(this.Po=e,this.loadIfEnabled())})}dispose(){var t,e,r,n;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,(t=this.Po)===null||t===void 0||t.dispose(),this.Po=void 0,(e=this._surveyEventReceiver)===null||e===void 0||e.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)===null||r===void 0||(n=r.dispose)===null||n===void 0||n.call(r),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(s=>clearTimeout(s)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var t,e;(t=this._surveyManager)===null||t===void 0||(e=t.clearInMemoryInProgressSurveyState)===null||e===void 0||e.call(t);try{var r;(r=this._surveyEventReceiver)===null||r===void 0||r.reset(),localStorage.removeItem("lastSeenSurveyDate");const n=[];for(let s=0;s<localStorage.length;s++){const i=localStorage.key(s);(i!=null&&i.startsWith("seenSurvey_")||i!=null&&i.startsWith("inProgressSurvey_"))&&n.push(i)}n.forEach(s=>localStorage.removeItem(s))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;const t=this.Rr;if(this._surveyManager)return;if(this.Ih)return void Yt.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Yt.info(P6);if(t.cookielessMode&&this.So.isOptedOut())return void Yt.info("Not loading surveys in cookieless mode without consent.");const e=this.So.getExtensions();if(!e)return void Yt.error("PostHog Extensions not found.");if(Se(this.Ah)&&!t.advancedEnableSurveys)return;const r=this.Ah||t.advancedEnableSurveys;this.Ih=!0;try{const n=e.generateSurveys;if(n)return this.Oh(n,r),void(this.Ih=!1);const s=e.loadExternalDependency;if(!s)return this.Dh(ER),void(this.Ih=!1);s(i=>{try{if(this.Io)return;const a=this.So.getExtensions();i||!(a!=null&&a.generateSurveys)?this.Dh("Could not load surveys script",i):this.Oh(a.generateSurveys,r)}finally{this.Ih=!1}})}catch(n){throw this.Ih=!1,this.Dh("Error initializing surveys",n),n}}Oh(t,e){this.Io||(this._surveyManager=t(e),this._surveyEventReceiver=this.So.createEventReceiver(),Yt.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(t,e){Yt.error(t,e),this.Lh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Mh.push(t),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(e=>e!==t)}}getSurveys(t,e=!1){var r;const n=(r=this.wo)!==null&&r!==void 0?r:this.Th;if(!n||this.Io)return;if(this.Rr.disableSurveys)return Yt.info(P6),t([]);const s=n.kv.get(q2);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:l,context:c})=>{this.Io||t(l,c)}).catch(l=>Yt.error("Error in survey callback",l));const i=this.qh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(l=>{try{return this.jh(n,l)}catch(c){return Yt.error("Error processing surveys response",c),this.jh(n,{statusCode:0,error:c})}},l=>this.jh(n,{statusCode:0,error:l}));this.Eh=i;const a=()=>{this.Eh===i&&(this.Eh=null)};i.then(l=>{a(),this.Io||t(l.surveys,l.context)},a).catch(l=>Yt.error("Error in survey callback",l))}qh(t,e){const r=this.wo;return r?r.sendRequest(t,e):new Promise(n=>n({statusCode:0,error:new Error(dh)}))}jh(t,e){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:dh}};const r=e.statusCode;if(r!==200||!e.json){const a=`Surveys API could not be loaded, status: ${r}`;return r!==0?Yt.error(a):e.error||Yt.warn(a),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Ph=null;const n=e.json.surveys||[],s=n.filter(a=>function(l){return!(!l.start_date||l.end_date)}(a)&&($Y(a)||function(l){var c;return!!(!((c=l.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0)&&c.length)}(a)));var i;return s.length>0&&((i=this._surveyEventReceiver)===null||i===void 0||i.register(s)),t.kv.set({[q2]:n,[D_]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var t,e;const r=(t=(e=this.wo)!==null&&e!==void 0?e:this.Th)===null||t===void 0?void 0:t.kv.get(D_);return Fr(r)&&Date.now()-r>3e5}Hh(){return Fr(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(t,e){var r;const n={id:t,current_iteration:(r=e==null?void 0:e.iteration)!==null&&r!==void 0?r:null};zY(n);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Lh(t){for(const e of this.Mh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(r){Yt.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,e=!1){if(!vt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Yt.warn("init was not called")}zh(t){let e=null;return this.getSurveys(r=>{var n;e=(n=r.find(s=>s.id===t))!==null&&n!==void 0?n:null}),e}Uh(t){if(vt(this._surveyManager))return{eligible:!1,reason:dh};const e=typeof t=="string"?this.zh(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wh(t){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(vt(this._surveyManager))return{eligible:!1,reason:dh};const e=typeof t=="string"?this.zh(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(vt(this._surveyManager))return Yt.warn("init was not called"),{visible:!1,disabledReason:dh};const e=this.Wh(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return vt(this._surveyManager)?(Yt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:dh})):new Promise(r=>{this.getSurveys(n=>{var s;const i=(s=n.find(a=>a.id===t))!==null&&s!==void 0?s:null;if(i){const a=this.Wh(i);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,r){var n;if(!this.So.isCapturing())return;if(vt(this._surveyManager))return void Yt.warn("init was not called");const s=typeof t=="string"?this.zh(t):t;if(!(s!=null&&s.id))return void Yt.warn("Survey not found");if(!tMe.includes(s.type))return void Yt.warn(`Surveys of type ${s.type} cannot be rendered in the app`);const i=Ce==null?void 0:Ce.querySelector(e);if(i){if(!((n=s.appearance)===null||n===void 0)&&n.surveyPopupDelaySeconds){Yt.info(`Rendering survey ${s.id} with delay of ${s.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var l,c;this.Rh.delete(a),!this.Io&&this.So.isCapturing()&&(Yt.info(`Rendering survey ${s.id} with delay of ${(l=s.appearance)===null||l===void 0?void 0:l.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(s,i,r),Yt.info(`Survey ${s.id} rendered`))},1e3*s.appearance.surveyPopupDelaySeconds);return void this.Rh.add(a)}this._surveyManager.renderSurvey(s,i,r)}else Yt.warn("Survey element not found")}displaySurvey(t,e){var r;if(!this.So.isCapturing())return;if(vt(this._surveyManager))return void Yt.warn("init was not called");const n=this.zh(t);if(!n)return void Yt.warn("Survey not found");let s=n;if(!((r=n.appearance)===null||r===void 0)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=ie(ie({},n),{},{appearance:ie(ie({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==J2.Popover&&e.initialResponses&&Yt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){const i=this.Uh(n);if(!i.eligible)return void Yt.warn("Survey is not eligible to be displayed: ",i.reason)}e.displayType!==J2.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){vt(this._surveyManager)?Yt.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;(t=this._surveyManager)===null||t===void 0||(e=t.handlePageUnload)===null||e===void 0||e.call(t)}};function hh(t,e,r){if(vt(t))return!1;switch(r){case"exact":return t===e;case"contains":{const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var kMe=class{constructor(t){this._instance=t,this.Vh=new Set,this.Gh=new Set,this.Zh=new $_,this.Qh=(e,r)=>this.Jh(e,r)&&this.Kh(e,r)&&this.Xh(e,r)&&this.Yh(e,r),this.Jh=(e,r)=>!(r!=null&&r.event)||(e==null?void 0:e.event)===(r==null?void 0:r.event)}init(){var t,e;Se((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)||(this.tc=(e=this._instance)===null||e===void 0?void 0:e._addCaptureHook((r,n)=>{this.on(r,n)}))}dispose(){var t;(t=this.tc)===null||t===void 0||t.call(this),this.tc=void 0,this.Zh=new $_}register(t){var e,r;if(!Se((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)&&(t.forEach(n=>{var s;this.Vh.add(n),(s=n.steps)===null||s===void 0||s.forEach(i=>{this.Gh.add((i==null?void 0:i.event)||"")})}),(r=this._instance)===null||r===void 0?void 0:r.autocapture)){const n=new Set;this.Vh.forEach(s=>{var i;(i=s.steps)===null||i===void 0||i.forEach(a=>{a!=null&&a.selector&&n.add(a.selector)})}),this._instance.autocapture.setElementSelectors(n)}}replace(t){this.Vh.clear(),this.Gh.clear(),this.register(t)}on(t,e){e!=null&&t.length!=0&&(this.Gh.has(t)||this.Gh.has(e.event))&&this.Vh.forEach(r=>{this.ec(e,r)&&this.Zh.emit("actionCaptured",r.name)})}nc(t){this.onAction("actionCaptured",e=>t(e))}ec(t,e){if((e==null?void 0:e.steps)==null)return!1;for(const r of e.steps)if(this.Qh(t,r))return!0;return!1}onAction(t,e){return this.Zh.on(t,e)}Kh(t,e){if(e!=null&&e.url){var r;const n=t==null||(r=t.properties)===null||r===void 0?void 0:r.$current_url;if(!n||typeof n!="string"||!hh(n,e.url,e.url_matching||"contains"))return!1}return!0}Xh(t,e){return!!this.sc(t,e)&&!!this.rc(t,e)&&!!this.oc(t,e)}sc(t,e){var r;if(!(e!=null&&e.href))return!0;const n=this.ac(t);if(n.length>0)return n.some(i=>hh(i.href,e.href,e.href_matching||"exact"));const s=(t==null||(r=t.properties)===null||r===void 0?void 0:r.$elements_chain)||"";return!!s&&hh(function(i){const a=i.match(/(?::|")href="(.*?)"/);return a?a[1]:""}(s),e.href,e.href_matching||"exact")}rc(t,e){var r;if(!(e!=null&&e.text))return!0;const n=this.ac(t);if(n.length>0)return n.some(c=>hh(c.text,e.text,e.text_matching||"exact")||hh(c.$el_text,e.text,e.text_matching||"exact"));const s=(t==null||(r=t.properties)===null||r===void 0?void 0:r.$elements_chain)||"";return!!s&&(i=function(c){const d=[],f=/(?::|")text="(.*?)"/g;let p;for(;!vt(p=f.exec(c));)d.includes(p[1])||d.push(p[1]);return d}(s),a=e.text,l=e.text_matching||"exact",i.some(c=>hh(c,a,l)));var i,a,l}oc(t,e){var r,n;if(!(e!=null&&e.selector))return!0;const s=t==null||(r=t.properties)===null||r===void 0?void 0:r.$element_selectors;if(s!=null&&s.includes(e.selector))return!0;const i=(t==null||(n=t.properties)===null||n===void 0?void 0:n.$elements_chain)||"";if(e.selector_regex&&i)try{return new RegExp(e.selector_regex).test(i)}catch{return!1}return!1}ac(t){var e;return(t==null||(e=t.properties)===null||e===void 0?void 0:e.$elements)==null?[]:t==null?void 0:t.properties.$elements}Yh(t,e){return!(e!=null&&e.properties)||e.properties.length===0||FY(e.properties.reduce((r,n)=>{const s=ut(n.value)?n.value.map(String):n.value!=null?[String(n.value)]:[];return r[n.key]={values:s,operator:n.operator||"exact"},r},{}),t==null?void 0:t.properties)}},EMe=class{constructor(t){var e,r;this.lc=[],this._instance=t,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=(e=this._instance)===null||e===void 0||(r=e.onSessionId)===null||r===void 0?void 0:r.call(e,n=>this.vc(n))}fc(t){return!1}gc(){return null}mc(t){}yc(){}bc(t,e){return!!t&&FY(t.propertyFilters,e==null?void 0:e.properties)}_c(t,e){const r=new Map;return t.forEach(n=>{var s;(s=n.conditions)===null||s===void 0||(s=s[e])===null||s===void 0||(s=s.values)===null||s===void 0||s.forEach(i=>{if(i!=null&&i.name){const a=r.get(i.name)||[];a.push(n.id),r.set(i.name,a)}})}),r}wc(t,e,r){const n=(r===pm.Activation?this.uc:this.hc).get(t);let s=[];return this.kc(i=>{s=i.filter(a=>n==null?void 0:n.includes(a.id))}),s.filter(i=>{var a;const l=(a=i.conditions)===null||a===void 0||(a=a[r])===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.find(c=>c.name===t);return this.bc(l,e)})}register(t){this.Sc(t,!1)}replace(t){this.Sc(t,!0)}Sc(t,e){var r;Se((r=this._instance)===null||r===void 0?void 0:r._addCaptureHook)||(this.xc(t,e),this.Cc(t,e))}Cc(t,e){const r=t.filter(i=>{var a;return(a=i.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.length});var n;if(e&&this.cc.clear(),r.length===0)return void(e&&((n=this.$c)===null||n===void 0||n.replace([])));this.$c||(this.$c=new kMe(this._instance),this.$c.init(),this.$c.nc(i=>this.onAction(i)));const s=[];r.forEach(i=>{var a;(a=i.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||a.values.forEach(l=>{if(s.push(l),l.name){var c;const d=(c=this.cc.get(l.name))!==null&&c!==void 0?c:[];d.includes(i.id)||d.push(i.id),this.cc.set(l.name,d)}})}),e?this.$c.replace(s):this.$c.register(s)}Tc(t,e){e.forEach((r,n)=>{var s;const i=(s=t.get(n))!==null&&s!==void 0?s:[];r.forEach(a=>{i.includes(a)||i.push(a)}),t.set(n,i)})}xc(t,e){var r,n;const s=t.filter(c=>{var d,f;return((d=c.conditions)===null||d===void 0?void 0:d.events)&&((f=c.conditions)===null||f===void 0||(f=f.events)===null||f===void 0||(f=f.values)===null||f===void 0?void 0:f.length)>0}),i=t.filter(c=>{var d,f;return((d=c.conditions)===null||d===void 0?void 0:d.cancelEvents)&&((f=c.conditions)===null||f===void 0||(f=f.cancelEvents)===null||f===void 0||(f=f.values)===null||f===void 0?void 0:f.length)>0}),a=this._c(t,pm.Activation),l=this._c(t,pm.Cancellation);e?(this.uc=a,this.hc=l):(this.Tc(this.uc,a),this.Tc(this.hc,l)),(s.length!==0||i.length!==0)&&((r=this.tc)!==null&&r!==void 0||(this.tc=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((c,d)=>{this.onEvent(c,d)})))}onEvent(t,e){var r,n;const s=this.Ic(),i=(e==null||(r=e.properties)===null||r===void 0?void 0:r.$survey_id)||(e==null||(n=e.properties)===null||n===void 0?void 0:n.$product_tour_id);if(i&&this.getActivatedIds().includes(i)){const l=this.Mc(t,i);if(l==="consume")return s.info("event consumed activated item, removing it",{event:t,itemId:i}),void this.Ec([i]);if(l==="persist")return s.info("shown item promoted to persisted activation",{event:t,itemId:i}),this.Pc(i),void this.Rc([i])}if(this.hc.has(t)){const l=this.wc(t,e,pm.Cancellation);l.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:l.map(c=>c.id)}),this.Ec(l.map(c=>c.id)),l.forEach(c=>this.Ac(c.id)))}if(!this.uc.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.uc.get(t)});const a=this.wc(t,e,pm.Activation);this.Fc(a.map(l=>l.id))}onAction(t){this.cc.has(t)&&this.Fc(this.cc.get(t)||[])}Fc(t){var e,r;if(t.length===0)return;const n=!!(!((e=this._instance)===null||e===void 0||(r=e.get_session_id)===null||r===void 0)&&r.call(e)),s=[];for(const i of t)n&&this.fc(i)?this.Pc(i)&&this.Oc(i):s.push(i);s.length>0&&(this.lc=[...new Set([...this.lc,...s])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(t){this.lc=this.lc.filter(r=>r!==t);const e=this.Dc();return!e.includes(t)&&(this.Lc([...e,t]),this.Nc(),!0)}Ec(t){const e=new Set(t);this.lc=this.lc.filter(s=>!e.has(s));const r=this.qc(),n=r.filter(s=>!e.has(s));n.length!==r.length&&(this.Lc(n),n.length===0&&this.jc()),this.Rc(t)}Bc(){var t;const e=this.gc();if(!e)return{};const r=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[e];return r&&typeof r=="object"?r:{}}Oc(t){if(!this.gc())return;const e=this.Bc();this.mc(ie(ie({},e),{},{[t]:Date.now()}))}Rc(t){if(!this.gc())return;const e=this.Bc(),r={};let n=!1;for(const[s,i]of Object.entries(e))t.includes(s)?n=!0:r[s]=i;n&&(Xs(r)?this.yc():this.mc(r))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(t){if(!this.Dc().includes(t))return;const e=this.Bc()[t];return Fr(e)?e:void 0}qc(){var t;const e=this.zc();return((t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[e])||[]}Dc(){var t,e,r;const n=this.qc();if(n.length===0)return[];const s=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Uc()],i=(e=this._instance)===null||e===void 0||(r=e.get_session_id)===null||r===void 0?void 0:r.call(e);return i&&s===i?n:[]}Nc(){var t,e;const r=(t=this._instance)===null||t===void 0||(e=t.get_session_id)===null||e===void 0?void 0:e.call(t);r&&this.Wc(r)}jc(){this.Vc()}vc(t){var e;const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Uc()];if(r&&r!==t){const n=this.qc(),s=this.Bc();n.length>0&&(this.Lc([]),n.filter(i=>Fr(s[i])).forEach(i=>this.Ac(i))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(t=>!this.Gc(t))}dispose(){var t,e,r;(t=this.dc)===null||t===void 0||t.call(this),this.dc=void 0,(e=this.tc)===null||e===void 0||e.call(this),this.tc=void 0,(r=this.$c)===null||r===void 0||r.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},CMe=class extends EMe{constructor(t){super(t)}zc(){return LK}Uc(){return $K}gc(){return BK}mc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated_timestamps:t})}yc(){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.unregister("$surveys_activated_timestamps")}fc(t){var e;let r;this.kc(s=>{r=s.find(i=>i.id===t)});const n=r==null||(e=r.appearance)===null||e===void 0?void 0:e.surveyPopupDelaySeconds;return Fr(n)&&n>0}Qc(){return Zo.SHOWN}kc(t){var e;(e=this._instance)===null||e===void 0||e.getSurveys(t)}Ac(t){var e;(e=this._instance)===null||e===void 0||e.cancelPendingSurvey(t)}Ic(){return Yt}Lc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated:t})}Wc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated_session:t})}Vc(){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.unregister("$surveys_activated_session")}Gc(){return!1}Mc(t,e){let r;return this.kc(n=>{r=n.find(s=>s.id===e)}),!r||function(n){var s;return $Y(n)&&!!(!((s=n.conditions)===null||s===void 0||(s=s.events)===null||s===void 0)&&s.repeatedActivation)||n.schedule==="always"}(r)?t===Zo.SHOWN?"consume":"ignore":t===Zo.SHOWN?"persist":t===Zo.DISMISSED||t===Zo.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},NMe=class{constructor(t){this._instance=t}initialize(){}get(t){if(typeof t=="string")return this._instance.get_property(t);const e={};for(const r of t){const n=this._instance.get_property(r);Se(n)||(e[r]=n)}return e}set(t,e){this._instance.register(typeof t=="string"?{[t]:e}:t)}remove(t){typeof t!="string"?t.forEach(e=>this._instance.unregister(e)):this._instance.unregister(t)}},jMe=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=rt==null?void 0:rt.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:r}=t;return{generateSurveys:e?n=>e(this._instance,n):void 0,loadExternalDependency:r?n=>r(this._instance,"surveys",n):void 0}}createEventReceiver(){return new CMe(this._instance)}};const TMe=me!=null&&me.location?M_(me.location.hash,"__posthog")||M_(location.hash,"state"):null,M6="_postHogToolbarParams",I6=Mr("[Toolbar]"),L6=Mr("[FeatureFlags]");var AMe=class{constructor(t,e=!1){this.Jc=!1,this.update(t,e)}update(t,e){this.Kc=((r,n)=>{var s,i,a,l,c,d,f,p;return{bootstrap:{featureFlags:(s=(i=r.bootstrap)===null||i===void 0?void 0:i.featureFlags)!==null&&s!==void 0?s:void 0,featureFlagPayloads:(a=(l=r.bootstrap)===null||l===void 0?void 0:l.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:n,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=r.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Se(r.remote_config_refresh_interval_ms),requestTimeoutMs:r.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(d=r.feature_flag_request_max_retries)!==null&&d!==void 0?d:1),compression:r.disable_compression?void 0:"best-available",evaluationContexts:(f=(p=r.evaluation_contexts)!==null&&p!==void 0?p:r.evaluation_environments)!==null&&f!==void 0?f:[],flagKeys:ut(r.flag_keys)?r.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Jc||(L6.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),Se(t.flag_keys)||ut(t.flag_keys)||L6.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const $6=Mr("[FeatureFlags]"),_u=Mr("[FeatureFlags]",{debugEnabled:!0}),zE=`" failed. Feature flags didn't load in time.`,RMe=[502,504],B6=["click","keydown","wheel","touchstart","pointerdown"],F6="connection_error",z6=t=>{const e={};for(let r=0;t.length>r;r++)e[t[r]]=!0;return e},U6=t=>{const e={};for(const[r,n]of D0(t||{}))n&&(e[r]=n);return e},V6=t=>zf(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),na=Mr("[Error tracking]"),ij="webkit-masked-url:",DMe=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],OMe=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",ij],PMe=["__firefox__","__gCrWeb"],H6="Refusing to render web experiment since the viewer is a likely bot",MMe={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>B_(e,t),not_regex:(t,e)=>!B_(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},Ii=Mr("[Conversations]"),bu="Conversations not available yet.";function q6(t,e){var r,n,s,i,a,l,c;const d=(r=t==null?void 0:t.flushIntervalMs)!==null&&r!==void 0?r:3e3,f=(n=t==null?void 0:t.maxBufferSize)!==null&&n!==void 0?n:100,p=e!=null&&e.consoleCapture?void 0:(s=t==null?void 0:t.maxLogsPerInterval)!==null&&s!==void 0?s:1e3,m=Se(p)?Math.max(f,2048):Math.max(f,p),g=ie(ie({},function(){let y="",x="";try{const w=Tn==null?void 0:Tn.userAgent;w&&([y,x]=lK(w))}catch{}return function(w,_){const S=function(k){if(k)return{}.hasOwnProperty.call(B$,k)?B$[k]:k}(w);return ie(ie({},S?{"os.name":S}:{}),_?{"os.version":_}:{})}(y,x)}()),t==null?void 0:t.resourceAttributes);return{serviceName:(i=(a=g==null?void 0:g["service.name"])!==null&&a!==void 0?a:t==null?void 0:t.serviceName)!==null&&i!==void 0?i:e==null?void 0:e.serviceNameDefault,serviceVersion:(l=g==null?void 0:g["service.version"])!==null&&l!==void 0?l:t==null?void 0:t.serviceVersion,environment:(c=g==null?void 0:g["deployment.environment"])!==null&&c!==void 0?c:t==null?void 0:t.environment,resourceAttributes:g,beforeSend:t==null?void 0:t.beforeSend,flushIntervalMs:d,maxBufferSize:f,maxQueueSize:m,maxBatchRecordsPerPost:100,rateCapWindowMs:d,maxLogsPerInterval:p,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const IMe=["debug","log","warn","error","info"],LMe=t=>{for(;t!=null&&t.__rrweb_original__;)t=t.__rrweb_original__;return t},W6="console",qY="__posthogHandledLogsRequestError",UE=(t,e)=>{const r=t instanceof Error?t:new Error(e);return r[qY]=!0,r},G6=t=>!!t&&typeof t=="object"&&t[qY]===!0,F_=Mr("[NetworkMetrics]"),PR=()=>{var t;return!(me==null||(t=me.performance)===null||t===void 0)&&t.now?me.performance.now():Date.now()},$Me={"http:":80,"https:":443},BMe=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),WY=(t,e)=>{var r;const n=String(e);return{method:String(t).toUpperCase(),url:((r=pl(n))===null||r===void 0?void 0:r.href)||n}},aj=(t,e,r,n,s,i,a=!1)=>{try{var l,c;const d=s();if(!d)return;const f=r||void 0,p=PR()-n,m=pl(e.url);if(m&&m.protocol!=="http:"&&m.protocol!=="https:")return;const g={url:(m==null?void 0:m.href)||e.url,method:e.method},y=jn(d.name)?d.name(g):St(d.name)?d.name:"http.client.request.duration";if(!y)return;const x=a&&!f?void 0:((_,S)=>_?400>_?void 0:String(_):(S==null?void 0:S.name)||"_OTHER")(f,i),w=ie(ie(ie(ie(ie({},(_=>{const S=BMe.has(_)?_:"_OTHER";return ie({"http.request.method":S},S==="_OTHER"&&_!==S?{"http.request.method_original":_}:{})})(g.method)),m?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||$Me[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(S=_.pathname,S.split("/").map(k=>(N=>/^\d+$/.test(N)||N.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(N))(k)?":id":k).join("/"))};var S})(m):{}),f?{"http.response.status_code":f}:{}),x?{"error.type":x}:{}),(l=d.attributes)===null||l===void 0?void 0:l.call(d,g,{status:f,durationMs:p}));(c=t.metrics)===null||c===void 0||c.histogram(y,p,{unit:"ms",attributes:w})}catch(d){F_.error("Failed to record network metric",d)}},GY=()=>{},FMe=(t,e)=>jn(me==null?void 0:me.fetch)?Xg(me,"fetch",r=>function(...n){const s=PR(),i=r.apply(this,n);if(!e())return i;try{var a,l,c;const[d,f]=n,p=WY((a=(l=f==null?void 0:f.method)!==null&&l!==void 0?l:d==null?void 0:d.method)!==null&&a!==void 0?a:"GET",(c=d==null?void 0:d.url)!==null&&c!==void 0?c:d);return i.then(m=>(aj(t,p,m==null?void 0:m.status,s,e,void 0,!0),m),m=>{throw aj(t,p,void 0,s,e,m),m})}catch(d){return F_.error("Failed to observe fetch",d),i}}):GY,zMe=(t,e)=>{var r;const n=me==null||(r=me.XMLHttpRequest)===null||r===void 0?void 0:r.prototype;if(!n)return GY;const s=new WeakMap,i=Xg(n,"open",l=>function(...c){try{EY.has(this)||s.set(this,WY(c[0],c[1]))}catch(d){F_.error("Failed to observe XHR open",d)}return l.apply(this,c)}),a=Xg(n,"send",l=>function(...c){let d;try{const f=s.get(this);if(f&&e()){const p=PR();d=()=>{this.removeEventListener("loadend",d),aj(t,f,this.status,p,e)},Gt(this,"loadend",d)}}catch(f){F_.error("Failed to observe XHR send",f)}try{return l.apply(this,c)}catch(f){throw d&&this.removeEventListener("loadend",d),f}});return()=>{i(),a()}},ew={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=$6,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const e=this.vd();this.hd=0,e&&this.reloadFeatureFlags()},this.fd=()=>{var e,r;const n=this.pd,s=(e=this.gd)!==null&&e!==void 0?e:n;Se(n)||Se(s)||this.Rr.remoteRequestsDisabled||!Ce||Ce.visibilityState==="hidden"||Date.now()-((r=this.md)!==null&&r!==void 0?r:0)<s||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?n:Math.min(2*s,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{(Ce==null?void 0:Ce.visibilityState)==="visible"&&this._d()},"get"in t?this.So=t:(this._instance=t,this.wd=new AMe(t.config,t.nl()),this.So=this.wd)}updateConfig(t,e){var r;(r=this.wd)===null||r===void 0||r.update(t,e),this.wo&&this.kd()}setup(t){return this.Fh=t,this.$=t.logger.createLogger("[FeatureFlags]"),HY(t.kv.initialize(),()=>{this.Fh===t&&(this.Fh=void 0,this.wo=t,this.Sd(t))})}Sd(t){var e;if(this.wo===t)return me&&Gt(me,"online",this.an),this.kd(),this.xd=t.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const t=this.Rr.refreshIntervalMs,e=!this.Rr.remoteRequestsDisabled&&Ce&&!Se(t)&&t>0?t:void 0;this.Rr.idleRefreshBackoff||(this.gd=e),e!==this.pd&&(this.Ed(),Se(e)||(this.pd=e,this.gd=e,this.yd(),Ce!=null&&Ce.addEventListener&&(Gt(Ce,Wg,this.ln),Rh(B6,r=>{Gt(Ce,r,this.bd,{capture:!0})}))))}yd(){Se(this.pd)||(Se(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var t;Se(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,Ce==null||(t=Ce.removeEventListener)===null||t===void 0||t.call(Ce,"visibilitychange",this.ln),Rh(B6,e=>{var r;Ce==null||(r=Ce.removeEventListener)===null||r===void 0||r.call(Ce,e,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var t,e;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),(t=this.xd)===null||t===void 0||t.dispose(),this.xd=void 0,(e=this.$d)===null||e===void 0||e.call(this),this.$d=void 0,this.ed=[],me==null||me.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(t){var e;return this.Od&&t in this.Od?this.Od[t]:(e=this.wo)===null||e===void 0?void 0:e.kv.get(t)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var t;return!Se((t=this.wo)===null||t===void 0?void 0:t.kv.get("$enabled_feature_flags"))&&this.Td()}At(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.set(t)})}Nd(t,e,r){var n;if(!(!((n=this._instance)===null||n===void 0)&&n.persistence)||!t.$enabled_feature_flags)return;const s=this.Fd("$enabled_feature_flags")||{},i=t.$enabled_feature_flags||{},a=e.flags||e.featureFlags,l=e.flags?Object.entries(e.flags).filter(([,_])=>!(_!=null&&_.failed)).map(([_])=>_):[],c=!!e.errorsWhileComputingFlags&&!!e.flags,d=c?l:r&&!ut(a)?Object.keys(a||{}):Array.from(new Set([...Object.keys(s),...Object.keys(i)])),f=this.Fd("$feature_flag_payloads")||{},p=t.$feature_flag_payloads||{},m=c||r?d:Array.from(new Set([...Object.keys(f),...Object.keys(p)])),g=!c&&!r,y=!!g||d,x=!!g||m,w={[Qo]:y,[ha]:y,[pc]:x};t.$feature_flag_details&&(w[Yu]=y);for(const _ of[Qu,wc,og])Se(t[_])||(w[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(w)}Lt(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.remove(t)})}Ld(t){try{t()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}Id(){const t={};for(const n of[Qo,pc,Qu,Za]){const s=this.Fd(n);Se(s)||(t[n]=s)}this.Yc=t;const e=ie({},t),r=this.Fd(ha);if(r)for(const[n,s]of Object.entries(r))e[`$feature/${n}`]=s;this.td=e}Cd(){const t=this.Rr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Fd(wc);return typeof e!="number"||Date.now()-e>t}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const t=this.Rr.evaluationContexts;return t!=null&&t.length?t.filter(e=>{const r=e&&typeof e=="string"&&e.trim().length>0;return r||this.$.error("Invalid evaluation context found:",e,"Expected non-empty string"),r}):[]}Bd(){const t=this.Rr.flagKeys;if(!Se(t))return t.filter(e=>{const r=e&&typeof e=="string"&&e.trim().length>0;return r||this.$.error("Invalid flag key found:",e,"Expected non-empty string"),r})}initialize(){var t,e;const r=this.Rr,n=(t=(e=r.bootstrap)===null||e===void 0?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(n).length){var s,i;const a=(s=(i=r.bootstrap)===null||i===void 0?void 0:i.featureFlagPayloads)!==null&&s!==void 0?s:{},l=Object.keys(n).filter(d=>!Se(n[d])).reduce((d,f)=>(d[f]=n[f],d),{}),c=Object.keys(a).filter(d=>l[d]).reduce((d,f)=>(d[f]=a[f],d),{});return this.Hd({featureFlags:l,featureFlagPayloads:c},void 0,{persist:!1})}}updateFlags(t,e,r){var n,s;const i=r!=null&&r.merge&&(n=this.Fd("$enabled_feature_flags"))!==null&&n!==void 0?n:{},a=r!=null&&r.merge&&(s=this.Fd("$feature_flag_payloads"))!==null&&s!==void 0?s:{},l=ie(ie({},i),t),c=ie(ie({},a),e),d={};for(const[f,p]of Object.entries(l))d[f]={key:f,enabled:P$(p),variant:M$(p),reason:void 0,metadata:Se(c==null?void 0:c[f])?void 0:{id:0,version:void 0,description:void 0,payload:c[f]}};this.Hd({flags:d})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Fd(Yu),e=this.Fd(Za),r=this.Fd(ju);if(!r&&!e)return t||{};const n=pr({},t||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(const l of s){var i;const c=n[l],d=e==null?void 0:e[l],f=Se(d)?(i=c==null?void 0:c.enabled)!==null&&i!==void 0&&i:!!d,p=Se(d)?c==null?void 0:c.variant:typeof d=="string"?d:void 0,m=r==null?void 0:r[l],g=ie(ie({},c),{},{enabled:f,variant:f?p??(c==null?void 0:c.variant):void 0});var a;f!==(c==null?void 0:c.enabled)&&(g.original_enabled=c==null?void 0:c.enabled),p!==(c==null?void 0:c.variant)&&(g.original_variant=c==null?void 0:c.variant),m&&(g.metadata=ie(ie({},c==null?void 0:c.metadata),{},{payload:m,original_payload:c==null||(a=c.metadata)===null||a===void 0?void 0:a.payload})),n[l]=g}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:n}),this.Xc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(r=>{const n=t[r];return{key:r,enabled:P$(n),variant:M$(n),payload:O$(e[r])}})}getFlagVariants(){const t=this.Fd(ha),e=this.Fd(Za);if(!e)return t||{};const r=pr({},t||{}),n=Object.keys(e);for(let s=0;n.length>s;s++)r[n[s]]=e[n[s]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:r}),this.Xc=!0),r}getFlagPayloads(){const t=this.Fd(pc),e=this.Fd(ju);if(!e)return t||{};const r=pr({},t||{}),n=Object.keys(e);for(let s=0;n.length>s;s++)r[n[s]]=e[n[s]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:r}),this.Xc=!0),r}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(t=>{try{t()}catch(e){this.$.error("Error while running feature flags reloading callback",e)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(t){return this.ed.push(t),()=>{this.ed=this.ed.filter(e=>e!==t)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.od=t}resetFlagCallReported(){this.Lt(vc)}Ud(t){this.Ad();const e=this.wo;if(!e||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const r={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ie(ie(ie({},e.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Fd(gc),timezone:vY()};Se(e.deviceId)||(r.$device_id=e.deviceId),(t!=null&&t.disableFlags||this.Rr.featureFlagsDisabled)&&(r.disable_flags=!0);const n=this.jd();n.length&&(r.evaluation_contexts=n);const s=this.Bd();Se(s)||(r.flag_keys=s);const i=this.Rr.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(i?"&only_evaluate_survey_feature_flags=true":""),l=this.rd;this.sd=!0;const c=()=>{this.ad&&(this.ad=!1,this.Ud())},d=y=>{var x,w;const _=(x=y.json)!==null&&x!==void 0?x:{},S=y.statusCode!==200;if(this.sd=!1,l!==this.rd)return void c();if(this.Wd(y.statusCode),S||this.ad||(this.$anon_distinct_id=void 0),r.disable_flags&&!this.ad)return;this.ld=!S;const k=[];y.error?k.push(y.error instanceof Error&&y.error.name==="AbortError"?"timeout":y.error instanceof Error?F6:"unknown_error"):y.statusCode!==200&&k.push(`api_error_${y.statusCode}`),_.errorsWhileComputingFlags&&k.push("errors_while_computing_flags");const N=!!(!((w=_.quotaLimited)===null||w===void 0)&&w.includes("feature_flags"));N&&k.push("quota_limited"),this.At({[qg]:k}),N?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.Hd(_,S,{partialResponse:i}),c()},f=y=>{this.sd=!1,l===this.rd&&(this.At({[qg]:[F6]}),this.$.error("Feature flag request failed",y),this.Dd()&&this.Md(!0)),c()};let p=this.Rr.requestMaxRetries;const m=()=>p>0&&l===this.rd,g=()=>{if(l!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void c();try{e.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(y=>{if((x=>RMe.includes(x.statusCode)||(w=>w.statusCode===0&&w.error instanceof Error&&w.error.name==="AbortError")(x))(y)&&m())return p--,void setTimeout(g,500);d(y)}).catch(f)}catch(y){f(y)}};g()}vd(){return lY(this.hd,3)}Wd(t){this.hd=cY(t,this.hd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var r;if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+zE);if(this.qd())return;const n=this.getFeatureFlagResult(t,e);return(r=n==null?void 0:n.variant)!==null&&r!==void 0?r:n==null?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+zE);if(this.qd())return;const r=this.getFlagVariants(),n=t in r,s=r[t],i=this.getFlagPayloads()[t],a=String(s),l=this.Fd("$feature_flag_request_id")||void 0,c=this.Fd("$feature_flag_evaluated_at")||void 0;let d,f=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var p;const L=(p=this.wo)===null||p===void 0?void 0:p.session.sessionId,$=this.Fd(Bm);L&&L!==$&&(f={},d=L)}if(e.send_event||!("send_event"in e))if(t in f&&f[t].includes(a))d&&this.At({[vc]:f,[Bm]:d});else{var m,g,y,x,w,_,S,k,N,j,T,D;ut(f[t])?f[t].push(a):f[t]=[a],this.At(ie({[vc]:f},d?{[Bm]:d}:{}));const L=this.getFeatureFlagDetails(t),$=[...(m=this.Fd("$feature_flag_errors"))!==null&&m!==void 0?m:[]];Se(s)&&$.push("flag_missing");const Q={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:i??null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:(g=(y=this.Rr.bootstrap)===null||y===void 0||(y=y.featureFlags)===null||y===void 0?void 0:y[t])!==null&&g!==void 0?g:null,$feature_flag_bootstrapped_payload:(x=(w=this.Rr.bootstrap)===null||w===void 0||(w=w.featureFlagPayloads)===null||w===void 0?void 0:w[t])!==null&&x!==void 0?x:null,$used_bootstrap_value:!this.ld};Se(L==null||(_=L.metadata)===null||_===void 0?void 0:_.has_experiment)||(Q.$feature_flag_has_experiment=L.metadata.has_experiment),Se(L==null||(S=L.metadata)===null||S===void 0?void 0:S.version)||(Q.$feature_flag_version=L.metadata.version);const M=(k=L==null||(N=L.reason)===null||N===void 0?void 0:N.description)!==null&&k!==void 0?k:L==null||(j=L.reason)===null||j===void 0?void 0:j.code;var I;M&&(Q.$feature_flag_reason=M),!(L==null||(T=L.metadata)===null||T===void 0)&&T.id&&(Q.$feature_flag_id=L.metadata.id),Se(L==null?void 0:L.original_variant)&&Se(L==null?void 0:L.original_enabled)||(Q.$feature_flag_original_response=Se(L.original_variant)?L.original_enabled:L.original_variant),!(L==null||(D=L.metadata)===null||D===void 0)&&D.original_payload&&(Q.$feature_flag_original_payload=L==null||(I=L.metadata)===null||I===void 0?void 0:I.original_payload),$.length&&(Q.$feature_flag_error=$.join(",")),this.Vd(Q)}else d&&this.At({[vc]:f,[Bm]:d});return n?{key:t,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:O$(i)}:void 0}Vd(t){try{var e;(e=this.wo)===null||e===void 0||e.capture("$feature_flag_called",t)}catch(r){this.$.error("Failed to capture feature flag call",r)}}getRemoteConfigPayload(t,e){this.Gd(t,e)}Gd(t,e){var r=this;return xr(function*(){const n=r.wo;if(!n)return;const s={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},i=r.jd();i.length&&(s.evaluation_contexts=i);const a=r.Bd();let l;Se(a)||(s.flag_keys=a);try{var c;const d=(c=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.Rr.compression,sentAt:"body",timeoutMs:r.Rr.requestTimeoutMs})).json)===null||c===void 0?void 0:c.featureFlagPayloads;l=(d==null?void 0:d[t])||void 0}catch(d){return void r.$.error("Remote config feature flag request failed",d)}try{e(l)}catch(d){r.$.error("Remote config feature flag callback failed",d)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.ld)return e.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+zE),e.defaultValue;const r=this.getFeatureFlag(t,e);return Se(r)?e.defaultValue:!!r}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,r){this.Hd(t,e,r)}Hd(t,e,r){if(!this.wo)return;this.nd=!0;const n=((s,i={},a={},l={},c,d=$6)=>{const f=((k,N)=>{const j=k.flags;if(j){const T=Object.fromEntries(Object.keys(j).map(I=>{var L;return[I,(L=j[I].variant)!==null&&L!==void 0?L:j[I].enabled]})),D=Object.fromEntries(Object.keys(j).filter(I=>j[I].enabled).filter(I=>{var L;return!Se((L=j[I].metadata)===null||L===void 0?void 0:L.payload)}).map(I=>{var L;return[I,(L=j[I].metadata)===null||L===void 0?void 0:L.payload]}));return ie(ie({},k),{},{featureFlags:T,featureFlagPayloads:D})}return k.featureFlags&&N.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),k})(s,d),p=f.flags,m=f.featureFlags,g=f.featureFlagPayloads;if(!m)return;const y=s.requestId,x=s.evaluatedAt;if(ut(m)){d.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const k={};if(m)for(let N=0;m.length>N;N++)k[m[N]]=!0;return{[Qo]:m,[ha]:k,[og]:!1}}let w=m,_=g,S=p;if(c!=null&&c.partialResponse){const k=Object.keys(w),N=_||{};w=ie(ie({},i),w),_=ie(ie({},a),N),k.forEach(j=>{j in N||_==null||delete _[j]}),S=ie(ie({},l),S)}else if(s.errorsWhileComputingFlags)if(p){const k=new Set(Object.keys(p).filter(j=>{var T;return!(!((T=p[j])===null||T===void 0)&&T.failed)}));w=ie(ie({},i),Object.fromEntries(Object.entries(w).filter(([j])=>k.has(j))));const N=Object.fromEntries(Object.entries(_||{}).filter(([j])=>k.has(j)));_=ie(ie({},a),N),k.forEach(j=>{j in N||_==null||delete _[j]}),S=ie(ie({},l),Object.fromEntries(Object.entries(S||{}).filter(([j])=>k.has(j))))}else w=ie(ie({},i),w),_=ie(ie({},a),_),S=ie(ie({},l),S);return ie(ie({[Qo]:Object.keys(U6(w)),[ha]:w||{},[pc]:_||{},[Yu]:S||{},[og]:s.minimalFlagCalledEvents===!0},y?{[Qu]:y}:{}),x?{[wc]:x}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.$);if(n)if((r==null?void 0:r.persist)===!1){const s=!Se(this.wo.kv.get(ha));this.Od=n,s||this.At(n)}else this.Td(),this.Nd(n,t,!!(r!=null&&r.partialResponse)),this.At(n);else e&&this.Dd();e||(this.ud=!1),this.Md(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Zd(t)}Zd(t){if(this.wo){if(t===!1)return this.Lt([Za,ju]),this.Md(),void _u.info("All overrides cleared");if(ut(t))return this.At({[Za]:z6(t)}),this.Md(),void _u.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e;const r=t;this.Xc=!!((e=r.suppressWarning)!==null&&e!==void 0&&e);const n={},s=r.flags,i=r.payloads;return s&&(n[Za]=ut(s)?z6(s):s),i&&(n[ju]=i),Object.keys(n).length&&this.At(n),s===!1&&i===!1?this.Lt([Za,ju]):s===!1?this.Lt(Za):i===!1&&this.Lt(ju),this.Md(),s===!1?_u.info("Flag overrides cleared"):s&&_u.info("Flag overrides set",{flags:s}),void(i===!1?_u.info("Payload overrides cleared"):i&&_u.info("Payload overrides set",{payloads:i}))}if(t&&typeof t=="object")return this.At({[Za]:t}),this.Md(),void _u.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.nd){const{flags:e,flagVariants:r}=this.Qd();try{t(e,r)}catch(n){this.$.error("Error while running feature flags callback",n)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var n;const s=(this.Fd("$early_access_features")||[]).find(d=>d.flagKey===t),i={[`$feature_enrollment/${t}`]:e},a={$feature_flag:t,$feature_enrollment:e,$set:i};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r);const l=ie(ie({},this.getFlagVariants()),{},{[t]:e});(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(i)}),this.At({[Qo]:Object.keys(U6(l)),[ha]:l,[mc]:ie(ie({},this.Fd("$stored_person_properties")||{}),i)}),this.Md();try{var c;(c=this.wo)===null||c===void 0||c.capture("$feature_enrollment_update",a)}catch(d){this.$.error("Failed to capture early access feature enrollment",d)}}getEarlyAccessFeatures(t,e=!1,r){const n=this.Fd(H2);!n||e?this.Jd(t,r):t(n)}Jd(t,e){var r=this;return xr(function*(){const n=r.wo;if(!n)return;const s=e?`&${e.map(a=>`stage=${a}`).join("&")}`:"";let i;try{const a=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;i=a.json.earlyAccessFeatures,r.At({[H2]:i})}catch(a){return void r.$.error("Early access feature request failed",a)}try{t(i)}catch(a){r.$.error("Early access feature callback failed",a)}})()}Qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(r=>e[r]),flagVariants:Object.keys(e).filter(r=>e[r]).reduce((r,n)=>(r[n]=e[n],r),{})}}Md(t){this.Id();const{flags:e,flagVariants:r}=this.Qd();this.featureFlagEventHandlers.forEach(n=>{try{n(e,r,{errorsLoading:t})}catch(s){this.$.error("Error while running feature flags callback",s)}})}setPersonPropertiesForFlags(t,e=!0){this.Kd(t,e)}Kd(t,e=!0){const r=this.Fd("$stored_person_properties")||{},n=(t==null?void 0:t.$set)||(t!=null&&t.$set_once?{}:t),s=t==null?void 0:t.$set_once,i={};if(s)for(const a in s)({}).hasOwnProperty.call(s,a)&&(a in r||(i[a]=s[a]));this.At({[mc]:ie(ie(ie({},r),i),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const r=ie({},this.Fd("$stored_person_properties")||{});t.forEach(n=>{delete r[n]}),this.At({[mc]:r}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(mc),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const r=this.Fd("$stored_group_properties")||{},n=ie({},r);for(const s of Object.keys(t))n[s]=ie(ie({},r[s]),t[s]);this.At({[gc]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[gc]:ie(ie({},e),{},{[t]:{}})})}else this.Lt(gc)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},UMe={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var t;return!!(!((t=this.Xd)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.Yd==="awaiting_config"||this.Yd==="missing_config"?this.Yd:(t=(e=this.Xd)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.Yd}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=$E,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,r;if(!(Ce!=null&&Ce.visibilityState)||Ce.visibilityState==="visible")return!0;const n=me==null||(e=me.performance)===null||e===void 0||(r=e.getEntriesByType)===null||r===void 0?void 0:r.call(e,"visibility-state");return!(n!=null&&n.length)||n.some(s=>s.name==="visible")})(),this.ln=()=>{var e,r;(Ce==null?void 0:Ce.visibilityState)==="visible"&&(this.Xe=!0,(e=this.Xd)===null||e===void 0||(r=e.setDocumentWasEverVisible)===null||r===void 0||r.call(e,!0))},!this._instance.sessionManager)throw Wo.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Rr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');Ce!=null&&Ce.addEventListener&&Gt(Ce,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.ev=!0,Ce==null||(e=Ce.removeEventListener)===null||e===void 0||e.call(Ce,"visibilitychange",this.ln),t?this.iv(!0):this.stopRecording()}get nv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),r=!this.Rr.disable_session_recording,n=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return me&&e&&r&&!n}startIfEnabledOrStop(t){var e;if(this.ev||this.nv&&(!((e=this.Xd)===null||e===void 0)&&e.isStarted))return;const r=!Se(Object.assign)&&!Se(Array.from);this.nv&&r?(this.sv(t),Wo.info("starting")):(this.Yd=$E,this.stopRecording())}sv(t){var e,r;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=D6),(rt==null||(e=rt.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((r=rt.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording))this.rv(t);else{var n,s;const i=this._instance.sessionManager;(n=rt.__PosthogExtensions__)===null||n===void 0||(s=n.loadExternalDependency)===null||s===void 0||s.call(n,this._instance,this.ov,a=>{if(!this.ev&&this.nv&&this._instance.sessionManager===i)return a?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Wo.error("could not load recorder",a)):void this.rv(t);this.Yd="disabled"})}}stopRecording(){var t,e;(t=this.tv)===null||t===void 0||t.call(this),this.tv=void 0,(e=this.Xd)===null||e===void 0||e.stop()}iv(t=!1){var e,r;(e=this.tv)===null||e===void 0||e.call(this),this.tv=void 0,(r=this.Xd)===null||r===void 0||r.discard({discardProducerEvents:t})}av(){var t,e;(t=this.Ml)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Ml)===null||e===void 0||e.unregister("$replay_sample_rate")}lv(t,e){if(vt(t))return null;const r=Fr(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Wo.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):r;var n}uv(t){if(this.Ml){var e,r;const n=this.Ml,s=()=>{var i;const a=t.sessionRecording===!1?void 0:t.sessionRecording,l=this.lv((i=this.Rr.session_recording)===null||i===void 0?void 0:i.sampleRate,"session_recording.sampleRate"),c=this.lv(a==null?void 0:a.sampleRate,"remote config sampleRate"),d=l??c;vt(d)&&this.av();const f=a==null?void 0:a.minimumDurationMilliseconds;n.register({[ag]:ie(ie({cache_timestamp:Date.now(),enabled:!!a},a),{},{networkPayloadCapture:ie({capturePerformance:t.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:d,minimumDurationMilliseconds:Se(f)?null:f,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers,version:a==null?void 0:a.version,triggerGroups:a==null?void 0:a.triggerGroups})})};s(),(e=this.tv)===null||e===void 0||e.call(this),this.tv=(r=this._instance.sessionManager)===null||r===void 0?void 0:r.onSessionId(s)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.uv(e),void this.iv()):(this.uv(e),void this.startIfEnabledOrStop()):(this.Yd==="awaiting_config"&&(this.Yd="missing_config",this._instance.register_for_session({[WK]:!0}),Wo.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var r;!((r=this.Xd)===null||r===void 0)&&r.log?this.Xd.log(t,e):Wo.warn("log called before recorder was ready")}get ov(){var t,e;const r=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(ag);return(r==null||(e=r.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(ag);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(r){return Wo.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}return!vt(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}rv(t){var e,r,n;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(!((e=rt.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return Wo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[qK]:!0});var s;if(this.Xd||(this.Xd=(s=rt.__PosthogExtensions__)===null||s===void 0?void 0:s.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv())return this.Yd==="missing_config"||this.Yd==="awaiting_config"?void 0:(this.Yd="awaiting_config",Wo.info("persisted remote config is stale, requesting fresh config before starting"),void new xY(this._instance).load());this.Yd=D6,(r=(n=this.Xd).setDocumentWasEverVisible)===null||r===void 0||r.call(n,this.Xe),this.Xd.start(t)}else this.Yd=$E}onRRwebEmit(t){var e,r;(e=this.Xd)===null||e===void 0||(r=e.onRRwebEmit)===null||r===void 0||r.call(e,t)}overrideLinkedFlag(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.Xd)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.Xd)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,r;this.Xd||(r=this.Ml)===null||r===void 0||r.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.Xd)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Xd)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var r;return!!(!((r=this.Xd)===null||r===void 0)&&r.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.Xd)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},VMe={autocapture:class extends gMe{constructor(t){super(new vMe(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.dv=!1,this._instance=t,this.vv=this.fv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.pv();return!!(t.path||t.search||this.gv(t))}startIfEnabled(){this.isEnabled&&(ze.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.vv=this.fv(),this.startIfEnabled()}stop(){this.mv&&this.mv(),this.mv=void 0,this.yv&&this.yv(),this.yv=void 0,ze.info("History API monitoring stopped")}monitorHistoryChanges(){me&&me.history&&(this.bv("pushState"),this.bv("replaceState"),this._v(),this.gv()&&this.wv())}bv(t){var e;if(!me||!((e=me.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const r=this;Xg(me.history,t,n=>function(s,i,a){var l;r.Sv(a)&&r.xv(),n.call(this,s,i,a),r.Cv(t,!r.dv&&(me==null||(l=me.event)===null||l===void 0?void 0:l.type)!=="popstate")})}fv(){const t=me==null?void 0:me.location;if(t!=null&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}pv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:Ct(t)?t:{}}gv(t=this.pv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}$v(t){const e=this.pv(),r=this.vv;return!(!r||!(e.path&&t.pathname!==r.pathname||e.search&&t.search!==r.search||this.gv(e)&&t.hash!==r.hash))}Cv(t,e=!1){try{e||this.xv();const r=this.fv();if(!r)return;if(this.$v(r)){const n=()=>this._instance.capture(CR,{navigation_type:t});e?(this.Tv=n,Promise.resolve().then(()=>this.xv())):n()}this.vv=r}catch(r){ze.error(`Error capturing ${t} pageview`,r)}}Sv(t){var e,r;return!(vt(t)||!me)&&((e=pl(String(t)))===null||e===void 0?void 0:e.href)!==((r=me.location)===null||r===void 0?void 0:r.href)}xv(){const t=this.Tv;if(t){this.Tv=void 0,this.dv=!0;try{t()}catch(e){ze.error("Error capturing deferred pageview",e)}finally{this.dv=!1}this.vv=this.fv()}}_v(){if(this.mv)return;const t=()=>{this.Cv("popstate")};Gt(me,"popstate",t),this.mv=()=>{me&&me.removeEventListener("popstate",t)}}wv(){if(this.yv)return;const t=()=>{this.Cv("hashchange")};Gt(me,"hashchange",t),this.yv=()=>{me&&me.removeEventListener("hashchange",t)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.Iv=!1,this.xo=!1,this.Mv=null,this.instance=t,this.Iv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[F2]),this.rageclicks=new VY(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return Ct(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return vt(this.Rr.capture_heatmaps)?vt(this.Rr.enable_heatmaps)?this.Iv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;bMe.info("starting..."),this.Ev(),this.ln()}else{var t;clearInterval((t=this.Mv)!==null&&t!==void 0?t:void 0),this.Pv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const r=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[F2]:r}),this.Iv=r,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Rv(t){BE(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Mv&&clearInterval(this.Mv),this.Mv=(Ce==null?void 0:Ce.visibilityState)==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}Ev(){me&&Ce&&(this.Av=this.bl.bind(this),Gt(me,O_,this.Av),this.Fv=t=>this.Tr(t||(me==null?void 0:me.event)),Gt(Ce,"click",this.Fv,{capture:!0}),this.Ov=t=>this.Dv(t||(me==null?void 0:me.event)),Gt(Ce,"mousemove",this.Ov,{capture:!0}),this.Lv=new a6(this.instance,kPe,this.Rv.bind(this)),this.Lv.startIfEnabledOrStop(),this.Nv=this.ln.bind(this),Gt(Ce,Wg,this.Nv),this.xo=!0)}Pv(){var t;me&&Ce&&(this.Av&&me.removeEventListener(O_,this.Av),this.Fv&&Ce.removeEventListener("click",this.Fv,{capture:!0}),this.Ov&&Ce.removeEventListener("mousemove",this.Ov,{capture:!0}),this.Nv&&Ce.removeEventListener(Wg,this.Nv),clearTimeout(this.qv),(t=this.Lv)===null||t===void 0||t.stop(),this.xo=!1)}jv(t,e){const r=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=function(a,l,c){let d=a;for(;d&&xo(d)&&!as(d,"body");){if(d===c)return!1;let g;try{var f,p,m;g=(f=(p=(m=d.ownerDocument)===null||m===void 0?void 0:m.defaultView)!==null&&p!==void 0?p:me)===null||f===void 0?void 0:f.getComputedStyle(d).position}catch{return!1}if(ht(l,g))return!0;d=tY(d)}return!1}(cg(t),["fixed","sticky"],s);return{x:t.clientX+(i?0:n),y:t.clientY+(i?0:r),target_fixed:i,type:e}}Tr(t,e="click"){var r;if(Q$(t.target)||!BE(t))return;const n=this.jv(t,e);!((r=this.rageclicks)===null||r===void 0)&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&nY(cg(t),this.instance.config.rageclick)&&this.Zs(ie(ie({},n),{},{type:"rageclick"})),this.Zs(n)}Dv(t){!Q$(t.target)&&BE(t)&&(clearTimeout(this.qv),this.qv=setTimeout(()=>{this.Zs(this.jv(t,"mousemove"))},500))}Zs(t){if(!me)return;const e=this.Rr.disable_capture_url_hashes?Mc(me.location.href):me.location.href,r=this.Rr.custom_personal_data_properties,n=this.Rr.mask_personal_data_properties?[...df,...r||[]]:[],s=Yg(e,n,Qg);this.Rt=this.Rt||{},this.Rt[s]||(this.Rt[s]=[]),this.Rt[s].push(t)}bl(){this.Rt&&!Xs(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:a6,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Iv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Bv=()=>{clearTimeout(this.Hv),this.Hv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",ie({$current_url:this.Rt.url},this.Rt.metrics.reduce((r,n)=>ie(ie({},r),{},{[`$web_vitals_${n.name}_event`]:ie({},n),[`$web_vitals_${n.name}_value`]:n.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.zv=r=>{var n;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},vt(r==null?void 0:r.name)||vt(r==null?void 0:r.value))return void xu.error("Invalid metric received",r);const s=typeof r.navigationURL=="string"?r.navigationURL:void 0,i=this.Uv(s);if(Se(i))return;const a=Fr(r.navigationId)||typeof r.navigationId=="string"?`navigation:${r.navigationId}`:`url:${i}`;if(this.Wv&&r.value>=this.Wv)return void xu.error("Ignoring metric with value >= "+this.Wv,r);this.Rt.navigationKey!==a&&(this.Bv(),this.Hv=setTimeout(this.Bv,this.flushToCaptureTimeoutMs)),Se(this.Rt.navigationKey)&&(this.Rt.navigationKey=a,this.Rt.url=i),this.Rt.firstMetricTimestamp=Se(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const l=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0),c=ie(ie(ie({},r),s?{navigationURL:i}:{}),{},{$current_url:i,timestamp:Date.now()});if(delete c.entries,Ct(r.attribution)&&this.attributionMetrics.indexOf(r.name)>-1){const d={};for(const f of _Me){const p=f==="url"&&typeof r.attribution[f]=="string"?this.Uv(r.attribution[f]):r.attribution[f];Se(p)||(d[f]=p)}c.attribution=d}else delete c.attribution;Se(l)||(c.$session_id=l.sessionId,c.$window_id=l.windowId),this.Rt.metrics.push(c),this.Rt.metrics.length===this.allowedMetrics.length&&this.Bv()},this.Vv=()=>{if(this.xo)return;let r,n,s,i,a=!1;const l=rt.__PosthogExtensions__,c=l==null?void 0:l.postHogWebVitalsCallbacksByFlavor,d=(c==null?void 0:c[this.Gv])||(this.Gv==="web-vitals"&&Se(c)?l==null?void 0:l.postHogWebVitalsCallbacks:void 0);if(!Se(d)){const m=d.withoutAttribution,g=this.attributionMetrics;a=!Se(m),r=g.indexOf("LCP")>-1?d.onLCP:(m==null?void 0:m.onLCP)||d.onLCP,n=g.indexOf("CLS")>-1?d.onCLS:(m==null?void 0:m.onCLS)||d.onCLS,s=g.indexOf("FCP")>-1?d.onFCP:(m==null?void 0:m.onFCP)||d.onFCP,i=g.indexOf("INP")>-1?d.onINP:(m==null?void 0:m.onINP)||d.onINP}if(!(r&&n&&s&&i))return void xu.error("web vitals callbacks not loaded - not starting");const f={reportSoftNavs:this.useSoftNavs},p=a&&this.attributionMetrics.indexOf("INP")>-1?ie(ie({},f),{},{includeProcessedEventEntries:!1}):f;this.allowedMetrics.indexOf("LCP")>-1&&r(this.zv.bind(this),f),this.allowedMetrics.indexOf("CLS")>-1&&n(this.zv.bind(this),f),this.allowedMetrics.indexOf("FCP")>-1&&s(this.zv.bind(this),f),this.allowedMetrics.indexOf("INP")>-1&&i(this.zv.bind(this),p),this.xo=!0},this.Iv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[V2]),this.startIfEnabled()}get Zv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const r=Ct(this.Zv)?(t=this.Zv)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return vt(r)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||R6:r}get flushToCaptureTimeoutMs(){return(Ct(this.Zv)?this.Zv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Ct(this.Zv)?this.Zv.web_vitals_attribution:void 0;return $s(t)?t?R6:[]:ut(t)?t:xMe}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Ct(this.Zv)?this.Zv.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Wv(){const t=Ct(this.Zv)&&Fr(this.Zv.__web_vitals_max_value)?this.Zv.__web_vitals_max_value:A6;return t>0&&6e4>=t?A6:t}get isEnabled(){const t=Dr==null?void 0:Dr.protocol;if(t!=="http:"&&t!=="https:")return xu.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Ct(this.Zv)?this.Zv.web_vitals:$s(this.Zv)?this.Zv:void 0;return $s(e)?e:this.Iv}startIfEnabled(){this.isEnabled&&!this.xo&&(xu.info("enabled, starting..."),this.zo(this.Vv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const r=Ct(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Ct(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[V2]:r}),this._instance.persistence.register({[PK]:n})),this.Iv=r,this.startIfEnabled()}get Gv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const r=rt.__PosthogExtensions__,n=this.Gv,s=r==null?void 0:r.postHogWebVitalsCallbacksByFlavor;s!=null&&s[n]||n==="web-vitals"&&Se(s)&&(r!=null&&r.postHogWebVitalsCallbacks)?t():r==null||(e=r.loadExternalDependency)===null||e===void 0||e.call(r,this._instance,n,i=>{i?xu.error("failed to load script",i):t()})}Uv(t){const e=t||(me==null?void 0:me.location.href);if(!e)return void xu.error("Could not determine current URL");const r=this._instance.config.disable_capture_url_hashes?Mc(e):e,n=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...df,...n||[]]:[];return Yg(r,s,Qg)}}},HMe={exceptionObserver:class{constructor(t){var e;this.Vv=()=>{var r;if(!me||!this.isEnabled||!(!((r=rt.__PosthogExtensions__)===null||r===void 0)&&r.errorWrappingFunctions))return;const n=rt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=rt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=rt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Qv&&this.Rr.capture_unhandled_errors&&(this.Qv=n(this.captureException.bind(this))),!this.Jv&&this.Rr.capture_unhandled_rejections&&(this.Jv=s(this.captureException.bind(this))),!this.Kv&&this.Rr.capture_console_errors&&(this.Kv=i(this.captureException.bind(this)))}catch(a){ym.error("failed to start",a),this.Xv()}},this._instance=t,this.Yv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[z2]),this.wt=new LDe(ie(ie({},function(r={}){var n,s,i,a;return{refillRate:(n=(s=r.exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:r.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(i=(a=r.exceptionRateLimiterBucketSize)!==null&&a!==void 0?a:r.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:ym})),this.Rr=this.tf(),this.startIfEnabledOrStop()}tf(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ct(t)?e=ie(ie({},e),t):(Se(t)?this.Yv:t)&&(e=ie(ie({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ym.info("enabled"),this.Xv(),this.zo(this.Vv)):this.Xv()}zo(t){var e,r,n;!((e=rt.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(r=rt.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"exception-autocapture",s=>{if(s)return ym.error("failed to load script",s);t()})}Xv(){var t,e,r;(t=this.Qv)===null||t===void 0||t.call(this),this.Qv=void 0,(e=this.Jv)===null||e===void 0||e.call(this),this.Jv=void 0,(r=this.Kv)===null||r===void 0||r.call(this),this.Kv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Yv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[z2]:this.Yv}),this.Rr=this.tf(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.tf()}captureException(t){try{var e,r,n;const s=(e=t==null||(r=t.$exception_list)===null||r===void 0||(r=r[0])===null||r===void 0?void 0:r.type)!==null&&e!==void 0?e:"Exception";if(this.wt.consumeRateLimit(s))return void ym.info("Skipping exception capture because of client rate limiting.",{exception:s});(n=this._instance.exceptions)===null||n===void 0||n.sendExceptionEvent(t)}catch{}}},exceptions:class{constructor(t){var e,r;this.ef=[],this.if=new YDe([new uOe,new xOe,new hOe,new dOe,new vOe,new gOe,new pOe,new yOe],function(n,...s){return(i,a=0)=>{const l=[],c=i.split(`
|
||
`),d=Math.min(c.length,a+1e3),f=[];for(let g=a;d>g;g++){const y=c[g];if(y.length>1024)continue;const x=D$.test(y)?y.replace(D$,"$1"):y;if(!x.match(/\S*Error: /)){for(const w of s){const _=w(x,n);if(_){l.push(_);const S=aOe(l);if(S){for(let k=f.length-1;k>=0;k--){const N=f[k];if(S.start>=N.start+N.length)break;f.pop()}f.push(S)}break}}if(lOe(l,f)>=50)break}}const p=[...f].sort((g,y)=>y.start-g.start),m=p[p.length-1];if(m){const g=gK(l,m);l.splice(m.start-g,g);for(const y of p)y.start-=g}for(const g of p)oOe(l,g);return f.some(g=>g.start===0&&l.length===g.length)&&function(g){const y=g.map(w=>`${w.function}|${w.filename}|${w.lineno}|${w.colno}|${w.module}`);let x=0;for(let w=1;y.length>w;w++)cOe(y,w,x)&&(x=w);g.push(...g.splice(0,x))}(l),function(g){if(!g.length)return[];const y=Array.from(g);return y.reverse(),y.slice(0,50).map(x=>{return ie(ie({},x),{},{filename:x.filename||(w=y,w[w.length-1]||{}).filename,function:x.function||"?"});var w})}(l)}}("web:javascript",rOe,iOe)),this._instance=t,this.ef=(e=(r=this._instance.persistence)===null||r===void 0?void 0:r.get_property("$error_tracking_suppression_rules"))!==null&&e!==void 0?e:[],this.nf=j_(this.sf()),this.rf=new bOe(this.nf)}onConfigChange(){this.nf=j_(this.sf()),this.rf.setConfig(this.nf)}onRemoteConfig(t){var e,r,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const i=(e=(r=s.errorTracking)===null||r===void 0?void 0:r.suppressionRules)!==null&&e!==void 0?e:[],a=(n=s.errorTracking)===null||n===void 0?void 0:n.captureExtensionExceptions;this.ef=i,this._instance.persistence&&this._instance.persistence.register({[DK]:this.ef,[U2]:a})}get af(){var t;const e=!!this._instance.get_property(U2),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.if.buildFromUnknown(t,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}addExceptionStep(t,e){if(this.nf.enabled)try{if(!St(t)||t.trim().length===0)return void na.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:r,droppedKeys:n}=function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(s).reduce((a,l)=>_Oe.has(l)?(i.push(l),a):(a[l]=s[l],a),{}),droppedKeys:i}}(this.lf(e));n.length>0&&na.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.rf.add(ie({[C_]:t,[N_]:new Date().toISOString()},r))}catch(r){na.error("Failed to add exception step. Ignoring breadcrumb.",r)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.uf(e)){if(this.hf(e))return this.cf("Exception dropped: matched a suppression rule"),void na.info("Skipping exception capture because a suppression rule matched");if(!this.af&&this.df(e))return this.cf("Exception dropped: thrown by a browser extension"),void na.info("Skipping exception capture because it was thrown by an extension");if(!this.af&&this.vf(e))return this.cf("Exception dropped: thrown by an injected browser script"),void na.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ff(e))return this.cf("Exception dropped: thrown by the PostHog SDK"),void na.info("Skipping exception capture because it was thrown by the PostHog SDK")}const r=this.nf.enabled&&vt(t.$exception_steps)?this.pf(t):t,n=function(){const s=globalThis._posthogReleaseId;return typeof s=="string"&&s.length>0?s:void 0}();n&&(r.$release_id=n);try{const s=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return s&&this.rf.clear(),s}catch(s){return V6(s)||na.error("Failed to capture exception event. Dropping this exception.",s),void this.rf.clear()}}catch(e){return void(V6(e)||na.error("Failed to process exception event. Ignoring this exception.",e))}}pf(t){try{const e=this.rf.getAttachable();return e.length===0?t:ie(ie({},t),{},{$exception_steps:e})}catch(e){return na.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}cf(t){this.nf.enabled&&this.rf.add({[C_]:t,[N_]:new Date().toISOString()})}lf(t){return Ct(t)?ie({},t):{}}sf(){var t,e;return(t=(e=this._instance.config.error_tracking)===null||e===void 0?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}hf(t){if(t.length===0)return!1;try{const e=t.reduce((r,{type:n,value:s})=>(St(n)&&n.length>0&&r.$exception_types.push(n),St(s)&&s.length>0&&r.$exception_values.push(s),r),{$exception_types:[],$exception_values:[]});return this.ef.some(r=>{const n=r.values.map(s=>{const i=BY[s.operator],a=e[s.key];if(!i||!a)return!1;const l=ut(s.value)?s.value:[s.value];return l.length>0&&i(l,a)});return r.type==="OR"?n.some(Boolean):n.every(Boolean)})}catch(e){return na.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}df(t){const e=t.flatMap(n=>{var s,i;return(s=(i=n.stacktrace)===null||i===void 0?void 0:i.frames)!==null&&s!==void 0?s:[]}),r=e.filter(({filename:n})=>!!n&&OMe.some(s=>n.startsWith(s)));return r.length!==0&&(!r.every(({filename:n})=>!!n&&n.startsWith(ij))||t.some(({type:n,value:s})=>n==="NoResponse"||St(s)&&DMe.some(({value:i,exact:a})=>a?s===i:s.includes(i)))&&!e.some(({in_app:n,filename:s})=>n&&!(s!=null&&s.startsWith(ij))))}vf(t){return t.some(({value:e})=>St(e)&&PMe.some(r=>e.includes(r)))}ff(t){if(t.length>0){var e,r,n,s;const i=(e=(r=t[0].stacktrace)===null||r===void 0?void 0:r.frames)!==null&&e!==void 0?e:[],a=i[i.length-1];return(n=a==null||(s=a.filename)===null||s===void 0?void 0:s.includes("posthog.com/static"))!==null&&n!==void 0&&n}return!1}uf(t){return!vt(t)&&ut(t)}}},qMe=ie({productTours:class{get Ml(){return this._instance.persistence}constructor(t){this.gf=null,this.mf=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var r,n;if(this.Ml&&this.Ml.register({[SR]:!!e.productTours}),!FE(this._instance))return!this.gf&&vt((r=this.Ml)===null||r===void 0?void 0:r.props.ph_product_tours)||Wx.info("product tours disabled; stopping and clearing cached tours"),(n=this.gf)===null||n===void 0||n.stop(),this.gf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.gf&&FE(this._instance)&&this.zo(()=>this.yf())}zo(t){var e,r,n;!((e=rt.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours?t():(r=rt.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"product-tours",s=>{s?Wx.error("Could not load product tours script",s):t()})}yf(){var t;!this.gf&&(!((t=rt.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours)&&(this.gf=rt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(ut(this.mf)&&!e)return void t(this.mf,{isLoaded:!0});const r=this.Ml;if(r){const n=r.props[W2];if(ut(n)&&!e)return this.mf=n,void t(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:n=>{if(!FE(this._instance))return void t([],{isLoaded:!0});const s=n.statusCode;if(s!==200||!n.json){const a=`Product Tours API could not be loaded, status: ${s}`;return s===0?n.error||Wx.warn(a):Wx.error(a),void t([],{isLoaded:!1,error:a})}const i=ut(n.json.product_tours)?n.json.product_tours:[];this.mf=i,r&&r.register({[W2]:i}),t(i,{isLoaded:!0})}})}getActiveProductTours(t){vt(this.gf)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.gf.getActiveProductTours(t)}showProductTour(t){var e;(e=this.gf)===null||e===void 0||e.showTourById(t)}previewTour(t){this.gf?this.gf.previewTour(t):this.zo(()=>{var e;this.yf(),(e=this.gf)===null||e===void 0||e.previewTour(t)})}dismissProductTour(){var t;(t=this.gf)===null||t===void 0||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.gf)===null||t===void 0||t.nextStep()}previousStep(){var t;(t=this.gf)===null||t===void 0||t.previousStep()}clearCache(){var t;this.mf=null,(t=this.Ml)===null||t===void 0||t.unregister("ph_product_tours")}resetTour(t){var e;(e=this.gf)===null||e===void 0||e.resetTour(t)}resetAllTours(){var t;(t=this.gf)===null||t===void 0||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.gf)===null||e===void 0||e.cancelPendingTour(t)}}},ew),WMe={siteApps:class{constructor(t){this._instance=t,this.bf=0,this._f=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}wf(t,e){if(!e)return;const r=this.globalsForEvent(e);this._f.push(r),this._f.length>1e3&&(this._f=this._f.slice(10))}get siteAppLoaders(){var t;return(t=rt._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(t=t[this._instance.config.token])===null||t===void 0?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.wf.bind(this));this.kf=()=>{t(),this._f=[],this.kf=void 0}}}globalsForEvent(t){var e,r,n,s,i,a,l;if(!t)throw new Error("Event payload is required");const c={},d=this._instance.get_property("$groups")||[],f=this._instance.get_property("$stored_group_properties")||{};for(const[g,y]of Object.entries(f))c[g]={id:d[g],type:g,properties:y};const{$set_once:p,$set:m}=t;return{event:ie(ie({},_K(t,wMe)),{},{properties:ie(ie(ie({},t.properties),m?{$set:ie(ie({},(e=(r=t.properties)===null||r===void 0?void 0:r.$set)!==null&&e!==void 0?e:{}),m)}:{}),p?{$set_once:ie(ie({},(n=(s=t.properties)===null||s===void 0?void 0:s.$set_once)!==null&&n!==void 0?n:{}),p)}:{}),elements_chain:(i=(a=t.properties)===null||a===void 0?void 0:a.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(l=t.properties)===null||l===void 0?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}Sf(t){var e;const r=(e=t.tagName)===null||e===void 0?void 0:e.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Ya.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Ya.error("prepare_external_dependency_script returned null"),null):t}xf(){var t,e,r,n,s,i,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=Ce==null?void 0:Ce.defaultView,d=c==null||(t=c.Node)===null||t===void 0?void 0:t.prototype;if(!c||!d)return()=>{};if(this.bf++,this.Cf)return this.$f();const f=[],p=this,m=new WeakSet,g=(w,_,S)=>{if(!(w!=null&&w[_]))return;const k=w[_];w[_]=S(k),f.push(()=>{w[_]=k})},y=w=>{if(m.has(w))return w;const _=p.Sf(w);return _&&m.add(_),_},x=w=>w.map(_=>typeof _=="string"?_:y(_)).filter(_=>!Or(_));return g(d,"appendChild",w=>function(_){const S=y(_);return S?w.call(this,S):_}),g(d,"insertBefore",w=>function(_,S){const k=y(_);return k?w.call(this,k,S):_}),g(d,"replaceChild",w=>function(_,S){const k=y(_);return k?w.call(this,k,S):S}),[(e=c.Element)===null||e===void 0?void 0:e.prototype,(r=c.Document)===null||r===void 0?void 0:r.prototype,(n=c.DocumentFragment)===null||n===void 0?void 0:n.prototype].forEach(w=>{g(w,"append",_=>function(...S){return _.apply(this,x(S))}),g(w,"prepend",_=>function(...S){return _.apply(this,x(S))})}),[(s=c.Element)===null||s===void 0?void 0:s.prototype,(i=c.CharacterData)===null||i===void 0?void 0:i.prototype,(a=c.DocumentType)===null||a===void 0?void 0:a.prototype].forEach(w=>{g(w,"before",_=>function(...S){return _.apply(this,x(S))}),g(w,"after",_=>function(...S){return _.apply(this,x(S))}),g(w,"replaceWith",_=>function(...S){const k=x(S);return S.length&&!k.length?void 0:_.apply(this,k)})}),g((l=c.Element)===null||l===void 0?void 0:l.prototype,"insertAdjacentElement",w=>function(_,S){const k=y(S);return k?w.call(this,_,k):null}),this.Cf=()=>{f.forEach(w=>w()),this.Cf=void 0},this.$f()}$f(){let t=!1;return()=>{var e;t||(t=!0,this.bf--,this.bf===0&&((e=this.Cf)===null||e===void 0||e.call(this)))}}Tf(t,e=!0){const r=this.xf();try{const n=t(r);return e&&r(),n}catch(n){throw r(),n}}setupSiteApp(t){const e=this.apps[t.id],r=()=>{var i;!e.errored&&this._f.length&&(Ya.info(`Processing ${this._f.length} events for site app with id ${t.id}`),this._f.forEach(a=>this.Tf(()=>{var l;return(l=e.processEvent)===null||l===void 0?void 0:l.call(e,a)})),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((i=this.kf)===null||i===void 0||i.call(this))};let n=!1;const s=i=>{e.errored=!i,e.loaded=!0,Ya.info(`Site app with id ${t.id} ${i?"loaded":"errored"}`),n&&r()};try{const{processEvent:i}=this.Tf(a=>t.init({posthog:this._instance,callback(l){a(),s(l)}}),!1);i&&(e.processEvent=i),n=!0}catch(i){Ya.error(O6+t.id,i),s(!1)}if(n&&e.loaded)try{r()}catch(i){Ya.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}If(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}Mf(t){if(Object.keys(this.apps).length===0)return;const e=this.globalsForEvent(t);for(const r of Object.values(this.apps))try{this.Tf(()=>{var n;return(n=r.processEvent)===null||n===void 0?void 0:n.call(r,e)})}catch(n){Ya.error(`Error while processing event ${t.event} for site app ${r.id}`,n)}}onRemoteConfig(t){var e,r,n;if(!((e=this.siteAppLoaders)===null||e===void 0)&&e.length)return this.isEnabled?(this.If(),void this._instance.on("eventCaptured",l=>this.Mf(l))):void Ya.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.kf)===null||r===void 0||r.call(this),!t.ok)return;const s=t.config;if(!((n=s.siteApps)===null||n===void 0)&&n.length)if(this.isEnabled)for(const{id:l,url:c}of s.siteApps){var i,a;rt[`__$$ph_site_app_${l}`]=this._instance,(i=rt.__PosthogExtensions__)===null||i===void 0||(a=i.loadSiteApp)===null||a===void 0||a.call(i,this._instance,c,d=>{if(d)return Ya.error(O6+l,d)})}else Ya.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},GMe={tracingHeaders:class{constructor(t){this._instance=t,this.Ef=void 0,this.Pf=void 0,this.Rf=void 0,this.Vv=()=>{const e=this.Af();var r,n;e?(Se(this.Ef)&&(this.Ef=(r=rt.__PosthogExtensions__)===null||r===void 0||(r=r.tracingHeadersPatchFns)===null||r===void 0?void 0:r._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Se(this.Pf)&&(this.Pf=(n=rt.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Xv()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,r,n;!((e=rt.__PosthogExtensions__)===null||e===void 0)&&e.tracingHeadersPatchFns?t():(r=rt.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"tracing-headers",s=>{if(s)return yMe.error("failed to load script",s);t()})}Ff(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Af(){const t=this.Ff();return ut(t)?(ut(this.Rf)?this.Rf.splice(0,this.Rf.length,...t):this.Rf=[...t],t.length>0?this.Rf:void 0):(ut(this.Rf)&&this.Rf.splice(0),this.Rf=t||void 0,this.Rf)}Xv(){var t,e;(t=this.Ef)===null||t===void 0||t.call(this),(e=this.Pf)===null||e===void 0||e.call(this),this.Ef=void 0,this.Pf=void 0}startIfEnabledOrStop(){this.Af()?this.zo(this.Vv):this.Xv()}}},KMe=ie({surveys:class extends SMe{constructor(t){var e;super(new jMe(t),(e=t,{get projectToken(){return e.config.token},kv:new NMe(e)})),this._instance=t}qh(t,e){const r=e.query?Dv(t,e.query):t;return new Promise(n=>{var s;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((s=e.target)!==null&&s!==void 0?s:"api",r),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:n})})}}},ew),YMe={toolbar:class{constructor(t){this.instance=t}Of(t){rt.ph_toolbar_state=t}Df(){var t;return(t=rt.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,e=void 0,r=void 0){var n,s;if(K2(this.instance.config)||!me||!Ce)return!1;t=(n=t)!==null&&n!==void 0?n:me.location,r=(s=r)!==null&&s!==void 0?s:me.history;try{if(!e){try{me.localStorage.setItem("test","test"),me.localStorage.removeItem("test")}catch{return!1}e=me==null?void 0:me.localStorage}const i=TMe||M_(t.hash,"__posthog")||M_(t.hash,"state");let a;const l=i?j$(()=>JSON.parse(atob(decodeURIComponent(i))))||j$(()=>JSON.parse(decodeURIComponent(i))):null;return l&&l.action==="ph_authorize"?(a=l,a.source="url",a&&Object.keys(a).length>0&&(l.desiredHash?t.hash=l.desiredHash:r?r.replaceState(r.state,"",t.pathname+t.search):t.hash="")):(a=JSON.parse(e.getItem(M6)||"{}"),a.source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token||(this.loadToolbar(a),0))}catch{return!1}}Lf(t){const e=rt.ph_load_toolbar||rt.ph_load_editor;!vt(e)&&jn(e)?e(t,this.instance):I6.warn("No toolbar load function found")}loadToolbar(t){const e=!!(Ce!=null&&Ce.getElementById("__POSTHOG_TOOLBAR__"));if(!me||e)return!1;const r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,n=ie(ie({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(me.localStorage.setItem(M6,JSON.stringify(ie(ie({},n),{},{source:void 0}))),this.Df()===2)this.Lf(n);else if(this.Df()===0){var s,i;this.Of(1),(s=rt.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this.instance,"toolbar",a=>{if(a)return I6.error("[Toolbar] Failed to load",a),void this.Of(0);this.Of(2),this.Lf(n)}),Gt(me,"turbolinks:load",()=>{this.Of(0),this.loadToolbar(n)})}return!0}Nf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,r=void 0){return this.maybeLoadToolbar(t,e,r)}}},QMe=ie({experiments:class Ps{get Rr(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(r=!1)=>{this.getWebExperiments(n=>{Ps.qf("retrieved web experiments from the server"),this.jf=new Map,n.forEach(s=>{if(s.feature_flag_key){var i;this.jf&&(Ps.qf("setting flag key ",s.feature_flag_key," to web experiment ",s),(i=this.jf)===null||i===void 0||i.set(s.feature_flag_key,s));const a=this._instance.getFeatureFlag(s.feature_flag_key);St(a)&&s.variants[a]&&this.Bf(s.name,a,s.variants[a].transforms)}else if(s.variants)for(const a in s.variants){const l=s.variants[a];Ps.Hf(l,this._instance)&&this.Bf(s.name,a,l.transforms)}})},r)},this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(e){if(this._is_bot())Ps.qf(H6);else if(!this.Rr.disable_web_experiments){if(vt(this.jf))return this.jf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ps.qf("applying feature flags",e),e.forEach(r=>{var n;if(this.jf&&(!((n=this.jf)===null||n===void 0)&&n.has(r))){var s;const i=this._instance.getFeatureFlag(r),a=(s=this.jf)===null||s===void 0?void 0:s.get(r);i&&(a!=null&&a.variants[i])&&this.Bf(a.name,i,a.variants[i].transforms)}})}}previewWebExperiment(){const e=Ps.getWindowLocation();if(e!=null&&e.search){const r=uf(e==null?void 0:e.search,"__experiment_id"),n=uf(e==null?void 0:e.search,"__experiment_variant");r&&n&&(Ps.qf(`previewing web experiments ${r} && ${n}`),this.getWebExperiments(s=>{this.zf(parseInt(r),n,s)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,r,n){if(this.Rr.disable_web_experiments&&!n)return e([]);const s=this._instance.get_property("$web_experiments");if(s&&!r)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Rr.token}`),method:"GET",timestampMode:"query",callback:i=>e(i.statusCode===200&&i.json&&i.json.experiments||[])})}zf(e,r,n){const s=n.filter(i=>i.id===e);s&&s.length>0&&(Ps.qf(`Previewing web experiment [${s[0].name}] with variant [${r}]`),this.Bf(s[0].name,r,s[0].variants[r].transforms))}static Hf(e,r){return!vt(e.conditions)&&Ps.Uf(e,r)&&Ps.Wf(e)}static Uf(e,r){var n;if(vt(e.conditions)||vt((n=e.conditions)===null||n===void 0?void 0:n.url))return!0;const s=Ps.getWindowLocation();if(s){var i,a,l;const c=ZK(r,s.href);return!(!((i=e.conditions)===null||i===void 0)&&i.url)||MMe[(a=(l=e.conditions)===null||l===void 0?void 0:l.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,c)}return!1}static getWindowLocation(){return me==null?void 0:me.location}static Wf(e){var r;if(vt(e.conditions)||vt((r=e.conditions)===null||r===void 0?void 0:r.utm))return!0;const n=uY();if(n.utm_source){var s,i,a,l,c,d,f,p;const m=!(!((s=e.conditions)===null||s===void 0||(s=s.utm)===null||s===void 0)&&s.utm_campaign)||((i=e.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0?void 0:i.utm_campaign)==n.utm_campaign,g=!(!((a=e.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0)&&a.utm_source)||((l=e.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0?void 0:l.utm_source)==n.utm_source,y=!(!((c=e.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_medium)||((d=e.conditions)===null||d===void 0||(d=d.utm)===null||d===void 0?void 0:d.utm_medium)==n.utm_medium,x=!(!((f=e.conditions)===null||f===void 0||(f=f.utm)===null||f===void 0)&&f.utm_term)||((p=e.conditions)===null||p===void 0||(p=p.utm)===null||p===void 0?void 0:p.utm_term)==n.utm_term;return m&&y&&x&&g}return!1}static qf(e,...r){ze.info(`[WebExperiments] ${e}`,r)}Bf(e,r,n){this._is_bot()?Ps.qf(H6):r!=="control"?n.forEach(s=>{if(s.selector){var i;Ps.qf(`applying transform of variant ${r} for experiment ${e} `,s);const a=(i=document)===null||i===void 0?void 0:i.querySelectorAll(s.selector);a==null||a.forEach(l=>{const c=l;s.html&&(c.innerHTML=s.html),s.css&&c.setAttribute("style",s.css)})}}):Ps.qf("Control variants leave the page unmodified.")}_is_bot(){return Tn&&this._instance?IY(Tn,this.Rr.custom_blocked_useragents):void 0}}},ew),XMe={conversations:class{constructor(t){this._instance=t,this.Vf=void 0,this._conversationsManager=null,this.Gf=!1,this.ne=null,this.Zf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations||(this.Qf=t.ok,!t.ok))return;const e=t.config.conversations;vt(e)||($s(e)?this.Vf=e:(this.Vf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;(t=this._conversationsManager)===null||t===void 0||t.reset(),this._conversationsManager=null,this.Vf=void 0,this.ne=null,this.Qf=void 0,this.Zf=!1}loadIfEnabled(){if(this._conversationsManager||this.Gf||this._instance.config.disable_conversations||K2(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=rt==null?void 0:rt.__PosthogExtensions__;if(t&&!Se(this.Vf)&&this.Vf)if(this.ne&&this.ne.token){this.Gf=!0;try{const e=t.initConversations;if(e)return this.Jf(e),void(this.Gf=!1);const r=t.loadExternalDependency;if(!r)return void this.Kf(ER);r(this._instance,"conversations",n=>{n||!t.initConversations?this.Kf("Could not load conversations script",n):this.Jf(t.initConversations),this.Gf=!1})}catch(e){this.Kf("Error initializing conversations",e),this.Gf=!1}}else Ii.error("Conversations enabled but missing token in remote config.")}Jf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Zf=!1,Ii.info("Conversations loaded successfully")}catch(e){this.Kf("Error completing conversations initialization",e)}else Ii.error("Cannot complete initialization: remote config is null")}Kf(t,e){Ii.error(t,e),this._conversationsManager=null,this.Gf=!1,this.Zf=!0}show(){this._conversationsManager?this._conversationsManager.show():Ii.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Vf===!0&&!Or(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":K2(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Qf===!1?"remote_config_failed":Se(this.Vf)?this.Qf?"disabled_in_project":"remote_config_pending":this.Vf?vt(this.ne)||!this.ne.token?"missing_token":rt!=null&&rt.__PosthogExtensions__?this.Gf?"initializing":this.Zf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,r){var n=this;return xr(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,r):(Ii.warn(bu),null)})()}getMessages(t,e){var r=this;return xr(function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Ii.warn(bu),null)})()}markAsRead(t){var e=this;return xr(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ii.warn(bu),null)})()}getTickets(t){var e=this;return xr(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ii.warn(bu),null)})()}requestRestoreLink(t){var e=this;return xr(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ii.warn(bu),null)})()}restoreFromToken(t){var e=this;return xr(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ii.warn(bu),null)})()}restoreFromUrlToken(){var t=this;return xr(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ii.warn(bu),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}Sh(){var t;(t=this._conversationsManager)===null||t===void 0||t.setIdentity()}xh(){var t;(t=this._conversationsManager)===null||t===void 0||t.clearIdentity()}}},ZMe={logs:class{constructor(t){var e;this._instance=t,this.name="logs",this.Xf=!1,this.Yf=!1,this.tp=!1,this.$=Mr("[logs]"),this.ep=ie(ie({},this.$),{},{error:(...r)=>{r.some(G6)||this.$.error(...r)}}),this.al=[],this.np=[],this.hd=0,this.Io=!1,this.sp=[],this.rp=[],this.op=!1,this.ap=!1,this.lp=()=>{var r,n;this.Io||(this.hd=0,(r=this.up)===null||r===void 0||r.onReconnect(),(n=this.hp)===null||n===void 0||n.onReconnect())},this._instance&&(!((e=this._instance.config.logs)===null||e===void 0)&&e.captureConsoleLogs)&&(this.Xf=!0),me&&Gt(me,"online",this.lp)}cp(t,e,r,n){var s;const i=q6((s=this._instance)===null||s===void 0||(s=s.config)===null||s===void 0?void 0:s.logs,r);return[new ROe(this.dp(t,e),i,this.ep,()=>this.vp(),a=>a(),void 0,n),i]}fp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs;var r;return this.up&&this.pp===e||((r=this.up)===null||r===void 0||r.reset(),this.pp=e,[this.up,this.gp]=this.cp(()=>this.al,n=>{this.al=n})),this.up}mp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs;var r;return this.hp&&this.yp===e||((r=this.hp)===null||r===void 0||r.reset(),this.yp=e,[this.hp,this.bp]=this.cp(()=>this.np,n=>{this.np=n},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},W6)),this.hp}setup(t){var e;if(this.Io)return;this.wo=t,!((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0||(e=e.logs)===null||e===void 0)&&e.captureConsoleLogs&&(this.Xf=!0),(this.Xf||this._p()&&this.wp())&&this.kp();let r=!1;const n=t.onRemoteConfig(s=>{var i;r=s.ok&&((i=s.config.logs)===null||i===void 0?void 0:i.captureConsoleLogs)===!0,this.onRemoteConfig(s)});this.Io?n.dispose():(this.Po=n,r||this.loadIfEnabled())}dispose(){var t,e,r,n;this.Io||(this.Io=!0,this.Sp(),(t=this.Po)===null||t===void 0||t.dispose(),this.Po=void 0,this.wo=void 0,this.tp=!1,me==null||me.removeEventListener("online",this.lp),(e=this.xp)===null||e===void 0||e.call(this),this.xp=void 0,(r=this.up)===null||r===void 0||r.reset(),(n=this.hp)===null||n===void 0||n.reset())}onRemoteConfig(t){var e,r;if(this.Io)return;const n=t.ok?(e=t.config.logs)===null||e===void 0?void 0:e.captureConsoleLogs:void 0;vt(n)?this.Cp():((r=this._instance)===null||r===void 0||(r=r.persistence)===null||r===void 0||r.register({$logs_capture_enabled_server_side:!!n}),n?(this.Xf=!0,this.Yf||this.kp(),this.loadIfEnabled()):this.Cp())}reset(){var t,e,r,n;this.Sp(),(t=this.up)===null||t===void 0||t.clearQueue(),this.al=[],(e=this.up)===null||e===void 0||e.reset(),(r=this.hp)===null||r===void 0||r.clearQueue(),this.np=[],(n=this.hp)===null||n===void 0||n.reset(),this.hd=0}captureLog(t){this.Io||this.fp().captureLog(t)}captureConsoleLog(t){this.Io||this.mp().captureLog(t)}captureBufferedConsoleLog(t,e,r){this.Io||this.mp().captureLog(t,{context:e,occurredAtMs:r})}wp(){var t;return!!(!((t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t[OK])}_p(){var t,e,r;return!(!((t=this._instance)===null||t===void 0||(e=t.nl)===null||e===void 0)&&e.call(t))||!!(!((r=rt._POSTHOG_REMOTE_CONFIG)===null||r===void 0||(r=r[this._instance.config.token])===null||r===void 0)&&r.config)}$h(){var t;this.Sp(),(t=this.hp)===null||t===void 0||t.clearQueue(),this.np=[]}Cp(){this.Xf||this.Sp()}kp(){var t;if(this.op||!(rt!=null&&rt.console))return;const e=q6((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs).maxBufferSize;let r=!0;this.rp.push(()=>{r=!1});for(const n of IMe){let s;try{s=LMe(rt.console[n])}catch{continue}s&&this.rp.push(Xg(rt.console,n,i=>{const a=(...l)=>{try{r&&this.$p(n,l,e)}catch{}return i.apply(rt.console,l)};return a.__rrweb_original__=s,a}))}this.op=!0,this.Tp=setTimeout(()=>{this.Sp()},3e4)}$p(t,e,r){var n;if(this.op&&!this.ap&&e.length!==0)if(!((n=this._instance)===null||n===void 0)&&n.is_capturing()){if(r>this.sp.length){this.ap=!0;try{this.sp.push({level:t,args:e,occurredAtMs:Date.now(),context:this.vp()})}finally{this.ap=!1}}}else this.Sp()}Sp(){if(this.sp=[],this.op){this.op=!1,this.Tp&&(clearTimeout(this.Tp),this.Tp=void 0);for(const t of this.rp)t();this.rp=[]}}Ip(){const t=this.sp;return this.Sp(),t}get logger(){return this.Mp||(this.Mp={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Mp}flushLogs(t){t?this.Ep(t):(this.up&&this.up.flush().catch(e=>this.Pp(e)),this.hp&&this.hp.flush().catch(e=>this.Pp(e)))}Pp(t){G6(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Io||!this.Xf||this.Yf||this.tp)return;const t=rt==null?void 0:rt.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.Sp();const e=t.loadExternalDependency;if(!e)return this.$.error(ER),void this.Sp();this.tp=!0;try{e(this._instance,"logs",r=>{if(this.tp=!1,this.Io||!this.Xf)return;const n=t.logs;if(r||!(n!=null&&n.initializeLogs))this.$.error("Could not load logs script",r),this.Sp();else{var s;const l=this.Ip();var i,a;this.xp=n.initializeLogs((s=this.wo)!==null&&s!==void 0?s:this._instance),this.Yf=!0,l.length>0&&((i=n.replayConsoleBuffer)===null||i===void 0||i.call(n,(a=this.wo)!==null&&a!==void 0?a:this._instance,l))}})}catch(r){throw this.tp=!1,r}}dp(t,e){const r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:n=>n===eo.LogsQueue?t():void 0,setPersistedProperty(n,s){var i;n===eo.LogsQueue&&e((i=s)!==null&&i!==void 0?i:[])},js:n=>this.js(n),getLibraryId:()=>xn.LIB_NAME,getLibraryVersion:()=>xn.LIB_VERSION}}js(t){return new Promise(e=>{if(lY(this.hd,3))return void e({kind:"fatal",error:UE(void 0,"logs endpoint is unreachable, dropping batch")});let r=!1;const n=i=>{r||(r=!0,clearTimeout(s),e(i))},s=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:UE(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Rp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:i=>{const a=i.statusCode;if(this.Ap(a),a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)n({kind:"fatal",error:new Error(`logs request failed with status ${a}`)});else{var l;a===0?(i.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:UE(i.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:(l=i.error)!==null&&l!==void 0?l:new Error(`logs request failed with status ${a}`)})}}})})}Ap(t){(t!==0||this._instance.__loaded)&&(this.hd=cY(t,this.hd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Ep(t){this.al.length>0&&this.Fp(t,this.al,this.gp,xn.LIB_NAME,e=>{this.al=e}),this.np.length>0&&this.Fp(t,this.np,this.bp,W6,e=>{this.np=e})}Fp(t,e,r,n,s){if(e.length===0)return;const i=e.map(l=>l.record);s([]);const a=CK(i,EK(r,xn.LIB_NAME,xn.LIB_VERSION),n,xn.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Rp(),data:a,compression:"best-available",batchKey:"logs",transport:t})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}vp(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:r,windowId:n,sessionStartTimestamp:s,lastActivityTimestamp:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=r,e.windowId=n,vt(s)||(e.sessionStartTimestamp=s),vt(i)||(e.lastActivityTimestamp=i)}if(!(rt==null||(t=rt.location)===null||t===void 0)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Mc(rt.location.href):rt.location.href),this._instance.featureFlags){const r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},JMe={metrics:class{constructor(t){this._instance=t,this.$=Mr("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Io)return;const e=!!(!((t=this._instance.config.metrics)===null||t===void 0)&&t.network);e&&!this.Op?this.Op=(r=>{let n=!0;const s=()=>n?(l=>{var c;const d=(c=l.config.metrics)===null||c===void 0?void 0:c.network;return d===!0?{}:d||void 0})(r):void 0,i=FMe(r,s),a=zMe(r,s);return()=>{n=!1,i(),a()}})(this._instance):!e&&this.Op&&(this.Op(),this.Op=void 0)}fp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.metrics;var r;return this.up&&this.pp===e||((r=this.up)===null||r===void 0||r.reset(),this.pp=e,this.up=new DOe(this.dp(),function(n){var s,i,a,l,c;const d=n==null?void 0:n.resourceAttributes;return{serviceName:(s=d==null?void 0:d["service.name"])!==null&&s!==void 0?s:n==null?void 0:n.serviceName,serviceVersion:(i=d==null?void 0:d["service.version"])!==null&&i!==void 0?i:n==null?void 0:n.serviceVersion,environment:(a=d==null?void 0:d["deployment.environment"])!==null&&a!==void 0?a:n==null?void 0:n.environment,resourceAttributes:d,beforeSend:n==null?void 0:n.beforeSend,flushIntervalMs:(l=n==null?void 0:n.flushIntervalMs)!==null&&l!==void 0?l:1e4,maxSeriesPerFlush:(c=n==null?void 0:n.maxSeriesPerFlush)!==null&&c!==void 0?c:1e3}}(e),this.$)),this.up}count(t,e=1,r){this.fp().count(t,e,r)}gauge(t,e,r){this.fp().gauge(t,e,r)}histogram(t,e,r){this.fp().histogram(t,e,r)}flush(t){if(!this.up)return Promise.resolve();if(t){const e=this.up.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.up.flush().catch(e=>this.$.error("PostHog metrics flush failed:",e))}reset(){var t;(t=this.up)===null||t===void 0||t.reset()}dispose(){var t,e;this.Io=!0,(t=this.Op)===null||t===void 0||t.call(this),this.Op=void 0,(e=this.up)===null||e===void 0||e.reset()}dp(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:r=>e.Ys(r),getLibraryId:()=>xn.LIB_NAME,getLibraryVersion:()=>xn.LIB_VERSION}}Ys(t,e){return new Promise(r=>{let n=!1;const s=a=>{n||(n=!0,clearTimeout(i),r(a))},i=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ie(ie({method:"POST",url:this.Dp(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(a){const l=a.statusCode;if(l>=200&&300>l)s({kind:"ok"});else if(l===413)s({kind:"too-large"});else if(l!==0&&l!==408&&l!==429&&500>l)s({kind:"fatal",error:new Error(`metrics request failed with status ${l}`)});else{var c;s({kind:"retry-later",error:(c=a.error)!==null&&c!==void 0?c:new Error(`metrics request failed with status ${l}`)})}}}))})}Dp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};pg.__defaultExtensionClasses=ie({},ie(ie(ie(ie(ie(ie(ie(ie(ie(ie(ie(ie(ie({},ew),UMe),VMe),HMe),qMe),WMe),KMe),GMe),YMe),QMe),XMe),ZMe),JMe));const e5e=function(){xn.SDK_DIST_CHANNEL="npm";const t=hg[Fm]=new pg;return function(){function e(){e.done||(e.done=!0,PY=!1,Xt(hg,function(r){r._dom_loaded()}))}Ce!=null&&Ce.addEventListener?Ce.readyState==="complete"?e():Gt(Ce,"DOMContentLoaded",e,{capture:!1}):me&&ze.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();var t5e=e5e,r5e=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),n5e=function(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})},Gx,K6="__POSTHOG_REACT_SHARED_STATE__",Y6=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Zg;try{Zg=Y6[K6]=Y6[K6]||new WeakMap}catch{Zg=new WeakMap}Zg.has(E.createContext)||Zg.set(E.createContext,{});var Xu=Zg.get(E.createContext),oj;function s5e(t){(!Xu.defaultPostHogInstance||Xu.defaultPostHogInstance===oj)&&(Xu.defaultPostHogInstance=t),oj=t}function lj(){return oj}Xu.context||(Xu.context=E.createContext({get client(){return lj()||Xu.defaultPostHogInstance},bootstrap:void 0}));var KY=Xu.context;function YY(t,e,r){if(r===void 0&&(r=new WeakMap),t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(r.has(t)&&r.get(t)===e)return!0;r.set(t,e);var n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(var i=0,a=n;i<a.length;i++){var l=a[i];if(!s.includes(l)||!YY(t[l],e[l],r))return!1}return!0}function i5e(t){var e,r,n=t.children,s=t.client,i=t.apiKey,a=t.options,l=E.useRef(null),c=E.useMemo(function(){if(s)return i&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),a&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),s;var d=lj();return i||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),d},[s,i,JSON.stringify(a)]);return E.useEffect(function(){if(!(s||!i)){var d=lj(),f=l.current;f?(i!==f.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),a&&!YY(a,f.options)&&d.set_config(a),l.current={apiKey:i,options:a??{}}):(d.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),d.init(i,a),l.current={apiKey:i,options:a??{}})}},[s,i,JSON.stringify(a)]),Ss.createElement(KY.Provider,{value:{client:c,bootstrap:(e=a==null?void 0:a.bootstrap)!==null&&e!==void 0?e:(r=s==null?void 0:s.config)===null||r===void 0?void 0:r.bootstrap}},n)}var VE=function(t){return typeof t=="function"},a5e=function(t){return t===void 0},P0=function(t){var e=Object.prototype.toString.call(t);return t instanceof Error||e==="[object Error]"||e==="[object Exception]"||e==="[object DOMException]"||e==="[object DOMError]"},o5e=function(t,e){try{Object.defineProperty(t,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}},l5e=function(t,e){for(var r=new WeakSet,n=t;!r.has(n);){if(r.add(n),!P0(n.cause)){a5e(n.cause)||(e.cause=n.cause),n.cause=e;return}n=n.cause}},c5e=function(t,e){if(!e)return t;var r=new Error(P0(t)?t.message:"Primitive value captured as exception: ".concat(String(t)));return o5e(r,"React ErrorBoundary ".concat(P0(t)?t.name:"Error")),r.stack=e,P0(t)?(l5e(t,r),t):r},Q6={componentStack:null,exceptionEvent:null,error:null},u5e={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};Gx=function(t){r5e(e,t);function e(r){var n=t.call(this,r)||this;return n._resetError=function(){n.setState(Q6)},n.state=Q6,n}return e.prototype.componentDidCatch=function(r,n){var s=this.props.additionalProperties,i;VE(s)?i=s(r,n):typeof s=="object"&&(i=s);var a=this.context.client,l=n.componentStack,c=a.captureException(c5e(r,l),i);this.setState({error:r,componentStack:l??null,exceptionEvent:c})},e.prototype.render=function(){var r=this.props,n=r.children,s=r.fallback,i=this.state;if(i.componentStack==null)return VE(n)?n():n;var a=VE(s)?Ss.createElement(s,{error:i.error,componentStack:i.componentStack,exceptionEvent:i.exceptionEvent,resetError:this._resetError}):s;return Ss.isValidElement(a)?a:(console.warn(u5e.INVALID_FALLBACK),Ss.createElement(Ss.Fragment,null))},e}(Ss.Component),n5e(Gx,"PostHogErrorBoundary"),function(){Gx.contextType=KY}();s5e(t5e);const d5e={api_host:"https://eu.i.posthog.com",defaults:"2026-05-30"};mZ.createRoot(document.getElementById("root")).render(o.jsx(E.StrictMode,{children:o.jsx(i5e,{apiKey:"phc_vMEjm6zAocpoLFc8YGPxN4V7yKoSe3bcZcC2krbUtQMB",options:d5e,children:o.jsx(NDe,{})})}))});export default h5e();
|