@fungi.computer/grove 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -9
- package/dist/assets/Effect-BY0T-p9d.js +76 -0
- package/dist/assets/abort-signals-joV34wzR.js +1 -0
- package/dist/assets/anthropic-messages-BPUe3sjP.js +19 -0
- package/dist/assets/azure-openai-responses-qVCjcy57.js +1 -0
- package/dist/assets/{base-face-BaB6vmvy.js → base-face-Dc6wvM5e.js} +1 -1
- package/dist/assets/burger-CJ8nsj7v.js +1 -0
- package/dist/assets/cat-DCYVOD6V.js +1 -0
- package/dist/assets/classifier-shared-DtTbFkSF.js +1 -0
- package/dist/assets/cloudflare-workers-ai-system-one-C4GWBDtR.js +1 -0
- package/dist/assets/compat-Dluy1HPa.js +2 -0
- package/dist/assets/{diagnostics-CmW2yJSB.js → diagnostics-CxvqSC4Q.js} +1 -1
- package/dist/assets/{document-D5hwZS3o.js → document-DjWTbvB5.js} +1 -1
- package/dist/assets/error-BTdmRKoB.js +1 -0
- package/dist/assets/extension-hook-Ce1QNicQ.js +721 -0
- package/dist/assets/extensions-D55BOb_a.js +1 -0
- package/dist/assets/{google-generative-ai-DP-8xZvz.js → google-generative-ai-D4EEWKtU.js} +1 -1
- package/dist/assets/{google-shared-Cs5udoZV.js → google-shared-CvUYw8Za.js} +3 -3
- package/dist/assets/{google-vertex-BJiAIGUd.js → google-vertex-MtdrRNuD.js} +1 -1
- package/dist/assets/index--Y1OC0IE.js +171 -0
- package/dist/assets/index-BmdZJzrt.css +1 -0
- package/dist/assets/{json-parse-nqKewMRF.js → json-parse-M7s0500m.js} +2 -2
- package/dist/assets/mistral-conversations-CI9T5Sz9.js +4 -0
- package/dist/assets/models-BM_0GHMS.js +1 -0
- package/dist/assets/mushroom-CstiBfYI.js +1 -0
- package/dist/assets/{node.browser-hsQQ6fyG.js → node.browser-DL9pz-ZD.js} +1 -1
- package/dist/assets/node.browser-HQ5SKBOf.js +1 -0
- package/dist/assets/openai-codex-responses-C1JF2nxc.js +9 -0
- package/dist/assets/openai-completions-DJRWblh-.js +5 -0
- package/dist/assets/openai-decisions-CRn788gD.js +2 -0
- package/dist/assets/openai-responses-DT9fG-Eg.js +1 -0
- package/dist/assets/openai-responses-shared-BDR0j8d9.js +10 -0
- package/dist/assets/{openrouter-images-DwousKhc.js → openrouter-images-BqwSYNGm.js} +1 -1
- package/dist/assets/parakeet-conversation-DFuwoFfN.js +4 -0
- package/dist/assets/{pi-messages-CfXPQ4jp.js → pi-messages-0BariYjJ.js} +1 -1
- package/dist/assets/preload-helper-DY31Aviq.js +8 -0
- package/dist/assets/{provider-retry-CSlu6hjs.js → provider-retry-RVfYd5Vz.js} +1 -1
- package/dist/assets/renderer-l9sYXW5N.js +1 -0
- package/dist/assets/runtime-core-BHRx5Fxu.js +2 -0
- package/dist/assets/system-one-shared-DywxmMny.js +1 -0
- package/dist/assets/transform-messages-ByuM-ZZe.js +1 -0
- package/dist/assets/typesafe-system-one-D7tQu98S.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +38 -18
- package/dist/assets/Effect-CxgtVs4O.js +0 -76
- package/dist/assets/anthropic-messages-DVt3Yh9K.js +0 -41
- package/dist/assets/azure-openai-responses-QZaJy-8U.js +0 -1
- package/dist/assets/burger-CoqBXzRV.js +0 -1
- package/dist/assets/cat-2dRm7fBw.js +0 -1
- package/dist/assets/cloudflare-workers-ai-system-one-Bq-3_D9p.js +0 -1
- package/dist/assets/compat-fz0ZcRJH.js +0 -2
- package/dist/assets/error-CJ3RHG07.js +0 -1
- package/dist/assets/extension-hook-0UB2lkEs.js +0 -560
- package/dist/assets/extensions-CAsZR9ky.js +0 -1
- package/dist/assets/index-Bw6tV9qS.css +0 -1
- package/dist/assets/index-DRDNbHYF.js +0 -171
- package/dist/assets/mistral-conversations-mRYg3mWw.js +0 -4
- package/dist/assets/models-CcNnosqL.js +0 -1
- package/dist/assets/mushroom-B9t9hgQE.js +0 -1
- package/dist/assets/node.browser-DFtqp6Hr.js +0 -1
- package/dist/assets/openai-codex-responses-CA-ivUEd.js +0 -9
- package/dist/assets/openai-completions-BxBCgHHI.js +0 -5
- package/dist/assets/openai-responses-cvwOEFWg.js +0 -1
- package/dist/assets/openai-responses-shared-DzD8B6NI.js +0 -10
- package/dist/assets/parakeet-conversation-w0nznEs9.js +0 -3
- package/dist/assets/preload-helper-mbhLTglw.js +0 -8
- package/dist/assets/renderer-s3PB0XrL.js +0 -1
- package/dist/assets/runtime-core-GKyHklNK.js +0 -2
- package/dist/assets/system-one-shared-CGF8IYMZ.js +0 -1
- package/dist/assets/transform-messages-CrQEqmfx.js +0 -1
- package/dist/assets/typesafe-system-one-CWcJw-Ys.js +0 -1
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/runtime-core-GKyHklNK.js","assets/rolldown-runtime-hePW80VL.js","assets/Effect-CxgtVs4O.js","assets/extension-hook-0UB2lkEs.js","assets/preload-helper-mbhLTglw.js","assets/extensions-CAsZR9ky.js","assets/mushroom-B9t9hgQE.js","assets/document-D5hwZS3o.js","assets/renderer-s3PB0XrL.js","assets/cat-2dRm7fBw.js","assets/base-face-BaB6vmvy.js","assets/burger-CoqBXzRV.js","assets/parakeet-conversation-w0nznEs9.js","assets/parakeet-conversation-COndlivb.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$i as n,$n as r,A as i,Aa as a,Ai as o,Ba as s,Bi as c,Ca as l,Da as u,Di as d,E as f,Ea as p,Ei as m,Fa as h,Fi as g,Gi as _,Hi as v,I as y,Ia as b,Ii as x,J as S,Ji as C,Jn as w,Ki as T,Kn as E,Li as D,Ln as O,Ma as k,Mi as A,Na as j,Ni as M,Oa as N,Oi as P,P as F,Pa as ee,Pi as I,Q as te,Qi as L,Qn as ne,Ra as re,Ri as ie,Sa as ae,T as oe,Ta as R,Ui as se,Va as ce,Vi as le,Vn as ue,Xi as de,Xn as fe,Yi as pe,Z as me,Zi as he,_ as ge,_a as _e,_t as ve,a as ye,aa as be,ai as xe,ba as Se,bi as Ce,ct as we,d as Te,da as Ee,dt as De,ea as Oe,er as ke,fa as Ae,g as je,ga as Me,gt as Ne,h as Pe,ha as Fe,hi as Ie,ht as Le,ia as Re,it as ze,ja as Be,ji as Ve,ka as He,ki as Ue,l as We,lt as Ge,m as Ke,ma as qe,na as Je,nr as Ye,oa as Xe,pa as Ze,q as Qe,qn as $e,ra as et,rt as tt,s as nt,sa as z,t as rt,tr as it,tt as at,ua as ot,ui as st,ut as ct,va as lt,vt as ut,w as dt,wa as ft,xa as pt,xi as mt,y as ht,ya as gt,yt as _t,z as vt,za as yt,zi as bt}from"./Effect-CxgtVs4O.js";import{$i as xt,$n as St,$r as Ct,An as wt,Ar as Tt,Bn as Et,Br as Dt,Ca as Ot,Ci as B,Cr as kt,Da as At,Di as jt,Dn as Mt,Dr as Nt,En as Pt,Fi as V,Fr as H,Gi as Ft,Gn as It,Hi as Lt,Hn as Rt,Hr as zt,Ii as Bt,In as Vt,Ir as Ht,Jn as Ut,Jr as Wt,Ki as Gt,Kn as Kt,Li as qt,Lr as Jt,Mr as Yt,Nn as Xt,Nr as Zt,Oa as Qt,Or as $t,Pi as U,Pn as en,Pr as tn,Qi as nn,Qn as rn,Qr as an,Rn as on,Sr as sn,Ta as cn,Tr as W,Ui as ln,Ur as un,Ut as dn,V as fn,Vn as pn,Vr as mn,Wi as hn,Wn as gn,Wr as _n,Xi as vn,Xn as yn,Xr as bn,Yi as xn,Yn as Sn,Zi as Cn,Zn as wn,Zr as Tn,_a as En,_r as Dn,aa as On,an as kn,ar as An,ba as jn,br as Mn,ci as Nn,cn as Pn,cr as Fn,di as In,dr as Ln,ea as Rn,er as zn,fa as Bn,fr as Vn,ga as Hn,ha as Un,hi as Wn,hr as Gn,i as Kn,ia as qn,ir as Jn,ja as Yn,ji as Xn,jn as Zn,jr as Qn,ka as $n,kn as er,kr as tr,ln as nr,ma as rr,mr as G,n as ir,na as ar,nr as or,oa as sr,on as cr,or as K,pa as lr,pr as ur,qi as dr,ra as fr,rr as pr,si as mr,ta as hr,tr as gr,ua as _r,ur as vr,va as yr,wn as br,wr as q,xa as xr,xr as Sr,ya as Cr,yi as wr,yr as Tr}from"./extension-hook-0UB2lkEs.js";import{a as Er,o as Dr,s as Or,t as kr}from"./document-D5hwZS3o.js";import{t as Ar}from"./preload-helper-mbhLTglw.js";import{a as jr,i as Mr,n as Nr,r as Pr,t as Fr}from"./base-face-BaB6vmvy.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ir=t((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},ee={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function I(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ee,e.act=I,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=I,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),Lr=t(((e,t)=>{t.exports=Ir()})),J=e(Lr(),1),Rr=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},zr=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Br(){let e=!1,t=vi,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=vi,s(),o.clear())},contribute:t=>{if(Jr(t),e)throw new zr;Yr(t,n),Xr(t,n);let r=Symbol(`whistle-contribution`);qr(t)||(n=[...n,{contribution:Zr(t),generation:r}],i=!0,s());let a=!0;return gi(o=>{if(!a||e)return;let c={...t,commands:o};Jr(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Yr(c,u),Xr(c,u);let d=Zr(c);if(qr(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async function t(r,i){if(r.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let o=Kr(r,n);if(o===void 0)return{status:`missing`};let s;try{let e=bi(o);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;i.interaction===void 0&&n!==void 0&&Vr.has(i.origin)&&(s=n({commandId:r,title:o.title,retry:()=>{t(r,i)}}));let c={...i,signal:i.signal??new AbortController().signal};s!==void 0&&(c.interaction=s.interaction,c.signal=AbortSignal.any([c.signal,s.interaction.signal]));let l=await o.handler(c);return s?.settle({status:`handled`}),l===void 0?{status:`handled`}:{status:`handled`,result:l}}catch(e){let t=Si(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return s?.settle(s.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return vi;let a=n.flatMap(e=>e.contribution.commands.map(bi));return(i||a.some((e,t)=>!xi(e,r[t])))&&(t=Ci(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var Vr=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Hr=16,Ur=32,Wr=64,Gr=256;function Kr(e,t){for(let n of t)for(let t of n.contribution.commands)if(`${n.contribution.namespace}:${t.id}`===e)return t}function qr(e){return e.commands.length===0}function Jr(e){mi(e.sourceId,`source ID`),mi(e.namespace,`namespace`,!0),e.scope!==void 0&&mi(e.scope,`scope`);for(let t of e.commands)li(t)}function Yr(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&_i(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(`${i.contribution.namespace}:${e.id}`),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=`${e.namespace}:${t.id}`;n.has(i)&&_i(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&_i(`Slash alias is already registered`),r.add(e)}}function Xr(e,t){t.length>=Wr&&_i(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>Gr&&_i(`Live command capacity exceeded`)}function Zr(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(Qr)};return e.scope===void 0?t:{...t,scope:e.scope}}function Qr(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=$r(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=ri(e.projections)),t}function $r(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=ei(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=ei(e.outputSchema)),e.presentation!==void 0&&(t.presentation=ni(e.presentation)),Object.freeze(t)}function ei(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ti(t)])))}function ti(e){return Array.isArray(e)?Object.freeze(e.map(ti)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ti(t)]))):e}function ni(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:ei(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:ti(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function ri(e){let t={};return e.bindings!==void 0&&(t.bindings=ii(e.bindings)),e.agent!==void 0&&(t.agent=ai(e.agent)),e.help!==void 0&&(t.help=oi(e.help.order)),e.menu!==void 0&&(t.menu=oi(e.menu.order)),e.palette!==void 0&&(t.palette=oi(e.palette.order)),e.slash!==void 0&&(t.slash=si(e.slash)),t}function ii(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function ai(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function oi(e){let t={};return e!==void 0&&(t.order=e),t}function si(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=ci(e.arguments)),t}function ci(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:ei(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:ei(e.text.arguments)})),Object.freeze(t)}function li(e){mi(e.id,`command ID`,!0),mi(e.title,`title`),mi(e.category,`category`),ui(e.action),di(e.projections)}function ui(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)mi(t.label,`choice label`),t.description!==void 0&&mi(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&mi(e.presentation.submitLabel,`submit label`);return;case`confirmation`:mi(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&mi(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&mi(e.presentation.cancelLabel,`cancellation label`)}}function di(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&hi(t.order);if(e.bindings!==void 0&&pi(e.bindings.values,`binding`),e.slash!==void 0){pi(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&_i(`slash alias must not contain whitespace`);fi(e.slash.arguments)}e.agent?.keybind!==void 0&&mi(e.agent.keybind,`agent keybind`)}}function fi(e){if(e===void 0)return;mi(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&_i(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])mi(n.word,`argument word`),/\s/u.test(n.word)&&_i(`argument word must not contain whitespace`),t.has(n.word)&&_i(`argument word is repeated`),t.add(n.word),n.description!==void 0&&mi(n.description,`argument word description`);t.size>Ur&&_i(`argument word count exceeds 32`),e.text!==void 0&&(mi(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&mi(e.text.requestIdField,`request id field`))}function pi(e,t){e.length>Hr&&_i(`${t} count exceeds 16`);for(let n of e)mi(n,t)}function mi(e,t,n=!1){e.trim().length===0&&_i(`${t} must not be blank`),n&&e.includes(`:`)&&_i(`${t} must not contain a colon`)}function hi(e){e!==void 0&&!Number.isSafeInteger(e)&&_i(`order must be a safe integer`)}function gi(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function _i(e){throw Error(e)}var vi=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),yi=Object.freeze({status:`available`});function bi(e){let t=e.availability?.()??yi;return t.status===`available`?yi:Object.freeze({status:`unavailable`,reason:t.reason})}function xi(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function Si(e){if(e instanceof Rr){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:ti(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function Ci(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??yi;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...Ai(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...Ai(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...Ai(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...Ai(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...Ai(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(Mi(e,l,u.agent,d))}}return Di(n),Oi(i),Ei(r),Ei(a),Ei(o),Ei(s),Object.freeze({bindings:ki(n),palette:ki(r),slash:ki(i),help:ki(a),menu:ki(o),agent:ki(s)})}var wi=new TextEncoder;function Ti(e,t){let n=wi.encode(e),r=wi.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function Ei(e){e.sort((e,t)=>e.order-t.order||Ti(e.commandId,t.commandId))}function Di(e){e.sort((e,t)=>e.order-t.order||Ti(e.commandId,t.commandId)||Ti(e.binding,t.binding))}function Oi(e){e.sort((e,t)=>e.order-t.order||Ti(e.commandId,t.commandId)||Ti(e.alias,t.alias))}function ki(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function Ai(e,t,n,r){let i=ji(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function ji(e,t,n,r){let i={commandId:`${e.namespace}:${t.id}`,sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function Mi(e,t,n,r){let i=Ai(e,t,n.order,r),a=i.action===void 0?i:{...i,action:Ni(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function Ni(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var Pi=he(),Fi=L(()=>de(`status`,[et({status:n(`available`)}).strict(),et({status:n(`unavailable`),reason:z()}).strict()])),Ii=Pi,Li=L(()=>be(z(),Ii)),Ri=e=>Ii.parse(e),zi=e=>Li.parse(e),Bi=L(()=>et({code:z().min(1).max(160),message:z().min(1).max(512),details:Ii.optional()}).strict()),Vi=e=>Bi.parse(e),Hi=Li,Ui=L(()=>z().refine(e=>e.trim().length>0)),Wi=Fi,Gi=L(()=>ot([et({type:n(`action`)}).strict(),et({type:n(`custom`),data:Li}).strict(),et({type:n(`choice`),options:T(et({value:Ii,label:Ui,description:Ui.optional()}))}).strict(),et({type:n(`form`),submitLabel:Ui.optional()}).strict(),et({type:n(`confirmation`),message:Ui,confirmLabel:Ui.optional(),cancelLabel:Ui.optional()}).strict()])),Ki=L(()=>et({inputSchema:Hi.optional(),outputSchema:Hi.optional(),presentation:Gi.optional()}).strict()),qi=L(()=>Je().int().refine(e=>Number.isSafeInteger(e))),Ji=L(()=>et({hint:Ui.pipe(z().max(120)),words:T(et({word:z().regex(/^\S{1,64}$/u),description:Ui.pipe(z().max(512)).optional(),arguments:Li}).strict()).max(32).optional(),text:et({field:Ui.pipe(z().max(120)),arguments:Li,requestIdField:Ui.pipe(z().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),Yi=L(()=>et({order:qi.optional()}).strict()),Xi=L(()=>et({bindings:et({order:qi.optional(),values:T(Ui).max(16)}).strict().optional(),agent:et({keybind:Ui.optional(),order:qi.optional()}).strict().optional(),help:Yi.optional(),menu:Yi.optional(),palette:Yi.optional(),slash:et({aliases:T(Ui).max(16),consumesDraft:C().optional(),order:qi.optional(),arguments:Ji.optional()}).strict().optional()}).strict()),Zi=L(()=>et({id:Ui.refine(e=>!e.includes(`:`)),title:Ui,category:Ui,description:Ui.optional(),projections:Xi.optional(),action:Ki.optional(),availability:Wi.optional()}).strict()),Qi=e=>Zi.parse(e),$i=L(()=>et({inputSchema:Hi.optional(),outputSchema:Hi.optional()}).strict()),ea=L(()=>et({commandId:z(),sourceId:z(),scope:z().optional(),title:z(),category:z(),description:z().optional(),order:Je(),availability:Fi,action:$i.optional(),keybind:z().optional()}).strict());T(ea);var ta=8192,na=Ui.pipe(z().max(ta)),ra=Ae({protocol:/^https?$/u}),ia=de(`type`,[et({type:n(`choice`),message:na,collapsedGroup:na.optional(),options:T(et({value:na,label:na,description:na.optional(),group:na.optional()}).strict()).min(1).max(256)}).strict(),et({type:n(`text`),message:na,placeholder:na.optional(),secret:C().optional()}).strict(),et({type:n(`confirmation`),message:na,confirmLabel:na.optional(),cancelLabel:na.optional()}).strict()]),aa=L(()=>de(`type`,[et({type:n(`info`),message:na,links:T(et({url:ra,label:na.optional()}).strict()).max(16).optional()}).strict(),et({type:n(`progress`),message:na}).strict(),et({type:n(`handoff`),url:ra,code:na.optional(),message:na.optional()}).strict(),et({type:n(`success`),message:na}).strict()])),oa=e=>ia.parse(e),sa=e=>aa.parse(e),ca={confirmation:e=>(ia.options[2].parse(e),C()),text:e=>(ia.options[1].parse(e),z().max(ta)),choice:e=>{let t=ia.options[0].parse(e);return z().refine(e=>t.options.some(t=>t.value===e))}};function la(e){let t=ca[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}function ua(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()};e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:Ri(r)}).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}var Y=class extends Error{code;retryable;constructor(e,t){super(e,{cause:t.cause}),this.name=`AppError`,this.code=t.code,this.retryable=t.retryable}};c(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var da=`data-theme`;function fa(e){return e||(globalThis.document?.documentElement??null)}function pa(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function ma(e,t){let n=pa(e),r=fa(t);r&&r.setAttribute(da,n)}function ha(e){return fa(e)?.getAttribute(da)??null}var ga=t((e=>{var t=Lr(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),_a=t(((e,t)=>{t.exports=ga()})),X=_a(),va=J.createContext(void 0),ya=e=>{let t=J.useContext(va);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ba=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,X.jsx)(va.Provider,{value:e,children:t})),xa={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Sa=new class{#e=xa;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ca(e){setTimeout(e,0)}var wa=typeof window>`u`||`Deno`in globalThis;function Ta(){}function Ea(e,t){return typeof e==`function`?e(t):e}function Da(e){return typeof e==`number`&&e>=0&&e!==1/0}function Oa(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ka(e,t){return typeof e==`function`?e(t):e}function Aa(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Ma(o,t.options))return!1}else if(!Pa(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ja(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Na(t.options.mutationKey)!==Na(a))return!1}else if(!Pa(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ma(e,t){return(t?.queryKeyHashFn||Na)(e)}function Na(e){return JSON.stringify(e,(e,t)=>za(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Pa(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Pa(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Pa(e[r],t[r]))return!1;return!0}return!1}var Fa=Object.prototype.hasOwnProperty;function Ia(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ra(e)&&Ra(t);if(!r&&!(za(e)&&za(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Fa.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ia(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function La(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Ra(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function za(e){if(!Ba(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ba(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ba(e){return Object.prototype.toString.call(e)===`[object Object]`}function Va(e){return new Promise(t=>{Sa.setTimeout(t,e)})}function Ha(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ia(e,t)}function Ua(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Wa(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ga=Symbol();function Ka(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ga?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function qa(e,t){return typeof e==`function`?e(...t):!!e}function Ja(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Ya=()=>wa,Xa=()=>Ya(),Za=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qa=new class extends Za{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},$a=Ca;function eo(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=$a,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var to=eo(),no=new class extends Za{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ro(e){return Math.min(1e3*2**e,3e4)}function io(e){return(e??`online`)!==`online`||no.isOnline()}var ao=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function oo(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Ta);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new ao(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Qa.isFocused()&&(e.networkMode===`always`||no.isOnline())&&e.canRun(),p=()=>io(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Xa()?0:3),a=e.retryDelay??ro,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Va(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var so=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Da(this.gcTime)&&(this.#e=Sa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xa()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Sa.clearTimeout(this.#e),this.#e=void 0)}};function co(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ja(e,()=>t.signal,()=>n=!0)},u=Ka(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Wa:Ua;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?uo:lo,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:lo(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function lo(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function uo(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function fo(e,t){return t?lo(e,t)!=null:!1}function po(e,t){return!t||!e.getPreviousPageParam?!1:uo(e,t)!=null}var mo=class extends so{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=_o(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=_o(this.options);e.data!==void 0&&(this.setState(go(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ha(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Ta).catch(Ta):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>ka(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ga||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>ka(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Oa(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Ka(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?co(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=oo({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ao&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ao){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...ho(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...go(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),to.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function ho(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:io(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function go(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function _o(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var vo=class extends Za{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),bo(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return xo(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return xo(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof ka(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!La(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&So(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||ka(this.options.enabled,this.#t)!==ka(t.enabled,this.#t)||ka(this.options.staleTime,this.#t)!==ka(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||ka(this.options.enabled,this.#t)!==ka(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return La(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Ta)),t}#h(e){return!Xa()&&ka(this.options.enabled,this.#t)!==!1&&Da(e)}#g(){this.#b();let e=ka(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Oa(this.#r.dataUpdatedAt,e)+1;this.#u=Sa.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=Sa.setInterval(()=>{(this.options.refetchIntervalInBackground||Qa.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Sa.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Sa.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&bo(e,t),o=i&&So(e,n,t,r);(a||o)&&(l={...l,...ho(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Ha(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Ha(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Co(e,t),refetch:this.refetch,isEnabled:ka(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),La(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();to.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function yo(e,t){return ka(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||ka(t.retryOnMount,e)!==!1)}function bo(e,t){return yo(e,t)||e.state.data!==void 0&&xo(e,t,t.refetchOnMount)}function xo(e,t,n){if(ka(t.enabled,e)!==!1&&ka(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Co(e,t)}return!1}function So(e,t,n,r){return(e!==t||ka(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Co(e,n)}function Co(e,t){return ka(t.enabled,e)!==!1&&e.isStaleByTime(ka(t.staleTime,e))}var wo=class extends vo{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:fo(t,n.data),hasPreviousPage:po(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},To=class extends so{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Eo(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=oo({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),to.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Eo(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Do=class extends Za{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new To({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Oo(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Oo(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Oo(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Oo(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){to.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ja(t,e))}findAll(e={}){return this.getAll().filter(t=>ja(e,t))}notify(e){to.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return to.batch(()=>Promise.all(e.map(e=>e.continue().catch(Ta))))}};function Oo(e){return e.options.scope?.id}var ko=class extends Za{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),La(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Na(t.mutationKey)!==Na(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Eo();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){to.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Ao(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var jo=class extends Za{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,to.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!La(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ao(e,n).forEach(e=>{e.destroy()}),Ao(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Ia(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new vo(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&to.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Mo=class extends Za{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ma(r,t),a=this.get(i);return a||(a=new mo({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){to.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Aa(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Aa(e,t)):t}notify(e){to.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){to.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){to.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},No=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Mo,this.#t=e.mutationCache||new Do,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Qa.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=no.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ka(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ea(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return to.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;to.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return to.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=to.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Ta).catch(Ta)}invalidateQueries(e,t={}){return to.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=to.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Ta)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Ta)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(ka(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ka(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ta).catch(Ta)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ta).catch(Ta)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return no.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Na(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Pa(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Na(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Pa(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Ma(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ga&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function Po({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Ua(e,t),initialValue:r=[]}){return async i=>{let a=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),o=!!a&&a.isFetched();o&&t===`reset`&&a.setState({...a.resetState,fetchStatus:`fetching`});let s=r,c=!1,l=await e(Ja({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>c=!0)),u=o&&t===`replace`;for await(let e of l){if(c)break;u?s=n(s,e):i.client.setQueryData(i.queryKey,t=>n(t===void 0?r:t,e))}return u&&!c&&i.client.setQueryData(i.queryKey,s),i.client.getQueryData(i.queryKey)??r}}var Fo=J.createContext(!1),Io=()=>J.useContext(Fo);Fo.Provider;function Lo(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ro=J.createContext(Lo()),zo=()=>J.useContext(Ro),Bo=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?qa(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Vo=e=>{J.useEffect(()=>{e.clearReset()},[e])},Ho=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||qa(n,[e.error,r])),Uo=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Wo=(e,t)=>e?.suspense&&t.isPending,Go=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ko({queries:e,...t},n){let r=ya(n),i=Io(),a=zo(),o=t.subscribed!==!1,s=J.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{Uo(e);let t=r.getQueryCache().get(e.queryHash);Bo(e,a,t)}),Vo(a);let[c]=J.useState(()=>new jo(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;J.useSyncExternalStore(J.useCallback(e=>f?c.subscribe(to.batchCalls(e)):Ta,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),J.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>Wo(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&Wo(n,e)?Go(n,new vo(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&Ho({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function qo(e,t,n){let r=Io(),i=zo(),a=ya(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Uo(o),Bo(o,i,s),Vo(i);let[l]=J.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(J.useSyncExternalStore(J.useCallback(e=>{let t=d?l.subscribe(to.batchCalls(e)):Ta;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),J.useEffect(()=>{l.setOptions(o)},[o,l]),Wo(o,u))throw Go(o,l,i);if(Ho({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Jo(e,t){return qo(e,vo,t)}function Yo(e){return e}function Xo(e){return e}function Zo(e,t){let n=ya(t),[r]=J.useState(()=>new ko(n,e));J.useEffect(()=>{r.setOptions(e)},[r,e]);let i=J.useSyncExternalStore(J.useCallback(e=>r.subscribe(to.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=J.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(Ta)},[r]);if(i.error&&qa(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Qo=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),$o=t(((e,t)=>{t.exports=Qo()})),es=t((e=>{var t=Lr(),n=$o();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function m(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function h(e,t,n,r){if(t==null||m(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function g(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var _={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){_[e]=new g(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];_[t]=new g(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){_[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){_[e]=new g(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){_[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){_[e]=new g(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){_[e]=new g(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){_[e]=new g(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){_[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),_.xlinkHref=new g(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,t,n,r){var i=_.hasOwnProperty(t)?_[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(h(t,n,i,r)&&(n=null),r||i===null?p(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=Symbol.for(`react.element`),C=Symbol.for(`react.portal`),w=Symbol.for(`react.fragment`),T=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),D=Symbol.for(`react.provider`),O=Symbol.for(`react.context`),k=Symbol.for(`react.forward_ref`),A=Symbol.for(`react.suspense`),j=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),N=Symbol.for(`react.lazy`),P=Symbol.for(`react.offscreen`),F=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=F&&e[F]||e[`@@iterator`],typeof e==`function`?e:null)}var I=Object.assign,te;function L(e){if(te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||``}return`
|
|
3
|
-
`+te+e}var ne=!1;function re(e,t){if(!e||ne)return``;ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
4
|
-
`),a=r.stack.split(`
|
|
5
|
-
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
6
|
-
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ne=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?L(e):``}function ie(e){switch(e.tag){case 5:return L(e.type);case 16:return L(`Lazy`);case 13:return L(`Suspense`);case 19:return L(`SuspenseList`);case 0:case 2:case 15:return e=re(e.type,!1),e;case 11:return e=re(e.type.render,!1),e;case 1:return e=re(e.type,!0),e;default:return``}}function ae(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case w:return`Fragment`;case C:return`Portal`;case E:return`Profiler`;case T:return`StrictMode`;case A:return`Suspense`;case j:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case O:return(e.displayName||`Context`)+`.Consumer`;case D:return(e._context.displayName||`Context`)+`.Provider`;case k:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case M:return t=e.displayName||null,t===null?ae(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}function oe(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ae(t);case 8:return t===T?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function R(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function se(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ce(e){var t=se(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function le(e){e._valueTracker||=ce(e)}function ue(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=se(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function de(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function fe(e,t){var n=t.checked;return I({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function pe(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=R(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function me(e,t){t=t.checked,t!=null&&b(e,`checked`,t,!1)}function he(e,t){me(e,t);var n=R(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?_e(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&_e(e,t.type,R(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ge(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function _e(e,t,n){(t!==`number`||de(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ve=Array.isArray;function ye(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+R(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function be(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return I({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function xe(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(ve(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:R(n)}}function Se(e,t){var n=R(t.value),r=R(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Ce(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function we(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Te(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?we(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Ee,De=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Ee||=document.createElement(`div`),Ee.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Ee.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Oe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ke={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ae=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(ke).forEach(function(e){Ae.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ke[t]=ke[e]})});function je(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||ke.hasOwnProperty(e)&&ke[e]?(``+t).trim():t+`px`}function Me(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=je(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ne=I({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pe(e,t){if(t){if(Ne[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Fe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){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 Ie=null;function Le(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Re=null,ze=null,Be=null;function Ve(e){if(e=Ni(e)){if(typeof Re!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Fi(t),Re(e.stateNode,e.type,t))}}function He(e){ze?Be?Be.push(e):Be=[e]:ze=e}function Ue(){if(ze){var e=ze,t=Be;if(Be=ze=null,Ve(e),t)for(e=0;e<t.length;e++)Ve(t[e])}}function We(e,t){return e(t)}function Ge(){}var Ke=!1;function qe(e,t,n){if(Ke)return e(t,n);Ke=!0;try{return We(e,t,n)}finally{Ke=!1,(ze!==null||Be!==null)&&(Ge(),Ue())}}function Je(e,t){var n=e.stateNode;if(n===null)return null;var i=Fi(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var Ye=!1;if(c)try{var Xe={};Object.defineProperty(Xe,"passive",{get:function(){Ye=!0}}),window.addEventListener(`test`,Xe,Xe),window.removeEventListener(`test`,Xe,Xe)}catch{Ye=!1}function Ze(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Qe=!1,$e=null,et=!1,tt=null,nt={onError:function(e){Qe=!0,$e=e}};function z(e,t,n,r,i,a,o,s,c){Qe=!1,$e=null,Ze.apply(nt,arguments)}function rt(e,t,n,i,a,o,s,c,l){if(z.apply(this,arguments),Qe){if(Qe){var u=$e;Qe=!1,$e=null}else throw Error(r(198));et||(et=!0,tt=u)}}function it(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function at(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function ot(e){if(it(e)!==e)throw Error(r(188))}function st(e){var t=e.alternate;if(!t){if(t=it(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return ot(a),e;if(o===i)return ot(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function ct(e){return e=st(e),e===null?null:lt(e)}function lt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=lt(e);if(t!==null)return t;e=e.sibling}return null}var ut=n.unstable_scheduleCallback,dt=n.unstable_cancelCallback,ft=n.unstable_shouldYield,pt=n.unstable_requestPaint,mt=n.unstable_now,ht=n.unstable_getCurrentPriorityLevel,gt=n.unstable_ImmediatePriority,_t=n.unstable_UserBlockingPriority,vt=n.unstable_NormalPriority,yt=n.unstable_LowPriority,bt=n.unstable_IdlePriority,xt=null,St=null;function Ct(e){if(St&&typeof St.onCommitFiberRoot==`function`)try{St.onCommitFiberRoot(xt,e,void 0,(e.current.flags&128)==128)}catch{}}var wt=Math.clz32?Math.clz32:Dt,Tt=Math.log,Et=Math.LN2;function Dt(e){return e>>>=0,e===0?32:31-(Tt(e)/Et|0)|0}var Ot=64,B=4194304;function kt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function At(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=kt(a))):r=kt(s)}else o=n&~i,o===0?a!==0&&(r=kt(a)):r=kt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-wt(t),i=1<<n,r|=e[n],t&=~i;return r}function jt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-wt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=jt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Nt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Pt(){var e=Ot;return Ot<<=1,!(Ot&4194240)&&(Ot=64),e}function V(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function H(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-wt(t),e[t]=n}function Ft(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-wt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function It(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-wt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Lt=0;function Rt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var zt,Bt,Vt,Ht,Ut,Wt=!1,Gt=[],Kt=null,qt=null,Jt=null,Yt=new Map,Xt=new Map,Zt=[],Qt=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit`.split(` `);function $t(e,t){switch(e){case`focusin`:case`focusout`:Kt=null;break;case`dragenter`:case`dragleave`:qt=null;break;case`mouseover`:case`mouseout`:Jt=null;break;case`pointerover`:case`pointerout`:Yt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Xt.delete(t.pointerId)}}function U(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ni(t),t!==null&&Bt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function en(e,t,n,r,i){switch(t){case`focusin`:return Kt=U(Kt,e,t,n,r,i),!0;case`dragenter`:return qt=U(qt,e,t,n,r,i),!0;case`mouseover`:return Jt=U(Jt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Yt.set(a,U(Yt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Xt.set(a,U(Xt.get(a)||null,e,t,n,r,i)),!0}return!1}function tn(e){var t=Mi(e.target);if(t!==null){var n=it(t);if(n!==null){if(t=n.tag,t===13){if(t=at(n),t!==null){e.blockedOn=t,Ut(e.priority,function(){Vt(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function nn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ie=r,n.target.dispatchEvent(r),Ie=null}else return t=Ni(n),t!==null&&Bt(t),e.blockedOn=n,!1;t.shift()}return!0}function rn(e,t,n){nn(e)&&n.delete(t)}function an(){Wt=!1,Kt!==null&&nn(Kt)&&(Kt=null),qt!==null&&nn(qt)&&(qt=null),Jt!==null&&nn(Jt)&&(Jt=null),Yt.forEach(rn),Xt.forEach(rn)}function on(e,t){e.blockedOn===t&&(e.blockedOn=null,Wt||(Wt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,an)))}function sn(e){function t(t){return on(t,e)}if(0<Gt.length){on(Gt[0],e);for(var n=1;n<Gt.length;n++){var r=Gt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Kt!==null&&on(Kt,e),qt!==null&&on(qt,e),Jt!==null&&on(Jt,e),Yt.forEach(t),Xt.forEach(t),n=0;n<Zt.length;n++)r=Zt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Zt.length&&(n=Zt[0],n.blockedOn===null);)tn(n),n.blockedOn===null&&Zt.shift()}var cn=x.ReactCurrentBatchConfig,W=!0;function ln(e,t,n,r){var i=Lt,a=cn.transition;cn.transition=null;try{Lt=1,dn(e,t,n,r)}finally{Lt=i,cn.transition=a}}function un(e,t,n,r){var i=Lt,a=cn.transition;cn.transition=null;try{Lt=4,dn(e,t,n,r)}finally{Lt=i,cn.transition=a}}function dn(e,t,n,r){if(W){var i=pn(e,t,n,r);if(i===null)ii(e,t,r,fn,n),$t(e,r);else if(en(i,e,t,n,r))r.stopPropagation();else if($t(e,r),t&4&&-1<Qt.indexOf(e)){for(;i!==null;){var a=Ni(i);if(a!==null&&zt(a),a=pn(e,t,n,r),a===null&&ii(e,t,r,fn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ii(e,t,r,null,n)}}var fn=null;function pn(e,t,n,r){if(fn=null,e=Le(r),e=Mi(e),e!==null){if(t=it(e),t===null)e=null;else if(n=t.tag,n===13){if(e=at(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return fn=e,null}function mn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(ht()){case gt:return 1;case _t:return 4;case vt:case yt:return 16;case bt:return 536870912;default:return 16}default:return 16}}var hn=null,gn=null,_n=null;function vn(){if(_n)return _n;var e,t=gn,n=t.length,r,i=`value`in hn?hn.value:hn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return _n=i.slice(e,1<r?1-r:void 0)}function yn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function bn(){return!0}function xn(){return!1}function Sn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?bn:xn,this.isPropagationStopped=xn,this}return I(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=bn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=bn)},persist:function(){},isPersistent:bn}),t}var Cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wn=Sn(Cn),Tn=I({},Cn,{view:0,detail:0}),En=Sn(Tn),Dn,On,kn,An=I({},Tn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==kn&&(kn&&e.type===`mousemove`?(Dn=e.screenX-kn.screenX,On=e.screenY-kn.screenY):On=Dn=0,kn=e),Dn)},movementY:function(e){return`movementY`in e?e.movementY:On}}),jn=Sn(An),Mn=Sn(I({},An,{dataTransfer:0})),Nn=Sn(I({},Tn,{relatedTarget:0})),Pn=Sn(I({},Cn,{animationName:0,elapsedTime:0,pseudoElement:0})),Fn=Sn(I({},Cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),In=Sn(I({},Cn,{data:0})),Ln={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Rn={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`},zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Bn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zn[e])?!!t[e]:!1}function Vn(){return Bn}var Hn=Sn(I({},Tn,{key:function(e){if(e.key){var t=Ln[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=yn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Rn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vn,charCode:function(e){return e.type===`keypress`?yn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?yn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Un=Sn(I({},An,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Wn=Sn(I({},Tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vn})),Gn=Sn(I({},Cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Kn=Sn(I({},An,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),qn=[9,13,27,32],Jn=c&&`CompositionEvent`in window,Yn=null;c&&`documentMode`in document&&(Yn=document.documentMode);var Xn=c&&`TextEvent`in window&&!Yn,Zn=c&&(!Jn||Yn&&8<Yn&&11>=Yn),Qn=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,Qn):null;case`textInput`:return e=t.data,e===Qn&&$n?null:e;default:return null}}function G(e,t){if(nr)return e===`compositionend`||!Jn&&er(e,t)?(e=vn(),_n=gn=hn=null,nr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Zn&&t.locale!==`ko`?null:t.data;default:return null}}var ir={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 ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ir[e.type]:t===`textarea`}function or(e,t,n,r){He(r),t=oi(t,`onChange`),0<t.length&&(n=new wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var sr=null,cr=null;function K(e){Qr(e,0)}function lr(e){if(ue(Pi(e)))return e}function ur(e,t){if(e===`change`)return t}var dr=!1;if(c){var fr;if(c){var pr=`oninput`in document;if(!pr){var mr=document.createElement(`div`);mr.setAttribute(`oninput`,`return;`),pr=typeof mr.oninput==`function`}fr=pr}else fr=!1;dr=fr&&(!document.documentMode||9<document.documentMode)}function hr(){sr&&(sr.detachEvent(`onpropertychange`,gr),cr=sr=null)}function gr(e){if(e.propertyName===`value`&&lr(cr)){var t=[];or(t,cr,e,Le(e)),qe(K,t)}}function _r(e,t,n){e===`focusin`?(hr(),sr=t,cr=n,sr.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(cr)}function yr(e,t){if(e===`click`)return lr(t)}function br(e,t){if(e===`input`||e===`change`)return lr(t)}function q(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var xr=typeof Object.is==`function`?Object.is:q;function Sr(e,t){if(xr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!xr(e[i],t[i]))return!1}return!0}function Cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wr(e,t){var n=Cr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(){for(var e=window,t=de();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=de(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Or(e){var t=Er(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Tr(n.ownerDocument.documentElement,n)){if(r!==null&&Dr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=wr(n,a);var o=wr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var kr=c&&`documentMode`in document&&11>=document.documentMode,Ar=null,jr=null,Mr=null,Nr=!1;function Pr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nr||Ar==null||Ar!==de(r)||(r=Ar,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mr&&Sr(Mr,r)||(Mr=r,r=oi(jr,`onSelect`),0<r.length&&(t=new wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ar)))}function Fr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ir={animationend:Fr(`Animation`,`AnimationEnd`),animationiteration:Fr(`Animation`,`AnimationIteration`),animationstart:Fr(`Animation`,`AnimationStart`),transitionend:Fr(`Transition`,`TransitionEnd`)},J={},Rr={};c&&(Rr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),`TransitionEvent`in window||delete Ir.transitionend.transition);function zr(e){if(J[e])return J[e];if(!Ir[e])return e;var t=Ir[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rr)return J[e]=t[n];return e}var Br=zr(`animationend`),Vr=zr(`animationiteration`),Hr=zr(`animationstart`),Ur=zr(`transitionend`),Wr=new Map,Gr=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function Kr(e,t){Wr.set(e,t),o(t,[e])}for(var qr=0;qr<Gr.length;qr++){var Jr=Gr[qr];Kr(Jr.toLowerCase(),`on`+(Jr[0].toUpperCase()+Jr.slice(1)))}Kr(Br,`onAnimationEnd`),Kr(Vr,`onAnimationIteration`),Kr(Hr,`onAnimationStart`),Kr(`dblclick`,`onDoubleClick`),Kr(`focusin`,`onFocus`),Kr(`focusout`,`onBlur`),Kr(Ur,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Yr=`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(` `),Xr=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Yr));function Zr(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,rt(r,t,void 0,e),e.currentTarget=null}function Qr(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;Zr(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;Zr(i,s,l),a=c}}}if(et)throw e=tt,et=!1,tt=null,e}function $r(e,t){var n=t[ki];n===void 0&&(n=t[ki]=new Set);var r=e+`__bubble`;n.has(r)||(ri(t,e,2,!1),n.add(r))}function ei(e,t,n){var r=0;t&&(r|=4),ri(n,e,r,t)}var ti=`_reactListening`+Math.random().toString(36).slice(2);function ni(e){if(!e[ti]){e[ti]=!0,i.forEach(function(t){t!==`selectionchange`&&(Xr.has(t)||ei(t,!1,e),ei(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ti]||(t[ti]=!0,ei(`selectionchange`,!1,t))}}function ri(e,t,n,r){switch(mn(t)){case 1:var i=ln;break;case 4:i=un;break;default:i=dn}n=i.bind(null,t,n,e),i=void 0,!Ye||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ii(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Mi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}qe(function(){var r=a,i=Le(n),o=[];a:{var s=Wr.get(e);if(s!==void 0){var c=wn,l=e;switch(e){case`keypress`:if(yn(n)===0)break a;case`keydown`:case`keyup`:c=Hn;break;case`focusin`:l=`focus`,c=Nn;break;case`focusout`:l=`blur`,c=Nn;break;case`beforeblur`:case`afterblur`:c=Nn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=jn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Mn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Wn;break;case Br:case Vr:case Hr:c=Pn;break;case Ur:c=Gn;break;case`scroll`:c=En;break;case`wheel`:c=Kn;break;case`copy`:case`cut`:case`paste`:c=Fn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Un}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Je(p,f),h!=null&&u.push(ai(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Ie&&(l=n.relatedTarget||n.fromElement)&&(Mi(l)||l[Oi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Mi(l):null,l!==null&&(d=it(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=jn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Un,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Pi(c),m=l==null?s:Pi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Mi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=si(m))p++;for(m=0,h=f;h;h=si(h))m++;for(;0<p-m;)u=si(u),p--;for(;0<m-p;)f=si(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=si(u),f=si(f)}u=null}else u=null;c!==null&&ci(o,s,c,u,!1),l!==null&&d!==null&&ci(o,d,l,u,!0)}}a:{if(s=r?Pi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=ur;else if(ar(s)){if(dr)g=br;else{g=vr;var _=_r}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=yr);if(g&&=g(e,r)){or(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&_e(s,`number`,s.value)}switch(_=r?Pi(r):window,e){case`focusin`:(ar(_)||_.contentEditable===`true`)&&(Ar=_,jr=r,Mr=null);break;case`focusout`:Mr=jr=Ar=null;break;case`mousedown`:Nr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Nr=!1,Pr(o,n,i);break;case`selectionchange`:if(kr)break;case`keydown`:case`keyup`:Pr(o,n,i)}var v;if(Jn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else nr?er(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(Zn&&n.locale!==`ko`&&(nr||y!==`onCompositionStart`?y===`onCompositionEnd`&&nr&&(v=vn()):(hn=i,gn=`value`in hn?hn.value:hn.textContent,nr=!0)),_=oi(r,y),0<_.length&&(y=new In(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=tr(n),v!==null&&(y.data=v)))),(v=Xn?rr(e,n):G(e,n))&&(r=oi(r,`onBeforeInput`),0<r.length&&(i=new In(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}Qr(o,t)})}function ai(e,t,n){return{instance:e,listener:t,currentTarget:n}}function oi(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Je(e,n),a!=null&&r.unshift(ai(e,a,i)),a=Je(e,t),a!=null&&r.push(ai(e,a,i))),e=e.return}return r}function si(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ci(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Je(n,a),c!=null&&o.unshift(ai(n,c,s))):i||(c=Je(n,a),c!=null&&o.push(ai(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var li=/\r\n?/g,ui=/\u0000|\uFFFD/g;function di(e){return(typeof e==`string`?e:``+e).replace(li,`
|
|
7
|
-
`).replace(ui,``)}function fi(e,t,n){if(t=di(t),di(e)!==t&&n)throw Error(r(425))}function pi(){}var mi=null,hi=null;function gi(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var _i=typeof setTimeout==`function`?setTimeout:void 0,vi=typeof clearTimeout==`function`?clearTimeout:void 0,yi=typeof Promise==`function`?Promise:void 0,bi=typeof queueMicrotask==`function`?queueMicrotask:yi===void 0?_i:function(e){return yi.resolve(null).then(e).catch(xi)};function xi(e){setTimeout(function(){throw e})}function Si(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),sn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);sn(t)}function Ci(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function wi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Ti=Math.random().toString(36).slice(2),Ei=`__reactFiber$`+Ti,Di=`__reactProps$`+Ti,Oi=`__reactContainer$`+Ti,ki=`__reactEvents$`+Ti,Ai=`__reactListeners$`+Ti,ji=`__reactHandles$`+Ti;function Mi(e){var t=e[Ei];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Oi]||n[Ei]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=wi(e);e!==null;){if(n=e[Ei])return n;e=wi(e)}return t}e=n,n=e.parentNode}return null}function Ni(e){return e=e[Ei]||e[Oi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Pi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Fi(e){return e[Di]||null}var Ii=[],Li=-1;function Ri(e){return{current:e}}function zi(e){0>Li||(e.current=Ii[Li],Ii[Li]=null,Li--)}function Bi(e,t){Li++,Ii[Li]=e.current,e.current=t}var Vi={},Hi=Ri(Vi),Ui=Ri(!1),Wi=Vi;function Gi(e,t){var n=e.type.contextTypes;if(!n)return Vi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ki(e){return e=e.childContextTypes,e!=null}function qi(){zi(Ui),zi(Hi)}function Ji(e,t,n){if(Hi.current!==Vi)throw Error(r(168));Bi(Hi,t),Bi(Ui,n)}function Yi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,oe(e)||`Unknown`,a));return I({},n,i)}function Xi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vi,Wi=Hi.current,Bi(Hi,e),Bi(Ui,Ui.current),!0}function Zi(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Yi(e,t,Wi),i.__reactInternalMemoizedMergedChildContext=e,zi(Ui),zi(Hi),Bi(Hi,e)):zi(Ui),Bi(Ui,n)}var Qi=null,$i=!1,ea=!1;function ta(e){Qi===null?Qi=[e]:Qi.push(e)}function na(e){$i=!0,ta(e)}function ra(){if(!ea&&Qi!==null){ea=!0;var e=0,t=Lt;try{var n=Qi;for(Lt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Qi=null,$i=!1}catch(t){throw Qi!==null&&(Qi=Qi.slice(e+1)),ut(gt,ra),t}finally{Lt=t,ea=!1}}return null}var ia=[],aa=0,oa=null,sa=0,ca=[],la=0,ua=null,Y=1,da=``;function fa(e,t){ia[aa++]=sa,ia[aa++]=oa,oa=e,sa=t}function pa(e,t,n){ca[la++]=Y,ca[la++]=da,ca[la++]=ua,ua=e;var r=Y;e=da;var i=32-wt(r)-1;r&=~(1<<i),n+=1;var a=32-wt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Y=1<<32-wt(t)+i|n<<i|r,da=a+e}else Y=1<<a|n<<i|r,da=e}function ma(e){e.return!==null&&(fa(e,1),pa(e,1,0))}function ha(e){for(;e===oa;)oa=ia[--aa],ia[aa]=null,sa=ia[--aa],ia[aa]=null;for(;e===ua;)ua=ca[--la],ca[la]=null,da=ca[--la],ca[la]=null,Y=ca[--la],ca[la]=null}var ga=null,_a=null,X=!1,va=null;function ya(e,t){var n=Jl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ba(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,ga=e,_a=Ci(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,ga=e,_a=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ua===null?null:{id:Y,overflow:da},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Jl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ga=e,_a=null,!0);default:return!1}}function xa(e){return!!(e.mode&1)&&!(e.flags&128)}function Sa(e){if(X){var t=_a;if(t){var n=t;if(!ba(e,t)){if(xa(e))throw Error(r(418));t=Ci(n.nextSibling);var i=ga;t&&ba(e,t)?ya(i,n):(e.flags=e.flags&-4097|2,X=!1,ga=e)}}else{if(xa(e))throw Error(r(418));e.flags=e.flags&-4097|2,X=!1,ga=e}}}function Ca(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ga=e}function wa(e){if(e!==ga)return!1;if(!X)return Ca(e),X=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!gi(e.type,e.memoizedProps)),t&&=_a){if(xa(e))throw Ta(),Error(r(418));for(;t;)ya(e,t),t=Ci(t.nextSibling)}if(Ca(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){_a=Ci(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}_a=null}}else _a=ga?Ci(e.stateNode.nextSibling):null;return!0}function Ta(){for(var e=_a;e;)e=Ci(e.nextSibling)}function Ea(){_a=ga=null,X=!1}function Da(e){va===null?va=[e]:va.push(e)}var Oa=x.ReactCurrentBatchConfig;function ka(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Aa(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function ja(e){var t=e._init;return t(e._payload)}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Zl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=tu(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===w?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===N&&ja(i)===t.type)?(r=a(t,n.props),r.ref=ka(e,t,n),r.return=e,r):(r=Ql(n.type,n.key,n.props,null,e.mode,r),r.ref=ka(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=nu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=$l(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=tu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case S:return n=Ql(t.type,t.key,t.props,null,e.mode,n),n.ref=ka(e,null,t),n.return=e,n;case C:return t=nu(t,e.mode,n),t.return=e,t;case N:var r=t._init;return f(e,r(t._payload),n)}if(ve(t)||ee(t))return t=$l(t,e.mode,n,null),t.return=e,t;Aa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case S:return n.key===i?l(e,t,n,r):null;case C:return n.key===i?u(e,t,n,r):null;case N:return i=n._init,p(e,t,i(n._payload),r)}if(ve(n)||ee(n))return i===null?d(e,t,n,r,null):null;Aa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case S:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case C:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case N:var a=r._init;return m(e,t,n,a(r._payload),i)}if(ve(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);Aa(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),X&&fa(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return X&&fa(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),X&&fa(r,h),l}function g(a,s,c,l){var u=ee(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),X&&fa(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return X&&fa(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),X&&fa(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===w&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case S:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===w){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===N&&ja(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=ka(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===w?(r=$l(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Ql(i.type,i.key,i.props,null,e.mode,o),o.ref=ka(e,r,i),o.return=e,e=o)}return s(e);case C:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=nu(i,e.mode,o),r.return=e,e=r}return s(e);case N:return l=i._init,_(e,r,l(i._payload),o)}if(ve(i))return h(e,r,i,o);if(ee(i))return g(e,r,i,o);Aa(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=tu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Na=Ma(!0),Pa=Ma(!1),Fa=Ri(null),Ia=null,La=null,Ra=null;function za(){Ra=La=Ia=null}function Ba(e){var t=Fa.current;zi(Fa),e._currentValue=t}function Va(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ha(e,t){Ia=e,Ra=La=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ns=!0),e.firstContext=null)}function Ua(e){var t=e._currentValue;if(Ra!==e){if(e={context:e,memoizedValue:t,next:null},La===null){if(Ia===null)throw Error(r(308));La=e,Ia.dependencies={lanes:0,firstContext:e}}else La=La.next=e}return t}var Wa=null;function Ga(e){Wa===null?Wa=[e]:Wa.push(e)}function Ka(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ga(t)):(n.next=i.next,i.next=n),t.interleaved=n,qa(e,r)}function qa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ja=!1;function Ya(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Za(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Hc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,qa(e,n)}return i=r.interleaved,i===null?(t.next=t,Ga(r)):(t.next=i.next,i.next=t),r.interleaved=t,qa(e,n)}function $a(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,It(e,n)}}function eo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function to(e,t,n,r){var i=e.updateQueue;Ja=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=I({},d,f);break a;case 2:Ja=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Xc|=o,e.lanes=o,e.memoizedState=d}}function no(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var ro={},io=Ri(ro),ao=Ri(ro),oo=Ri(ro);function so(e){if(e===ro)throw Error(r(174));return e}function co(e,t){switch(Bi(oo,t),Bi(ao,e),Bi(io,ro),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Te(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Te(t,e)}zi(io),Bi(io,t)}function lo(){zi(io),zi(ao),zi(oo)}function uo(e){so(oo.current);var t=so(io.current),n=Te(t,e.type);t!==n&&(Bi(ao,e),Bi(io,n))}function fo(e){ao.current===e&&(zi(io),zi(ao))}var po=Ri(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ho=[];function go(){for(var e=0;e<ho.length;e++)ho[e]._workInProgressVersionPrimary=null;ho.length=0}var _o=x.ReactCurrentDispatcher,vo=x.ReactCurrentBatchConfig,yo=0,bo=null,xo=null,So=null,Co=!1,wo=!1,To=0,Eo=0;function Do(){throw Error(r(321))}function Oo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xr(e[n],t[n]))return!1;return!0}function ko(e,t,n,i,a,o){if(yo=o,bo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_o.current=e===null||e.memoizedState===null?ps:ms,e=n(i,a),wo){o=0;do{if(wo=!1,To=0,25<=o)throw Error(r(301));o+=1,So=xo=null,t.updateQueue=null,_o.current=hs,e=n(i,a)}while(wo)}if(_o.current=fs,t=xo!==null&&xo.next!==null,yo=0,So=xo=bo=null,Co=!1,t)throw Error(r(300));return e}function Ao(){var e=To!==0;return To=0,e}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return So===null?bo.memoizedState=So=e:So=So.next=e,So}function Mo(){if(xo===null){var e=bo.alternate;e=e===null?null:e.memoizedState}else e=xo.next;var t=So===null?bo.memoizedState:So.next;if(t!==null)So=t,xo=e;else{if(e===null)throw Error(r(310));xo=e,e={memoizedState:xo.memoizedState,baseState:xo.baseState,baseQueue:xo.baseQueue,queue:xo.queue,next:null},So===null?bo.memoizedState=So=e:So=So.next=e}return So}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=xo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((yo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,bo.lanes|=d,Xc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,xr(i,t.memoizedState)||(Ns=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,bo.lanes|=o,Xc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Fo(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);xr(o,t.memoizedState)||(Ns=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Io(){}function Lo(e,t){var n=bo,i=Mo(),a=t(),o=!xr(i.memoizedState,a);if(o&&(i.memoizedState=a,Ns=!0),i=i.queue,Yo(Bo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||So!==null&&So.memoizedState.tag&1){if(n.flags|=2048,Wo(9,zo.bind(null,n,i,a,t),void 0,null),Uc===null)throw Error(r(349));yo&30||Ro(n,t,a)}return a}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xr(e,n)}catch{return!0}}function Ho(e){var t=qa(e,1);t!==null&&gl(t,e,1,-1)}function Uo(e){var t=jo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t.queue=e,e=e.dispatch=cs.bind(null,bo,e),[t.memoizedState,e]}function Wo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Go(){return Mo().memoizedState}function Ko(e,t,n,r){var i=jo();bo.flags|=e,i.memoizedState=Wo(1|t,n,void 0,r===void 0?null:r)}function qo(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=void 0;if(xo!==null){var o=xo.memoizedState;if(a=o.destroy,r!==null&&Oo(r,o.deps)){i.memoizedState=Wo(t,n,a,r);return}}bo.flags|=e,i.memoizedState=Wo(1|t,n,a,r)}function Jo(e,t){return Ko(8390656,8,e,t)}function Yo(e,t){return qo(2048,8,e,t)}function Xo(e,t){return qo(4,2,e,t)}function Zo(e,t){return qo(4,4,e,t)}function Qo(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function es(e,t,n){return n=n==null?null:n.concat([e]),qo(4,4,Qo.bind(null,t,e),n)}function ts(){}function ns(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function rs(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function is(e,t,n){return yo&21?(xr(n,t)||(n=Pt(),bo.lanes|=n,Xc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ns=!0),e.memoizedState=n)}function as(e,t){var n=Lt;Lt=n!==0&&4>n?n:4,e(!0);var r=vo.transition;vo.transition={};try{e(!1),t()}finally{Lt=n,vo.transition=r}}function os(){return Mo().memoizedState}function ss(e,t,n){var r=hl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ls(e))us(t,n);else if(n=Ka(e,t,n,r),n!==null){var i=ml();gl(n,e,r,i),ds(n,t,r)}}function cs(e,t,n){var r=hl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ls(e))us(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o)){var c=t.interleaved;c===null?(i.next=i,Ga(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ka(e,t,i,r),n!==null&&(i=ml(),gl(n,e,r,i),ds(n,t,r))}}function ls(e){var t=e.alternate;return e===bo||t!==null&&t===bo}function us(e,t){wo=Co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ds(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,It(e,n)}}var fs={readContext:Ua,useCallback:Do,useContext:Do,useEffect:Do,useImperativeHandle:Do,useInsertionEffect:Do,useLayoutEffect:Do,useMemo:Do,useReducer:Do,useRef:Do,useState:Do,useDebugValue:Do,useDeferredValue:Do,useTransition:Do,useMutableSource:Do,useSyncExternalStore:Do,useId:Do,unstable_isNewReconciler:!1},ps={readContext:Ua,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:Ua,useEffect:Jo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Ko(4194308,4,Qo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ko(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ko(4,2,e,t)},useMemo:function(e,t){var n=jo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=jo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ss.bind(null,bo,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:Uo,useDebugValue:ts,useDeferredValue:function(e){return jo().memoizedState=e},useTransition:function(){var e=Uo(!1),t=e[0];return e=as.bind(null,e[1]),jo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=bo,a=jo();if(X){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Uc===null)throw Error(r(349));yo&30||Ro(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Jo(Bo.bind(null,i,o,e),[e]),i.flags|=2048,Wo(9,zo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=jo(),t=Uc.identifierPrefix;if(X){var n=da,r=Y;n=(r&~(1<<32-wt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=To++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Eo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ms={readContext:Ua,useCallback:ns,useContext:Ua,useEffect:Yo,useImperativeHandle:es,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:rs,useReducer:Po,useRef:Go,useState:function(){return Po(No)},useDebugValue:ts,useDeferredValue:function(e){return is(Mo(),xo.memoizedState,e)},useTransition:function(){return[Po(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:os,unstable_isNewReconciler:!1},hs={readContext:Ua,useCallback:ns,useContext:Ua,useEffect:Yo,useImperativeHandle:es,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:rs,useReducer:Fo,useRef:Go,useState:function(){return Fo(No)},useDebugValue:ts,useDeferredValue:function(e){var t=Mo();return xo===null?t.memoizedState=e:is(t,xo.memoizedState,e)},useTransition:function(){return[Fo(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:os,unstable_isNewReconciler:!1};function gs(e,t){if(e&&e.defaultProps){for(var n in t=I({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function _s(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:I({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vs={isMounted:function(e){return(e=e._reactInternals)?it(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ml(),i=hl(e),a=Za(r,i);a.payload=t,n!=null&&(a.callback=n),t=Qa(e,a,i),t!==null&&(gl(t,e,i,r),$a(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ml(),i=hl(e),a=Za(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Qa(e,a,i),t!==null&&(gl(t,e,i,r),$a(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ml(),r=hl(e),i=Za(n,r);i.tag=2,t!=null&&(i.callback=t),t=Qa(e,i,r),t!==null&&(gl(t,e,r,n),$a(t,e,r))}};function ys(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Sr(n,r)||!Sr(i,a):!0}function bs(e,t,n){var r=!1,i=Vi,a=t.contextType;return typeof a==`object`&&a?a=Ua(a):(i=Ki(t)?Wi:Hi.current,r=t.contextTypes,a=(r=r!=null)?Gi(e,i):Vi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=vs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function xs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&vs.enqueueReplaceState(t,t.state,null)}function Ss(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ya(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ua(a):(a=Ki(t)?Wi:Hi.current,i.context=Gi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(_s(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&vs.enqueueReplaceState(i,i.state,null),to(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Cs(e,t){try{var n=``,r=t;do n+=ie(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
8
|
-
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function ws(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ts(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Es=typeof WeakMap==`function`?WeakMap:Map;function Ds(e,t,n){n=Za(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){il||(il=!0,al=r),Ts(e,t)},n}function Os(e,t,n){n=Za(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ts(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ts(e,t),typeof r!=`function`&&(ol===null?ol=new Set([this]):ol.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function ks(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Es;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Vl.bind(null,e,t,n),t.then(e,e))}function As(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function js(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Za(-1,1),t.tag=2,Qa(n,t,1))),n.lanes|=1),e)}var Ms=x.ReactCurrentOwner,Ns=!1;function Ps(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function Fs(e,t,n,r,i){n=n.render;var a=t.ref;return Ha(t,i),r=ko(e,t,n,r,a,i),n=Ao(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(X&&n&&ma(t),t.flags|=1,Ps(e,t,r,i),t.child)}function Is(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Yl(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Ls(e,t,a,r,i)):(e=Ql(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Sr:n,n(o,r)&&e.ref===t.ref)return tc(e,t,i)}return t.flags|=1,e=Zl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ls(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Sr(a,r)&&e.ref===t.ref){if(Ns=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ns=!0);else return t.lanes=e.lanes,tc(e,t,i)}}return Bs(e,t,n,r,i)}function Rs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Bi(qc,Kc),Kc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Bi(qc,Kc),Kc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Bi(qc,Kc),Kc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Bi(qc,Kc),Kc|=r;return Ps(e,t,i,n),t.child}function zs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Bs(e,t,n,r,i){var a=Ki(n)?Wi:Hi.current;return a=Gi(t,a),Ha(t,i),n=ko(e,t,n,r,a,i),r=Ao(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(X&&r&&ma(t),t.flags|=1,Ps(e,t,n,i),t.child)}function Vs(e,t,n,r,i){if(Ki(n)){var a=!0;Xi(t)}else a=!1;if(Ha(t,i),t.stateNode===null)ec(e,t),bs(t,n,r),Ss(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ua(l):(l=Ki(n)?Wi:Hi.current,l=Gi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&xs(t,o,r,l),Ja=!1;var f=t.memoizedState;o.state=f,to(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ui.current||Ja?(typeof u==`function`&&(_s(t,n,u,r),c=t.memoizedState),(s=Ja||ys(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Xa(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:gs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ua(c):(c=Ki(n)?Wi:Hi.current,c=Gi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&xs(t,o,r,c),Ja=!1,f=t.memoizedState,o.state=f,to(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ui.current||Ja?(typeof p==`function`&&(_s(t,n,p,r),m=t.memoizedState),(l=Ja||ys(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Hs(e,t,n,r,a,i)}function Hs(e,t,n,r,i,a){zs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&Zi(t,n,!1),tc(e,t,a);r=t.stateNode,Ms.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Na(t,e.child,null,a),t.child=Na(t,null,s,a)):Ps(e,t,s,a),t.memoizedState=r.state,i&&Zi(t,n,!0),t.child}function Us(e){var t=e.stateNode;t.pendingContext?Ji(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ji(e,t.context,!1),co(e,t.containerInfo)}function Ws(e,t,n,r,i){return Ea(),Da(i),t.flags|=256,Ps(e,t,n,r),t.child}var Gs={dehydrated:null,treeContext:null,retryLane:0};function Ks(e){return{baseLanes:e,cachePool:null,transitions:null}}function qs(e,t,n){var r=t.pendingProps,i=po.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Bi(po,i&1),e===null)return Sa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=eu(o,r,0,null),e=$l(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ks(n),t.memoizedState=Gs,e):Js(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Xs(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Zl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=$l(a,o,n,null),a.flags|=2):a=Zl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Ks(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Gs,r}return a=e.child,e=a.sibling,r=Zl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Js(e,t){return t=eu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Ys(e,t,n,r){return r!==null&&Da(r),Na(t,e.child,null,n),e=Js(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xs(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ws(Error(r(422))),Ys(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=eu({mode:`visible`,children:i.children},a,0,null),o=$l(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Na(t,e.child,null,s),t.child.memoizedState=Ks(s),t.memoizedState=Gs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Ys(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=ws(o,i,void 0),Ys(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ns||c){if(i=Uc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,qa(e,a),gl(i,e,a,-1))}return Al(),i=ws(Error(r(421))),Ys(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Ul.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,_a=Ci(a.nextSibling),ga=t,X=!0,va=null,e!==null&&(ca[la++]=Y,ca[la++]=da,ca[la++]=ua,Y=e.id,da=e.overflow,ua=t),t=Js(t,i.children),t.flags|=4096,t)}function Zs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Va(e.return,t,n)}function Qs(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function $s(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ps(e,t,r.children,n),r=po.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zs(e,n,t);else if(e.tag===19)Zs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Bi(po,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&mo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qs(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&mo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qs(t,!0,n,null,a);break;case`together`:Qs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ec(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Xc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Zl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nc(e,t,n){switch(t.tag){case 3:Us(t),Ea();break;case 5:uo(t);break;case 1:Ki(t.type)&&Xi(t);break;case 4:co(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Bi(Fa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Bi(po,po.current&1),e=tc(e,t,n),e===null?null:e.sibling):qs(e,t,n):(Bi(po,po.current&1),t.flags|=128,null);Bi(po,po.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $s(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Bi(po,po.current),r)break;return null;case 22:case 23:return t.lanes=0,Rs(e,t,n)}return tc(e,t,n)}var rc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ic=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,so(io.current);var o=null;switch(n){case`input`:i=fe(e,i),r=fe(e,r),o=[];break;case`select`:i=I({},i,{value:void 0}),r=I({},r,{value:void 0}),o=[];break;case`textarea`:i=be(e,i),r=be(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=pi)}Pe(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&$r(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},ac=function(e,t,n,r){n!==r&&(t.flags|=4)};function oc(e,t){if(!X)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function sc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function cc(e,t,n){var i=t.pendingProps;switch(ha(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sc(t),null;case 1:return Ki(t.type)&&qi(),sc(t),null;case 3:return i=t.stateNode,lo(),zi(Ui),zi(Hi),go(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(wa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,va!==null&&(bl(va),va=null))),sc(t),null;case 5:fo(t);var o=so(oo.current);if(n=t.type,e!==null&&t.stateNode!=null)ic(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return sc(t),null}if(e=so(io.current),wa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ei]=t,i[Di]=s,e=!!(t.mode&1),n){case`dialog`:$r(`cancel`,i),$r(`close`,i);break;case`iframe`:case`object`:case`embed`:$r(`load`,i);break;case`video`:case`audio`:for(o=0;o<Yr.length;o++)$r(Yr[o],i);break;case`source`:$r(`error`,i);break;case`img`:case`image`:case`link`:$r(`error`,i),$r(`load`,i);break;case`details`:$r(`toggle`,i);break;case`input`:pe(i,s),$r(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},$r(`invalid`,i);break;case`textarea`:xe(i,s),$r(`invalid`,i)}for(var c in Pe(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&fi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&fi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&$r(`scroll`,i)}switch(n){case`input`:le(i),ge(i,s,!0);break;case`textarea`:le(i),Ce(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=pi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=we(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ei]=t,e[Di]=i,rc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Fe(n,i),n){case`dialog`:$r(`cancel`,e),$r(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:$r(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Yr.length;o++)$r(Yr[o],e);o=i;break;case`source`:$r(`error`,e),o=i;break;case`img`:case`image`:case`link`:$r(`error`,e),$r(`load`,e),o=i;break;case`details`:$r(`toggle`,e),o=i;break;case`input`:pe(e,i),o=fe(e,i),$r(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=I({},i,{value:void 0}),$r(`invalid`,e);break;case`textarea`:xe(e,i),o=be(e,i),$r(`invalid`,e);break;default:o=i}for(s in Pe(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Me(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&De(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Oe(e,u):typeof u==`number`&&Oe(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&$r(`scroll`,e):u!=null&&b(e,s,u,c))}switch(n){case`input`:le(e),ge(e,i,!1);break;case`textarea`:le(e),Ce(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+R(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&ye(e,!!i.multiple,i.defaultValue,!0):ye(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=pi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return sc(t),null;case 6:if(e&&t.stateNode!=null)ac(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=so(oo.current),so(io.current),wa(t)){if(i=t.stateNode,n=t.memoizedProps,i[Ei]=t,(s=i.nodeValue!==n)&&(e=ga,e!==null))switch(e.tag){case 3:fi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&fi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Ei]=t,t.stateNode=i}return sc(t),null;case 13:if(zi(po),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(X&&_a!==null&&t.mode&1&&!(t.flags&128))Ta(),Ea(),t.flags|=98560,s=!1;else if(s=wa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Ei]=t}else Ea(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;sc(t),s=!1}else va!==null&&(bl(va),va=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||po.current&1?Jc===0&&(Jc=3):Al())),t.updateQueue!==null&&(t.flags|=4),sc(t),null);case 4:return lo(),e===null&&ni(t.stateNode.containerInfo),sc(t),null;case 10:return Ba(t.type._context),sc(t),null;case 17:return Ki(t.type)&&qi(),sc(t),null;case 19:if(zi(po),s=t.memoizedState,s===null)return sc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)oc(s,!1);else{if(Jc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=mo(e),c!==null){for(t.flags|=128,oc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Bi(po,po.current&1|2),t.child}e=e.sibling}s.tail!==null&&mt()>nl&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=mo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!X)return sc(t),null}else 2*mt()-s.renderingStartTime>nl&&n!==1073741824&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(sc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=mt(),t.sibling=null,n=po.current,Bi(po,i?n&1|2:n&1),t);case 22:case 23:return El(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Kc&1073741824&&(sc(t),t.subtreeFlags&6&&(t.flags|=8192)):sc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function lc(e,t){switch(ha(t),t.tag){case 1:return Ki(t.type)&&qi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lo(),zi(Ui),zi(Hi),go(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return fo(t),null;case 13:if(zi(po),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zi(po),null;case 4:return lo(),null;case 10:return Ba(t.type._context),null;case 22:case 23:return El(),null;case 24:return null;default:return null}}var uc=!1,dc=!1,fc=typeof WeakSet==`function`?WeakSet:Set,Z=null;function pc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Bl(e,t,n)}else n.current=null}}function mc(e,t,n){try{n()}catch(n){Bl(e,t,n)}}var hc=!1;function gc(e,t){if(mi=W,e=Er(),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(hi={focusedElem:e,selectionRange:n},W=!1,Z=t;Z!==null;)if(t=Z,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:gs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Bl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return h=hc,hc=!1,h}function _c(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&mc(t,n,a)}i=i.next}while(i!==r)}}function vc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function yc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function bc(e){var t=e.alternate;t!==null&&(e.alternate=null,bc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ei],delete t[Di],delete t[ki],delete t[Ai],delete t[ji])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function xc(e){return e.tag===5||e.tag===3||e.tag===4}function Sc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||xc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=pi));else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}function wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}var Tc=null,Ec=!1;function Dc(e,t,n){for(n=n.child;n!==null;)Oc(e,t,n),n=n.sibling}function Oc(e,t,n){if(St&&typeof St.onCommitFiberUnmount==`function`)try{St.onCommitFiberUnmount(xt,n)}catch{}switch(n.tag){case 5:dc||pc(n,t);case 6:var r=Tc,i=Ec;Tc=null,Dc(e,t,n),Tc=r,Ec=i,Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tc.removeChild(n.stateNode));break;case 18:Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?Si(e.parentNode,n):e.nodeType===1&&Si(e,n),sn(e)):Si(Tc,n.stateNode));break;case 4:r=Tc,i=Ec,Tc=n.stateNode.containerInfo,Ec=!0,Dc(e,t,n),Tc=r,Ec=i;break;case 0:case 11:case 14:case 15:if(!dc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&mc(n,t,o),i=i.next}while(i!==r)}Dc(e,t,n);break;case 1:if(!dc&&(pc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Bl(n,t,e)}Dc(e,t,n);break;case 21:Dc(e,t,n);break;case 22:n.mode&1?(dc=(r=dc)||n.memoizedState!==null,Dc(e,t,n),dc=r):Dc(e,t,n);break;default:Dc(e,t,n)}}function kc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fc),t.forEach(function(t){var r=Wl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ac(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Tc=c.stateNode,Ec=!1;break a;case 3:Tc=c.stateNode.containerInfo,Ec=!0;break a;case 4:Tc=c.stateNode.containerInfo,Ec=!0;break a}c=c.return}if(Tc===null)throw Error(r(160));Oc(o,s,a),Tc=null,Ec=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Bl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)jc(t,e),t=t.sibling}function jc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ac(t,e),Mc(e),i&4){try{_c(3,e,e.return),vc(3,e)}catch(t){Bl(e,e.return,t)}try{_c(5,e,e.return)}catch(t){Bl(e,e.return,t)}}break;case 1:Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return);break;case 5:if(Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return),e.flags&32){var a=e.stateNode;try{Oe(a,``)}catch(t){Bl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&me(a,o),Fe(c,s);var u=Fe(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Me(a,f):d===`dangerouslySetInnerHTML`?De(a,f):d===`children`?Oe(a,f):b(a,d,f,u)}switch(c){case`input`:he(a,o);break;case`textarea`:Se(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?ye(a,!!o.multiple,o.multiple?[]:``,!1):ye(a,!!o.multiple,o.defaultValue,!0)):ye(a,!!o.multiple,m,!1)}a[Di]=o}catch(t){Bl(e,e.return,t)}}break;case 6:if(Ac(t,e),Mc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Bl(e,e.return,t)}}break;case 3:if(Ac(t,e),Mc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{sn(t.containerInfo)}catch(t){Bl(e,e.return,t)}break;case 4:Ac(t,e),Mc(e);break;case 13:Ac(t,e),Mc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(tl=mt())),i&4&&kc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(dc=(u=dc)||d,Ac(t,e),dc=u):Ac(t,e),Mc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Z=e,d=e.child;d!==null;){for(f=Z=d;Z!==null;){switch(p=Z,m=p.child,p.tag){case 0:case 11:case 14:case 15:_c(4,p,p.return);break;case 1:pc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Bl(i,n,e)}}break;case 5:pc(p,p.return);break;case 22:if(p.memoizedState!==null){Ic(f);continue}}m===null?Ic(f):(m.return=p,Z=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=je(`display`,s))}catch(t){Bl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Bl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Ac(t,e),Mc(e),i&4&&kc(e);break;case 21:break;default:Ac(t,e),Mc(e)}}function Mc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(xc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Oe(a,``),i.flags&=-33),wc(e,Sc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Cc(e,Sc(e),o);break;default:throw Error(r(161))}}catch(t){Bl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nc(e,t,n){Z=e,Pc(e,t,n)}function Pc(e,t,n){for(var r=!!(e.mode&1);Z!==null;){var i=Z,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||uc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||dc;s=uc;var l=dc;if(uc=o,(dc=c)&&!l)for(Z=i;Z!==null;)o=Z,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Lc(i):(c.return=o,Z=c);for(;a!==null;)Z=a,Pc(a,t,n),a=a.sibling;Z=i,uc=s,dc=l}Fc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Z=a):Fc(e,t,n)}}function Fc(e){for(;Z!==null;){var t=Z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:dc||vc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!dc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:gs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&no(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}no(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&sn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}dc||t.flags&512&&yc(t)}catch(e){Bl(t,t.return,e)}}if(t===e){Z=null;break}if(n=t.sibling,n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ic(e){for(;Z!==null;){var t=Z;if(t===e){Z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Lc(e){for(;Z!==null;){var t=Z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{vc(4,t)}catch(e){Bl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Bl(t,i,e)}}var a=t.return;try{yc(t)}catch(e){Bl(t,a,e)}break;case 5:var o=t.return;try{yc(t)}catch(e){Bl(t,o,e)}}}catch(e){Bl(t,t.return,e)}if(t===e){Z=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Z=s;break}Z=t.return}}var Rc=Math.ceil,zc=x.ReactCurrentDispatcher,Bc=x.ReactCurrentOwner,Vc=x.ReactCurrentBatchConfig,Hc=0,Uc=null,Wc=null,Gc=0,Kc=0,qc=Ri(0),Jc=0,Yc=null,Xc=0,Zc=0,Qc=0,$c=null,el=null,tl=0,nl=1/0,rl=null,il=!1,al=null,ol=null,sl=!1,cl=null,ll=0,ul=0,dl=null,fl=-1,pl=0;function ml(){return Hc&6?mt():fl===-1?fl=mt():fl}function hl(e){return e.mode&1?Hc&2&&Gc!==0?Gc&-Gc:Oa.transition===null?(e=Lt,e===0?(e=window.event,e=e===void 0?16:mn(e.type),e):e):(pl===0&&(pl=Pt()),pl):1}function gl(e,t,n,i){if(50<ul)throw ul=0,dl=null,Error(r(185));H(e,n,i),(!(Hc&2)||e!==Uc)&&(e===Uc&&(!(Hc&2)&&(Zc|=n),Jc===4&&Sl(e,Gc)),_l(e,i),n===1&&Hc===0&&!(t.mode&1)&&(nl=mt()+500,$i&&ra()))}function _l(e,t){var n=e.callbackNode;Mt(e,t);var r=At(e,e===Uc?Gc:0);if(r===0)n!==null&&dt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&dt(n),t===1)e.tag===0?na(Cl.bind(null,e)):ta(Cl.bind(null,e)),bi(function(){!(Hc&6)&&ra()}),n=null;else{switch(Rt(r)){case 1:n=gt;break;case 4:n=_t;break;case 16:n=vt;break;case 536870912:n=bt;break;default:n=vt}n=Kl(n,vl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function vl(e,t){if(fl=-1,pl=0,Hc&6)throw Error(r(327));var n=e.callbackNode;if(Rl()&&e.callbackNode!==n)return null;var i=At(e,e===Uc?Gc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=jl(e,i);else{t=i;var a=Hc;Hc|=2;var o=kl();(Uc!==e||Gc!==t)&&(rl=null,nl=mt()+500,Dl(e,t));do try{Nl();break}catch(t){Ol(e,t)}while(1);za(),zc.current=o,Hc=a,Wc===null?(Uc=null,Gc=0,t=Jc):t=0}if(t!==0){if(t===2&&(a=Nt(e),a!==0&&(i=a,t=yl(e,a))),t===1)throw n=Yc,Dl(e,0),Sl(e,i),_l(e,mt()),n;if(t===6)Sl(e,i);else{if(a=e.current.alternate,!(i&30)&&!xl(a)&&(t=jl(e,i),t===2&&(o=Nt(e),o!==0&&(i=o,t=yl(e,o))),t===1))throw n=Yc,Dl(e,0),Sl(e,i),_l(e,mt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Il(e,el,rl);break;case 3:if(Sl(e,i),(i&130023424)===i&&(t=tl+500-mt(),10<t)){if(At(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){ml(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=_i(Il.bind(null,e,el,rl),t);break}Il(e,el,rl);break;case 4:if(Sl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-wt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=mt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Rc(i/1960))-i,10<i){e.timeoutHandle=_i(Il.bind(null,e,el,rl),i);break}Il(e,el,rl);break;case 5:Il(e,el,rl);break;default:throw Error(r(329))}}}return _l(e,mt()),e.callbackNode===n?vl.bind(null,e):null}function yl(e,t){var n=$c;return e.current.memoizedState.isDehydrated&&(Dl(e,t).flags|=256),e=jl(e,t),e!==2&&(t=el,el=n,t!==null&&bl(t)),e}function bl(e){el===null?el=e:el.push.apply(el,e)}function xl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!xr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Sl(e,t){for(t&=~Qc,t&=~Zc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-wt(t),r=1<<n;e[n]=-1,t&=~r}}function Cl(e){if(Hc&6)throw Error(r(327));Rl();var t=At(e,0);if(!(t&1))return _l(e,mt()),null;var n=jl(e,t);if(e.tag!==0&&n===2){var i=Nt(e);i!==0&&(t=i,n=yl(e,i))}if(n===1)throw n=Yc,Dl(e,0),Sl(e,t),_l(e,mt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Il(e,el,rl),_l(e,mt()),null}function wl(e,t){var n=Hc;Hc|=1;try{return e(t)}finally{Hc=n,Hc===0&&(nl=mt()+500,$i&&ra())}}function Tl(e){cl!==null&&cl.tag===0&&!(Hc&6)&&Rl();var t=Hc;Hc|=1;var n=Vc.transition,r=Lt;try{if(Vc.transition=null,Lt=1,e)return e()}finally{Lt=r,Vc.transition=n,Hc=t,!(Hc&6)&&ra()}}function El(){Kc=qc.current,zi(qc)}function Dl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,vi(n)),Wc!==null)for(n=Wc.return;n!==null;){var r=n;switch(ha(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&qi();break;case 3:lo(),zi(Ui),zi(Hi),go();break;case 5:fo(r);break;case 4:lo();break;case 13:zi(po);break;case 19:zi(po);break;case 10:Ba(r.type._context);break;case 22:case 23:El()}n=n.return}if(Uc=e,Wc=e=Zl(e.current,null),Gc=Kc=t,Jc=0,Yc=null,Qc=Zc=Xc=0,el=$c=null,Wa!==null){for(t=0;t<Wa.length;t++)if(n=Wa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Wa=null}return e}function Ol(e,t){do{var n=Wc;try{if(za(),_o.current=fs,Co){for(var i=bo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Co=!1}if(yo=0,So=xo=bo=null,wo=!1,To=0,Bc.current=null,n===null||n.return===null){Jc=1,Yc=t,Wc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Gc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=As(s);if(m!==null){m.flags&=-257,js(m,s,c,o,t),m.mode&1&&ks(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){ks(o,u,t),Al();break a}l=Error(r(426))}else if(X&&c.mode&1){var _=As(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),js(_,s,c,o,t),Da(Cs(l,c));break a}}o=l=Cs(l,c),Jc!==4&&(Jc=2),$c===null?$c=[o]:$c.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ds(o,l,t);eo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ol===null||!ol.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Os(o,c,t);eo(o,x);break a}}o=o.return}while(o!==null)}Fl(n)}catch(e){t=e,Wc===n&&n!==null&&(Wc=n=n.return);continue}break}while(1)}function kl(){var e=zc.current;return zc.current=fs,e===null?fs:e}function Al(){(Jc===0||Jc===3||Jc===2)&&(Jc=4),Uc===null||!(Xc&268435455)&&!(Zc&268435455)||Sl(Uc,Gc)}function jl(e,t){var n=Hc;Hc|=2;var i=kl();(Uc!==e||Gc!==t)&&(rl=null,Dl(e,t));do try{Ml();break}catch(t){Ol(e,t)}while(1);if(za(),Hc=n,zc.current=i,Wc!==null)throw Error(r(261));return Uc=null,Gc=0,Jc}function Ml(){for(;Wc!==null;)Pl(Wc)}function Nl(){for(;Wc!==null&&!ft();)Pl(Wc)}function Pl(e){var t=Gl(e.alternate,e,Kc);e.memoizedProps=e.pendingProps,t===null?Fl(e):Wc=t,Bc.current=null}function Fl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lc(n,t),n!==null){n.flags&=32767,Wc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Jc=6,Wc=null;return}}else if(n=cc(n,t,Kc),n!==null){Wc=n;return}if(t=t.sibling,t!==null){Wc=t;return}Wc=t=e}while(t!==null);Jc===0&&(Jc=5)}function Il(e,t,n){var r=Lt,i=Vc.transition;try{Vc.transition=null,Lt=1,Ll(e,t,n,r)}finally{Vc.transition=i,Lt=r}return null}function Ll(e,t,n,i){do Rl();while(cl!==null);if(Hc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Ft(e,o),e===Uc&&(Wc=Uc=null,Gc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||sl||(sl=!0,Kl(vt,function(){return Rl(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Vc.transition,Vc.transition=null;var s=Lt;Lt=1;var c=Hc;Hc|=4,Bc.current=null,gc(e,n),jc(n,e),Or(hi),W=!!mi,hi=mi=null,e.current=n,Nc(n,e,a),pt(),Hc=c,Lt=s,Vc.transition=o}else e.current=n;if(sl&&(sl=!1,cl=e,ll=a),o=e.pendingLanes,o===0&&(ol=null),Ct(n.stateNode,i),_l(e,mt()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(il)throw il=!1,e=al,al=null,e;return ll&1&&e.tag!==0&&Rl(),o=e.pendingLanes,o&1?e===dl?ul++:(ul=0,dl=e):ul=0,ra(),null}function Rl(){if(cl!==null){var e=Rt(ll),t=Vc.transition,n=Lt;try{if(Vc.transition=null,Lt=16>e?16:e,cl===null)var i=!1;else{if(e=cl,cl=null,ll=0,Hc&6)throw Error(r(331));var a=Hc;for(Hc|=4,Z=e.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Z=u;Z!==null;){var d=Z;switch(d.tag){case 0:case 11:case 15:_c(8,d,o)}var f=d.child;if(f!==null)f.return=d,Z=f;else for(;Z!==null;){d=Z;var p=d.sibling,m=d.return;if(bc(d),d===u){Z=null;break}if(p!==null){p.return=m,Z=p;break}Z=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}Z=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Z=s;else b:for(;Z!==null;){if(o=Z,o.flags&2048)switch(o.tag){case 0:case 11:case 15:_c(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Z=v;break b}Z=o.return}}var y=e.current;for(Z=y;Z!==null;){s=Z;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Z=b;else b:for(s=y;Z!==null;){if(c=Z,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:vc(9,c)}}catch(e){Bl(c,c.return,e)}if(c===s){Z=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Z=x;break b}Z=c.return}}if(Hc=a,ra(),St&&typeof St.onPostCommitFiberRoot==`function`)try{St.onPostCommitFiberRoot(xt,e)}catch{}i=!0}return i}finally{Lt=n,Vc.transition=t}}return!1}function zl(e,t,n){t=Cs(n,t),t=Ds(e,t,1),e=Qa(e,t,1),t=ml(),e!==null&&(H(e,1,t),_l(e,t))}function Bl(e,t,n){if(e.tag===3)zl(e,e,n);else for(;t!==null;){if(t.tag===3){zl(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ol===null||!ol.has(r))){e=Cs(n,e),e=Os(t,e,1),t=Qa(t,e,1),e=ml(),t!==null&&(H(t,1,e),_l(t,e));break}}t=t.return}}function Vl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ml(),e.pingedLanes|=e.suspendedLanes&n,Uc===e&&(Gc&n)===n&&(Jc===4||Jc===3&&(Gc&130023424)===Gc&&500>mt()-tl?Dl(e,0):Qc|=n),_l(e,t)}function Hl(e,t){t===0&&(e.mode&1?(t=B,B<<=1,!(B&130023424)&&(B=4194304)):t=1);var n=ml();e=qa(e,t),e!==null&&(H(e,t,n),_l(e,n))}function Ul(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Hl(e,n)}function Wl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Hl(e,n)}var Gl=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Ui.current)Ns=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ns=!1,nc(e,t,n);Ns=!!(e.flags&131072)}}else Ns=!1,X&&t.flags&1048576&&pa(t,sa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ec(e,t),e=t.pendingProps;var a=Gi(t,Hi.current);Ha(t,n),a=ko(null,t,i,e,a,n);var o=Ao();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ki(i)?(o=!0,Xi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Ya(t),a.updater=vs,t.stateNode=a,a._reactInternals=t,Ss(t,i,e,n),t=Hs(null,t,i,!0,o,n)):(t.tag=0,X&&o&&ma(t),Ps(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ec(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Xl(i),e=gs(i,e),a){case 0:t=Bs(null,t,i,e,n);break a;case 1:t=Vs(null,t,i,e,n);break a;case 11:t=Fs(null,t,i,e,n);break a;case 14:t=Is(null,t,i,gs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Bs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Vs(e,t,i,a,n);case 3:a:{if(Us(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Xa(e,t),to(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Cs(Error(r(423)),t),t=Ws(e,t,i,n,a);break a}if(i!==a){a=Cs(Error(r(424)),t),t=Ws(e,t,i,n,a);break a}for(_a=Ci(t.stateNode.containerInfo.firstChild),ga=t,X=!0,va=null,n=Pa(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ea(),i===a){t=tc(e,t,n);break a}Ps(e,t,i,n)}t=t.child}return t;case 5:return uo(t),e===null&&Sa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,gi(i,a)?s=null:o!==null&&gi(i,o)&&(t.flags|=32),zs(e,t),Ps(e,t,s,n),t.child;case 6:return e===null&&Sa(t),null;case 13:return qs(e,t,n);case 4:return co(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Na(t,null,i,n):Ps(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Fs(e,t,i,a,n);case 7:return Ps(e,t,t.pendingProps,n),t.child;case 8:return Ps(e,t,t.pendingProps.children,n),t.child;case 12:return Ps(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Bi(Fa,i._currentValue),i._currentValue=s,o!==null){if(xr(o.value,s)){if(o.children===a.children&&!Ui.current){t=tc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=Za(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Va(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Va(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Ps(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ha(t,n),a=Ua(a),i=i(a),t.flags|=1,Ps(e,t,i,n),t.child;case 14:return i=t.type,a=gs(i,t.pendingProps),a=gs(i.type,a),Is(e,t,i,a,n);case 15:return Ls(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),ec(e,t),t.tag=1,Ki(i)?(e=!0,Xi(t)):e=!1,Ha(t,n),bs(t,i,a),Ss(t,i,a,n),Hs(null,t,i,!0,e,n);case 19:return $s(e,t,n);case 22:return Rs(e,t,n)}throw Error(r(156,t.tag))};function Kl(e,t){return ut(e,t)}function ql(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jl(e,t,n,r){return new ql(e,t,n,r)}function Yl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xl(e){if(typeof e==`function`)return+!!Yl(e);if(e!=null){if(e=e.$$typeof,e===k)return 11;if(e===M)return 14}return 2}function Zl(e,t){var n=e.alternate;return n===null?(n=Jl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ql(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)Yl(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case w:return $l(n.children,a,o,t);case T:s=8,a|=8;break;case E:return e=Jl(12,n,t,a|2),e.elementType=E,e.lanes=o,e;case A:return e=Jl(13,n,t,a),e.elementType=A,e.lanes=o,e;case j:return e=Jl(19,n,t,a),e.elementType=j,e.lanes=o,e;case P:return eu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case D:s=10;break a;case O:s=9;break a;case k:s=11;break a;case M:s=14;break a;case N:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Jl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function $l(e,t,n,r){return e=Jl(7,e,r,t),e.lanes=n,e}function eu(e,t,n,r){return e=Jl(22,e,r,t),e.elementType=P,e.lanes=n,e.stateNode={isHidden:!1},e}function tu(e,t,n){return e=Jl(6,e,null,t),e.lanes=n,e}function nu(e,t,n){return t=Jl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ru(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=V(0),this.expirationTimes=V(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=V(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function iu(e,t,n,r,i,a,o,s,c){return e=new ru(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Jl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ya(a),e}function au(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:C,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function ou(e){if(!e)return Vi;e=e._reactInternals;a:{if(it(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Ki(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Ki(n))return Yi(e,n,t)}return t}function su(e,t,n,r,i,a,o,s,c){return e=iu(n,r,!0,e,i,a,o,s,c),e.context=ou(null),n=e.current,r=ml(),i=hl(n),a=Za(r,i),a.callback=t??null,Qa(n,a,i),e.current.lanes=i,H(e,i,r),_l(e,r),e}function cu(e,t,n,r){var i=t.current,a=ml(),o=hl(i);return n=ou(n),t.context===null?t.context=n:t.pendingContext=n,t=Za(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Qa(i,t,o),e!==null&&(gl(e,i,o,a),$a(e,i,o)),o}function lu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function uu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function du(e,t){uu(e,t),(e=e.alternate)&&uu(e,t)}function fu(){return null}var pu=typeof reportError==`function`?reportError:function(e){console.error(e)};function mu(e){this._internalRoot=e}hu.prototype.render=mu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));cu(e,t,null,null)},hu.prototype.unmount=mu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Tl(function(){cu(null,e,null,null)}),t[Oi]=null}};function hu(e){this._internalRoot=e}hu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Zt.length&&t!==0&&t<Zt[n].priority;n++);Zt.splice(n,0,e),n===0&&tn(e)}};function gu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function vu(){}function yu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=lu(o);a.call(e)}}var o=su(t,r,e,0,null,!1,!1,``,vu);return e._reactRootContainer=o,e[Oi]=o.current,ni(e.nodeType===8?e.parentNode:e),Tl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=lu(c);s.call(e)}}var c=iu(e,0,!1,null,null,!1,!1,``,vu);return e._reactRootContainer=c,e[Oi]=c.current,ni(e.nodeType===8?e.parentNode:e),Tl(function(){cu(t,c,n,r)}),c}function bu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=lu(o);s.call(e)}}cu(t,o,e,i)}else o=yu(n,t,e,i,r);return lu(o)}zt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=kt(t.pendingLanes);n!==0&&(It(t,n|1),_l(t,mt()),!(Hc&6)&&(nl=mt()+500,ra()))}break;case 13:Tl(function(){var t=qa(e,1);t!==null&&gl(t,e,1,ml())}),du(e,1)}},Bt=function(e){if(e.tag===13){var t=qa(e,134217728);t!==null&&gl(t,e,134217728,ml()),du(e,134217728)}},Vt=function(e){if(e.tag===13){var t=hl(e),n=qa(e,t);n!==null&&gl(n,e,t,ml()),du(e,t)}},Ht=function(){return Lt},Ut=function(e,t){var n=Lt;try{return Lt=e,t()}finally{Lt=n}},Re=function(e,t,n){switch(t){case`input`:if(he(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Fi(i);if(!a)throw Error(r(90));ue(i),he(i,a)}}}break;case`textarea`:Se(e,n);break;case`select`:t=n.value,t!=null&&ye(e,!!n.multiple,t,!1)}},We=wl,Ge=Tl;var xu={usingClientEntryPoint:!1,Events:[Ni,Pi,Fi,He,Ue,wl]},Su={findFiberByHostInstance:Mi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Cu={bundleType:Su.bundleType,version:Su.version,rendererPackageName:Su.rendererPackageName,rendererConfig:Su.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ct(e),e===null?null:e.stateNode},findFiberByHostInstance:Su.findFiberByHostInstance||fu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wu.isDisabled&&wu.supportsFiber)try{xt=wu.inject(Cu),St=wu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gu(t))throw Error(r(200));return au(e,t,null,n)},e.createRoot=function(e,t){if(!gu(e))throw Error(r(299));var n=!1,i=``,a=pu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=iu(e,1,!1,null,null,n,!1,i,a),e[Oi]=t.current,ni(e.nodeType===8?e.parentNode:e),new mu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=ct(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Tl(e)},e.hydrate=function(e,t,n){if(!_u(t))throw Error(r(200));return bu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!gu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=pu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=su(t,null,e,1,n??null,a,!1,o,s),e[Oi]=t.current,ni(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new hu(t)},e.render=function(e,t,n){if(!_u(t))throw Error(r(200));return bu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!_u(e))throw Error(r(40));return e._reactRootContainer?(Tl(function(){bu(null,null,e,!1,function(){e._reactRootContainer=null,e[Oi]=null})}),!0):!1},e.unstable_batchedUpdates=wl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!_u(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return bu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),ts=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=es()})),ns=t((e=>{var t=ts();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function rs(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),Yn(t))}var is=Symbol(`workers-module`);Symbol.dispose||(Symbol.dispose=Symbol.for(`dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`asyncDispose`)),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}});var as=globalThis[is],os=as?as.RpcTarget:class{},ss=async function(){}.constructor,cs=typeof Buffer<`u`?Buffer.prototype:void 0;function ls(e){switch(typeof e){case`boolean`:case`number`:case`string`:return`primitive`;case`undefined`:return`undefined`;case`object`:case`function`:break;case`bigint`:return`bigint`;default:return`unsupported`}if(e===null)return`primitive`;let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return`object`;case Function.prototype:case ss.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case cs:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return`bytes`;case WritableStream.prototype:return`writable`;case ReadableStream.prototype:return`readable`;case URL.prototype:return`url`;case Headers.prototype:return`headers`;case Request.prototype:return`request`;case Response.prototype:return`response`;case Blob.prototype:return`blob`;case xs.prototype:return`stub`;case Ss.prototype:return`rpc-promise`;default:if(as){if(t==as.RpcStub.prototype||e instanceof as.ServiceStub)return`rpc-target`;if(t==as.RpcPromise.prototype||t==as.RpcProperty.prototype)return`rpc-thenable`}return e instanceof os?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function us(){throw Error(`RPC map() implementation was not loaded.`)}var ds={applyMap:us,sendMap:us};function fs(){throw Error(`Stream implementation was not loaded.`)}var ps={createWritableStreamHook:fs,createWritableStreamFromHook:fs,createReadableStreamHook:fs},ms=class{stream(e,t){let n=this.call(e,t),r;try{r=n.pull()}catch(e){throw n.dispose(),e}let i;return r instanceof Promise?i=r.then(e=>{e.dispose()}):(r.dispose(),i=Promise.resolve()),{promise:i}}},hs=class extends ms{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let e of t)e.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(e){Promise.resolve(e)}}},gs=new hs(Error(`Attempted to use RPC stub after it has been disposed.`)),_s=(e,t,n)=>e.call(t,n);function vs(e,t){let n=_s;_s=e;try{return t()}finally{_s=n}}var ys=Symbol(`realStub`),bs={apply(e,t,n){let r=e.raw;return new Ss(_s(r.hook,r.pathIfPromise||[],ks.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===ys)return r;if(t in Ss.prototype)return r[t];if(typeof t==`string`)return new Ss(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=gs}},has(e,t){let n=e.raw;return t===ys?!0:t in Ss.prototype?t in n:typeof t==`string`||t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw Error(`An RPC stub cannot be used as a constructor.`)},defineProperty(e,t,n){throw Error(`Can't define properties on RPC stubs.`)},deleteProperty(e,t){throw Error(`Can't delete properties on RPC stubs.`)},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,r){throw Error(`Can't assign properties on RPC stubs.`)},setPrototypeOf(e,t){throw Error(`Can't override prototype of RPC stubs.`)}},xs=class e extends os{constructor(e,t){if(super(),!(e instanceof ms)){let n=e;if(e=n instanceof os||n instanceof Function?Ps.create(n,void 0):new Ms(ks.fromAppReturn(n)),t)throw TypeError(`RpcStub constructor expected one argument, received two.`)}this.hook=e,this.pathIfPromise=t;let n=()=>{};return n.raw=this,new Proxy(n,bs)}hook;pathIfPromise;dup(){let t=this[ys];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[ys].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[ys];return ds.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},Ss=class extends xs{constructor(e,t){if(e instanceof ms)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=ls(e);if(n===`rpc-promise`){let t=Ds(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=gs,super(e,[])}}else if(n===`rpc-thenable`)super(Ps.create(e,void 0),[]);else{let t=new Fs(Promise.resolve(e).then(e=>new Ms(ks.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return Os(this).then(...arguments)}catch(e){return Os(this).catch(...arguments)}finally(e){return Os(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function Cs(e){let{hook:t,pathIfPromise:n}=e[ys];return n&&n.length>0?t.get(n):t}function ws(e){let{hook:t,pathIfPromise:n}=e[ys];return n?t.get(n):t.dup()}function Ts(e){let{hook:t,pathIfPromise:n}=e[ys];if(!(n&&n.length>0))return t}function Es(e){return e[ys].hook}function Ds(e){return e[ys]}async function Os(e){let{hook:t,pathIfPromise:n}=e[ys];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var ks=class e{value;source;hooks;promises;static fromAppParams(t){return new e(t,`params`)}static fromAppReturn(t){return new e(t,`return`)}static fromArray(t){let n=[],r=[],i=[];for(let e of t){e.ensureDeepCopied();for(let t of e.hooks)n.push(t);for(let t of e.promises)t.parent===e&&(t={parent:i,property:i.length,promise:t.promise}),r.push(t);i.push(e.value)}return new e(i,`owned`,n,r)}static forEvaluate(t,n){return new e(null,`owned`,t,n)}static deepCopyFrom(t,n,r){let i=new e(null,`owned`,[],[]);return i.value=i.deepCopy(t,n,`value`,i,!0,r),i}constructor(e,t,n,r){this.value=e,this.source=t,this.hooks=n,this.promises=r}rpcTargets;getHookForRpcTarget(e,t,n=!0){if(this.source===`params`){if(n){let t=e;typeof t.dup==`function`&&(e=t.dup())}return Ps.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=Ps.create(e,t),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,r),r.dup()):r)}throw Error(`owned payload shouldn't contain raw RpcTargets`)}getHookForWritableStream(e,t,n=!0){if(this.source===`params`)return ps.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=ps.createWritableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw WritableStreams`)}getHookForReadableStream(e,t,n=!0){if(this.source===`params`)return ps.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=ps.createReadableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw ReadableStreams`)}deepCopy(e,t,n,r,i,a){switch(ls(e)){case`unsupported`:return e;case`primitive`:case`bigint`:case`date`:case`bytes`:case`blob`:case`url`:case`error`:case`undefined`:return e;case`array`:{let t=e,n=t.length,r=Array(n);for(let e=0;e<n;e++)r[e]=this.deepCopy(t[e],t,e,r,i,a);return r}case`object`:{let t={},n=e;for(let e in n)t[e]=this.deepCopy(n[e],n,e,t,i,a);return t}case`stub`:case`rpc-promise`:{let t=e,a;if(a=i?ws(t):Cs(t),t instanceof Ss){let e=new Ss(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new xs(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):Ps.create(n,t),this.hooks.push(r),new xs(r)}case`rpc-thenable`:{let o=e,s;return s=a?new Ss(a.getHookForRpcTarget(o,t,i),[]):new Ss(Ps.create(o,t),[]),this.promises.push({parent:r,property:n,promise:s}),s}case`writable`:{let n=e,r;return r=a?a.getHookForWritableStream(n,t,i):ps.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):ps.createReadableStreamHook(n),this.hooks.push(r),n}case`headers`:return new Headers(e);case`request`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Request(t)}case`response`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Response(t.body,t)}default:throw Error(`unreachable`)}}ensureDeepCopied(){if(this.source!==`owned`){let e=this.source===`params`;this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,`value`,this,e,this)}catch(e){throw this.hooks=void 0,this.promises=void 0,e}if(this.source=`owned`,this.rpcTargets&&this.rpcTargets.size>0)throw Error(`Not all rpcTargets were accounted for in deep-copy?`);this.rpcTargets=void 0}}deliverTo(t,n,r){if(this.ensureDeepCopied(),this.value instanceof Ss)e.deliverRpcPromiseTo(this.value,t,n,r);else{t[n]=this.value;for(let t of this.promises)e.deliverRpcPromiseTo(t.promise,t.parent,t.property,r)}}static deliverRpcPromiseTo(t,n,r,i){let a=Ts(t);if(!a)throw Error(`property promises should have been resolved earlier`);let o=a.pull();o instanceof e?o.deliverTo(n,r,i):i.push(o.then(e=>{let t=[];if(e.deliverTo(n,r,t),t.length>0)return Promise.all(t)}))}async deliverCall(t,n){try{let r=[];this.deliverTo(this,`value`,r),r.length>0&&await Promise.all(r);let i=Function.prototype.apply.call(t,n,this.value);return i instanceof Ss?e.fromAppReturn(i):e.fromAppReturn(await i)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,`value`,n),n.length>0&&await Promise.all(n);let r=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&r instanceof Object?(Symbol.dispose in r||Object.defineProperty(r,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(r),e.fromAppReturn(void 0)):(await t.write(r),this.dispose(),e.fromAppReturn(void 0))}catch(e){throw this.dispose(),e}}async deliverResolve(){try{let e=[];this.deliverTo(this,`value`,e),e.length>0&&await Promise.all(e);let t=this.value;return t instanceof Object&&(Symbol.dispose in t||Object.defineProperty(t,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),t}catch(e){throw this.dispose(),e}}dispose(){if(this.source===`owned`)this.hooks.forEach(e=>e.dispose()),this.promises.forEach(e=>e.promise[Symbol.dispose]());else if(this.source===`return`&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw Error(`Not all rpcTargets were accounted for in disposeImpl()?`);this.source=`owned`,this.hooks=[],this.promises=[]}disposeImpl(e,t){switch(ls(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`url`:case`error`:case`undefined`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.disposeImpl(t[e],t);return}case`object`:{let t=e;for(let e in t)this.disposeImpl(t[e],t);return}case`stub`:case`rpc-promise`:{let t=Ts(e);t&&t.dispose();return}case`function`:case`rpc-target`:{let t=e,n=this.rpcTargets?.get(t);n?(n.dispose(),this.rpcTargets.delete(t)):Ns(t);return}case`rpc-thenable`:return;case`headers`:return;case`request`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`response`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`writable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=ps.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=ps.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>Es(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(ls(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`undefined`:case`function`:case`rpc-target`:case`writable`:case`readable`:case`url`:case`headers`:case`request`:case`response`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`object`:{let t=e;for(let e in t)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`stub`:case`rpc-promise`:Es(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function As(e,t,n,r){for(let i=0;i<n.length;i++){t=e;let a=n[i];if(a in Object.prototype){e=void 0;continue}switch(ls(e)){case`object`:case`function`:e=Object.hasOwn(e,a)?e[a]:void 0;break;case`array`:e=Number.isInteger(a)&&a>=0?e[a]:void 0;break;case`rpc-target`:case`rpc-thenable`:if(Object.hasOwn(e,a))throw TypeError(`Attempted to access property '${a}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[a],r=null;break;case`stub`:case`rpc-promise`:{let{hook:t,pathIfPromise:r}=Ds(e);return{hook:t,remainingPath:r?r.concat(n.slice(i)):n.slice(i)}}case`writable`:e=void 0;break;case`readable`:e=void 0;break;case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`url`:case`headers`:case`request`:case`response`:e=void 0;break;case`undefined`:e=e[a];break;case`unsupported`:if(i===0)throw TypeError(`RPC stub points at a non-serializable type.`);{let e=n.slice(0,i).join(`.`),t=n.slice(0,i).join(`.`);throw TypeError(`'${e}' is not a serializable type, so property ${t} cannot be accessed.`)}default:throw TypeError(`unreachable`)}}if(e instanceof Ss){let{hook:t,pathIfPromise:n}=Ds(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var js=class extends ms{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=As(t,void 0,e,r)}catch(e){return t.dispose(),new hs(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new Fs(t.deliverCall(n.value,n.parent).then(e=>new Ms(e))):(t.dispose(),new hs(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=As(t,void 0,e,n)}catch(e){for(let e of t)e.dispose();throw e}return r.hook?r.hook.map(r.remainingPath,t,n):ds.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new hs(e)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&`then`in t)return this.dup();throw Error(`Can't dup an RpcTarget stub as a promise.`)}let r=As(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new Ms(ks.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new hs(e)}}},Ms=class e extends js{constructor(e){super(),this.payload=e}payload;getPayload(){if(this.payload)return this.payload;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){let e=this.getPayload();return{value:e.value,owner:e}}dup(){let t=this.getPayload();return new e(ks.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&=(this.payload.dispose(),void 0)}onBroken(e){this.payload&&this.payload.value instanceof xs&&this.payload.value.onRpcBroken(e)}};function Ns(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var Ps=class e extends js{static create(t,n){return typeof t!=`function`&&(n=void 0),new e(t,n)}constructor(e,t,n){super(),this.target=e,this.parent=t,n?n.refcount&&(this.refcount=n.refcount,++this.refcount.count):Symbol.dispose in e&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new e(this.getTarget(),this.parent,this)}pull(){let e=this.getTarget();return`then`in e?Promise.resolve(e).then(e=>ks.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&Ns(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},Fs=class e extends ms{promise;resolution;constructor(e){super(),this.promise=e.then(e=>(this.resolution=e,e))}call(t,n){return n.ensureDeepCopied(),new e(this.promise.then(e=>e.call(t,n),e=>{throw n.dispose(),e}))}stream(e,t){return t.ensureDeepCopied(),{promise:this.promise.then(n=>n.stream(e,t).promise,e=>{throw t.dispose(),e})}}map(t,n,r){return new e(this.promise.then(e=>e.map(t,n,r),e=>{for(let e of n)e.dispose();throw e}))}get(t){return new e(this.promise.then(e=>e.get(t)))}dup(){return this.resolution?this.resolution.dup():new e(this.promise.then(e=>e.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(e=>e.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(e=>{e.ignoreUnhandledRejections()},e=>{})}dispose(){this.promise.then(e=>e.dispose(),()=>{})}onBroken(e){this.resolution?this.resolution.onBroken(e):this.promise.then(t=>{t.onBroken(e)},e)}},Is={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},Ls=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,Rs=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function zs(e){return Rs.includes(e)}var Bs={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},Vs={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},Hs=new Map;for(let e of Object.keys(Vs))Hs.set(Vs[e],e);function Us(e,t){if(t!==2&&t!==4&&t!==8)throw RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let r=0;r<e.byteLength;r+=t)switch(t){case 2:n.setUint16(r,n.getUint16(r,!1),!0);break;case 4:n.setUint32(r,n.getUint32(r,!1),!0);break;case 8:n.setBigUint64(r,n.getBigUint64(r,!1),!0)}}var Ws=new class{exportStub(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}exportPromise(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}getImport(e){}unexport(e){}createPipe(e){throw Error(`Cannot create pipes without an RPC session.`)}onSendError(e){}};async function Gs(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var Ks={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},qs=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=Ws,i,a=`string`){let o=new e(r,i,a);try{return o.devaluateImpl(t,n,0)}catch(e){if(o.exports)try{r.unexport(o.exports)}catch{}throw e}}exports;devaluateImpl(e,t,n){if(n>=256)throw Error(`Serialization exceeded maximum allowed depth. (Does the message contain cycles?)`);switch(ls(e)){case`unsupported`:{let t;try{t=`Cannot serialize value: ${e}`}catch{t=`Cannot serialize value: (couldn't stringify value)`}throw TypeError(t)}case`primitive`:return typeof e==`number`&&!isFinite(e)?this.encodingLevel===`structuredClonable`?e:e===1/0?[`inf`]:e===-1/0?[`-inf`]:[`nan`]:e;case`object`:{let t=e,r={};for(let e in t)r[e]=this.devaluateImpl(t[e],t,n+1);return r}case`array`:{let t=e,r=t.length,i=Array(r);for(let e=0;e<r;e++)i[e]=this.devaluateImpl(t[e],t,n+1);return[i]}case`bigint`:return this.encodingLevel===`structuredClonable`?e:[`bigint`,e.toString()];case`date`:{if(this.encodingLevel===`structuredClonable`)return e;let t=e.getTime();return[`date`,Number.isNaN(t)?null:t]}case`bytes`:{let t=Hs.get(Object.getPrototypeOf(e)),n;if(t===`ArrayBuffer`)n=new Uint8Array(e);else if(t===void 0)n=e;else{let r=e;n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let i=Bs[t];!Ls&&i&&(n=n.slice(),Us(n,i))}if(this.encodingLevel===`structuredClonable`||this.encodingLevel===`jsonCompatibleWithBytes`)return t===void 0?[`bytes`,n]:[`bytes`,n,t];let r;if(n.toBase64)r=n.toBase64({omitPadding:!0});else if(typeof Buffer<`u`)r=(n instanceof Buffer?n:Buffer.from(n.buffer,n.byteOffset,n.byteLength)).toString(`base64`);else{let e=``;for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);r=btoa(e)}return r=r.replace(/=+$/,``),t===void 0?[`bytes`,r]:[`bytes`,r,t]}case`url`:return[`url`,e.href];case`headers`:return[`headers`,[...e]];case`request`:{let t=e,r={};t.method!==`GET`&&(r.method=t.method);let i=[...t.headers];if(i.length>0&&(r.headers=i),t.body)r.body=this.devaluateImpl(t.body,t,n+1),r.duplex=t.duplex||`half`;else if(t.body===void 0&&![`GET`,`HEAD`,`OPTIONS`,`TRACE`,`DELETE`].includes(t.method)){let e=t.arrayBuffer(),n=new ReadableStream({async start(t){try{t.enqueue(new Uint8Array(await e)),t.close()}catch(e){t.error(e)}}}),i=ps.createReadableStreamHook(n);r.body=[`readable`,this.exporter.createPipe(n,i)],r.duplex=t.duplex||`half`}t.cache&&t.cache!=="default"&&(r.cache=t.cache),t.redirect!==`follow`&&(r.redirect=t.redirect),t.integrity&&(r.integrity=t.integrity),t.mode&&t.mode!==`cors`&&(r.mode=t.mode),t.credentials&&t.credentials!==`same-origin`&&(r.credentials=t.credentials),t.referrer&&t.referrer!==`about:client`&&(r.referrer=t.referrer),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),t.keepalive&&(r.keepalive=t.keepalive);let a=t;return a.cf&&(r.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!==`automatic`&&(r.encodeResponseBody=a.encodeResponseBody),[`request`,t.url,r]}case`response`:{let t=e,r=this.devaluateImpl(t.body,t,n+1),i={};t.status!==200&&(i.status=t.status),t.statusText&&(i.statusText=t.statusText);let a=[...t.headers];a.length>0&&(i.headers=a);let o=t;if(o.cf&&(i.cf=o.cf),o.encodeBody&&o.encodeBody!==`automatic`&&(i.encodeBody=o.encodeBody),o.webSocket)throw TypeError(`Can't serialize a Response containing a webSocket.`);return[`response`,r,i]}case`blob`:{let t=e,n=t.stream(),r=ps.createReadableStreamHook(n),i=this.exporter.createPipe(n,r);return[`blob`,t.type,[`readable`,i]]}case`error`:{let t=e,r=this.exporter.onSendError(t);r&&(t=r);let i=t,a,o=(e,r)=>{let i=this.exports?.length??0;try{let i=this.devaluateImpl(r,t,n+1);a||={},a[e]=i}catch{if(this.exports&&this.exports.length>i){let e=this.exports.splice(i);try{this.exporter.unexport(e)}catch{}}}};for(let e of Object.keys(t))e!==`name`&&e!==`message`&&e!==`stack`&&o(e,i[e]);`cause`in t&&o(`cause`,i.cause),t instanceof AggregateError&&o(`errors`,t.errors);let s=[`error`,t.name,t.message];return a?(s.push(r&&r.stack?r.stack:null),s.push(a)):r&&r.stack&&s.push(r.stack),s}case`undefined`:return this.encodingLevel===`structuredClonable`?void 0:[`undefined`];case`stub`:case`rpc-promise`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let{hook:t,pathIfPromise:n}=Ds(e),r=this.exporter.getImport(t);return r===void 0?(t=n?t.get(n):t.dup(),this.devaluateHook(n?`promise`:`export`,t)):n?n.length>0?[`pipeline`,r,n]:[`pipeline`,r]:[`import`,r]}case`function`:case`rpc-target`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`export`,n)}case`rpc-thenable`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`promise`,n)}case`writable`:{if(!this.source)throw Error(`Can't serialize WritableStream in this context.`);let n=this.source.getHookForWritableStream(e,t);return this.devaluateHook(`writable`,n)}case`readable`:{if(!this.source)throw Error(`Can't serialize ReadableStream in this context.`);let n=e,r=this.source.getHookForReadableStream(n,t);return[`readable`,this.exporter.createPipe(n,r)]}default:throw Error(`unreachable`)}}devaluateHook(e,t){this.exports||=[];let n=e===`promise`?this.exporter.exportPromise(t):this.exporter.exportStub(t);return this.exports.push(n),[e,n]}};new class{importStub(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}importPromise(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}getExport(e){}getPipeReadable(e){throw Error(`Cannot retrieve pipe readable without an RPC session.`)}getLimits(){return Is}};function Js(e,t){return new Ss(new Fs(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new Ms(ks.fromAppReturn(r))})),[])}function Ys(e,t){return new Ss(new Fs(Gs(e,t).then(e=>new Ms(ks.fromAppReturn(e)))),[])}var Xs=class e{importer;encodingLevel;limits;constructor(e,t=`string`){this.importer=e,this.encodingLevel=t,this.limits=e.getLimits()}hooks=[];promises=[];evaluate(e){return this.evaluateWithDepth(e,0)}evaluateWithDepth(e,t){let n=ks.forEvaluate(this.hooks,this.promises);try{return n.value=this.evaluateImpl(e,n,`value`,t),n}catch(e){throw n.dispose(),e}}evaluateCopy(e){return this.evaluate(structuredClone(e))}evaluateImpl(t,n,r,i){let a=this.limits.maxDepth;if(i>=a)throw TypeError(`Deserialization exceeded maximum allowed message depth of ${a}.`);if(this.encodingLevel===`structuredClonable`&&(t instanceof Date||typeof t==`bigint`))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let e=t[0];for(let t=0;t<e.length;t++)e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}switch(t[0]){case`bigint`:if(typeof t[1]==`string`){let e=t[1],n=this.limits.maxBigIntDigits;if(e.length>n)throw TypeError(`Deserialized bigint exceeds maximum length of ${n} digits.`);return BigInt(e)}break;case`date`:if(t[1]===null)return new Date(NaN);if(typeof t[1]==`number`)return new Date(t[1]);break;case`bytes`:{let e;if(t[1]instanceof Uint8Array)e=t[1];else if(typeof t[1]==`string`){if(typeof Buffer<`u`)e=Buffer.from(t[1],`base64`);else if(Uint8Array.fromBase64)e=Uint8Array.fromBase64(t[1]);else{let n=atob(t[1]),r=n.length;e=new Uint8Array(r);for(let t=0;t<r;t++)e[t]=n.charCodeAt(t)}}else break;if(t.length===2)return e;if(typeof t[2]!=`string`)throw TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!zs(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=Bs[n];if(r!==void 0&&e.byteLength%r!==0)throw TypeError(`Invalid byte length ${e.byteLength} for ${n}; expected a multiple of ${r}`);let i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);switch(!Ls&&r!==void 0&&Us(new Uint8Array(i),r),n){case`ArrayBuffer`:return i;case`DataView`:return new DataView(i);case`Int8Array`:return new Int8Array(i);case`Uint8Array`:return new Uint8Array(i);case`Uint8ClampedArray`:return new Uint8ClampedArray(i);case`Int16Array`:return new Int16Array(i);case`Uint16Array`:return new Uint16Array(i);case`Int32Array`:return new Int32Array(i);case`Uint32Array`:return new Uint32Array(i);case`BigInt64Array`:return new BigInt64Array(i);case`BigUint64Array`:return new BigUint64Array(i);case`Float32Array`:return new Float32Array(i);case`Float64Array`:return new Float64Array(i)}}case`error`:if(t.length>=3&&typeof t[1]==`string`&&typeof t[2]==`string`){let e=Ks[t[1]]||Error,n=e===AggregateError?new e([],t[2]):new e(t[2]);if(typeof t[3]==`string`&&(n.stack=t[3]),t.length>=5){let e=t[4];if(!e||typeof e!=`object`||Array.isArray(e))break;let r=n,a=e;for(let e of Object.keys(a))if(e!==`name`&&e!==`message`&&e!==`stack`){if(e in Object.prototype||e===`toJSON`){this.evaluateImpl(a[e],n,e,i+1);continue}r[e]=this.evaluateImpl(a[e],n,e,i+1)}}return n}break;case`undefined`:if(t.length===1)return;break;case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;case`url`:if(t.length===2&&typeof t[1]==`string`)return new URL(t[1]);break;case`headers`:if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case`request`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=t[2];if(typeof a!=`object`||!a)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,`body`,i+1),!(a.body===null||typeof a.body==`string`||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw TypeError(`Request body must be of type ReadableStream.`);if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,`signal`,i+1),!(a.signal instanceof AbortSignal)))throw TypeError(`Request siganl must be of type AbortSignal.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);let o=new Request(e,a);if(a.body instanceof ReadableStream&&o.body===void 0){let e=Js(o,a.body);return this.promises.push({promise:e,parent:n,property:r}),e}return o}case`response`:{if(t.length!==3)break;let e=this.evaluateImpl(t[1],n,r,i+1);if(!(e===null||typeof e==`string`||e instanceof Uint8Array||e instanceof ReadableStream))throw TypeError(`Response body must be of type ReadableStream.`);let a=t[2];if(typeof a!=`object`||!a)break;if(a.webSocket)throw TypeError(`Can't deserialize a Response containing a webSocket.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);return new Response(e,a)}case`blob`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=this.evaluateImpl(t[2],n,r,i+1);if(!(a instanceof ReadableStream))throw TypeError(`Blob content must be serialized as a ReadableStream.`);let o=Ys(a,e);return this.promises.push({promise:o,parent:n,property:r}),o}case`import`:case`pipeline`:{if(t.length<2||t.length>4||typeof t[1]!=`number`)break;let a=this.importer.getExport(t[1]);if(!a)throw Error(`no such entry on exports table: ${t[1]}`);let o=t[0]==`pipeline`,s=e=>{if(o){let t=new Ss(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new Ss(e,[])};if(t.length==2)return s(o?a.get([]):a.dup());let c=t[2];if(!(c instanceof Array)||!c.every(e=>typeof e==`string`||typeof e==`number`))break;if(t.length==3)return s(a.get(c));let l=t[3];if(!(l instanceof Array))break;return l=new e(this.importer).evaluateWithDepth([l],i),s(a.call(c,l))}case`remap`:{if(t.length!==5||typeof t[1]!=`number`||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let e=this.importer.getExport(t[1]);if(!e)throw Error(`no such entry on exports table: ${t[1]}`);let i=t[2];if(!i.every(e=>typeof e==`string`||typeof e==`number`))break;let a=t[3].map(e=>{if(!(e instanceof Array)||e.length!==2||e[0]!==`import`&&e[0]!==`export`||typeof e[1]!=`number`)throw TypeError(`unknown map capture: ${JSON.stringify(e)}`);if(e[0]===`export`)return this.importer.importStub(e[1]);{let t=this.importer.getExport(e[1]);if(!t)throw Error(`no such entry on exports table: ${e[1]}`);return t.dup()}}),o=t[4],s=new Ss(e.map(i,a,o),[]);return this.promises.push({promise:s,parent:n,property:r}),s}case`export`:case`promise`:if(typeof t[1]==`number`){if(t[0]==`promise`){let e=new Ss(this.importer.importPromise(t[1]),[]);return this.promises.push({parent:n,property:r,promise:e}),e}{let e=this.importer.importStub(t[1]);return this.hooks.push(e),new xs(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=ps.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=ps.createReadableStreamHook(e);return this.hooks.push(n),e}}throw TypeError(`unknown special value: ${JSON.stringify(t)}`)}if(t instanceof Object){let e=t;for(let t in e)t in Object.prototype||t===`toJSON`?(this.evaluateImpl(e[t],e,t,i+1),delete e[t]):e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}return t}},Zs=16,Qs=8,$s=16,ec=64;function tc(e){return 2+e.length*3}function nc(e,t,n=0){if(n>=ec)return Qs;switch(typeof e){case`string`:return tc(e);case`number`:return 16;case`bigint`:return 16;case`boolean`:return 8;case`undefined`:return 16;case`object`:{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return $s+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return $s+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return Qs;if(t.add(e),e instanceof Array){let r=Zs;for(let i of e)r+=Qs+nc(i,t,n+1);return r}if(e instanceof Error){let r=Zs+tc(e.name)+tc(e.message)+tc(e.stack??``);for(let i of Object.keys(e))r+=Qs+tc(i)+nc(e[i],t,n+1);return r}let r=Zs;for(let i of Object.keys(e))r+=Qs+tc(i)+nc(e[i],t,n+1);return r}default:return 16}}var rc=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],r=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[r]===n?delete this.session.onBrokenCallbacks[r]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&=(this.activePull.resolve(),void 0)}async awaitResolution(){return this.activePull||=(this.session.sendPull(this.importId),Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(Error(`RPC was canceled because the RpcPromise was disposed.`)),this.sendRelease())}abort(e){this.resolution||(this.resolution=new hs(e),this.activePull&&=(this.activePull.reject(e),void 0),this.onBrokenRegistrations=void 0)}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||=[],this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},ic=class e extends ms{isPromise;entry;constructor(e,t){super(),this.isPromise=e,++t.localRefcount,this.entry=t}collectPath(e){return this}getEntry(){if(this.entry)return this.entry;throw Error(`This RpcImportHook was already disposed.`)}getEntryTakingOwnership(e){try{return this.getEntry()}catch(t){throw e(),t}}call(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.call(e,t):n.session.sendCall(n.importId,e,t)}stream(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.stream(e,t):n.session.sendStream(n.importId,e,t)}map(e,t,n){let r=this.getEntryTakingOwnership(()=>{for(let e of t)e.dispose()});return r.resolution?r.resolution.map(e,t,n):r.session.sendMap(r.importId,e,t,n)}get(e){let t=this.getEntry();return t.resolution?t.resolution.get(e):t.session.sendCall(t.importId,e)}dup(){return new e(!1,this.getEntry())}pull(){let e=this.getEntry();if(!this.isPromise)throw Error(`Can't pull this hook because it's not a promise hook.`);return e.resolution?e.resolution.pull():e.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let e=this.entry;this.entry=void 0,e&&--e.localRefcount===0&&e.dispose()}onBroken(e){this.entry&&this.entry.onBroken(e)}},ac=class extends ic{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},oc=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let r=`string`;if(`encodingLevel`in e){let t=e.encodingLevel;if(t!==void 0){if(t!==`string`&&t!==`jsonCompatible`&&t!==`jsonCompatibleWithBytes`&&t!==`structuredClonable`)throw TypeError(`Unknown transport encodingLevel: ${String(t)}`);r=t}}this.encodingLevel=r,this.limits={...Is,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new rc(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new ac(this.imports[0])}shutdown(){this.abort(Error(`RPC session was shut down by disposing the main stub`),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),t}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}releaseExport(e,t){let n=this.exports[e];if(!n)throw Error(`no such export ID: ${e}`);if(n.refcount<t)throw Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let e=t.hook;for(;;){let t=await e.pull();if(t.value instanceof xs){let{hook:n,pathIfPromise:r}=Ds(t.value);if(r&&r.length==0&&this.getImport(e)===void 0){e=n;continue}}return t}},r=t.autoRelease;++this.pullCount,t.pull=n().then(t=>{let n=qs.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,qs.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,qs.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}catch(e){this.abort(e)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof ic&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new rc(this,e,!1),this.imports[e]=t),new ic(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new hs(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new rc(this,e,!0);return this.imports[e]=t,new ic(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send([`pipe`]);let n=this.imports.length,r=new rc(this,n,!1);this.imports.push(r);let i=new ic(!1,r),a=ps.createWritableStreamFromHook(i);return e.pipeTo(a).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel===`string`){let t;try{t=JSON.stringify(e)}catch(e){try{this.abort(e)}catch{}throw e}try{let e=this.transport.send(t);e!==void 0&&typeof e.catch==`function`&&e.catch(e=>this.abort(e,!1))}catch(e){queueMicrotask(()=>this.abort(e,!1))}return t.length}try{let t=this.transport.send(e);if(typeof t==`number`)return t;let n=t;n&&typeof n.then==`function`&&Promise.resolve(n).catch(e=>this.abort(e,!1));return}catch(e){queueMicrotask(()=>this.abort(e,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let r=[`pipeline`,e,t];if(n){let e;try{e=qs.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(e[0])}this.send([`push`,r]);let i=new rc(this,this.imports.length,!1);return this.imports.push(i),new ic(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=qs.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(i[0]);let a=[`stream`,r],o=this.send(a);o===void 0&&(o=nc(a));let s=this.imports.length,c=new rc(this,s,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(e=>{e.dispose(),delete this.imports[s]},e=>{throw delete this.imports[s],e}),size:o}}sendMap(e,t,n,r){if(this.abortReason){for(let e of n)e.dispose();throw this.abortReason}let i=[`remap`,e,t,n.map(e=>{let t=this.getImport(e);return t===void 0?[`export`,this.exportStub(e)]:[`import`,t]}),r];this.send([`push`,i]);let a=new rc(this,this.imports.length,!1);return this.imports.push(a),new ic(!0,a)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send([`pull`,e])}sendRelease(e,t){this.abortReason||(this.send([`release`,e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let t=[`abort`,qs.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel===`string`){let e=this.transport.send(JSON.stringify(t));e!==void 0&&typeof e.catch==`function`&&e.catch(e=>{})}else{let e=this.transport.send(t);e&&typeof e.then==`function`&&Promise.resolve(e).catch(e=>{})}}catch{}if(e===void 0&&(e=`undefined`),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(e){Promise.resolve(e)}for(let t in this.onBrokenCallbacks)try{this.onBrokenCallbacks[t](e)}catch(e){Promise.resolve(e)}for(let t in this.imports)this.imports[t].abort(e);for(let e in this.exports)this.exports[e].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel===`string`&&t.length>this.limits.maxMessageSize)throw TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel===`string`?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case`push`:if(n.length>1){let e=new Ms(new Xs(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections(),this.exports.push({hook:e,refcount:1});continue}break;case`stream`:if(n.length>1){let e=new Ms(new Xs(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections();let t=this.exports.length;this.exports.push({hook:e,refcount:1,autoRelease:!0}),this.ensureResolvingExport(t);continue}break;case`pipe`:{let{readable:e,writable:t}=new TransformStream,n=ps.createWritableStreamHook(t);this.exports.push({hook:n,refcount:1,pipeReadable:e});continue}case`pull`:{let e=n[1];if(typeof e==`number`){this.ensureResolvingExport(e);continue}break}case`resolve`:case`reject`:{let e=n[1];if(typeof e==`number`&&n.length>2){let t=this.imports[e];if(t){if(n[0]==`resolve`)t.resolve(new Ms(new Xs(this,this.encodingLevel).evaluate(n[2])));else{let e=new Xs(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new hs(e.value))}}else n[0]==`resolve`&&new Xs(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case`release`:{let e=n[1],t=n[2];if(typeof e==`number`&&typeof t==`number`){this.releaseExport(e,t);continue}break}case`abort`:{let e=new Xs(this,this.encodingLevel).evaluate(n[1]);e.dispose(),this.abort(e.value,!1);break}}throw Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},sc=class{#e;#t;constructor(e,t,n={}){let r;r=t?new Ms(ks.fromAppReturn(t)):new hs(Error(`This connection has no main object.`)),this.#e=new oc(e,r,n),this.#t=new xs(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function cc(e,t,n){return new sc(new lc(e),t,n).getRemoteMain()}var lc=class{encodingLevel=`structuredClonable`;constructor(e){this.#e=e,e.start(),e.addEventListener(`message`,e=>{this.#i||(e.data===null?this.#a(Error(`Peer closed MessagePort connection.`)):this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data))}),e.addEventListener(`messageerror`,e=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0)return this.#r.shift();if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},uc,dc=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=uc?{parent:uc,captures:[],subject:uc.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},uc=this}unregister(){uc=this.context.parent}makeInput(){return new Z(this,0)}makeOutput(e){let t;try{t=qs.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push([`remap`,this.context.subject,this.context.path,this.context.captures.map(e=>[`import`,e]),this.instructions]),new Z(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let r=qs.devaluate(n.value,void 0,this,n);r=r[0];let i=this.capture(e.dup());return this.instructions.push([`pipeline`,i,t,r]),new Z(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new Z(this,this.instructions.length)}capture(e){if(e instanceof Z&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let t=this.context.parent.capture(e);this.context.captures.push(t)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw Error(`Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.`)}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw Error(`Cannot send ReadableStream inside a mapper function.`)}onSendError(e){}};ds.sendMap=(e,t,n)=>{let r=new dc(e,t),i;try{i=ks.fromAppReturn(vs(r.pushCall.bind(r),()=>n(new Ss(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new Ss(r.makeOutput(i),[])};function fc(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var Z=class extends ms{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(uc)return uc.pushGet(this,e);fc()}call(e,t){t.dispose(),fc()}map(e,t,n){for(let e of t)e.dispose();fc()}pull(){fc()}ignoreUnhandledRejections(){}onBroken(e){fc()}},pc=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw Error(`Invalid empty mapper function.`);for(let t of e.slice(0,-1)){let e=new Xs(this).evaluateCopy(t);if(e.value instanceof xs){let t=Ts(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new Ms(e))}return new Xs(this).evaluateCopy(e[e.length-1])}finally{for(let e of this.variables)e.dispose()}}importStub(e){throw Error(`A mapper function cannot refer to exports.`)}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw Error(`A mapper function cannot use pipe readables.`)}getLimits(){return Is}};function mc(e,t,n,r,i){let a=new pc(r,new Ms(ks.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}ds.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof Ss)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(mc(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=ks.fromArray(t)}else a=e==null?ks.fromAppReturn(e):mc(e,t,n,r,i);return new Ms(a)}finally{for(let e of r)e.dispose()}};var hc=class e extends ms{state;static create(t){let n=t.getWriter();return new e({refcount:1,writer:n,closed:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}getState(){if(this.state)return this.state;throw Error(`Attempted to use a WritableStreamStubHook after it was disposed.`)}call(e,t){try{let n=this.getState();if(e.length!==1||typeof e[0]!=`string`)throw Error(`WritableStream stub only supports direct method calls`);let r=e[0];if(r!==`write`&&r!==`close`&&r!==`abort`)throw Error(`Unknown WritableStream method: ${r}`);return(r===`close`||r===`abort`)&&(n.closed=!0),new Fs((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new Ms(e)))}catch(e){return t.dispose(),new hs(e)}}map(e,t,n){for(let e of t)e.dispose();return new hs(Error(`Cannot use map() on a WritableStream`))}get(e){return new hs(Error(`Cannot access properties on a WritableStream stub`))}dup(){let t=this.getState();return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a WritableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.closed||e.writer.abort(Error(`WritableStream RPC stub was disposed without calling close()`)).catch(()=>{}),e.writer.releaseLock())}onBroken(e){}},gc=262144,_c=1073741824,vc=65536,yc=2,bc=1.25,xc=.9,Sc=3,Cc=class{now;window=gc;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let n,r;e.deliveredTimeAtSend===0?(n=this.firstAckTime,r=this.firstAckDelivered):(n=e.deliveredTimeAtSend,r=e.deliveredAtSend);let i=t-n,a=(this.delivered-r)/i,o=this.inStartupPhase?yc:bc,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*xc):Math.max(s,this.window),this.window=Math.max(Math.min(s,_c),vc),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*bc?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=Sc&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function wc(e){let t,n=!1,r=new Cc(()=>performance.now()),i,a,o=()=>{n||(n=!0,e.dispose())};return new WritableStream({write(n,s){if(t!==void 0)throw t;let c=ks.fromAppParams([n]),{promise:l,size:u}=e.stream([`write`],c);if(u===void 0)return l.catch(e=>{throw t===void 0&&(t=e),e});{let{token:e,shouldBlock:n}=r.onSend(u);if(l.then(()=>{r.onAck(e)&&i&&(i(),i=void 0,a=void 0)},n=>{r.onError(e),t===void 0&&(t=n,s.error(n),o()),a&&=(a(n),i=void 0,void 0)}),n)return new Promise((e,t)=>{i=e,a=t})}},async close(){if(t!==void 0)throw o(),t;let{promise:n}=e.stream([`close`],ks.fromAppParams([]));try{await n}catch(e){throw t??e}finally{o()}},abort(n){if(t!==void 0)return;t=n??Error(`WritableStream was aborted`),a&&=(a(t),i=void 0,void 0);let{promise:r}=e.stream([`abort`],ks.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var Tc=class e extends ms{state;static create(t){return new e({refcount:1,stream:t,canceled:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}call(e,t){return t.dispose(),new hs(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new hs(Error(`Cannot use map() on a ReadableStream`))}get(e){return new hs(Error(`Cannot access properties on a ReadableStream stub`))}dup(){let t=this.state;if(!t)throw Error(`Attempted to dup a ReadableStreamStubHook after it was disposed.`);return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a ReadableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.canceled||(e.canceled=!0,e.stream.locked||e.stream.cancel(Error(`ReadableStream RPC stub was disposed without being consumed`)).catch(()=>{})))}onBroken(e){}};ps.createWritableStreamHook=hc.create,ps.createWritableStreamFromHook=wc,ps.createReadableStreamHook=Tc.create;var Ec=xs,Dc=os,Oc=cc;function kc(e){return e<32||e>=127&&e<=159||e===1564||e>=8203&&e<=8207||e===8232||e===8233||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function Ac(e,t){let n=e.find(e=>e.id===t.itemId);if(n===void 0||n.kind===`text`)return!1;if(n.kind===`menu`){let e=n.options.find(e=>e.id===t.optionId);return e!==void 0&&e.disabled!==!0}return t.optionId===void 0?n.kind!==`button`||n.disabled!==!0:!1}Object.freeze({publish:()=>Promise.resolve(),onBack:()=>()=>void 0,onActivate:()=>()=>void 0});function jc(e,t){if(t.kind===`action`){let n=[...e.primary??[],...e.menu??[]].find(e=>e.id===t.actionId);return n!==void 0&&n.disabled!==!0}let n=e.crumbs?.find(e=>e.id===t.crumbId);return n===void 0?!1:t.siblingId===void 0||n.siblings?.some(e=>e.id===t.siblingId)===!0}function Mc(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function Nc(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function Pc(e){return{name:Nc(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function Fc(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function Ic(e,t){let n=Fc(Pc(e));return{stroke:n,display:t?.display??Wc(n),match:t?.match??Bc(n),tokenName:t?.tokenName?Mc(t.tokenName):void 0}}function Lc(e){return{stroke:Fc(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function Rc(e){return e.map(e=>Lc(e))}function zc(e){return`match`in e?e.match:`stroke`in e?Bc(e.stroke):Bc(e)}function Bc(e){return`key:${Gc(Pc(e))}`}function Vc(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function Hc(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:Wc(e.stroke):Wc(Pc(e))}function Uc(e,t){return e.map(e=>Hc(e,t)).join(t?.separator??``)}function Wc(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function Gc(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var Kc=Symbol(`keymap-extension-context`);function qc(e){return e.isDestroyed?null:e.getFocusedTarget()}function Jc(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function Yc(e,t){let n=new Set;return Jc(e,t,e=>{n.add(e)}),n}function Xc(e,t,n){let r=[],i=Yc(t,n),a=Array.isArray(e)?e:Zc(e);for(let e of a)Qc(t,e,n,i)&&r.push(e);return r}function Zc(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function Qc(e,t,n,r=Yc(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function $c(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function el(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?$c(e)>=i.min:n}function tl(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&$c(e)<n.max)return!0}return el(e,t,n)&&e.index+1<e.binding.sequence.length}function nl(e,t){return e.index===e.binding.sequence.length-1&&el(e,t,!1)}function rl(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function il(e,t){let n=rl(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=rl(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=rl(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function al(e,t){let n=[];for(let r of e){if(!el(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function ol(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function sl(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function cl(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return ol({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function ll(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&$c(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return ol(e,e.index,r,t.value??n.name)}}return el(e,r,!1)?cl(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return cl(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function ul(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=cl(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=sl(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function dl(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function fl(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function pl(){let e=fl();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function ml(){let e=fl(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function hl(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function gl(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!hl(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function _l(e){let t=gl(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function vl(e){return{...e,sequence:Rc(e.sequence)}}function yl(e,t){let n=pl();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=bl(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function bl(e){return e.map(t=>({sequence:Rc(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:vl(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&xl(e,t)),hasContinuations:e.some(e=>e.event===`press`&&Sl(t,e))}))}function xl(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function Sl(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function Cl(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function wl(){return{plain:Cl(),bindings:Cl(),metadata:Cl(),bindingsAndMetadata:Cl()}}function Tl(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function El(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function Dl(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function Ol(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function kl(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function Al(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=Hc(i.stroke)),c&&(o=void 0),n.push(Ic(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function jl(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function Ml(e,t,n,r,i,a,o={}){let s=wl(),c=-1,l=[],u=()=>jl(t).getFocusedTarget(),d=()=>qc(t),f=t=>{let n=e.pending;Ol(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),R(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&D(t.binding,n,r)&&tl(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?Al(t):[];return(!t||T())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=kl(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=Tl(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&jl(t);let o=u(),s=El(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?F(l.captures,r,i,o,c):j(d,r,i,o,c);return(l?T():w(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,Dl(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return F(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?F(i.captures,n,r,e,o):j(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=Xc(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>Qc(t,e,n),w=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,T=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,E=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},D=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),O=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?Hc(r):``}return a&&(r=void 0),{display:n,tokenName:r}},k=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),A=(e,t,n)=>e.map(e=>k(e,t,n)),j=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(M(n.root.children.values(),o,s,t,r,a),M(n.root.patternChildren,o,s,t,r,a));return te(o,t,n,r,a)},M=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=N(o,r,i,a);if(!s)continue;let c=t.get(e);c?ae(c,s,r):t.set(e,ie(o.stroke,s,r)),s.stop&&n.add(e)}},N=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=re(P(e)?E(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=O(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=E(e.reachableBindings,n,r);if(i.length===0)return;let a=re(e.bindings,n,r),o=O(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},P=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},F=(t,n,r,i,a)=>{let o=new Map,s=new Set;return ee(al(t,e.patterns),o,s,n,i,a),te(o,n,r,i,a)},ee=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),I(s,e,t,n,r,i,a))},I=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=L(e,t,i,a,o);if(!c)return;let l=n.get(s);l?ae(l,c,i):n.set(s,ie(e.part.stroke,c,i)),c.stop&&r.add(s)},te=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=oe(o,t,n,r,i);e&&a.push(e)}return a},L=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=re(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=ne(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},ne=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?Hc(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},re=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},ie=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),ae=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},oe=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:Fc(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[k(e.bindings[0],r,i)]:A(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},R=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?Al(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:Al,collectMatchingBindings:E,collectActiveBindings:A}}var Nl=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),Pl=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),Fl=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function Il(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function Ll(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function Rl(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function zl(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),Rl(n,e.command.name,i)}return{entries:t,chainsByName:n}}function Bl(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),Rl(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function Vl(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=Xc(e.sortedLayers,t,r)),Bl(e.activeLayersCache,n,!0)}function Hl(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function Ul(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function Wl(e){let t=`field ${e.fieldName}`;return{require(n,r){Hl(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);Ul(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function Gl(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Kl(e,t){return e instanceof Error&&e.message?e.message:t}function ql(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function Jl(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>Jl(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!Gl(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?Jl(i,t):i;return r?Object.freeze(a):a}return e}var Yl=[`name`],Xl=Object.freeze({}),Zl=new WeakMap;function Ql(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>eu({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>te(()=>e.commandResolvers.prepend(t),t),y=t=>te(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>ce(e).map(e=>$l(e.commandState)),S=e=>{let t=se(e),n=ce(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:$l(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&le(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(ue(n,se(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},w=(e,t,n)=>{let r=M(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=ge(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=ge(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},T=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=ie(re(t));return g.set(t,n??null),n},E=(e,t)=>ie(M(t).chainsByName.get(e)),D=(e,t)=>ge(e,null,{mode:`registered`,execution:t}),O=(e,t,n)=>ge(e,t,{mode:`active`,execution:n}),k=(e,t)=>L(e,t)?.command,A=e=>ne(e)?.commandState.command,j=(e,n,i)=>{let a=N().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!Qc(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},M=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=Vl(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=zl(e),o),P=()=>e.activeCommandViewCacheBlockers===0,F=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:ae(e.command,t,`active`)!==void 0:!1,ee=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:ae(e.command,t,`active`)?.attrs},I=(e,n)=>{if(n?.some(t=>t.command.name===e)||N().chainsByName.has(e))return`resolved`;let r=ge(e,qc(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},te=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),L=(e,t)=>{let n=M(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:ae(e,t,`active`)},ne=e=>re(e)?.[0],re=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},ie=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},ae=(e,t,n)=>ge(e,t,{mode:n}).resolved,oe=()=>N().entries,R=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},se=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:qc(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:M(r)}},ce=(e,t=se(e))=>{let r;return r=t.visibility===`registered`?oe():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],au({entries:r,query:e,getCommand:e=>$l(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},le=(e,t,n)=>{de(n,n=>{fe(e,t,n)})},ue=(e,t)=>{if(t.visibility===`registered`){let t=R();for(let[n,r]of e){let e=N().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(me(i,e))}return}de(t,n=>{pe(e,n,t)})},de=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&F(a,t.focused,i)&&n(a)}},fe=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(me(n,r.commandAttrs))}},pe=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(me(t,he(t,n)))},me=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),he=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return N().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return ee(e,t.focused,n)},ge=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=tu(t,e.commandResolvers.values(),()=>ye(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=ve(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=_e(c.command.name,r,a)??iu(c.command);e&&(s.resolved={...c,attrs:e})}return s},_e=(e,t,n)=>n===`registered`?ne(e)?.commandState.attrs:M(t).reachableByName.get(e)?.commandState.attrs,ve=(e,t,n)=>n===`registered`?ne(e):M(t).reachableByName.get(e),ye=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?A(n):k(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:w,getRegisteredResolvedEntries:T,getActiveRegisteredResolvedEntries:E,resolveRegisteredResolverFallback:D,resolveActiveResolverFallback:O,getTopCommand:k,getDispatchUnavailableCommandState:j,getActiveCommandView:M,isBindingVisible:F,getBindingCommandAttrs:ee,getCommandResolutionStatus:I}}function $l(e){return e.command}function eu(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=Ll(r.name),s=nu(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,Wl({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,Kl(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function tu(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:ru(t,o.getExecutionFields())}}return{hadError:i}}function nu(e){let t={};for(let[n,r]of Object.entries(e))!Nl.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?Xl:t}function ru(e,t){return{command:e,input:t.input,payload:t.payload}}function iu(e){let t=nu(e);return t===Xl?void 0:t}function au(e){let t=e.query?.namespace,n=ou(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=Yl;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if(cu(u,t)&&su(u,r,i)&&!(c&&!c.has(u.command.name))&&lu(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function ou(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function su(e,t,n){if(!t)return!0;for(let r of n)if(uu(e,r,t))return!0;return!1}function cu(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?_u(n.namespace,t):!1}function lu(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!mu(e,r,i,n))return!1;return!0}function uu(e,t,n){return du(e,t)?.includes(n)===!0}function du(e,t){let n=Zl.get(e);if(n||(n=new Map,Zl.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=fu(a);return n.set(t,o),o}function fu(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=fu(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function pu(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function mu(e,t,n,r){return typeof n==`function`?hu(e,t,n,r):gu(e,t,n)}function hu(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,pu(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,pu(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,pu(n,o[t],l(),r.onFilterError))?!0:!c&&pu(n,void 0,l(),r.onFilterError)}function gu(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&_u(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&_u(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&_u(a[t],n)}function _u(e,t){return Array.isArray(t)?t.some(t=>vu(e,t)):vu(e,t)}function vu(e,t){return Array.isArray(e)?e.some(e=>vu(e,t)):Object.is(e,t)}function yu(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(ql(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(bu(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=Il(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(xu(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return xu(n,i),!0;return!1}}}function bu(e){return typeof e==`object`&&!!e&&`ok`in e}function xu(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var Su=Object.freeze({}),Cu=[],wu=[];function Tu(e){if(Object.keys(e).length!==0)return Jl(e,{freeze:!0})}function Eu(e,t,n,r){let i=t=>Mu(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:Su,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=ju(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:Su,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>Uc(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=ku(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,Kl(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?ju(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=Au(x,m)}catch(e){t.emitError(`binding-parse-error`,e,Kl(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||Pl.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,Wl({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?Tu(u):void 0,m=Il(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:vl(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):Cu,matchers:d.length>0?d:wu,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&Ou(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,Kl(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>Ic(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:Rc(r)}];let l={...n,sequence:Rc(r)},u=[],d=!0,f=o??Su;for(let n of s)try{n(l,{layer:f,parseKey:t=>Mu(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(vl(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function Du(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function Ou(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&Du(n.sequence,t.sequence)||t.command!==void 0&&Du(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function ku(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??Su,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function Au(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function ju(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??Su,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:Mc,createMatch:Vc,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function Mu(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=ju(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function Nu(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function Pu(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if(Nu(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var Fu=Symbol(`keymap-disambiguation-decision`),Iu=Symbol(`keymap-deferred-disambiguation-decision`);function Lu(e,t){return{[Fu]:!0,action:e,handler:t}}function Ru(e){return{[Iu]:!0,action:e}}function zu(e){return!!e&&typeof e==`object`&&e[Fu]===!0}function Bu(e){return!!e&&typeof e==`object`&&e[Iu]===!0}function Vu(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function Hu(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function Uu(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...Ic({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function Wu(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function Gu(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return I(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return I(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&me()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:Rc(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function w(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:Rc(n.sequence),command:n.command})}function T(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function E(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function D(e){return e.sequence?Rc(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function O(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function k(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function A(e,t){return t.handled||e.reason===`no-match`?t:e}function j(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:D(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function M(){return{handled:!1,reason:`no-match`}}function N(e){e.preventDefault(),e.stopPropagation()}function P(e,t,n,i){r.setPendingSequence({captures:t});let a=O(`sequence-pending`,t);return T(e,t,n),N(i),a}function F(e,t,n,i){let a=O(e,t);return T(`sequence-clear`,t,n),r.setPendingSequence(null),N(i),a}function ee(i,a){a||me();let o=E(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&j(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=te(i);o&&j(o,i,a,s,e);return}let u=L(i);o&&j(o,i,a,s,u)}function I(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function te(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=be(e),o=M();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=xe(a,r,e,t);if(o=A(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function L(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=be(e);if(n)return ne(n,i,e,t);let a=r.getActiveLayers(t),o=M();for(let n of i){let r=ie(a,[n],e,t);if(o=A(o,r),r.handled)return o}return o}function ne(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=ll(r,n,i,e.patterns,Se,Ce);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,sl(t,n)),1/0),u=c.filter(e=>sl(e,n)===l);if(u.length===0||!u.some(e=>De(e,a,o))){let e=O(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return re(u,0,!1,i,a)}function re(t,n,i,a,o){let s=i,c=M(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=ve(t,i,n);if(u.length>0){if(s)continue;let e=ye(t,n);return R(t,i,u,e,a,o,s)||P(`sequence-advance`,u,o,a)}if(!nl(n,e.patterns))continue;let d=ye(t,n);for(let e of d)l.add(e);let f=Oe(n.layer,d,a,o);if(c=A(c,f.outcome),f.handled&&(s=!0,f.stop))return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}function ie(e,t,n,r){return ae(e,0,t,n,r)}function ae(t,n,r,a,o){let c=s.getActiveCommandView(o),l=M();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=we(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>tl(t,e.patterns,!1)).length>0){let n=u.filter(t=>nl(t,e.patterns)),i=_e(t,s,r,a,o);return oe(t,s,r,i,n,a,o)||P(`sequence-start`,i,o,a)}let d=Oe(n,u.filter(t=>nl(t,e.patterns)),a,o);if(l=A(l,d.outcome),d.handled&&d.stop)return l}return l}function oe(e,t,n,i,a,o,s){return se({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return M();let c=Oe(i,a,o,s);return c.stop?c.outcome:A(c.outcome,ae(e,t+1,n,o,s))}})}function R(e,t,n,i,a,o,s){return se({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return M();let c=Oe(n,i,a,o);return c.stop?c.outcome:A(c.outcome,re(e,t+1,s||c.handled,a,o))}})}function se(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>P(c,a,i,n),p=()=>F(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=le({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?ce(g,a,l,f,p,i,h):(ge(h()),f())}function ce(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return ue(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function le(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=Rc(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:Fc(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:Rc(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>Lu(`run-exact`),continueSequence:()=>Lu(`continue-sequence`),clear:()=>Lu(`clear`),defer:e=>Lu(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(ql(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!zu(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function ue(e,t,n,r,i){me();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{de(o,t,n,r)})}function de(e,n,r,i){if(!he(e))return;let a={signal:e.controller.signal,sequence:Rc(i),focused:r,sleep:t=>Vu(t,e.controller.signal),runExact:()=>Ru(`run-exact`),continueSequence:()=>Ru(`continue-sequence`),clear:()=>Ru(`clear`)},o;try{o=n(a)}catch(n){he(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),pe(e));return}if(ql(o)){o.then(t=>{fe(e,t)}).catch(n=>{he(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),pe(e))});return}fe(e,o)}function fe(e,n){if(he(e)){if(n!==void 0&&!Bu(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),pe(e);return}pe(e),e.apply(n)}}function pe(e){he(e)&&(d=null)}function me(){let e=d;e&&(d=null,e.controller.abort())}function he(e){return d===e}function ge(e){let n=Uc(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function _e(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of we(n,r,a,o,l))tl(t,e.patterns,!1)&&c.push(t)}return c}function ve(t,n,r){return t.filter((t,i)=>i>=n&&tl(t,e.patterns,!1)&&qu(t.parts,r.parts))}function ye(t,n){return t.filter(t=>t.layer===n.layer&&nl(t,e.patterns)&&qu(t.parts,n.parts))}function be(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return Ku(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function xe(e,t,n,r){let o=!1,s=M();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=A(s,k(c,u)),!u){w(`binding-reject`,e,c,r);continue}if(w(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function Se(n,r){return Hu(e.patterns,t,n,r)}function Ce(t,n,r){return Uu(e.patterns,t,n,r)}function we(e,t,n,r,i){let a=ul(e,t,n,Se,Ce);return a.some(e=>De(e,r,i))?a:[]}function Te(n){return Wu(e.patterns,t,n)}function Ee(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function De(e,t,n){return Ee(e.binding,t,n)}function Oe(e,t,n,r){let o=!1,s=M();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,Te(c));if(s=A(s,k(t,l)),!l){w(`binding-reject`,e,t,r);continue}if(w(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:ee}}function Ku(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function qu(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var Ju=()=>{};function Yu(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function Xu(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function Zu(e,t,n,r,i){let a;try{a=Mc(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,Kl(e,`Failed to register keymap token`)),Ju}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),Ju;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,Kl(e,`Failed to register keymap token "${a}"`)),Ju}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,Kl(e,`Failed to register keymap token "${a}"`)),Ju}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,Kl(e,`Failed to unregister keymap token "${a}"`))}}}function Qu(e,t,n,r){let i,a;try{i=Mc(r.name);let e=Yu(i,`min`,r.min,1),t=Yu(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:Vc(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,Kl(e,`Failed to register keymap sequence pattern`)),Ju}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),Ju):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function $u(e,t,n,r){return Xu(r,{kind:n,reservedFields:n===`layer`?Fl:n===`binding`?Pl:Nl,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var ed=()=>{};function td(e,t){return t.priority-e.priority||t.order-e.order}function nd(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function rd(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function id(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),ed;let o,s,c,p,m,v,y;try{y=l(n),o=u(_l(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,Kl(e,`Failed to register keymap layer`)),ed}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return ed;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:il(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(td),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>gl(e)});t&&(i=_l(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(Fl.has(c)||l===void 0)continue;o[c]=Jl(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,Wl({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?Jl(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=il(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,Kl(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=nd(t),r=rd(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,Kl(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var ad=1e3;function od(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=ad){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:ad},`[Keymap] Possible infinite state listener feedback loop detected after ${ad} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function sd(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var cd=Object.freeze({});function ld(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:pl(),bindingExpanders:pl(),bindingParsers:pl(),bindingTransformers:pl(),bindingFields:new Map,commandTransformers:pl(),commandFields:new Map,eventMatchResolvers:pl(),disambiguationResolvers:pl(),keyHooks:ml(),keyAfterHooks:ml(),rawHooks:ml(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:pl(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:cd,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function ud(e){return zc(e)}var dd=class{#e=ld();#t=!1;#n=new Map;#r=[];#i=dl(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=dl((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=od(this.#e,this.#i,this.#a),this.#l=Pu(this.#e,this.#o),this.#u=Ql(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=Ml(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=sd(this.#e,this.#o,this.#s),this.#d=yu(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=Eu(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=yl(this.#o,this.#u),this.#m=id(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=Gu(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[Kc](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?ud(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return $u(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return Zu(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return Qu(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return $u(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return $u(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},fd=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),pd=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),md=gd(fd),hd=gd(pd);function gd(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function _d(e){return e>=65&&e<=90?e+32:e}function vd(e){return e>=48&&e<=57}function yd(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(_d(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function bd(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(_d(r));if(i){for(let e of i)if(yd(t,e,n))return e}}function xd(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function Sd(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function Cd(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function wd(e,t){let n=bd(md,e,t);if(n)return n;if(_d(e.charCodeAt(t))!==102||!vd(e.charCodeAt(t+1)))return;let r=vd(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function Td(e,t){return bd(hd,e,t)}function Ed(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=Td(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=wd(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var Dd=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[Sd(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[Sd(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[xd(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[Sd(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=Ed(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=wd(t,n);return s?{parts:[Cd(s,e)],nextIndex:n+s.length}:{parts:[Sd(a,e)],nextIndex:n+1}},Od=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function kd(e){return e.appendBindingParser(e=>Dd(e))}function Ad(e){return e.appendEventMatchResolver((e,t)=>Od(e,t))}function jd(e){let t=kd(e),n=Ad(e);return()=>{n(),t()}}var Md=Symbol(`keymap:mod-bindings`),Nd=/(^|[+,\s])mod(?=\s*\+)/i,Pd=/(^|[+,\s])mod(?=\s*\+)/gi;function Fd(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function Id(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function Ld(e){return e.acquireResource(Md,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!Nd.test(t))return;let r=Fd(e.getHostMetadata());return[{key:t.replace(Pd,(e,t)=>`${t}${r}`),displays:n??Id(t)}]}))}var Rd=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function zd(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function Bd(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=zd(t);return n===`unknown`?zd(e?.platform??e?.userAgent):n}function Vd(){let e=Bd();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function Hd(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Ud(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!Hd(t.name)?[t]:[t,{...t,shift:!1}]}var Wd=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function Gd(){return globalThis.MutationObserver}function Kd(e){return Rd.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function qd(e){if(!e)return new Wd(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Wd(Kd(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Jd=class{metadata=Vd();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(qd(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(qd(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return qd()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=Gd();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function Yd(e){return new Jd(e)}var Xd=(e,t)=>Ud(e).map(e=>t.resolveKey(e)),Zd=`fungi.app.ready`,Qd=`fungi.app.connect`,$d=[`PROTOCOL`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`FILE_TOO_LARGE`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`COMMAND_NOT_DECLARED`,`CONFLICT`,`INVALID_ARGUMENT`,`TIMEOUT`,`CANCELLED`,`DISCONNECTED`,`HOST_FAILURE`,`SELECTION_CHANGED`,`SAFETY_FILTER_REFUSED`],ef=e=>q.pipe(H(jt(1)),H(B(e))),tf=e=>V(ef(e)),nf=sn.pipe(H(Wn()),H(U(Number.isSafeInteger,{message:`Expected a safe integer`}))),rf=nf.pipe(H(In(0))),af=nf.pipe(H(Nn(0))),of=W({appId:ef(160),releaseId:ef(160),surfaceId:ef(160)}),sf=W({editing:Fn,surface:Yt([ef(160),Mn])}),cf=Yt([W({kind:G(`compose`),requestId:ef(160),text:ef(2e3)}),W({kind:G(`navigate`),requestId:ef(160),params:K(W({key:ef(64),value:ef(4096)})).pipe(H(B(16)))})]),lf=W({computerId:Yt([ef(256),Mn]),teamHasComputers:V(Sr(Fn)),computerAccessGranted:V(Fn),focus:sf,openRequest:Yt([Mn,cf]),visibility:Gn([`visible`,`hidden`])}),uf=Gn([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),df=W({altKey:Fn,ctrlKey:Fn,id:ef(160),key:ef(64),metaKey:Fn,shiftKey:Fn}),ff=W({action:V(Zt),availability:V(Zt),category:ef(160),description:tf(512),id:ef(160),projections:V(Zt),title:ef(160)}),pf=W({arguments:V(Zt),commandId:ef(321),origin:Gn([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:ef(160)}),mf=Yt([W({result:V(Zt),status:G(`handled`)}),W({error:Zt,status:G(`failed`)})]),hf=e=>ef(e).pipe(H(U(e=>{for(let t=0;t<e.length;t+=1)if(kc(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),gf={id:ef(64),text:hf(80),end:Bt(Fn)},_f=Bt(sn.pipe(H(Wn()),H(Ct({minimum:0,maximum:9999})))),vf=K(Yt([W({...gf,kind:G(`text`),tone:Bt(Gn([`neutral`,`success`,`warning`,`error`]))}),W({...gf,kind:G(`button`),icon:Bt(Gn([`folder`,`ports`,`processes`,`access`])),count:_f,title:Bt(hf(1024)),disabled:Bt(Fn),opens:Bt(G(`dialog`)),expanded:Bt(Fn)}),W({...gf,kind:G(`toggle`),pressed:Fn}),W({...gf,kind:G(`menu`),count:_f,title:Bt(hf(1024)),options:K(W({id:ef(64),text:hf(80),checked:Bt(Fn),disabled:Bt(Fn)})).pipe(H(B(16)),H(U(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(H(B(6)),H(U(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),yf=W({computerId:ef(256),path:ef(1024)}),bf=ef(80).pipe(H(U(e=>e.trim()===e,{message:`Expected a trimmed title`}))),xf=ef(64),Sf=ef(80),Cf=e=>new Set(e.map(e=>e.id)).size===e.length,wf=W({id:xf,label:Sf,siblings:V(K(W({id:xf,label:Sf})).pipe(H(B(16)),H(U(Cf,{message:`Expected unique crumb sibling ids`}))))}),Tf=W({id:xf,label:Sf,variant:V(Gn([`primary`,`outline`,`ghost`])),tone:V(G(`destructive`)),disabled:V(Fn)}),Ef=e=>K(Tf).pipe(H(B(e)),H(U(Cf,{message:`Expected unique header command ids`}))),Df=W({id:xf,label:Sf,tone:V(Gn([`neutral`,`info`,`warning`,`success`,`error`]))}),Of={status:V(K(Df).pipe(H(B(4)),H(U(Cf,{message:`Expected unique header status ids`})))),crumbs:V(K(wf).pipe(H(B(8)),H(U(Cf,{message:`Expected unique crumb ids`})))),primary:V(Ef(3)),menu:V(Ef(12))},kf=W({contractVersion:G(1),canGoBack:Fn,title:V(bf),...Of}),Af=W({canGoBack:Fn,title:V(q),...Of}),jf=Yt([W({kind:G(`crumb`),crumbId:xf,siblingId:V(xf)}),W({kind:G(`action`),actionId:xf})]),Mf=Sr(W({agentId:ef(256),sessionId:ef(256)})),Nf=W({agents:V(K(Gn([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(H(B(4)))),computers:V(K(Gn([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(H(B(4))))}),Pf=Gn([`granted`,`declined`,`customize`]),Ff=W({message:ef(512),tone:V(Gn([`info`,`success`,`warning`,`error`]))}),If=W({code:Gn($d),message:ef(512),retryable:Fn}),Lf=W({protocolVersion:G(2),type:G(Zd)}),Rf=W({epoch:ef(160),protocolVersion:G(2),type:G(Qd)}),zf=W({epoch:ef(160),protocolVersion:G(2)}),Bf={[Symbol.dispose]:V(Zt)},Vf=Yt([W({...Bf,ok:G(!0),value:Zt}),W({...Bf,error:If,ok:G(!1)})]);function Hf(e,t,n=`PROTOCOL`){return Ce(un(e,{onExcessProperty:`error`}),ue({onFailure:e=>{throw new Y(`The peer sent malformed protocol data`,{cause:e,code:n,retryable:!1})},onSuccess:t}))}function Uf(e){return Object.freeze(e)}function Wf(e,t){let n=e.arguments===void 0?void 0:Ri(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),Uf(r)}var Gf=Hf(ff,e=>{let t={category:e.category,id:e.id,title:e.title};return e.action!==void 0&&Object.assign(t,{action:e.action}),e.availability!==void 0&&Object.assign(t,{availability:e.availability}),e.description!==void 0&&Object.assign(t,{description:e.description}),e.projections!==void 0&&Object.assign(t,{projections:e.projections}),Uf(Pp(()=>Qi(t)))},`INVALID_ARGUMENT`),Kf=Hf(ef(321),e=>e),qf=Hf(pf,e=>{let t=e.arguments===void 0?void 0:Ri(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),Uf(n)}),Jf=Hf(Yt([Tt,Zt]),e=>e===void 0?void 0:Ri(e)),Yf=Hf(Rf,e=>Uf(e));Hf(zf,e=>Uf(e));var Xf=Hf(lf,e=>{let t={computerId:e.computerId,focus:Uf({...e.focus}),openRequest:e.openRequest===null?null:Uf({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),Uf(t)}),Zf=Hf(If,e=>Uf({...e})),Qf=Hf(sf,e=>Uf({...e}),`INVALID_ARGUMENT`),$f=Hf(of,e=>Uf({...e})),ep=Hf(uf,e=>e),tp=Hf(vf,e=>Uf(e.map(e=>e.kind===`menu`?Uf({...e,options:Uf(e.options.map(e=>Uf(e)))}):Uf(e))),`INVALID_ARGUMENT`),np=Hf(W({itemId:ef(64),optionId:Bt(ef(64)),anchor:Bt(W({start:sn.pipe(H(Ct({minimum:0,maximum:1e5}))),width:sn.pipe(H(Ct({minimum:0,maximum:1e5})))}))}),e=>Uf(e.anchor===void 0?{...e}:{...e,anchor:Uf({...e.anchor})}),`INVALID_ARGUMENT`),rp=Hf(yf,e=>Uf({...e}),`INVALID_ARGUMENT`);function ip(e){let t={id:e.id,label:e.label};return Uf(e.tone===void 0?t:{...t,tone:e.tone})}function ap(e){let t={id:e.id,label:e.label};return e.siblings===void 0?Uf(t):Uf({...t,siblings:Uf(e.siblings.map(e=>Uf({...e})))})}function op(e){let t={id:e.id,label:e.label};return e.variant!==void 0&&(t={...t,variant:e.variant}),e.tone!==void 0&&(t={...t,tone:e.tone}),e.disabled!==void 0&&(t={...t,disabled:e.disabled}),Uf(t)}function sp(e){let t={canGoBack:e.canGoBack};return e.title!==void 0&&(t={...t,title:e.title}),e.crumbs!==void 0&&(t={...t,crumbs:Uf(e.crumbs.map(ap))}),e.primary!==void 0&&(t={...t,primary:Uf(e.primary.map(op))}),e.menu!==void 0&&(t={...t,menu:Uf(e.menu.map(op))}),e.status!==void 0&&(t={...t,status:Uf(e.status.map(ip))}),Uf(t)}var cp=Hf(kf,sp,`INVALID_ARGUMENT`),lp=Hf(Af,e=>{let t=e.title?.trim();return up({...sp({...e,title:t===void 0||t.length===0?void 0:t}),contractVersion:1})},`INVALID_ARGUMENT`),up=Hf(kf,e=>Uf({...sp(e),contractVersion:1}),`INVALID_ARGUMENT`),dp=Hf(jf,e=>e.kind===`action`?Uf({...e}):Uf(e.siblingId===void 0?{kind:e.kind,crumbId:e.crumbId}:e),`INVALID_ARGUMENT`),fp=Hf(Mf,e=>e===null?null:Uf({...e}),`INVALID_ARGUMENT`),pp=Hf(Nf,e=>Uf({agents:Uf([...new Set(e.agents??[])]),computers:Uf([...new Set(e.computers??[])])}),`INVALID_ARGUMENT`);Hf(Lf,e=>Uf(e));var mp=Hf(ef(512),e=>e),hp=Hf(Ff,e=>Uf({...e}),`INVALID_ARGUMENT`);Hf(W({id:ef(160),repeat:Fn}),e=>Uf(e));var gp=Hf(K(df).pipe(H(B(64))),e=>{if(new Set(e.map(e=>e.id)).size!==e.length)throw new Y(`Reserved chords are invalid`,{code:`PROTOCOL`,retryable:!1});return Uf(e.map(e=>Uf({...e})))});function _p(e){return Hf(W({value:Zt,version:rf}),t=>Uf({value:e(t.value),version:t.version}))}var vp=_p(Xf),yp=Hf(W({capabilities:K(Zt).pipe(H(B(128))),context:Zt}),e=>Uf({capabilities:Uf(e.capabilities.map(e=>Tp(e))),context:vp(e.context)})),bp=_p(ep),xp=_p(gp),Sp=_p(mp),Cp=Ce(bp,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new Y(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return Uf({value:e.value,version:e.version})});function wp(e){return Hf(W({handle:Zt,id:ef(160),version:af}),t=>{if(!(t.handle instanceof Ec)&&!(e&&t.handle instanceof Dc))throw new Y(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return Uf({handle:t.handle,id:t.id,version:t.version})})}var Tp=wp(!1),Ep=wp(!0);function Dp(e){let t=e?Ep:Tp;return Hf(W({capabilities:K(Zt).pipe(H(B(128))),context:Zt,identity:Zt,lifecycle:Zt,reservedChords:Zt,theme:Zt}),e=>Uf({capabilities:Uf(e.capabilities.map(e=>t(e))),context:vp(e.context),identity:$f(e.identity),lifecycle:Cp(e.lifecycle),reservedChords:xp(e.reservedChords),theme:Sp(e.theme)}))}var Op=Dp(!1);Dp(!0);function kp(e){return Hf(Vf,t=>t.ok?Uf({ok:!0,value:e(t.value)}):Uf({ok:!1,error:Zf(t.error)}))}var Ap=kp(Op),jp=kp(Hf(W({commandId:ef(321)}),e=>Uf(e)));kp(Hf(mf,e=>{if(e.status===`failed`)return Uf({status:`failed`,error:Pp(()=>Vi(e.error))});let t=e.result===void 0?void 0:Ri(e.result);return Uf(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var Mp=kp(Hf(Tt,()=>void 0)),Np=kp(Hf(Pf,e=>e));kp(Hf(Fn,e=>e)),kp(Hf(Fn,e=>e));function Pp(e){try{return e()}catch(e){throw new Y(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var Fp=Yt([W({kind:G(`saveFile`),name:ef(255).pipe(H(Xn(/^[^\p{Cc}/\\]+$/u))),mime:ef(255),bytes:tr}),W({kind:G(`copyText`),text:q})]);function Ip(e){let t=un(Fp,{onExcessProperty:`error`})(e);if(O(t))return{kind:`refused`,reason:`invalid-request`};let n=t.success;return n.kind===`saveFile`?n.name===`.`||n.name===`..`?{kind:`refused`,reason:`invalid-request`}:n.bytes.byteLength>33554432?{kind:`refused`,reason:`too-large`}:{...n,bytes:new Uint8Array(n.bytes)}:n.text.length>1048576||new TextEncoder().encode(n.text).byteLength>1048576?{kind:`refused`,reason:`too-large`}:n}var Lp=kp(Hf(Yt([W({kind:G(`saved`)}),W({kind:G(`copied`)}),W({kind:G(`refused`),reason:Gn([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>Uf(e)));function Rp(e){return e instanceof Y?{code:e.code,message:Bp(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function zp(e){try{let t=Zf(e);return new Y(t.message,{code:t.code,retryable:t.retryable})}catch(e){return new Y(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function Bp(e){return e.trim().slice(0,512)||`Host operation failed`}var Vp=e=>({ok:!0,value:e}),Hp=e=>({error:Rp(e),ok:!1});async function Up(e,t){let n,r=new Set;try{return n=await e,Wp(t(n))}catch(e){throw Gp(e)&&Kp(e,r),e instanceof Y?e:new Y(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&Gp(n)&&Kp(n,r)}}function Wp(e){if(e.ok)return e.value;throw zp(e.error)}function Gp(e){return st(e)&&Symbol.dispose in e&&xe(e[Symbol.dispose])}function Kp(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function qp(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function Jp(e){let t=gp(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=gp(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function Yp(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Yd(r),a=new dd(i);jd(a),Ld(a),a.prependEventMatchResolver(Xd);let o=Zp(e.onBroken),s=tm(a,e.chords,e.remote,o),c=Xp(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=()=>{queueMicrotask(c)};e.window.addEventListener(`focus`,u),e.window.addEventListener(`blur`,u);let d=e.bindings,f=()=>Qp(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:$p(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=$p(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=tm(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,u),e.window.removeEventListener(`blur`,u),h(),s(),m(),p())}}function Xp(e,t,n,r,i){return()=>{if(!n())return;let a=Qp(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function Zp(e){return t=>{try{Up(t(),Mp).catch(t=>{rs(`browser-bridge.host-call`,t),e(t)})}catch(t){rs(`browser-bridge.host-call`,t),e(t)}}}function Qp(e,t){let n=e.activeElement;return Qf({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function $p(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||em(e.key)&&n())return!1;e.run()}})),priority:500})}function em(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function tm(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:Kd(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function nm(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=am(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=im(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),t.type===`mouseup`&&n===`back`&&!r&&e.canGoBack()&&e.back()};e.window.addEventListener(`keydown`,t);for(let t of rm)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of rm)e.window.removeEventListener(t,n)}}var rm=[`mousedown`,`mouseup`,`auxclick`];function im(e){return e===3?`back`:e===4?`forward`:null}function am(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:om(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function om(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function sm(){return!Ie(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function cm(e){let t=e,n=new Set;return{get:()=>t,subscribe(e){n.add(e);let t=!0;return()=>{t&&(t=!1,n.delete(e))}},update(e){if(!Object.is(t,e)){t=e;for(let e of Array.from(n))try{e(t)}catch(e){console.warn(`App store subscriber failed`,e)}}}}}function lm(e){let t=new Map,n=cm(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=Tp(n),r=pm(e.id,e.version);if(t.has(r))throw dm(e.handle),new Y(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())dm(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)dm(t)},o=e=>{if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=pm(e.id,e.version);return t.get(n)};return{directory:Object.freeze({get version(){return n.get()},subscribe:e=>n.subscribe(e),has(e){return!!o(e)},require(e){let t=o(e);if(!t)throw new Y(`The capability is not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});try{return e.schema.parse(t)}catch(e){throw new Y(`The capability interface is malformed`,{cause:e,code:`PROTOCOL`,retryable:!1})}}}),replace(e){if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let o=i(e),s=[...t.values()];t.clear();for(let[e,n]of o)t.set(e,n);a(s.filter(e=>![...o.values()].includes(e))),n.update(n.get()+1)},disconnect(){r||(r=!0,a(t.values()),t.clear(),n.update(n.get()+1))}}}var um=Ee().transform(e=>{let t=v(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=_n(W({[Symbol.dispose]:V(Tn(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function dm(e){try{let t=um.parse(e);if(t===void 0||fm.has(t.owner))return;fm.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}var fm=new WeakSet;function pm(e,t){return`${e}@${String(t)}`}var mm=class extends Dc{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(Kf(e))?.abort(),Promise.resolve(Vp(void 0))}catch(e){return Promise.resolve(Hp(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new Y(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=qf(e);if(this.#n.has(t.requestId))throw new Y(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new Y(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=Jf(await this.#t(Wf(t,n.signal)));return Vp(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof Rr)try{return Vp({status:`failed`,error:Vi({code:e.code,message:e.message,details:e.details})})}catch(e){return Hp(e)}return Hp(e)}}[Symbol.dispose](){this.dispose()}};function hm(e){let t=[];for(let n of e.values()){let{definition:e,handler:r}=n;if(n.commandId===void 0)continue;let i=e.availability?.status!==`unavailable`;for(let n of e.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{i&&Promise.resolve().then(()=>r({origin:`keyboard`,signal:new AbortController().signal})).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function gm(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:hm(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{Up(e(),Mp).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:vm(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function _m(e,t,n,r){let i=t.id;if(e.size>=128||e.has(i))throw r.dispose(),new Y(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let a={commandId:void 0,definition:t,handler:n,target:r};e.set(i,a);let o=!1;return{commit(e){o||(a.commandId=e)},release(){o||(o=!0,e.get(i)===a&&e.delete(i),r.dispose())},target:r}}function vm(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!xe(s))throw new Y(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=Gf(o),l=new mm(s),u=_m(n,c,s,l);try{let t=await ym(e,c,u.target);r()&&await bm(e,t.commandId,l),u.commit(t.commandId),a()}catch(e){throw u.release(),e}let d=!0;return()=>{d&&(d=!1,i(c.id))}}})}async function ym(e,t,n){return Up(e.registerCommand(t,n),jp)}async function bm(e,t,n){throw n.dispose(),await Up(e.unregisterCommand(t),Mp),new Y(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var xm=Ht(e=>e instanceof Ec),Sm=class extends Dc{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw Nm();let t=e===void 0?void 0:Zf(e);return setTimeout(()=>this.#t.disconnect?.(t??Lm()),0),Promise.resolve(Vp(void 0))}catch(e){return Promise.resolve(Hp(e))}}async requestClose(){try{if(this.#e)throw Nm();return Vp(await(this.#t.beforeClose?.()??!0))}catch(e){return Hp(e)}}async requestBack(){try{if(this.#e)throw Nm();return Vp(await(this.#t.back?.()??!1))}catch(e){return Hp(e)}}async activateNavigation(e){try{if(this.#e)throw Nm();let t=dp(e);return jc(this.#t.navigation,t)?Vp(await(this.#t.activate?.(t)??!1)):Vp(!1)}catch(e){return Hp(e)}}async activateStatus(e){try{if(this.#e)throw Nm();let t=np(e);return Ac(this.#t.statusItems,t)?Vp(await(this.#t.statusAction?.(t)??!1)):Vp(!1)}catch(e){return Hp(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?Hp(Nm()):this.#n(e,`context`,Xf,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw Nm();let n=yp(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Vp(void 0));for(let e of n.capabilities)t.push({...e,handle:_n(xm)(e.handle).dup()});if(!this.#t.capabilities)throw Nm();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Vp(void 0))}catch(e){for(let e of t)dm(e.handle);return Promise.resolve(Hp(e))}}updateLifecycle(e){try{if(this.#e)throw Nm();let t=_p(ep)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Vp(void 0));if(!Rm(this.#t.lifecycle.get(),t.value))throw new Y(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(Vp(void 0))}catch(e){return Promise.resolve(Hp(e))}}async updateReservedChords(e){return this.#e?Hp(Nm()):this.#n(e,`chords`,gp,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?Hp(Nm()):this.#n(e,`theme`,mp,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=_p(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Vp(void 0))}catch(e){return Promise.resolve(Hp(e))}}};async function Cm(e){let t=Dm(),n=new Sm(t),r=Oc(e.port,n),i,a=Em(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:2}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=Wp(Ap(o));if(!e.isActive())throw Tm();let c=Om({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return Bm(t,e,n,r,i)}}function wm(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function Tm(){return new Y(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Em(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{rs(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new Y(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function Dm(){return{statusItems:[],navigation:{canGoBack:!1},bindings:qp(),chords:Jp([]),context:cm({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:cm(`connecting`),theme:cm(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function Om(e){let t=$f(e.bootstrap.identity),n=zm(e.bootstrap);wm(e.state,n);let r=lm(e.bootstrap.capabilities);return e.state.capabilities=r,Am(e,t,r)}function km(e,t,n){return Yp({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof Y?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function Am(e,t,n){let r=!1,i=t=>{r||(r=!0,Fm([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{dm(e.bootstrapOwner)},()=>{dm(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=gm(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=Mm(e.remote,a,e.state),c=jm(e.state,e.remote,a),l=km(e,t,i),u=nm({window:e.options.window,mac:sm(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{rs(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{Pm(i)}),Im({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function jm(e,t,n){let r=Object.freeze({async publish(r){n();let i=lp(r);e.canGoBack=i.canGoBack,e.navigation=cp(i),await Up(t.reportNavigation(i),Mp)},onActivate(t){if(n(),e.activate!==void 0)throw new Y(`The App already owns navigation activations`,{code:`INVALID_ARGUMENT`,retryable:!1});e.activate=t;let r=!1;return()=>{r||(r=!0,e.activate===t&&(e.activate=void 0))}},onBack(t){if(n(),e.back!==void 0)throw new Y(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new Y(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function Mm(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await Up(e.requestComputerChoice(),Mp)},async requestBrowserAction(n){t();let r=Ip(n);return r.kind===`refused`?r:await Up(e.requestBrowserAction(r),Lp)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new Y(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await Up(e.requestAppPermissions(pp(n)),Np)},async openDesktopSettings(){t(),await Up(e.openDesktopSettings(),Mp)},async openTeamBilling(){t(),await Up(e.openTeamBilling(),Mp)},async openNavigation(n){t(),await Up(e.openNavigation(rp(n)),Mp)},async reportStatus(r){t();let i=tp(r);n.statusItems=i,await Up(e.reportStatus(i),Mp)},async reportAgentSessionSelection(n){t(),await Up(e.reportAgentSessionSelection(fp(n)),Mp)},async showToast(n){t(),await Up(e.showToast(hp(n)),Mp)}})}function Nm(){return new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function Pm(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function Fm(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function Im(e){return Object.freeze(e)}function Lm(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function Rm(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function zm(e){let t=_p(Xf)(e.context),n=_p(mp)(e.theme),r=_p(ep)(e.lifecycle),i=_p(gp)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new Y(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function Bm(e,t,n,r,i){throw Fm([()=>{n[Symbol.dispose]()},()=>{i&&dm(i)},()=>{dm(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof Y?e:new Y(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var Vm=!1,Hm=class{options;#e;#t;#n;#r=!1;#i;#a;constructor(e){this.options=e,this.#t=qm(e.expectedHostOrigin),this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#t;if(!e)return Promise.reject(Ym());let t=this.#u();return t?Promise.reject(t):(Vm=!0,this.#o(e))}#o(e){return new Promise((t,n)=>{let r=(e,r)=>{this.#s(e,r,a,i,t,n)},i=()=>{r(Wm())},a=t=>{this.#c(t,e,r,a)};this.#e.addEventListener(`message`,a),this.options.signal?.addEventListener(`abort`,i,{once:!0});let o=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:2,type:Zd},e)}catch(e){rs(`connect.notify-host`,e),r(Zm(e))}};this.#i=setInterval(o,200),this.#a=setTimeout(()=>{r(Km())},1e4),o()})}#s(e,t,n,r,i,a){if(!this.#r){if(this.#r=!0,this.#l(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#n?.close(),Vm=!1,a(e??Km());return}i(t)}}#c(e,t,n,r){if(!Xm(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||e.origin!==t){n(Jm());return}let i=Qm(e,n);if(!i)return;let a=e.ports.length===1?e.ports[0]:void 0;if(!a){n($m(`The app host did not transfer exactly one port`));return}this.#n=a,this.#l(),this.#e.removeEventListener(`message`,r),Cm({epoch:i.epoch,isActive:()=>!this.#r,onDisposed:()=>{Vm=!1},port:a,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),n(void 0,e)},e=>{n(Gm(e))})}#l(){clearInterval(this.#i),clearTimeout(this.#a),this.#i=void 0,this.#a=void 0}#u(){if(this.options.signal?.aborted)return Wm();if(Vm)return new Y(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Ie(globalThis.window)||this.#e.parent===this.#e)return new Y(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function Um(e){return new Hm(e).start()}function Wm(){return new Y(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Gm(e){return e instanceof Y?e:new Y(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function Km(){return new Y(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function qm(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function Jm(){return new Y(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}function Ym(){return new Y(`expectedHostOrigin must be an origin`,{code:`INVALID_ARGUMENT`,retryable:!1})}var Xm=an(W({type:G(Qd)}));function Zm(e){return new Y(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function Qm(e,t){try{return Yf(e.data)}catch(e){rs(`connect.decode-message`,e),t(e instanceof Y?e:new Y(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function $m(e){return new Y(e,{code:`PROTOCOL`,retryable:!1})}function eh(e,t,n){e.style.isolation=`isolate`;let r=(0,ns.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=ha(a),s,c,l,u=!1,d=e=>{let i=(0,J.createElement)(th,{state:e,render:n});r.render(t.queryClient?(0,J.createElement)(ba,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):ma(o,a),!1)},{referrer:p,defaultView:m}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),!m||m.parent===m||!URL.canParse(p)?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),Um({expectedHostOrigin:new URL(p).origin,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,ma(e.theme.get(),a),c=e.theme.subscribe(e=>{ma(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof Y&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`ended`}))})),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function th({state:e,render:t}){return(0,J.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,J.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),t(e)}function nh(e){let t=(0,J.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,J.useCallback)(()=>e?.get(),[e]);return(0,J.useSyncExternalStore)(t,n,n)}function rh(e){return nh(e?.context)??null}function ih(e,t,n,r){let i=(0,J.useRef)(t);i.current=t;let a=(0,J.useRef)(n);a.current=n;let o=(0,J.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,J.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,J.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,J.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function ah(e,{canGoBack:t,title:n,crumbs:r,primary:i,menu:a,status:o,onBack:s,onCrumb:c,onAction:l}){let u=(0,J.useRef)(s),d=(0,J.useRef)(c),f=(0,J.useRef)(l);(0,J.useEffect)(()=>{u.current=s,d.current=c,f.current=l},[s,c,l]),(0,J.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>u.current()),n=e.onActivate(e=>{if(e.kind===`action`){let t=f.current;return t?.(e.actionId),t!==void 0}let t=d.current;return e.siblingId===void 0?t?.(e.crumbId):t?.(e.crumbId,e.siblingId),t!==void 0});return()=>{t(),n(),oh(e,{canGoBack:!1})}},[e]);let p=JSON.stringify([r,i,a,o]),m=(0,J.useRef)({crumbs:r,primary:i,menu:a,status:o});(0,J.useEffect)(()=>{m.current={crumbs:r,primary:i,menu:a,status:o}},[r,i,a,o]),(0,J.useEffect)(()=>{if(!e)return;let r={canGoBack:t};n!==void 0&&(r={...r,title:n});let i=m.current;i.crumbs!==void 0&&(r={...r,crumbs:i.crumbs}),i.primary!==void 0&&(r={...r,primary:i.primary}),i.menu!==void 0&&(r={...r,menu:i.menu}),i.status!==void 0&&(r={...r,status:i.status}),oh(e,r)},[e,t,n,p])}function oh(e,t){e.publish(t).catch(e=>{e instanceof Y&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var sh=L(()=>Xe({id:z().min(1).max(256),name:z().min(1).max(128)})),ch=L(()=>z().min(1).max(256)),lh=L(()=>Xe({agentId:ch,sessionId:ch,commandId:ch,outcome:c([`completed`,`failed`,`interrupted`,`cancelled`,`outcome_unknown`]),diagnostic:z().min(1).max(200).optional()})),uh=Xe({author:sh.optional(),delegation:Xe({ancestors:T(ch).max(8),maxDepth:Je().int().min(1).max(8),reply:lh.optional()}).optional()});function dh(e){let t=uh.safeParse(e);return t.success?t.data.author:void 0}var fh=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}};function ph(e,t,n){return new fh(e,t,n)}function mh(e){let t=et(e),n=v(Object),r=et(Object.fromEntries(Object.keys(e).map(e=>[e,Ee().optional()])));return Ee().transform(e=>{let i=n.parse(e),a=Object.create(i),o=r.parse(a),s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,le().parse(t).bind(i)]));return{...t.parse(s),[Symbol.dispose](){dm(e)}}})}function hh(e){return Ee().transform(t=>{try{return e.parse(t)}catch(e){throw e instanceof Y?e:new Y(`The capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}finally{dm(t)}})}function gh(e){return le({output:Re(Ee().transform(t=>{try{return e.parse(t)}catch(e){throw dm(t),e instanceof Y?e:new Y(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var _h=gh(hh(_())),vh=mh({fetch:gh(v(Response)),close:_h}),yh=[];for(let e=0;e<256;++e)yh.push((e+256).toString(16).slice(1));function bh(e,t=0){return(yh[e[t+0]]+yh[e[t+1]]+yh[e[t+2]]+yh[e[t+3]]+`-`+yh[e[t+4]]+yh[e[t+5]]+`-`+yh[e[t+6]]+yh[e[t+7]]+`-`+yh[e[t+8]]+yh[e[t+9]]+`-`+yh[e[t+10]]+yh[e[t+11]]+yh[e[t+12]]+yh[e[t+13]]+yh[e[t+14]]+yh[e[t+15]]).toLowerCase()}var xh,Sh=new Uint8Array(16);function Ch(){if(!xh){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);xh=crypto.getRandomValues.bind(crypto)}return xh(Sh)}var wh={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Th(e,t,n){if(wh.randomUUID&&!t&&!e)return wh.randomUUID();e||={};let r=e.random??e.rng?.()??Ch();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return bh(r)}var Eh=Ze({version:`v7`}),Dh=z().regex(/^replay_[a-f0-9]{64}$/);pe(e=>Dh.safeParse(e).success);var Oh=Ze({version:`v4`});pe(e=>Eh.safeParse(e).success);var kh=pe(e=>Oh.safeParse(e).success);function Ah(){return kh.parse(Th())}var jh=c([`plain`,`pencil`,`manga`,`riso`,`halftone`,`blueprint`,`crt`,`watercolor`]),Mh={ink:`var(--sprite-ink, var(--color-base-content, #1c1c1a))`,paper:`var(--sprite-paper, var(--color-base-100, #fbfaf6))`,accent:`var(--sprite-accent, var(--color-accent, #d20f39))`,risoFirst:`var(--sprite-riso-first, var(--color-info, #1e66f5))`,risoSecond:`var(--sprite-riso-second, var(--color-accent, #ea76cb))`,blueprint:`var(--sprite-blueprint, color-mix(in oklab, var(--color-info, #1e66f5) 55%, #0b2350))`,blueprintLine:`var(--sprite-blueprint-line, color-mix(in oklab, var(--color-info-content, #ffffff) 25%, #ffffff))`,screen:`var(--sprite-screen, color-mix(in oklab, var(--color-base-content, #111111) 12%, #050805))`,phosphor:`var(--sprite-phosphor, var(--color-success, #40a02b))`},Q=(e,t={},...n)=>({tag:e,attributes:t,children:n}),Nh=(e,t,n=1)=>Q(`feFlood`,{style:`flood-color: ${e}`,"flood-opacity":n,result:t}),Ph=(e,t,n)=>[Q(`feImage`,{href:`data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='${String(t)}' height='${String(t)}'>${e}</svg>`)}`,width:t,height:t,result:`${n}Cell`}),Q(`feTile`,{in:`${n}Cell`,result:n})],Fh=(e,t,n)=>Q(`feColorMatrix`,{in:t,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${e}`,result:n}),Ih=(e,t)=>Fh(`-0.333 -0.333 -0.333 1 0`,e,t),Lh=(e,t,n,r=1.1)=>[Q(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 1 0 1 -4 1 0 1 0`,result:`${t}In`}),Q(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 -1 0 -1 4 -1 0 -1 0`,result:`${t}Out`}),Q(`feComposite`,{in:`${t}In`,in2:`${t}Out`,operator:`arithmetic`,k2:1,k3:1,result:`${t}Edges`}),Fh(`${String(n)} ${String(n)} ${String(n)} ${String(r)} 0`,`${t}Edges`,t)],Rh=(e,t,n,r)=>[Q(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 1 0 1 -4 1 0 1 0`,preserveAlpha:`true`,result:`${t}In`}),Q(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 -1 0 -1 4 -1 0 -1 0`,preserveAlpha:`true`,result:`${t}Out`}),Q(`feComposite`,{in:`${t}In`,in2:`${t}Out`,operator:`arithmetic`,k2:1,k3:1,result:`${t}Edges`}),Fh(`${String(n)} ${String(n)} ${String(n)} 0 -0.15`,`${t}Edges`,`${t}Inner`),Q(`feMorphology`,{in:e,operator:`dilate`,radius:r,result:`${t}Grown`}),Q(`feComposite`,{in:`${t}Grown`,in2:e,operator:`out`,result:`${t}Ring`}),Fh(`0 0 0 1 0`,`${t}Ring`,`${t}Outline`),Bh(t,`${t}Inner`,`${t}Outline`)],zh=(e,t,n)=>Q(`feComponentTransfer`,{in:e,result:n},Q(`feFuncA`,{type:`discrete`,tableValues:t})),Bh=(e,...t)=>Q(`feMerge`,{result:e},...t.map(e=>Q(`feMergeNode`,{in:e}))),Vh=(e,t,n,r=1)=>[Nh(e,`${n}Flood`,r),Q(`feComposite`,{in:`${n}Flood`,in2:t,operator:`in`,result:n})],Hh={x:`0%`,y:`0%`,width:`100%`,height:`100%`},Uh={x:`-8%`,y:`-8%`,width:`116%`,height:`116%`},Wh={value:1.6,line:6,outline:2.4,midHatch:[3.2,-.05],darkHatch:[3.4,-.4],tooth:`0 0 0 -0.7 1.45`,opacity:1},Gh=e=>({region:Uh,primitives:[Q(`feComponentTransfer`,{in:`SourceGraphic`,result:`valued`},...[`feFuncR`,`feFuncG`,`feFuncB`].map(t=>Q(t,{type:`gamma`,amplitude:1,exponent:e.value,offset:0}))),Q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.05,numOctaves:2,seed:1,result:`wobble`,"data-sprite-boil":`wobble`}),Q(`feDisplacementMap`,{in:`valued`,in2:`wobble`,scale:2.6,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...Lh(`drawn`,`line`,e.line,e.outline),Ih(`drawn`,`dark`),...Ph(`<path d='M-1 1l2-2M0 6l6-6M5 7l2-2' stroke='black' stroke-width='1.1'/>`,6,`hatch45`),Q(`feOffset`,{in:`hatch45`,dx:0,dy:0,result:`hatchOffset`,"data-sprite-boil":`hatch`}),Q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.07,numOctaves:2,seed:5,result:`strokeBend`}),Q(`feDisplacementMap`,{in:`hatchOffset`,in2:`strokeBend`,scale:4,xChannelSelector:`R`,yChannelSelector:`B`,result:`hatchA`}),...Ph(`<path d='M-1 4l2 2M0 0l5 5M4 -1l2 2' stroke='black' stroke-width='0.9'/>`,5,`hatch135`),Q(`feDisplacementMap`,{in:`hatch135`,in2:`strokeBend`,scale:3,xChannelSelector:`G`,yChannelSelector:`R`,result:`hatchB`}),Q(`feComposite`,{in:`dark`,in2:`hatchA`,operator:`arithmetic`,k1:e.midHatch[0],k4:e.midHatch[1],result:`shadeA`}),Q(`feComposite`,{in:`dark`,in2:`hatchB`,operator:`arithmetic`,k1:e.darkHatch[0],k4:e.darkHatch[1],result:`shadeB`}),Q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.9,numOctaves:1,seed:3,result:`tooth`}),Fh(e.tooth,`tooth`,`toothMask`),Fh(`0 0 0 6 -4.6`,`dark`,`solid`),Bh(`graphiteRaw`,`solid`,`shadeA`,`shadeB`,`line`),Q(`feComposite`,{in:`graphiteRaw`,in2:`toothMask`,operator:`in`,result:`graphite`}),...Vh(Mh.ink,`graphite`,`pencil`,e.opacity)],boil:{intervalMs:160,tracks:[{name:`wobble`,attribute:`seed`,frames:[1,2,3]},{name:`hatch`,attribute:`dx`,frames:[0,1,2]}]}}),Kh={region:Uh,primitives:[Q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.04,numOctaves:2,seed:2,result:`brush`,"data-sprite-boil":`brush`}),Q(`feDisplacementMap`,{in:`SourceGraphic`,in2:`brush`,scale:2,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...Vh(Mh.paper,`SourceAlpha`,`paperFill`),Ih(`drawn`,`dark`),...Ph(`<circle cx='2.5' cy='2.5' r='1.15' fill='black'/>`,5,`dots`),zh(`dark`,`0 1 1 0`,`midTone`),Q(`feComposite`,{in:`dots`,in2:`midTone`,operator:`in`,result:`tone`}),zh(`dark`,`0 0 0 1`,`solid`),Fh(`3 -3 0 0 -0.35`,`drawn`,`satRG`),Fh(`-3 3 0 0 -0.35`,`drawn`,`satGR`),Fh(`0 3 -3 0 -0.35`,`drawn`,`satGB`),Fh(`0 -3 3 0 -0.35`,`drawn`,`satBG`),Bh(`saturation`,`satRG`,`satGR`,`satGB`,`satBG`),zh(`saturation`,`0 1`,`accentMask`),...Vh(Mh.accent,`accentMask`,`accentFill`),...Rh(`drawn`,`edge`,2,2.2),Q(`feMorphology`,{in:`edge`,operator:`dilate`,radius:.25,result:`stroke`}),Bh(`inkRaw`,`tone`,`solid`,`stroke`),...Vh(Mh.ink,`inkRaw`,`ink`),Bh(`manga`,`paperFill`,`accentFill`,`ink`)],boil:{intervalMs:180,tracks:[{name:`brush`,attribute:`seed`,frames:[2,4,6]}]}},qh={region:Uh,primitives:[Fh(`-0.55 -0.55 -0.55 1.65 0`,`SourceGraphic`,`dark`),Q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.85,numOctaves:1,seed:7,result:`grain`}),Fh(`0 0 0 -0.9 1.35`,`grain`,`grainMask`),Q(`feComposite`,{in:`dark`,in2:`grainMask`,operator:`in`,result:`firstMask`}),...Vh(Mh.risoFirst,`firstMask`,`firstInk`,.92),Fh(`0 -1.9 0 1.9 0`,`SourceGraphic`,`secondMask`),...Vh(Mh.risoSecond,`secondMask`,`secondInk`,.9),Q(`feOffset`,{in:`firstInk`,dx:-1.5,dy:1,result:`firstPlate`,"data-sprite-boil":`register`}),Q(`feOffset`,{in:`secondInk`,dx:1.5,dy:-.5,result:`secondPlate`}),Q(`feBlend`,{in:`firstPlate`,in2:`secondPlate`,mode:`multiply`})],boil:{intervalMs:240,tracks:[{name:`register`,attribute:`dx`,frames:[-1.5,-1,-2]}]}},Jh={region:Uh,primitives:[Fh(`-0.5 -0.5 -0.5 1.65 0`,`SourceGraphic`,`value`),Fh(`0 0 0 0.16 0`,`SourceGraphic`,`floor`),Bh(`dark`,`floor`,`value`),...Ph(`<defs><radialGradient id='d'><stop offset='0' stop-opacity='1'/><stop offset='1' stop-opacity='0'/></radialGradient></defs><rect width='6' height='6' fill='url(#d)'/>`,6,`screen`),Q(`feComposite`,{in:`dark`,in2:`screen`,operator:`arithmetic`,k2:1,k3:1,k4:-.92,result:`dotField`}),Q(`feComponentTransfer`,{in:`dotField`,result:`dotsRaw`},Q(`feFuncA`,{type:`linear`,slope:12,intercept:0})),Q(`feComposite`,{in:`dotsRaw`,in2:`SourceAlpha`,operator:`in`,result:`dots`}),...Vh(Mh.ink,`dots`,`halftone`)]},Yh={region:Hh,primitives:[Nh(Mh.blueprint,`ground`),Q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.05,numOctaves:1,seed:4,result:`hand`,"data-sprite-boil":`hand`}),Q(`feDisplacementMap`,{in:`SourceGraphic`,in2:`hand`,scale:1.6,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...Ph(`<path d='M0 0.5h16M0.5 0v16' stroke='black' stroke-width='1' stroke-opacity='0.22'/>`,16,`grid`),...Vh(Mh.blueprintLine,`grid`,`gridLines`),...Vh(Mh.blueprintLine,`SourceAlpha`,`wash`,.12),...Rh(`drawn`,`edge`,3,1.2),Q(`feMorphology`,{in:`edge`,operator:`dilate`,radius:.3,result:`stroke`}),...Vh(Mh.blueprintLine,`stroke`,`lines`),Bh(`blueprint`,`ground`,`gridLines`,`wash`,`lines`)],boil:{intervalMs:200,tracks:[{name:`hand`,attribute:`seed`,frames:[4,5,6]}]}},Xh={region:Hh,primitives:[Nh(Mh.screen,`ground`),Q(`feColorMatrix`,{in:`SourceGraphic`,type:`luminanceToAlpha`,result:`lumRaw`}),Q(`feComposite`,{in:`lumRaw`,in2:`SourceAlpha`,operator:`in`,result:`lum`}),Q(`feComponentTransfer`,{in:`lum`,result:`beam`},Q(`feFuncA`,{type:`linear`,slope:1.5,intercept:-.35})),Q(`feComposite`,{in:`beam`,in2:`SourceAlpha`,operator:`in`,result:`trace`}),...Vh(Mh.phosphor,`trace`,`glow`),Q(`feGaussianBlur`,{in:`glow`,stdDeviation:2.5,result:`bloom`}),...Ph(`<rect y='2' width='3' height='1' fill='black'/>`,3,`scan`),Q(`feOffset`,{in:`scan`,dx:0,dy:0,result:`scanRoll`,"data-sprite-boil":`roll`}),...Vh(Mh.screen,`scanRoll`,`scanlines`,.6),Bh(`crt`,`ground`,`bloom`,`glow`,`scanlines`)],boil:{intervalMs:120,tracks:[{name:`roll`,attribute:`dy`,frames:[0,1,2]}]}},Zh={region:Uh,primitives:[Q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.03,numOctaves:3,seed:9,result:`flow`}),Q(`feDisplacementMap`,{in:`SourceGraphic`,in2:`flow`,scale:7,xChannelSelector:`R`,yChannelSelector:`G`,result:`bled`}),Q(`feGaussianBlur`,{in:`bled`,stdDeviation:1.4,result:`wash`}),Q(`feComponentTransfer`,{in:`wash`,result:`thin`},Q(`feFuncR`,{type:`linear`,slope:.78,intercept:.2}),Q(`feFuncG`,{type:`linear`,slope:.78,intercept:.2}),Q(`feFuncB`,{type:`linear`,slope:.78,intercept:.2}),Q(`feFuncA`,{type:`linear`,slope:.9,intercept:0})),Q(`feGaussianBlur`,{in:`wash`,stdDeviation:3,result:`spread`}),Q(`feComposite`,{in:`wash`,in2:`spread`,operator:`arithmetic`,k2:1.6,k3:-1.4,result:`rimMask`}),Q(`feComponentTransfer`,{in:`wash`,result:`deep`},Q(`feFuncR`,{type:`linear`,slope:.6,intercept:0}),Q(`feFuncG`,{type:`linear`,slope:.6,intercept:0}),Q(`feFuncB`,{type:`linear`,slope:.6,intercept:0})),Q(`feComposite`,{in:`deep`,in2:`rimMask`,operator:`in`,result:`rim`}),Q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.7,numOctaves:2,seed:11,result:`tooth`}),Fh(`0 0 0 -0.8 1.5`,`tooth`,`toothMask`),Ih(`SourceGraphic`,`dark`),Fh(`0 0 0 5 -3.8`,`dark`,`keyMask`),...Vh(Mh.ink,`keyMask`,`key`,.9),Bh(`paint`,`thin`,`rim`,`key`),Q(`feComposite`,{in:`paint`,in2:`toothMask`,operator:`in`})]},Qh=Gh(Wh),$h={manga:Kh,riso:qh,halftone:Jh,blueprint:Yh,crt:Xh,watercolor:Zh},eg=e=>e===`pencil`?Qh:$h[e],tg=`http://www.w3.org/2000/svg`,ng=(e,t)=>{let n=e.createElementNS(tg,t.tag);for(let[e,r]of Object.entries(t.attributes))n.setAttribute(e,String(r));for(let r of t.children)n.append(ng(e,r));return n};function rg(e){let t=`sprite-style-${Ah()}`,n=e.ownerDocument,r=n.defaultView,i=`plain`,a,o,s=!1,c=!0,l,u=0,d=()=>{l!==void 0&&clearInterval(l),l=void 0},f=()=>{if(d(),i===`plain`||!o||s||!c||n.hidden)return;let e=eg(i).boil;if(!e)return;let t=o;l=setInterval(()=>{if(!n.hidden){u+=1;for(let n of e.tracks){let e=n.frames[u%n.frames.length];t.querySelector(`[data-sprite-boil="${n.name}"]`)?.setAttribute(n.attribute,String(e))}}},e.intervalMs)},p=r?.IntersectionObserver,m=p?new p(e=>{c=e.some(e=>e.isIntersecting),f()}):void 0;m?.observe(e);let h=()=>{d(),o?.remove(),o=void 0,a&&(a.style.filter=``)};return{set(r,s){if(r===i&&s===a||(h(),i=r,a=s,r===`plain`))return;let c=eg(r),l=`${t}-${r}`,u=n.createElementNS(tg,`svg`);u.setAttribute(`aria-hidden`,`true`),u.setAttribute(`focusable`,`false`),u.setAttribute(`width`,`0`),u.setAttribute(`height`,`0`),u.style.cssText=`position:absolute;width:0;height:0;overflow:hidden`,u.append(ng(n,Q(`filter`,{id:l,...c.region,"color-interpolation-filters":`sRGB`},...c.primitives))),e.append(u),o=u,s.style.filter=`url(#${l})`,f()},still(e){e!==s&&(s=e,f())},dispose(){h(),a=void 0,m?.disconnect()}}}var ig=[`mushroom`,`cat`,`burger`];c([`shift`,`keep`]);var ag=z().regex(/^#[0-9a-f]{6}$/i),og=ot([ag,Je(),C()]),sg=16,cg=Xe({v:n(1),character:c(ig),appearance:be(z().min(1),og).refine(e=>Object.keys(e).length<=sg,{message:`Avatar appearance cannot exceed ${String(sg)} keys`}),expression:z().min(1),renderStyle:jh});function lg(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(-1,Math.min(n-3,9-n,1));return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function ug(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619)>>>0;return t}function dg(e){let t=ug(e)%360;return{cap:lg(t,68,72),capSpot:lg(t,70,92)}}function fg(e){return{v:1,character:`mushroom`,appearance:dg(e),expression:`normal`,renderStyle:`plain`}}var pg=q.pipe(H(jt(1)),H(B(256))),mg=Ht(e=>cg.safeParse(e).success,{expected:`an Avatar v1 descriptor`}),hg=W({agentId:pg,name:pg,avatar:mg,sessionOperations:K(Gn([`agent.read`,`agent.send`,`agent.manage`]))});L(()=>Xe({agents:T(Xe({agentId:z(),name:z()}))}));var gg=Gn([`new`,`none`]),_g=W({name:pg,requestId:pg,computer:Bt(gg),avatar:Bt(mg)}),vg=K(hg),yg=_n(vg,{onExcessProperty:`error`}),bg=_n(pg),xg=_n(Tn(Response)),Sg=ph(`agent.list`,1,L(()=>mh({list:gh(hh(Ee().transform(e=>yg(e))))}))),Cg=ph(`agent.manage`,1,L(()=>mh({open:gh(vh),create:gh(hh(Ee().transform(e=>_n(hg)(e))))}))),wg=W({agentId:pg,name:pg}),Tg=ph(`agent.rename`,1,L(()=>mh({rename:gh(hh(Ee().transform(e=>_n(hg)(e))))})));async function Eg(e,t){let n=_n(wg)(t),r=await e.require(Tg).rename(n);return _n(hg)(r)}var Dg=W({agentId:pg,avatar:mg}),Og=ph(`agent.avatar`,1,L(()=>mh({setAvatar:gh(hh(Ee().transform(e=>_n(hg)(e))))})));async function kg(e,t){let n=_n(Dg)(t),r=await e.require(Og).setAvatar(n);return _n(hg)(r)}var Ag=L(()=>ot([et({status:n(`pending`),revision:z()}),et({status:n(`approved`),revision:z()})])),jg=L(()=>ot([Ag,et({error:z()})])),Mg=ph(`agent.toolPolicy`,1,L(()=>mh({status:gh(hh(ot([Ag,se()]))),approve:gh(hh(jg))}))),Ng=ph(`agent.read`,1,L(()=>mh({open:gh(vh),openInbox:gh(vh)}))),Pg=ph(`agent.send`,1,L(()=>mh({open:gh(vh),openInbox:gh(vh)})));async function Fg(e,t){let n=_n(_g)(t),r=await e.require(Cg).create(n);return _n(hg)(r)}async function Ig(e,t){let n=await e(),r,i,a=()=>{if(i)throw new Y(`The Agent connection is closed`,{code:`DISCONNECTED`,retryable:!0})},o=async e=>{try{await e.close()}finally{e[Symbol.dispose]()}};return{fetch:async i=>{a();let o=i.method===`GET`||i.method===`HEAD`||e===t?n:await(r??=t());return a(),xg(await o.fetch(i))},close:()=>(i||(i=Promise.all([o(n),...r?[r.then(o)]:[]]).then(()=>void 0),i.catch(e=>{rs(`agents.close`,e)})),i)}}var Lg=`https://agent-session.fungi.invalid`;async function Rg(e,t){let n=bg(t.agentId),r=`/agents/id-${encodeURIComponent(n)}`,i=`${Lg}${r}`,a=e.has(Ng)?e.require(Ng):e.has(Pg)?e.require(Pg):e.require(Cg),o=()=>a.open({agentId:n}),s=await Ig(o,e.has(Ng)?()=>(e.has(Pg)?e.require(Pg):e.require(Cg)).open({agentId:n}):o);return Object.freeze({baseUrl:i,fetch:async(e,t)=>{let n=new Request(e,t),i=new URL(n.url);if(i.origin!==Lg||!i.pathname.startsWith(`${r}/`))throw new Y(`The Agent request target is invalid`,{code:`INVALID_ARGUMENT`,retryable:!1});return i.pathname=i.pathname.slice(r.length),s.fetch(new Request(i,n))},close:s.close})}var zg=`${Lg}/member`;async function Bg(e){let t=e.has(Ng)?Ng:Pg,n=()=>e.require(t).openInbox(),r=await Ig(n,e.has(Ng)?()=>e.require(Pg).openInbox():n);return Object.freeze({baseUrl:zg,fetch:async(e,t)=>{let n=new Request(e,t),i=new URL(n.url);if(i.origin!==Lg||!i.pathname.startsWith(`/member/inbox`))throw new Y(`The inbox request target is invalid`,{code:`INVALID_ARGUMENT`,retryable:!1});return i.pathname=i.pathname.slice(7),r.fetch(new Request(i,n))},close:r.close})}var Vg=`~effect/Sink`,Hg={_A:mt,_In:mt,_L:mt,_E:mt,_R:mt},Ug={[Vg]:Hg,pipe(){return m(this,arguments)}},Wg=e=>{let t=Object.create(Ug);return t.transform=e,t},Gg=((e,t,n)=>Wg(r=>{let i=e(),a;return t(i)?r.pipe(ht(e=>{for(let r=0;r<e.length;r++)if(i=n(i,e[r]),!t(i))return r+1<e.length&&(a=e.slice(r+1)),cn();return _t}),oe({disableYield:!0}),_r(()=>we([i,a]))):we([i])}))(ke,w,(e,t)=>Ye(t)),Kg=()=>Gg,qg=class extends Event{code;message;constructor(e,t){super(e),this.code=t?.code??void 0,this.message=t?.message??void 0}[Symbol.for(`nodejs.util.inspect.custom`)](e,t,n){return n(Xg(this),t)}[Symbol.for(`Deno.customInspect`)](e,t){return e(Xg(this),t)}};function Jg(e){let t=globalThis.DOMException;return typeof t==`function`?new t(e,`SyntaxError`):SyntaxError(e)}function Yg(e){return e instanceof Error?`errors`in e&&Array.isArray(e.errors)?e.errors.map(Yg).join(`, `):`cause`in e&&e.cause instanceof Error?`${e}: ${Yg(e.cause)}`:e.message:`${e}`}function Xg(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var Zg=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},Qg=10,$g=13,e_=32,t_=6;function n_(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{maxBufferSize:t,onComment:n,onError:r,onEvent:i,onId:a,onRetry:o}=e,s=[],c=0,l=!0,u,d=``,f=0,p,m=!1,h=!1,g=!1;function _(e){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,e.charCodeAt(0)===65279?e=e.slice(1):e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),(h||g)&&(e=v(e),!e))return;if(!s.length){let t=S(e);t!==``&&y(t),x();return}if(e.indexOf(`
|
|
10
|
-
`)===-1&&e.indexOf(`\r`)===-1){if(c<t_&&!b(s.join(``)+e.slice(0,t_-c))){s.length=0,c=0,h=!0;return}s.push(e),c+=e.length,x();return}s.push(e);let t=s.join(``);s.length=0,c=0,y(S(t)),x()}function v(e){if(e.length===0)return e;if(g)return g=!1,e.charCodeAt(0)===Qg?e.slice(1):e;let t=e.indexOf(`\r`),n=e.indexOf(`
|
|
11
|
-
`),r=t===-1?n:n===-1||t<n?t:n;return r===-1?``:r===e.length-1&&e.charCodeAt(r)===$g?(h=!1,g=!0,``):(h=!1,e.slice(r+(e.charCodeAt(r)===$g&&e.charCodeAt(r+1)===Qg?2:1)))}function y(e){if(e){if(e.charCodeAt(e.length-1)===$g){C(e,0,e.length-1),g=!0;return}if(b(e)){s.push(e),c=e.length;return}h=!0}}function b(e){let t=e.charCodeAt(0);return t===58&&!!n||t===100&&a_(e,`data`)||t===101&&a_(e,`event`)||t===105&&a_(e,`id`)||t===114&&a_(e,`retry`)}function x(){t!==void 0&&(c+d.length<=t||(m=!0,s.length=0,c=0,u=void 0,d=``,f=0,p=void 0,h=!1,g=!1,r?.(new Zg(`Buffered data exceeded max buffer size of ${t} characters`,{type:`max-buffer-size-exceeded`}))))}function S(e){let t=0;if(e.indexOf(`\r`)===-1){let n=e.indexOf(`
|
|
12
|
-
`,t);for(;n!==-1;){if(t===n){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0,t=n+1,n=e.indexOf(`
|
|
13
|
-
`,t);continue}let r=e.charCodeAt(t);if(r_(e,t,r)){let r=e.charCodeAt(t+5)===e_?t+6:t+5,o=e.slice(r,n);if(f===0&&e.charCodeAt(n+1)===Qg){u!==void 0&&a?.(u),i?.({id:u,event:p,data:o}),u=void 0,d=``,p=void 0,t=n+2,n=e.indexOf(`
|
|
14
|
-
`,t);continue}d=f===0?o:`${d}\n${o}`,f++}else i_(e,t,r)?p=e.slice(e.charCodeAt(t+6)===e_?t+7:t+6,n)||void 0:C(e,t,n);t=n+1,n=e.indexOf(`
|
|
15
|
-
`,t)}return e.slice(t)}for(;t<e.length;){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
16
|
-
`,t),i=-1;if(n!==-1&&r!==-1?i=n<r?n:r:n===-1?r!==-1&&(i=r):i=n===e.length-1?-1:n,i===-1)break;C(e,t,i),t=i+1,e.charCodeAt(t-1)===$g&&e.charCodeAt(t)===Qg&&t++}return e.slice(t)}function C(e,t,r){if(t===r){T();return}let i=e.charCodeAt(t);if(r_(e,t,i)){let n=e.charCodeAt(t+5)===e_?t+6:t+5,i=e.slice(n,r);d=f===0?i:`${d}\n${i}`,f++;return}if(i_(e,t,i)){p=e.slice(e.charCodeAt(t+6)===e_?t+7:t+6,r)||void 0;return}if(i===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let n=e.slice(e.charCodeAt(t+3)===e_?t+4:t+3,r);n.includes(`\0`)||(u=n);return}if(i===58){if(n){let i=e.slice(t,r);n(i.slice(e.charCodeAt(t+1)===e_?2:1))}return}let a=e.slice(t,r),o=a.indexOf(`:`);if(o===-1){w(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===e_?2:1;w(s,a.slice(o+c),a)}function w(e,t,n){switch(e){case`event`:p=t||void 0;break;case`data`:d=f===0?t:`${d}\n${t}`,f++;break;case`id`:t.includes(`\0`)||(u=t);break;case`retry`:/^\d+$/.test(t)?o?.(parseInt(t,10)):r?.(new Zg(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:n}));break;default:r?.(new Zg(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=!0,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function r_(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function i_(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function a_(e,t){let n=1;for(;n<e.length&&n<t.length;){if(e.charCodeAt(n)!==t.charCodeAt(n))return!1;n++}return e.length<=t.length||e.charCodeAt(t.length)===58}var o_=104857600,s_=class extends EventTarget{static CONNECTING=0;static OPEN=1;static CLOSED=2;CONNECTING=0;OPEN=1;CLOSED=2;get readyState(){return this.#e}get url(){return this.#t.href}get withCredentials(){return this.#r}get onerror(){return this.#u}set onerror(e){this.#u&&this.removeEventListener(`error`,this.#u),this.#u=e,e&&this.addEventListener(`error`,e)}get onmessage(){return this.#d}set onmessage(e){this.#d&&this.removeEventListener(`message`,this.#d),this.#d=e,e&&this.addEventListener(`message`,e)}get onopen(){return this.#f}set onopen(e){this.#f&&this.removeEventListener(`open`,this.#f),this.#f=e,e&&this.addEventListener(`open`,e)}addEventListener(e,t,n){let r=t;super.addEventListener(e,r,n)}removeEventListener(e,t,n){let r=t;super.removeEventListener(e,r,n)}constructor(e,t){super();try{if(e instanceof URL)this.#t=e;else if(typeof e==`string`)this.#t=new URL(e,l_());else throw Error(`Invalid URL`)}catch{throw Jg(`An invalid or illegal string was specified`)}this.#l=n_({maxBufferSize:t?.maxBufferSize??o_,onEvent:this.#v,onError:this.#b,onId:this.#_,onRetry:this.#y}),this.#e=this.CONNECTING,this.#a=3e3,this.#i=t?.fetch??globalThis.fetch,this.#r=t?.withCredentials??!1,this.#p()}close(){this.#o&&clearTimeout(this.#o),this.#e!==this.CLOSED&&(this.#c&&this.#c.abort(),this.#e=this.CLOSED,this.#c=void 0)}#e;#t;#n;#r;#i;#a;#o;#s=null;#c;#l;#u=null;#d=null;#f=null;#p(){this.#e=this.CONNECTING,this.#c=new AbortController;let e=this.#i;e(this.#t,this.#g()).then(this.#m).catch(this.#h)}#m=async e=>{this.#l.reset();let{body:t,redirected:n,status:r,headers:i}=e;if(r===204){this.#x(`Server sent HTTP 204, not reconnecting`,204),this.close();return}if(this.#n=n?new URL(e.url):void 0,r!==200){this.#x(`Non-200 status code (${r})`,r);return}if(!(i.get(`content-type`)||``).startsWith(`text/event-stream`)){this.#x(`Invalid content type, expected "text/event-stream"`,r);return}if(this.#e===this.CLOSED)return;this.#e=this.OPEN;let a=new Event(`open`);if(this.dispatchEvent(a),typeof t!=`object`||!t||!(`getReader`in t)){this.#x(`Invalid response body, expected a web ReadableStream`,r),this.close();return}let o=new TextDecoder,s=t.getReader(),c=!0;do{let{done:e,value:t}=await s.read();if(this.#e===this.CLOSED){c=!1;break}t&&this.#l.feed(o.decode(t,{stream:!e})),e&&(c=!1,this.#l.reset(),this.#S())}while(c)};#h=e=>{this.#c=void 0,e.name!==`AbortError`&&e.type!==`aborted`&&this.#S(Yg(e))};#g(){let e={mode:`cors`,redirect:`follow`,headers:{Accept:`text/event-stream`,...this.#s?{"Last-Event-ID":this.#s}:void 0},cache:`no-store`,signal:this.#c?.signal};return`window`in globalThis&&(e.credentials=this.withCredentials?`include`:`same-origin`),e}#_=e=>{this.#s=e};#v=e=>{let t=this.#n?this.#n.origin:this.#t.origin,n=this.#s??``,r=new MessageEvent(e.event||`message`,{data:e.data,origin:t,lastEventId:n});r.origin!==t&&u_(r,`origin`,t),r.lastEventId!==n&&u_(r,`lastEventId`,n),this.dispatchEvent(r)};#y=e=>{this.#a=e};#b=e=>{e.type===`max-buffer-size-exceeded`&&(this.close(),this.#x(e.message))};#x(e,t){this.#e!==this.CLOSED&&(this.#e=this.CLOSED);let n=new qg(`error`,{code:t,message:e});this.dispatchEvent(n)}#S(e,t){if(this.#e===this.CLOSED)return;this.#e=this.CONNECTING;let n=new qg(`error`,{code:t,message:e});this.dispatchEvent(n);let r=setTimeout(this.#C,this.#a);typeof r==`object`&&r&&`unref`in r&&r.unref(),this.#o=r}#C=()=>{this.#o=void 0,this.#e===this.CONNECTING&&this.#p()}};Object.defineProperty(s_,"name",{value:`EventSource`}),Object.defineProperty(s_,Symbol.for(`eventsource.supports-fetch-override`),{value:!0,writable:!1,configurable:!1,enumerable:!1});var c_=s_;function l_(){let e=`document`in globalThis?globalThis.document:void 0;return e&&typeof e==`object`&&`baseURI`in e&&typeof e.baseURI==`string`?e.baseURI:void 0}function u_(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0})}var d_=q.check(jt(1),B(256)),f_=sn.check(Wn(),In(0)),p_=Yt([W({agentId:d_,sessionId:d_,title:q.check(B(4096)),triggerId:Bt(d_),createdAt:f_,lastActivityAt:f_,settledAt:Bt(f_),visitedAt:Bt(f_),state:Gn([`needs_you`,`running`,`errored`,`done`])}),W({agentId:d_,sessionId:d_,state:G(`unavailable`)})]),m_=W({runId:d_,nodeId:d_,iteration:d_}),h_=W({kind:G(`workflow-review`),key:m_,installationId:d_,workflowId:Sr(d_),workflowTitle:q,reviewTitle:q,reviewers:Gn([`runner`,`owners`]),show:K(Vn),choices:Bt(K(d_)),openedAt:f_,expiresAt:f_,state:Gn([`pending`,`answered`,`delivered`,`timed_out`,`closed`])}),g_=Yt([p_,h_]),__=Yt([g_,W({agentId:d_,sessionId:d_,deleted:G(!0)})]);function v_(e,t){return`${e}\u0000${t}`}function y_(e){return`kind`in e?JSON.stringify([e.kind,e.installationId,e.key.runId,e.key.nodeId,e.key.iteration]):v_(e.agentId,e.sessionId)}var b_=q.pipe(H(jt(1),B(256))),x_=W({kind:G(`seller-closed`),dispositionId:q.pipe(H(jt(1),B(1024))),sellerAccountId:b_,buyerAccountId:b_,appId:b_,releaseIds:$t([b_]),displayName:b_,sellerName:b_,requestId:b_}),S_=q.pipe(H(jt(1)),H(B(4096))),C_=q.pipe(H(jt(1)),H(B(513))),w_=W({params:K(W({key:q.check(jt(1),B(64)),value:q.check(B(4096))})).check(B(16))}),T_=W({id:C_,title:S_,detail:V(q.pipe(H(B(1024)))),tone:V(Gn([`attention`,`running`,`error`,`settled`,`muted`])),status:V(W({label:S_,tone:Gn([`neutral`,`primary`,`secondary`,`accent`,`success`,`info`,`warning`,`error`])})),open:V(w_)}),E_=K(T_).pipe(H(B(200)));W({...T_.fields,media:V(W({path:S_,format:Gn([`fungi:image`,`fungi:video`])}))});var D_=e=>new Set(e).size===e.length,O_=q.pipe(H(B(256)),H(U(e=>e.trim().length>0,{message:`Declared command text must not be blank`}))),k_=O_.pipe(H(B(64))),A_=W({key:k_,label:O_,kind:Gn([`computer`,`repository`,`branch`]),required:Fn,options:V(O_)}).check(U(e=>e.kind!==`computer`||e.options===void 0,{message:`Computer options are host-owned`})),j_=K(A_).check(B(4),U(e=>D_(e.map(e=>e.key)),{message:`Gill parameter keys must be unique`})),M_=Yt([W({storage:O_}),W({binding:O_})]),N_=W({id:O_.pipe(H(U(e=>!e.includes(`:`),{message:`Gill IDs are App-local`}))),title:O_,source:O_,params:V(j_),watch:V(M_),desktop:V(W({sizes:K(Gn([`S`,`M`,`L`])).check(jt(1),B(3),U(D_,{message:`Desktop Gill sizes must be unique`}))}))}),P_=kt(k_,q.check(B(256))).check(U(e=>Object.keys(e).length<=4,{message:`Gill placement supports at most four parameters`}));W({viewId:C_,params:V(P_),after:V(q.check(B(1024))),options:V(k_)}),W({id:C_,params:V(P_),after:V(q.check(B(1024))),options:V(k_)});var F_=Yt([W({viewId:C_,title:S_,state:G(`empty`),rows:$t([]),next:V(q.pipe(H(B(1024))))}),W({viewId:C_,title:S_,state:G(`error`),rows:$t([]),reason:V(Gn([`exec_isolation_required`,`params_required`])),error:q.pipe(H(jt(1)),H(B(512))),recovery:V(Yt([W({kind:G(`configure`),param:k_}),W({kind:G(`open`)})]))}),W({viewId:C_,title:S_,state:G(`full`),rows:E_.pipe(H(jt(1))),next:V(q.pipe(H(B(1024))))})]);_n(F_,{onExcessProperty:`error`});var I_=W({options:K(W({value:q.check(B(256)),label:S_,detail:V(q.check(B(1024)))})).check(B(200)),next:V(q.check(B(1024)))}),L_=Yt([F_,I_]);_n(L_,{onExcessProperty:`error`}),_n(I_,{onExcessProperty:`error`});var R_={BACKGROUND:{name:`BACKGROUND`,operations:{admit:{cap:`app.background.admit`,requires:[],effect:`read`}}},GIT:{name:`GIT`,operations:{create:{cap:`app.git.create`,requires:[`git.repository`],effect:`write`},fork:{cap:`app.git.fork`,requires:[`git.repository`],effect:`write`},read:{cap:`app.git.read`,requires:[`git.repository`],effect:`read`},write:{cap:`app.git.write`,requires:[`git.repository`],effect:`write`},exchange:{cap:`app.git.exchange`,requires:[`git.repository`],effect:`write`}}},EVENTS:{name:`EVENTS`,operations:{emit:{cap:`app.events.emit`,requires:[`app.events.emit`],effect:`write`}}},APPS:{name:`APPS`,operations:{build:{cap:`app.build`,requires:[`git.repository`,`computer.execute`],effect:`write`},buildStatus:{cap:`app.build`,requires:[`git.repository`,`computer.execute`],effect:`read`},select:{cap:`app.select`,requires:[`git.repository`,`computer.execute`],effect:`write`},catalog:{cap:`app.catalog.read`,requires:[`team.workbenchHost`],effect:`read`},fork:{cap:`app.fork`,requires:[`git.repository`],effect:`write`}}},WORKFLOWS:{name:`WORKFLOWS`,operations:{catalog:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`},runGraph:{cap:`app.workflow.run`,requires:[`workflow.run`],effect:`write`},armSchedule:{cap:`app.workflow.run`,requires:[`workflow.run`,`workflow.arm`],effect:`write`},disarmSchedule:{cap:`app.workflow.run`,requires:[`workflow.run`,`workflow.arm`],effect:`write`},schedules:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`},armEventTrigger:{cap:`app.workflow.run`,requires:[`workflow.run`,`workflow.arm`],effect:`write`},disarmEventTrigger:{cap:`app.workflow.run`,requires:[`workflow.run`,`workflow.arm`],effect:`write`},eventTriggers:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`},cancel:{cap:`app.workflow.run`,requires:[`workflow.run`],effect:`write`},answerReview:{cap:`app.workflow.run`,requires:[`workflow.run`],effect:`write`},graphStatus:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`},runs:{cap:`app.workflow.read`,requires:[`workflow.run`],effect:`read`}}},APP_STORAGE:{name:`APP_STORAGE`,operations:{read:{cap:`app.storage.read`,requires:[`app.storage`],effect:`read`},write:{cap:`app.storage.write`,requires:[`app.storage`],effect:`write`},reset:{cap:`app.storage.write`,requires:[`app.storage`],effect:`write`}}},MEDIA:{name:`MEDIA`,operations:{models:{cap:`app.media.read`,requires:[`media.generation`],effect:`read`},generate:{cap:`app.media.generate`,requires:[`media.generation`,`computer.writeFile`],effect:`write`}}},COMPUTER:{name:`COMPUTER`,operations:{list:{cap:`app.computer.read`,requires:[`computer.list`],effect:`read`},read:{cap:`app.computer.read`,requires:[`computer.readFile`],effect:`read`},ports:{cap:`app.computer.read`,requires:[`computer.execute`],effect:`read`},processes:{cap:`app.computer.read`,requires:[`computer.execute`],effect:`read`},write:{cap:`app.computer.write`,requires:[`computer.writeFile`],effect:`write`},workflowGitPass:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`},preview:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`},processKill:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`},processStart:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`},exec:{cap:`app.computer.exec`,requires:[`computer.execute`],effect:`write`}}},INBOX:{name:`INBOX`,operations:{page:{cap:`inbox.read`,requires:[`agent.read`],effect:`read`},visit:{cap:`inbox.visit`,requires:[`agent.read`],effect:`write`}}},AGENTS:{name:`AGENTS`,operations:{list:{cap:`agent.list`,requires:[`agent.list`],effect:`read`},send:{cap:`agent.send`,requires:[`agent.send`],effect:`write`}}}},z_=[`dashboard`,`inbox`,`files`,`media`,`sessions`,`terminal`],B_=`agent.list,agent.manage,agent.rename,agent.avatar,agent.toolPolicy,agent.read,agent.send,computer.list,computer.readFile,computer.writeFile,computer.execute,llm.generation,media.generation,games:servers,git.repository,apps.open,apps.call,app.storage,app.events.emit,team.workbenchHost,marketplace.browse,marketplace.purchase,workflow.run,workflow.publish,workflow.arm,world,channels.read,channels.personal.manage`.split(`,`),V_=[`file.open`],H_=[`team`,`member`],U_=Object.freeze({capabilities:[],handlers:[],roles:[]});function W_(e,t){if(t===void 0)return!0;let n=e?.methods[t.method];return n?.effect===`write`&&Object.values(e?.methods??{}).every(e=>e.effect!==`write`||e.requires.every(e=>n.requires.includes(e)))}var G_=ce(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);k.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>j(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>h(e,t,n),e.parseAsync=async(t,n)=>ee(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>b(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>re(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),K_=ce(`ZodMiniString`,(e,t)=>{Be.init(e,t),G_.init(e,t)});function q_(e){return Se(K_,e)}var J_=ce(`ZodMiniNever`,(e,t)=>{u.init(e,t),G_.init(e,t)});function Y_(e){return _e(J_,e)}var X_=ce(`ZodMiniObject`,(e,t)=>{He.init(e,t),G_.init(e,t),yt(e,`shape`,()=>t.shape)});function Z_(e,t){return new X_({type:`object`,shape:e??{},...s(t)})}function Q_(e,t){return new X_({type:`object`,shape:e,catchall:Y_(),...s(t)})}var $_=ce(`ZodMiniDiscriminatedUnion`,(e,t)=>{l.init(e,t),G_.init(e,t)});function ev(e,t,n){return new $_({type:`union`,options:t,discriminator:e,...s(n)})}var tv=ce(`ZodMiniEnum`,(e,t)=>{ft.init(e,t),G_.init(e,t),e.options=Object.values(t.entries)});function nv(e,t){return new tv({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...s(t)})}var rv=ce(`ZodMiniLiteral`,(e,t)=>{p.init(e,t),G_.init(e,t)});function iv(e,t){return new rv({type:`literal`,values:Array.isArray(e)?e:[e],...s(t)})}var av=ce(`ZodMiniOptional`,(e,t)=>{a.init(e,t),G_.init(e,t)});function ov(e){return new av({type:`optional`,innerType:e})}var sv=ce(`ZodMiniNullable`,(e,t)=>{N.init(e,t),G_.init(e,t)});function cv(e){return new sv({type:`nullable`,innerType:e})}var lv=ce(`ZodMiniLazy`,(e,t)=>{R.init(e,t),G_.init(e,t)});function uv(e){return new lv({type:`lazy`,getter:e})}var dv=ce(`ZodMiniCustom`,(e,t)=>{ae.init(e,t),G_.init(e,t)});function fv(e,t={}){return lt(dv,e,t)}var pv=Object.freeze({intrinsic:[`constructor`,`toString`,`valueOf`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`],rpc:[`then`,`dup`,`connect`,`id`,`name`],instance:[`ctx`,`env`],lifecycle:[`gill`,`onGitPush`,`syncRefused`,`authorizeGitPush`,`fetch`,`alarm`,`queue`,`scheduled`,`tail`,`trace`,`email`,`test`,`tailStream`,`webSocketMessage`,`webSocketClose`,`webSocketError`]}),mv=q_().check(Me(1),Fe(256)),hv=Z_({kind:iv(`member`),memberId:mv}),gv=Z_({kind:iv(`agent`),agentId:mv}),_v=Z_({kind:iv(`team-key`),keyId:mv}),vv=ev(`kind`,[hv,gv,_v]),yv=Z_({workflowId:mv,runId:mv,nodeId:mv,armedBy:vv}),bv=uv(()=>Q_({method:q_().check(fv(e=>Sv(e))),seal:q_().check(gt(/^[A-Za-z0-9_-]{43}$/u))})),xv=Z_({computerId:cv(mv),actor:vv,backgroundLane:ov(q_().check(Me(8),Fe(263))),backgroundOrigin:ov(bv),role:ov(nv([`owner`,`member`])),soleMember:ov(iv(!0)),workflow:ov(yv),idempotencyKey:ov(q_().check(Me(1),Fe(128)))});hv.shape,gv.shape,_v.shape,{...xv.shape},{...yv.shape};var Sv=e=>e.length<=80&&/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(e)&&!Object.values(pv).flat().some(t=>t===e),Cv=q.check(U(Sv));function wv(e,t=0){return t>16?!1:an(K(Vn))(e)?e.every(e=>wv(e,t+1)):!an(ur)(e)||Object.values(e).every(e=>wv(e,t+1))}var Tv=ur.pipe(H(U(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=2e4&&wv(e),{message:`App API schema exceeds its byte or depth bound`}))),Ev=q.check(jt(1),B(128)),Dv=W({description:q.pipe(H(jt(1)),H(B(1e3))),input:Tv,output:Tv,pending:V(G(!0)),hidden:V(G(!0)),anonymous:V(G(!0)),present:V(W({verb:q.check(jt(1),B(32))})),effect:Gn([`read`,`write`,`external`]),requires:K(Gn(B_)).pipe(H(U(e=>new Set(e).size===e.length)))}).check(U(e=>e.anonymous!==!0||e.effect===`read`&&e.requires.length===0,{message:`Anonymous methods must be reads with no required capabilities`})),Ov=W({methods:kt(q,Dv).pipe(H(U(e=>Object.keys(e).every(an(Cv)),{message:`Invalid App API method name`})),H(U(e=>Object.keys(e).length<=64)),H(U(e=>{let t=Object.keys(e);return t.every(e=>!t.some(t=>t.startsWith(`${e}.`)))},{message:`App API method name is also a method group`}))),toolFamily:Bt(W({name:Cv.check(U(e=>!e.includes(`.`))),list:Cv,call:Cv})),events:Bt(kt(q,W({description:q.check(jt(1),B(1e3)),payload:Tv})).check(U(e=>Object.keys(e).every(an(Ev)),{message:`Invalid App API event name`}),U(e=>Object.keys(e).length<=64)))}).pipe(H(U(e=>{if(e.toolFamily===void 0)return!0;let{name:t,list:n,call:r}=e.toolFamily,i=e.methods[n],a=e.methods[r];return i?.effect===`read`&&a!==void 0&&a.effect!==`external`&&a.hidden!==!0&&!Object.keys(e.methods).some(e=>e.split(`.`)[0]===t)},{message:`Tool family must reference declared callable methods in a distinct namespace`})),H(U(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=256e3,{message:`App API exceeds its total byte bound`}))),kv=e=>new Set(e).size===e.length;function Av(e,t){let n=Object.keys(t);for(let e of n)_n(Cv)(e);return{declaration:W({name:G(e),operations:K(Gn(n)).pipe(H(jt(1)),H(B(n.length)),H(U(kv)))}),shard:W({name:G(e),operations:K(Yt(Object.entries(t).map(([e,t])=>W({name:G(e),cap:G(t.cap)})))).pipe(H(jt(1)),H(B(n.length)),H(U(e=>kv(e.map(e=>e.name)),{message:`App backend operation repeated`})))})}}var jv=Object.values(R_).map(e=>Av(e.name,e.operations)),Mv=jv.length,Nv=K(Yt(jv.map(e=>e.declaration))).pipe(H(B(Mv)),H(U(e=>kv(e.map(e=>e.name)))));K(Yt(jv.map(e=>e.shard))).pipe(H(B(Mv)),H(U(e=>kv(e.map(e=>e.name)))));var Pv=new Map(Object.entries(R_).map(([e,t])=>[e,new Map(Object.entries(t.operations))]));function Fv(e,t){return Pv.get(e)?.get(t)}var Iv=Gn(z_),Lv=Gn(B_),Rv=Gn(V_),zv={message:`App declaration entries must be unique`},Bv=e=>new Set(e).size===e.length,Vv=new Set([`super+k`,`meta+k`,`cmd+k`,`mod+k`,`ctrl+k`,`control+k`]),Hv=q.pipe(H(B(256)),H(U(e=>e.trim().length>0,{message:`Declared command text must not be blank`}))),Uv={order:V(Ln)},Wv=W(Uv),Gv=W({id:Hv.pipe(H(U(e=>!e.includes(`:`),{message:`Declared command IDs are namespace-local`}))),title:Hv,category:Hv,description:V(q.pipe(H(B(1024)))),sigil:V(Hv.pipe(H(B(64)))),projections:V(W({bindings:V(W({...Uv,values:K(Hv).pipe(H(B(16)),H(U(e=>!e.some(e=>Vv.has(e.trim().toLowerCase())),{message:`Apps cannot bind the reserved leader chord`})))})),agent:V(W({...Uv,keybind:V(q)})),help:V(Wv),menu:V(Wv),palette:V(Wv),slash:V(W({...Uv,aliases:K(Hv).pipe(H(B(16)))}))}))}),Kv=e=>Bv(e.map(e=>e.id))&&Bv(e.flatMap(e=>e.projections?.slash?.aliases??[])),qv=e=>Bv(e.map(e=>e.id)),Jv=q.check(Xn(/^[a-z][a-z0-9.-]{0,63}$/)),Yv=W({key:Jv,scopes:K(Gn(H_)).check(jt(1),U(Bv,zv)),maxBytes:Ln.check(Ct({minimum:1,maximum:65536}))}),Xv=Jt()([Yv],([e])=>(t,n,r)=>hn(e)(t,{...r,onExcessProperty:`error`}),{toCodecJson:()=>new Ft(Yv.ast,sr())}),Zv=W({appId:q.check(jt(1),B(128)),methods:K(Cv).check(jt(1),B(16),U(Bv,zv))}),Qv=Jt()([Zv],([e])=>(t,n,r)=>hn(e)(t,{...r,onExcessProperty:`error`}),{toCodecJson:()=>new Ft(Zv.ast,sr())}),$v=K(Qv).check(jt(1),B(16),U(e=>Bv(e.map(e=>e.appId)),zv)),ey=W({api:Bt(Ov),displayName:V(q.pipe(H(jt(1)),H(B(64)))),capabilities:K(Lv).pipe(H(U(Bv,zv))),calls:Bt($v),guidance:V(q.pipe(H(jt(1)),H(B(12e3)))),handlers:K(Rv).pipe(H(U(Bv,zv))),receives:Bt(K(G(`git.push`)).check(B(1),U(Bv,zv))),icon:Bt(q.pipe(H(jt(1)),H(B(80)))),roles:K(Iv).pipe(H(U(Bv,zv))),storage:Bt(K(Xv).check(B(16),U(e=>Bv(e.map(e=>e.key)),zv))),commands:V(K(Gv).pipe(H(B(64)),H(U(Kv,{message:`Declared command IDs and slash aliases must be unique`})))),gills:V(K(N_).pipe(H(B(16)),H(U(qv,{message:`Declared Gill IDs must be unique`})))),backend:V(W({bindings:Nv,sync:Bt(W({method:Cv}))}))}).pipe(H(U(e=>e.calls===void 0||e.capabilities.includes(`apps.call`),{message:`App calls require apps.call`})),H(U(e=>e.backend?.bindings.every(e=>e.name!==`BACKGROUND`)??!0,{message:`BACKGROUND is host-minted and cannot be declared by an App`})),H(U(e=>W_(e.api,e.backend?.sync),{message:`Background continuation must be a declared write covering all write requirements`})),H(U(e=>!(e.receives?.includes(`git.push`)??!1)||e.capabilities.includes(`git.repository`),{message:`Git push reception requires git.repository`})),H(U(e=>e.backend?.bindings.every(t=>t.operations.every(n=>Fv(t.name,n)?.requires.every(t=>e.capabilities.includes(t))===!0))??!0,{message:`Backend bindings require declared App capabilities`})),H(U(e=>!e.backend?.bindings.some(e=>e.name===`APP_STORAGE`)||(e.storage?.length??0)>0,{message:`App storage bindings require declared keys`})),H(U(e=>Object.values(e.api?.methods??{}).every(t=>t.requires.every(t=>e.capabilities.includes(t))),{message:`App API requires capabilities outside the App declaration`})));function ty(e){return/^app_[a-z0-9]{1,63}$/u.test(e)}function ny(e){return/^rel_[a-z0-9]{1,63}$/u.test(e)}function ry(e){return/^ps_[a-z0-9]{1,63}$/u.test(e)}function iy(e){return/^artifact:[a-z0-9](?:[a-z0-9._-]{0,126}[a-z0-9])?$/u.test(e)}function ay(e){return/^idem_[a-z0-9](?:[a-z0-9_-]{0,126}[a-z0-9])?$/u.test(e)}function oy(e){return/^git:[0-9a-f]{40}$/u.test(e)}function sy(e){return/^sha256:[0-9a-f]{64}$/u.test(e)}function cy(e){return/^\/[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(e)}var ly=Jn({family:`app-release`,version:1,kinds:{transition:{prefix:`app_transition`},surface:{prefix:`ps`},erasure:{prefix:`app_erasure`}}}),uy=ly.transition;ly.surface,ly.erasure;var dy=q.pipe(qt(ty)),fy=q.pipe(qt(ny)),py=q.pipe(qt(ry)),my=q.pipe(qt(iy)),hy=q.pipe(qt(ay)),gy=q.pipe(qt(oy)),_y=q.pipe(qt(sy)),vy=q.pipe(qt(cy)),yy=W({byteLength:sn,copy:Tn(Function)}).pipe(qt(e=>e.byteLength>=0)),by=W({appId:dy}),xy=W({sourceRevision:gy,sourceTreeDigest:_y,buildRecipeDigest:_y}),Sy=W({artifactRef:my,artifactDigest:_y,provenance:xy}),Cy=W({releaseId:fy,appId:dy,artifact:Sy}),wy=W({publicSurfaceId:py,appId:dy,stableRoute:vy}),Ty=q.pipe(H(jt(1)),H(B(256))),Ey=W({...wy.fields,publisher:W({kind:Gn([`customer`,`platform`]),teamId:Ty,userId:Ty,requestKey:Ty})}),Dy=Gn([`text/html; charset=utf-8`,`application/vnd.fungi.app-backend+json`,`application/vnd.fungi.app-assets+json`,`application/vnd.fungi.app+json`]),Oy=W({artifactRef:my,digest:_y,mediaType:Gn([`text/html; charset=utf-8`,`application/vnd.fungi.app-backend+json`,`application/vnd.fungi.app-assets+json`]),version:q.pipe(H(jt(1))),byteLength:sn.pipe(H(Wn()),H(Nn(0)),H(U(Number.isSafeInteger)))}),ky=W({runtime:W({kind:G(`durable-facet`),stateSchema:sn.pipe(H(Wn()),H(Nn(0)))}),compatibilityDate:q.pipe(H(Xn(/^\d{4}-\d{2}-\d{2}$/))),exportName:q.pipe(H(jt(1)))}),Ay=W({format:G(`fungi-app-v1`),ui:Sr(Oy),backend:Sr(W({artifact:Oy,profile:ky})),declaration:ey.pipe(ln(we(U_)))}),jy=W({kind:G(`verified`),digest:_y,mediaType:Dy,bytes:yy,byteLength:sn}),My=Yt([jy,W({kind:G(`unavailable`)}),W({kind:G(`missing`)}),W({kind:G(`digest-mismatch`),actualDigest:_y})]),Ny=Yt([W({kind:G(`found`),app:by}),W({kind:G(`absent`)})]),Py=Yt([W({kind:G(`created`),app:by}),W({kind:G(`existing`),app:by})]),Fy=Yt([W({kind:G(`found`),release:Cy}),W({kind:G(`absent`)})]),Iy=Yt([W({kind:G(`created`),release:Cy}),W({kind:G(`existing`),release:Cy})]),Ly=Yt([W({kind:G(`found`),surface:wy}),W({kind:G(`absent`)})]),Ry=Yt([W({kind:G(`created`),surface:wy}),W({kind:G(`existing`),surface:wy}),W({kind:G(`conflict`)})]),zy=Yt([W({kind:G(`verified`),digest:_y,mediaType:G(`application/vnd.fungi.app+json`),description:Ay}),W({kind:G(`unverified`)})]),By=Yt([W({kind:G(`active`)}),W({kind:G(`revoked`)})]),Vy=Yt([W({kind:G(`promotion`),publicSurfaceId:py,releaseId:fy,idempotencyKey:hy}),W({kind:G(`rollback`),publicSurfaceId:py,releaseId:fy,idempotencyKey:hy}),W({kind:G(`revocation`),releaseId:fy,idempotencyKey:hy})]),Hy=Ht(e=>uy.schema.safeParse(e).success),Uy=W({transition:Vy,transitionId:Hy}),Wy=Yt([W({kind:G(`none`)}),W({kind:G(`selected`),releaseId:fy})]),Gy=Yt([W({kind:G(`found`),release:Cy,verification:zy,revocation:By}),W({kind:G(`absent`)})]);Yt([W({kind:G(`found`),surface:wy,selection:Wy}),W({kind:G(`absent`)})]);var Ky=Yt([W({kind:G(`absent`)}),W({kind:G(`found`),receipt:Uy}),W({kind:G(`conflict`)})]),qy=Yt([W({kind:G(`created`),receipt:Uy}),W({kind:G(`existing`),receipt:Uy}),W({kind:G(`conflict`)}),W({kind:G(`identity-collision`)}),W({kind:G(`lifecycle-conflict`)})]),Jy=W({kind:G(`recorded`)}),Yy=W({kind:G(`unavailable`)});function Xy(e){return Yt([W({kind:G(`success`),value:e}),W({kind:G(`failure`),failure:Yy})])}var Zy=Xy(Ny),Qy=Xy(Py),$y=Xy(Fy),eb=Xy(Iy),tb=Xy(Ly),nb=Xy(Ry),rb=Xy(Gy),ib=Xy(Jy),ab=Xy(Ky),ob=Xy(qy);un(dy,{onExcessProperty:`error`}),un(fy,{onExcessProperty:`error`}),un(py,{onExcessProperty:`error`}),un(my,{onExcessProperty:`error`}),un(hy,{onExcessProperty:`error`}),un(gy,{onExcessProperty:`error`}),un(_y,{onExcessProperty:`error`}),un(vy,{onExcessProperty:`error`}),un(Hy,{onExcessProperty:`error`}),Dt(My,{onExcessProperty:`error`}),un(by,{onExcessProperty:`error`}),un(Cy,{onExcessProperty:`error`}),un(wy,{onExcessProperty:`error`}),un(Ey,{onExcessProperty:`error`}),un(Zy,{onExcessProperty:`error`}),un(Qy,{onExcessProperty:`error`}),un($y,{onExcessProperty:`error`}),un(eb,{onExcessProperty:`error`}),un(tb,{onExcessProperty:`error`}),un(nb,{onExcessProperty:`error`}),un(Vy,{onExcessProperty:`error`}),un(rb,{onExcessProperty:`error`}),un(ib,{onExcessProperty:`error`}),un(ab,{onExcessProperty:`error`}),un(ob,{onExcessProperty:`error`});var sb=q.pipe(H(jt(1)),H(B(256))),cb=q.pipe(H(Xn(/\S/u)),H(B(1e3)));W({dispositionId:sb,requestId:sb,operatorId:sb,reason:cb,action:Yt([W({kind:G(`retain-detached`)}),W({kind:G(`revoke-with-notice`)})])});var lb=W({dispositionId:sb,appId:dy,displayName:q.pipe(H(jt(1)),H(B(64))),releaseIds:K(fy).pipe(H(jt(1)),H(B(1e4))),reason:cb}),ub=W({disposition_id:sb,app_id:dy,release_ids_json:q,artifact_roots_json:q,created_at:sn,state:Gn([`pending`,`retaining`,`retained`,`revoking`,`revoked`]),request_id:Sr(sb),reason:Sr(cb),completed_at:Sr(sn)});W({...ub.fields,releaseIds:K(fy).pipe(H(B(1e4)))}),bn(K(fy).pipe(H(B(1e4)))),bn(K(my).pipe(H(B(1e4)))),[`CREATE TABLE app_release_artifact_dispositions(disposition_id TEXT PRIMARY KEY, app_id TEXT NOT NULL UNIQUE REFERENCES app_release_apps(app_id),
|
|
17
|
-
release_ids_json TEXT NOT NULL CHECK(json_valid(release_ids_json)), artifact_roots_json TEXT NOT NULL CHECK(json_valid(artifact_roots_json)),
|
|
18
|
-
created_at INTEGER NOT NULL,state TEXT NOT NULL CHECK(state IN ('pending','retaining','retained','revoking','revoked')),
|
|
19
|
-
request_id TEXT,reason TEXT,completed_at INTEGER,
|
|
20
|
-
CHECK((state='pending' AND request_id IS NULL AND reason IS NULL) OR (state<>'pending' AND request_id IS NOT NULL AND length(request_id) BETWEEN 1 AND 256 AND reason IS NOT NULL AND length(trim(reason)) BETWEEN 1 AND 1000)),
|
|
21
|
-
CHECK((state IN ('retained','revoked'))=(completed_at IS NOT NULL))) STRICT;`,`CREATE TABLE app_release_artifact_notice_recipients(recipient_id INTEGER PRIMARY KEY,disposition_id TEXT NOT NULL REFERENCES app_release_artifact_dispositions(disposition_id),
|
|
22
|
-
buyer_team_id TEXT CHECK(buyer_team_id IS NULL OR length(buyer_team_id) BETWEEN 1 AND 256),receipt TEXT CHECK(receipt IS NULL OR length(receipt) BETWEEN 1 AND 256),
|
|
23
|
-
erased_by TEXT,erased_at INTEGER,
|
|
24
|
-
CHECK((erased_by IS NULL)=(erased_at IS NULL)),
|
|
25
|
-
CHECK(erased_by IS NULL OR length(erased_by) BETWEEN 1 AND 256),
|
|
26
|
-
CHECK(receipt IS NULL OR erased_at IS NULL),
|
|
27
|
-
CHECK(buyer_team_id IS NOT NULL OR erased_at IS NOT NULL),
|
|
28
|
-
UNIQUE(disposition_id,buyer_team_id)) STRICT;`,`CREATE INDEX app_release_artifact_dispositions_pending ON app_release_artifact_dispositions(state,disposition_id);`,`CREATE TABLE app_release_artifact_disposition_steps(step_id INTEGER PRIMARY KEY,disposition_id TEXT NOT NULL REFERENCES app_release_artifact_dispositions(disposition_id),
|
|
29
|
-
phase TEXT NOT NULL CHECK(phase IN ('prepared','completed')),operator_id TEXT NOT NULL,recorded_at INTEGER NOT NULL) STRICT;`,`CREATE INDEX app_release_artifact_disposition_steps_by_action ON app_release_artifact_disposition_steps(disposition_id,phase);`].map(e=>e.replaceAll(`
|
|
30
|
-
`,` `)).join(`
|
|
31
|
-
`);var db=sn.pipe(H(Wn()),H(In(0))),fb=W({items:K(g_),next:Sr(q),cursor:db});Xe({visited:n(!0)});var pb=_n(fb),mb=_n(bn(W({kind:G(`rows`),from:db,to:db,items:K(__),more:Fn})));function hb(e){let t=new Map,n=0,r=!1,i,a=0,o=n=>{r||e.onChange({items:[...t.values()],status:n})},s=e=>{for(let n of e){let e=y_(n);`deleted`in n?t.delete(e):t.set(e,n)}},c=()=>{i?.close();let t=++a,u=e.openEvents(`${e.baseUrl}/inbox/events?after=${String(n)}`);i=u;let d=!1;u.addEventListener(`error`,()=>{r||t!==a||(d=!0,rs(`inbox.observe`,Error(`Member inbox stream disconnected`)),o(`error`))}),u.addEventListener(`open`,()=>{r||t!==a||!d||l()}),u.addEventListener(`rows`,e=>{if(r||t!==a)return;let i;try{i=mb(e.data)}catch(e){rs(`inbox.decode-event`,e),o(`loading`),c();return}if(i.from!==n){o(`loading`),c();return}s(i.items),n=i.to,o(`live`)}),u.addEventListener(`reset`,()=>{r||t!==a||l()})},l=async()=>{let l=++a;i?.close(),i=void 0,o(`loading`);try{t.clear();let i=null,u=!0;for(let t=0;t<5;t+=1){let t=i===null?``:`?after=${encodeURIComponent(i)}`,o=await e.fetch(`${e.baseUrl}/inbox${t}`,{cache:`no-store`});if(!o.ok)throw Error(`Inbox unavailable`);let c=pb(await o.json());if(r||l!==a)return;if(u&&(n=c.cursor),u=!1,s(c.items),i=c.next,i===null)break}o(`live`),c()}catch(e){if(r||l!==a)return;rs(`inbox.refresh`,e),o(`error`)}};return l(),Object.freeze({refresh:()=>r?Promise.resolve():l(),visit:async(t,n)=>{let r=await e.fetch(`${e.baseUrl}/inbox/visits`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agentId:t,sessionId:n})});if(!r.ok&&r.status!==404)throw Error(`Visit was not recorded`)},close:()=>{r=!0,a+=1,i?.close()}})}var gb=_n(W({items:K(Yt([W({...lb.fields,reason:V(lb.fields.reason),createdAt:db}),W({...x_.fields,createdAt:db})])).pipe(H(B(100))),next:Sr(q.pipe(H(B(1024))))}),{onExcessProperty:`error`});async function _b(e,t=null){let n=new URL(`${e.baseUrl}/inbox/notices`);t!==null&&n.searchParams.set(`after`,t);let r=await e.fetch(n);if(!r.ok)throw Error(`Team notices unavailable`);return gb(await r.json())}function vb(e,t){return t.status===`live`?t:{...t,data:t.data??e.data}}function yb(e,t,n={}){return Jo({queryKey:e,...n,retry:!1,staleTime:1/0,refetchOnMount:`always`,queryFn:Po({initialValue:{status:`loading`},refetchMode:`append`,reducer:vb,streamFn:({signal:e})=>Sn(Et(n=>i(function*(){let r={status:`loading`},i=()=>{gr(n)};if(yield*rt(ct(()=>{e.addEventListener(`abort`,i,{once:!0})}),()=>ct(()=>{e.removeEventListener(`abort`,i)})),e.aborted){i();return}yield*rt(Le({try:()=>Promise.resolve(t(e=>{r=vb(r,e),pr(n,r)},e)),catch:xb}),e=>ct(e))}).pipe(Te(e=>or(n,e))),{bufferSize:1,strategy:`sliding`}))})})}async function bb(e,t,n){if(!e)throw new Y(`No App connection`,{code:`DISCONNECTED`,retryable:!0});let r=await Bg(e.capabilities),i=()=>{r.close().catch(e=>{rs(`inbox.query-close`,e)})};if(n.aborted)return i(),()=>void 0;let a=hb({baseUrl:r.baseUrl,fetch:r.fetch,openEvents:e=>{let t=new c_(e,{fetch:(e,t)=>r.fetch(e,t)});return{addEventListener:(e,n)=>{t.addEventListener(e,t=>{e===`open`||e===`error`?n(new MessageEvent(e)):t instanceof MessageEvent&&n(new MessageEvent(e,{data:z().parse(t.data)}))})},close:()=>{t.close()}}},onChange:e=>{t(e.status===`live`?{status:`live`,data:e.items}:{status:e.status})}});return()=>{a.close(),i()}}function xb(e){return e instanceof Y?e:new Y(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var Sb=new WeakMap,Cb={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function wb(e){let t={};return e&&Sb.set(t,e),t}function Tb(){let e=new No({defaultOptions:{queries:{retry:!1,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}}),t=new Map;return e.getQueryCache().subscribe(n=>{let r=n.query;if(n.type===`removed`){t.get(r.queryHash)?.release(),t.delete(r.queryHash);return}let i=r.meta&&Sb.get(r.meta),a=t.get(r.queryHash);if(a?.app===i||(a?.release(),t.delete(r.queryHash),!i))return;let o=()=>{queueMicrotask(()=>{e.getQueryCache().get(r.queryHash)===r&&t.get(r.queryHash)?.app===i&&e.resetQueries({predicate:e=>e===r})})},s=i.capabilities.subscribe(o);t.set(r.queryHash,{app:i,release:s}),a&&o()}),e}function Eb(e,t,n,r){let i=e?.context.get().computerId;return Yo({queryKey:n,meta:wb(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new Y(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new Y(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw xb(e)}}})}function Db(e){nh(e?.context);let t=ya(),n=e?.context.get().computerId,r=(0,J.useMemo)(()=>Cb.of(e,`member-inbox`),[e,n]),i=yb(r,(0,J.useCallback)((t,r)=>{if(e?.context.get().computerId!==n)throw new Y(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return bb(e,t,r)},[e,n]),{enabled:e!==null,meta:wb(e)}),a=(0,J.useCallback)(()=>{t.invalidateQueries({queryKey:r,exact:!0})},[t,r]),o=(0,J.useCallback)(async(t,n)=>{if(!e)throw new Y(`No App connection`,{code:`DISCONNECTED`,retryable:!0});let r=await Bg(e.capabilities);try{let e=await r.fetch(`${r.baseUrl}/inbox/visits`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agentId:t,sessionId:n})});if(!e.ok&&e.status!==404)throw new Y(`Visit was not recorded`,{code:`HOST_FAILURE`,retryable:!0})}finally{await r.close()}},[e]);return{items:i.data?.data??[],status:i.isError?`error`:i.data?.status??`loading`,error:i.error,refresh:a,visit:o}}var Ob=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5}),kb=Object.freeze([`2xs`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`]);Object.freeze(`--stipe-font-synthesis.--stipe-surface-frame-width.--stipe-surface-frame-image.--stipe-surface-molding-contrast.--stipe-shadow-raised.--stipe-shadow-inset.--stipe-shadow-edge.--stipe-display-gasket-face.--stipe-display-texture-image.--stipe-display-text-shadow.--stipe-canvas.--stipe-surface.--stipe-surface-raised.--stipe-surface-selected.--stipe-fg-muted.--stipe-linework.--stipe-hairline.--stipe-figure-ink.--stipe-density-compact.--stipe-density-comfortable.--stipe-motion-spring.--stipe-motion-squish.--stipe-motion-fast.--stipe-motion-normal.--stipe-motion-slow.--stipe-motion-ease.--stipe-motion-ease-exit.--stipe-motion-bounce.--stipe-motion-spring-duration.--stipe-motion-stretch.--stipe-motion-distance.--stipe-motion-stagger.--stipe-motion-blur.--stipe-motion-shake.--stipe-motion-steps.--stipe-motion-fuse.--stipe-press-depth.--stipe-press-scale.--stipe-layer-desktop.--stipe-layer-windows.--stipe-layer-chrome.--stipe-layer-popover.--stipe-layer-dialog.--stipe-layer-toast.--stipe-layer-tooltip.--stipe-overlay-shadow-outset.--stipe-icon-size-sm.--stipe-icon-size-md.--stipe-icon-size-lg.--stipe-icon-stroke.--stipe-card-rim.--stipe-card-rim-edge.--stipe-card-face.--stipe-card-panel.--stipe-card-ink.--stipe-card-ink-muted.--stipe-card-accent.--stipe-card-shadow.--stipe-card-foil-highlight.--stipe-card-foil-warm.--stipe-card-foil-cool.--stipe-avatar-shadow.--stipe-art-coral.--stipe-art-blue.--stipe-art-mint.--stipe-art-grape.--stipe-art-yellow.--stipe-art-cream.--stipe-art-ink.--stipe-art-inkcap.--stipe-art-graphite.--stipe-sketch-ink`.split(`.`));function Ab(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ab(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function jb(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ab(e))&&(r&&(r+=` `),r+=t);return r}var Mb=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Nb=jb,Pb=(e,t)=>n=>{if(t?.variants==null)return Nb(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Mb(t)||Mb(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Nb(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Fb=Object.defineProperty,Ib=((e,t)=>{let n={};for(var r in e)Fb(n,r,{get:e[r],enumerable:!0});return t||Fb(n,Symbol.toStringTag,{value:`Module`}),n})({isAny:()=>Xb,isAnyNonArbitrary:()=>tx,isArbitraryFamilyName:()=>vx,isArbitraryImage:()=>bx,isArbitraryLength:()=>hx,isArbitraryNumber:()=>gx,isArbitraryPosition:()=>yx,isArbitraryShadow:()=>xx,isArbitrarySize:()=>px,isArbitraryValue:()=>mx,isArbitraryVariable:()=>Sx,isArbitraryVariableFamilyName:()=>wx,isArbitraryVariableImage:()=>Dx,isArbitraryVariableLength:()=>Cx,isArbitraryVariablePosition:()=>Tx,isArbitraryVariableShadow:()=>Ox,isArbitraryVariableSize:()=>Ex,isArbitraryVariableWeight:()=>kx,isArbitraryWeight:()=>_x,isFraction:()=>Gb,isInteger:()=>qb,isNamedContainerQuery:()=>nx,isNumber:()=>Kb,isPercent:()=>Jb,isTshirtSize:()=>Yb}),Lb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Bb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vb=/\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$/,Hb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ub=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gb=e=>zb.test(e),Kb=e=>!!e&&!Number.isNaN(Number(e)),qb=e=>!!e&&Number.isInteger(Number(e)),Jb=e=>e.endsWith(`%`)&&Kb(e.slice(0,-1)),Yb=e=>Bb.test(e),Xb=()=>!0,Zb=e=>Vb.test(e)&&!Hb.test(e),Qb=()=>!1,$b=e=>Ub.test(e),ex=e=>Wb.test(e),tx=e=>!mx(e)&&!Sx(e),nx=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),rx=(e,t,n)=>{let r=Lb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ix=(e,t,n=!1)=>{let r=Rb.exec(e);return r?r[1]?t(r[1]):n:!1},ax=e=>e===`position`||e===`percentage`,ox=e=>e===`image`||e===`url`,sx=e=>e===`length`||e===`size`||e===`bg-size`,cx=e=>e===`length`,lx=e=>e===`number`,ux=e=>e===`family-name`,dx=e=>e===`number`||e===`weight`,fx=e=>e===`shadow`,px=e=>rx(e,sx,Qb),mx=e=>Lb.test(e),hx=e=>rx(e,cx,Zb),gx=e=>rx(e,lx,Kb),_x=e=>rx(e,dx,Xb),vx=e=>rx(e,ux,Qb),yx=e=>rx(e,ax,Qb),bx=e=>rx(e,ox,ex),xx=e=>rx(e,fx,$b),Sx=e=>Rb.test(e),Cx=e=>ix(e,cx),wx=e=>ix(e,ux),Tx=e=>ix(e,ax),Ex=e=>ix(e,sx),Dx=e=>ix(e,ox),Ox=e=>ix(e,fx,!0),kx=e=>ix(e,dx,!0),Ax=(e,t)=>{let n=Object.keys(e);return n.length===1&&n[0]===t&&typeof e[t]==`string`},jx=e=>typeof e==`function`&&e.isThemeGetter===!0,Mx=e=>({...e,theme:{...e.theme},classGroups:{...e.classGroups},conflictingClassGroups:{...e.conflictingClassGroups},conflictingClassGroupModifiers:{...e.conflictingClassGroupModifiers},orderSensitiveModifiers:[...e.orderSensitiveModifiers],postfixLookupClassGroups:[...e.postfixLookupClassGroups??[]]}),Nx=(e,t)=>{let n=Mx(e);t.prefix!==void 0&&(n.prefix=t.prefix);let r=(e,t)=>{if(t)for(let n in t)t[n]!==void 0&&(e[n]=t[n])},i=t.override;i&&(i.orderSensitiveModifiers&&(n.orderSensitiveModifiers=[...i.orderSensitiveModifiers]),r(n.theme,i.theme),r(n.classGroups,i.classGroups),r(n.conflictingClassGroups,i.conflictingClassGroups),r(n.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers));let a=(e,t)=>{if(t)for(let n in t){let r=t[n];r&&(e[n]=(e[n]??[]).concat(r))}},o=t.extend;return o&&(o.orderSensitiveModifiers&&(n.orderSensitiveModifiers=[...n.orderSensitiveModifiers,...o.orderSensitiveModifiers]),a(n.theme,o.theme),a(n.classGroups,o.classGroups),a(n.conflictingClassGroups,o.conflictingClassGroups),a(n.conflictingClassGroupModifiers,o.conflictingClassGroupModifiers)),n},Px={isAny:0,isAnyNonArbitrary:1,isArbitraryValue:2,isArbitraryVariable:3,isFraction:4,isNumber:5,isInteger:6,isPercent:7,isTshirtSize:8,isNamedContainerQuery:9,isArbitraryLength:10,isArbitraryNumber:11,isArbitraryWeight:12,isArbitraryFamilyName:13,isArbitraryPosition:14,isArbitrarySize:15,isArbitraryImage:16,isArbitraryShadow:17,isArbitraryVariableLength:18,isArbitraryVariableFamilyName:19,isArbitraryVariablePosition:20,isArbitraryVariableSize:21,isArbitraryVariableImage:22,isArbitraryVariableShadow:23,isArbitraryVariableWeight:24},Fx=25,Ix=()=>({names:[],idByName:new Map,impls:{},fnName:new Map,classifierFns:new Map}),Lx=(e,t,n)=>{let r=e.idByName.get(t);return r===void 0&&(r=e.names.length,e.names.push(t),e.idByName.set(t,r),e.classifierFns.set(t,n)),r},Rx=(e,t)=>{if(typeof t==`function`){let n=e.fnName.get(t);return n===void 0&&(n=`$c`+e.fnName.size,e.fnName.set(t,n),e.impls[n]=t),Lx(e,n,t)}let n=t.$v,r=Ib[n];if(Px[n]===void 0||!r)throw Error(`cn: unknown validator "${n}"`);return Lx(e,n,r)},zx=()=>({nextPart:new Map,validators:null,classGroupId:-1,lit:[]}),Bx=(e,t)=>e.theme[t]??[],Vx=(e,t,n)=>{let r=zx(),i=(e,t)=>{for(let n of t.split(`-`)){let t=e.nextPart.get(n);t||(t=zx(),e.nextPart.set(n,t)),e=t}return e},a=(n,r,o)=>{if(typeof n==`string`){let e=n===``?r:i(r,n);e.classGroupId=o;return}if(typeof n==`function`){if(jx(n)){for(let t of n(e.theme))a(t,r,o);return}(r.validators??=[]).push({validatorId:Rx(t,n),groupId:o});return}if(Ax(n,`$t`)){for(let t of Bx(e,n.$t))a(t,r,o);return}if(Ax(n,`$v`)){(r.validators??=[]).push({validatorId:Rx(t,n),groupId:o});return}for(let[e,t]of Object.entries(n)){let n=i(r,e);for(let e of t)a(e,n,o)}};for(let[t,i]of Object.entries(e.classGroups)){let e=n(t);for(let t of i)a(t,r,e)}return r},Hx=e=>{let t=Ix(),n=[],r=new Map,i=e=>{let t=r.get(e);return t===void 0&&(t=n.length,n.push(e),r.set(e,t)),t},a=Vx(e,t,i),o=e=>{if(e.validators)return!1;for(let t of e.nextPart.values())if(!o(t))return!1;return!0},s=(e,t,n)=>{e.classGroupId>=0&&n.push({tail:t,gid:e.classGroupId});for(let[r,i]of e.nextPart)s(i,t+`-`+r,n)},c=e=>{for(let[t,n]of[...e.nextPart])o(n)?(s(n,t,e.lit),e.nextPart.delete(t)):c(n)};c(a);let l=[{edges:new Map,groupId:-1,vlist:-1}],u=()=>(l.push({edges:new Map,groupId:-1,vlist:-1}),l.length-1),d=[],f=new Map,p=e=>{let t=e.map(e=>e.validatorId+`:`+e.groupId).join(`,`),n=f.get(t);return n===void 0&&(n=d.length,d.push(e.map(e=>[e.validatorId,e.groupId])),f.set(t,n)),n},m=(e,t)=>{let n=e;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e),i=l[n].edges.get(r);i===void 0&&(i=u(),l[n].edges.set(r,i)),n=i}return n},h=[],g=(e,t,n)=>{e.classGroupId>=0&&(l[t].groupId=e.classGroupId),e.validators&&(l[t].vlist=p(e.validators));for(let{tail:n,gid:r}of e.lit)h.push({anchor:t,tail:n,gid:r});for(let[r,i]of e.nextPart){let e=t;if(!n){let n=l[t].edges.get(45);n===void 0&&(n=u(),l[t].edges.set(45,n)),e=n}let a=m(e,r);g(i,a,!1)}};g(a,0,!0);let _=new Set(h.map(e=>e.anchor)),v=e=>l[e].groupId>=0||l[e].vlist>=0||_.has(e),y=new Map,b=[],x=e=>{let t=b.length;y.set(e,t);let n={edges:[],groupId:l[e].groupId,vlist:l[e].vlist};b.push(n);let r=[...l[e].edges.entries()].sort((e,t)=>e[0]-t[0]);for(let[e,t]of r){let r=String.fromCharCode(e),i=t;for(;l[i].edges.size===1&&!v(i);){let[[e,t]]=l[i].edges.entries();r+=String.fromCharCode(e),i=t}n.edges.push({label:r,oldTarget:i})}for(let e of n.edges)x(e.oldTarget);return t};x(0);let S=b.length,C=0;for(let e of b)C+=e.edges.length;let w=new Int32Array(S),T=new Int32Array(C),E=``,D=new Int32Array(S),O=new Int32Array(S),k=[];{let e=0;for(let t=0;t<S;t++){let n=b[t];w[t]=n.edges.length;for(let t of n.edges)T[e]=t.label.length,E+=t.label,k.push(y.get(t.oldTarget)),e++;D[t]=n.groupId,O[t]=n.vlist}}{let e=new Int32Array(S);for(let t=S-1;t>=0;t--){let n=1,r=t+1;for(let i=0;i<w[t];i++)n+=e[r],r+=e[r];e[t]=n}let t=0;for(let n=0;n<S;n++){let r=n+1;for(let i=0;i<w[n];i++){if(r!==k[t])throw Error(`cn compiler: edge target mismatch at ${t}`);r+=e[r],t++}}}for(let e of h)e.anchor=y.get(e.anchor);{let e=new Int32Array(d.length).fill(-1),t=[];for(let n=0;n<S;n++){let r=O[n];r>=0&&(e[r]===-1&&(e[r]=t.length,t.push(d[r])),O[n]=e[r])}d.length=0,d.push(...t)}let A=0;for(let e of d)A+=e.length;let j=new Int32Array(A),M=new Int32Array(A);{let e=0;for(let t of d)for(let[n,r]of t)j[e]=n,M[e]=r,e++}h.sort((e,t)=>e.anchor-t.anchor||e.gid-t.gid||(e.tail<t.tail?-1:1));let N=[];for(let e of h){let t=N[N.length-1];t&&t.anchor===e.anchor&&t.gid===e.gid?t.tails.push(e.tail):N.push({anchor:e.anchor,gid:e.gid,tails:[e.tail],set:-1})}let P=new Map,F=[];for(let e of N){let t=e.tails.join(` `),n=P.get(t);n===void 0&&(n=F.length,P.set(t,n),F.push(e.tails)),e.set=n}for(let e of F.flat())if(e.includes(`|`)||e.includes(` `))throw Error(`cn compiler: tail contains delimiter: `+e);let ee=new Set(F.flat()).size;N.sort((e,t)=>e.anchor-t.anchor||e.set-t.set);for(let t of Object.values(e.conflictingClassGroups))for(let e of t)i(e);for(let t of Object.values(e.conflictingClassGroupModifiers))for(let e of t)i(e);for(let t of e.postfixLookupClassGroups??[])i(t);let I=n.length,te=new Int32Array(I).fill(-1),L=0,ne=e=>(te[e]===-1&&(te[e]=L++),te[e]);for(let e=0;e<M.length;e++)M[e]=ne(M[e]);for(let e of N)e.gid=ne(e.gid);for(let e=0;e<D.length;e++)D[e]>=0&&(D[e]=ne(D[e]));for(let e=0;e<I;e++)te[e]===-1&&(te[e]=L++);let re=Array(I);for(let e=0;e<I;e++)re[te[e]]=n[e];let ie=[],ae=[],oe=[],R=[],se=[];for(let t=0;t<I;t++){let n=re[t],i=(e.conflictingClassGroups[n]??[]).map(e=>te[r.get(e)]),a=(e.conflictingClassGroupModifiers[n]??[]).map(e=>te[r.get(e)]);i.length&&(ie.push(t),ae.push(i.length),oe.push(...i));for(let e of a)R.push(t),se.push(e)}let ce=(e.postfixLookupClassGroups??[]).map(e=>te[r.get(e)]),le=[],ue=new Int32Array(j.length);for(let e=0;e<j.length;e++){let n=t.names[j[e]],r=Px[n];if(r!==void 0)ue[e]=r;else{let t=le.indexOf(n);t===-1&&(t=le.length,le.push(n)),ue[e]=Fx+t}}let de=new Map,fe=[],pe=[],me=[];{let e=0;for(let t of d){let n=[];for(let r=0;r<t.length;r++)n.push(ue[e++]);let r=n.join(`,`),i=de.get(r);i===void 0&&(i=fe.length,de.set(r,i),fe.push(n.length),pe.push(...n)),me.push(i)}}let he={};for(let e of le)he[e]=t.classifierFns.get(e);return{G:I,customNames:le,impls:he,edgeCounts:w,edgeLabelLen:T,labelText:E,edgeTargetActual:k,nodeGroup:D,nodeVlist:O,nodeCount:S,totalEdges:C,patCounts:fe,patOps:pe,listPat:me,vlistGroup:M,litEntries:h,sets:F,attachments:N,uniqueTailCount:ee,adjGid:ie,adjCnt:ae,adjTgt:oe,patGid:R,patTgt:se,postfixLookup:ce,orderSensitiveModifiers:e.orderSensitiveModifiers.join(` `),prefix:e.prefix}},Ux=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},Wx=e=>{let t=Hx(e),n=t.litEntries.length,r=new Int32Array(n),i=new Int32Array(n),a=new Int32Array(n),o=``,s=new Int32Array(t.uniqueTailCount*2);{let e=new Map,n=0,c=0;for(let l of t.attachments)for(let u of t.sets[l.set]){let t=e.get(u);t===void 0&&(t=n++,e.set(u,t),s[t*2]=o.length,s[t*2+1]=u.length,o+=u),r[c]=l.anchor,i[c]=l.gid,a[c]=t,c++}}return{tables:{GROUP_COUNT:t.G,edgeStart:Ux(t.edgeCounts),labelStart:Ux(t.edgeLabelLen),labelText:t.labelText,edgeTarget:Int32Array.from(t.edgeTargetActual),nodeGroup:t.nodeGroup,nodeVlist:t.nodeVlist,vlistPat:Ux(t.patCounts),vlistOps:Int32Array.from(t.patOps),vlistRef:Int32Array.from(t.listPat),vlistGroup:t.vlistGroup,litAnchor:r,litGroup:i,litPool:a,poolOffsets:s,poolText:o,adjGid:Int32Array.from(t.adjGid),adjStart:Ux(t.adjCnt),adjTgt:Int32Array.from(t.adjTgt),patGid:Int32Array.from(t.patGid),patTgt:Int32Array.from(t.patTgt),postfixLookupGroups:Int32Array.from(t.postfixLookup),customValidatorNames:t.customNames,orderSensitiveModifiers:t.orderSensitiveModifiers},validatorImpls:t.impls,prefix:t.prefix}},Gx=`line`in Error(),Kx=-1,qx=-1,Jx=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},Yx=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15|0},Xx=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let ee=1;for(;ee<m.length*2;)ee<<=1;let I=new Int32Array(ee).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(Jx(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&ee-1;for(;I[n]!==-1;)n=n+1&ee-1;I[n]=e}let te=(e,t,n,r)=>{let i=(Jx(t,n,r)^Math.imul(e,2654435761)|0)&ee-1,a=r-n;for(;;){let r=I[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&ee-1}},L=n.cacheSize??8192,ne=n.prefix??e.prefix??``,re=ne===``?``:ne+`:`,ie=re.length,ae=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),oe=/\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$/,R=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,se=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ce=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,le=0,ue=-1,de=-1,fe=-1,pe=-1,me=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,he=e=>/\s/.test(String.fromCharCode(e)),ge=(e,t,n)=>{if(le=0,ue=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)le=1;else if(r===40&&i===41)le=2;else return;fe=t+1,pe=n-1;let a=t+1;if(me(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!me(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(ue=t+1,de=a,fe=a+1)}},_e=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},ve=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ye=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,be=e=>!!e&&!Number.isNaN(Number(e)),xe=(e,t,n)=>{if(n-t<11||!_e(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&_e(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&_e(e,t+10,t+18,`-normal/`)},Se=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Ce=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),we=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],Te=(e,t,n,r)=>{if(e>=10){if(e>=25)return ae[e-25](t.slice(n,r));let i=e-10;if(le!==Se[i])return!1;if(ue>=0){for(let e of Ce[i])if(_e(t,ue,de,e))return!0;return!1}switch(we[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(fe,pe);return oe.test(e)&&!R.test(e)}case 3:return be(t.slice(fe,pe));case 4:return ce.test(t.slice(fe,pe));default:return se.test(t.slice(fe,pe))}}switch(e){case 0:return!0;case 1:return le===0;case 2:return le===1;case 3:return le===2;case 4:return ve.test(t.slice(n,r));case 5:return be(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&be(t.slice(n,r-1));case 8:return ye.test(t.slice(n,r));default:return xe(t,n,r)}},Ee=new Set(typeof E==`string`?E.split(` `):E),De=(e,t,n,r,i,a)=>{let o=Jx(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},Oe=new Map,ke=new Map,Ae=2,je=4096,Me=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Ee.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=ke.get(s);return c===void 0&&ke.set(s,c=Ae++),c},Ne=new Map,Pe=r,Fe=r+4096,Ie=()=>Pe++,Le=2097152,Re=8192,ze=new Int32Array(Re),Be=Array(Re).fill(null),Ve=new Int32Array(Re),He=new Int32Array(Re),Ue=new Uint8Array(Re),We=0,Ge=(e,t,n,r,i,a,o,s)=>{let c=e;if(Be[e]!==null){if(Be[e|1]===null)c=e|1;else if(!(We++&3))c=e|We>>2&1;else return}Be[c]=t.slice(n,r),ze[c]=i,Ve[c]=a,He[c]=o,Ue[c]=s},Ke=()=>Be.fill(null),qe=256,Je=[new Int32Array(qe),new Int32Array(qe),new Int32Array(qe),new Int32Array(qe)],[Ye,Xe,Ze,Qe]=Je,$e=new Uint8Array(qe),et=new Uint8Array(qe),tt=()=>{qe*=2,Je=Je.map(e=>{let t=new Int32Array(qe);return t.set(e),t}),[Ye,Xe,Ze,Qe]=Je;let e=new Uint8Array(qe);e.set($e),$e=e,et=new Uint8Array(qe)},nt=64,z=new Int32Array(nt),rt=new Int32Array(nt),it=new Int32Array(r),at=2048,ot=21,st=new Float64Array(at),ct=new Int32Array(at),lt=0,ut=(e,t)=>{if(e===0&&t<r)return it[t]===lt?1:(it[t]=lt,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>ot;for(;ct[i]===lt;){if(st[i]===n)return 1;i=i+1&at-1}return st[i]=n,ct[i]=lt,0},dt=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?Kx:De(Ne,e,t+1,r,0,Ie)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=rt[t];if(r>n)continue;let i=z[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=te(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;ge(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(Te(d[t],e,r,n))return p[h+t]}return Kx},ft=e=>{let t=e.length,n=0,c=0,u=!1;(Ae>je||Oe.size>je)&&(Oe=new Map,ke=new Map,Ae=2,Ke()),Pe>Fe&&(Ne=new Map,Pe=r,Ke());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&he(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&he(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===qe&&tt();let _=n++;Ye[_]=p,Xe[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(ze[y]===v&&Be[y]!==null&&Be[y].length===g?t=y:ze[y|1]===v&&Be[y|1]!==null&&Be[y|1].length===g&&(t=y|1),t>=0){let n=Be[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Ze[_]=Ve[t],Qe[_]=He[t],$e[_]=Ue[t];continue}}}let b=p;if(ie!==0){if(h-p<=ie||!e.startsWith(re,p)){Ze[_]=Kx,Ge(y,e,p,h,v,Kx,0,0);continue}b=p+ie}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,ee=0,I=-1,te=0;(l[0]>=0||N[0]===1)&&(z[0]=0,rt[0]=M,te=1);let L=qx,ne=0;for(let t=M;t<D;t++)if(t===A&&(L=F<ee?qx:P,ne=te),P!==qx){let n=e.charCodeAt(t),r=-1;if(F<ee)o.charCodeAt(F)===n?(F++,F===ee&&(r=P=I)):P=qx;else{let e=i[P],t=i[P+1],c=qx;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,ee=a[i+1],I=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(te===nt){nt*=2;let e=new Int32Array(nt);e.set(z),z=e;let t=new Int32Array(nt);t.set(rt),rt=t}z[te]=r,rt[te]=t+2,te++}}A===D&&(L=F<ee?qx:P,ne=te);let ae=F<ee?qx:P,oe,R=!1;if(A>=0){if(R=!0,oe=dt(e,E,A,L,ne),oe!==Kx&&oe<r&&j[oe]){let t=dt(e,E,D,ae,te);t!==Kx&&t!==oe&&(oe=t,R=!1)}else oe===Kx&&(oe=dt(e,E,D,ae,te),R=!1)}else oe=dt(e,E,D,ae,te);let se=0,ce=0;oe===Kx?Ze[_]=Kx:(ce=+!!R,se=b>=C?+!!O:De(Oe,e,b,C,+!!O,e=>Me(e,O)),Ze[_]=oe,$e[_]=ce,Qe[_]=se),Ge(y,e,p,h,v,oe,se,ce)}if(n===0)return``;if(n===1)return Ye[0]===0&&Xe[0]===t?e:e.slice(Ye[0],Xe[0]);if(n*k>at){for(;n*k>at;)at<<=1,ot--;st=new Float64Array(at),ct=new Int32Array(at)}if(Ae>=Le||Pe>=Le)throw Error(`cn: too many distinct classes in one merge`);lt=lt+1|0,lt===0&&(it.fill(0),ct.fill(0),lt=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Ze[e];if(t===Kx){et[e]=1;continue}let n=Qe[e];if(ut(n,t)===1){et[e]=0,f=!0;continue}if(et[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)ut(n,x[e]);if($e[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&ut(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!et[m]){m++;continue}let t=Ye[m],r=Xe[m],i=m+1;for(;i<n&&et[i]&&Ye[i]===r+1&&e.charCodeAt(r)===32;)r=Xe[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},pt=16384,mt=new Int32Array(pt*2),ht=0,gt=1,_t=Object.create(null),vt=Object.create(null),yt=new Map,bt=new Map,xt=0,St=0,Ct=()=>{ht^=pt,gt=gt+1|0,St=0},wt=e=>{let t=_t[e];if(t!==void 0)return t;let n=Yx(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=vt[e],t!==void 0)?(_t[e]=t,t):(t=ft(e),i?(_t[e]=t,++xt>L&&(xt=0,vt=_t,_t=Object.create(null),Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Tt=e=>{let t=yt.get(e);if(t!==void 0)return t;let n=Yx(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=bt.get(e),t!==void 0)?(yt.set(e,t),t):(t=ft(e),i?(yt.set(e,t),++xt>L&&(xt=0,bt=yt,yt=new Map,Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Et=e=>{let t=Yx(e,0,e.length),n=(t&16383)+ht;return mt[n]===(t^gt)||mt[n^pt]===(t^gt-1)||(mt[n]=t^gt,++St>pt&&Ct(),!1)},Dt=L===0?ft:Gx?e=>{let t=yt.get(e);return t===void 0?Tt(e):t}:wt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?Dt(arguments[0]):Dt($x.apply(null,arguments))},mergeString:Dt,seenBefore:L===0?()=>!1:Et,mergeUncached:ft}},Zx=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:Zx(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},Qx=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:Zx(i,t);a&&(n&&(n+=` `),n+=a)}return n},$x=function(){return Qx(arguments,!1)},eS=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},l=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},u=(t,c)=>{let u=t.length,d=s===null?null:s.n;if(!c){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let f=``,p=-1,m=0,h=!1;for(let e=0;e<u;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=Zx(n,!0),!n)continue;h=!0}p<0&&(f=n,p=e),m++}}if(m===0)return``;if(m===1)return e(f);if(h){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let g=i.get(f);g===void 0&&(g=a.get(f),g!==void 0&&i.set(f,g));let _=null;if(g!==void 0)outer:for(let e=0;e<g.length;e++){let n=g[e];if(n.t!==m)continue;let r=n.a,i=1;for(let e=p+1;e<u;e++){let n=t[e];if(n&&n!==r[i++])continue outer}_=n;break}if(_===null){let s=f,c=[f];for(let e=p+1;e<u;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);_={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},g===void 0&&i.set(f,g=[]),g.length>=256&&g.shift(),g.push(_),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==_&&(s.n=_),s=_,_.r},d=t=>Array.isArray(t)?u(t.slice(),!1):e(Zx(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},tS=`{"theme":{"animate":[{"$v":"isAny"}],"aspect":["video"],"blur":[{"$v":"isTshirtSize"}],"breakpoint":[{"$v":"isTshirtSize"}],"color":[{"$v":"isAny"}],"container":[{"$v":"isTshirtSize"}],"drop-shadow":[{"$v":"isTshirtSize"}],"ease":["in","out","in-out"],"font":[{"$v":"isAnyNonArbitrary"}],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[{"$v":"isTshirtSize"}],"leading":["none","tight","snug","normal","relaxed","loose"],"perspective":["dramatic","near","normal","midrange","distant","none"],"radius":[{"$v":"isTshirtSize"}],"shadow":[{"$v":"isTshirtSize"}],"spacing":["px",{"$v":"isNumber"}],"text":[{"$v":"isTshirtSize"}],"text-shadow":[{"$v":"isTshirtSize"}],"tracking":["tighter","tight","normal","wide","wider","widest"]},"classGroups":{"aspect":[{"aspect":["auto","square",{"$v":"isFraction"},{"$v":"isArbitraryValue"},{"$v":"isArbitraryVariable"},{"$t":"aspect"}]}],"container":["container"],"container-type":[{"@container":["","normal","size",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"container-named":[{"$v":"isNamedContainerQuery"}],"columns":[{"columns":[{"$v":"isNumber"},{"$v":"isArbitraryValue"},{"$v":"isArbitraryVariable"},{"$t":"container"}]},"columns-auto"],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"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":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"overflow":[{"overflow":["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],"overscroll":[{"overscroll":["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],"position":["static","fixed","absolute","relative","sticky"],"inset":[{"inset":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-x":[{"inset-x":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-y":[{"inset-y":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"start":[{"inset-s":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}],"start":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"end":[{"inset-e":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}],"end":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-bs":[{"inset-bs":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-be":[{"inset-be":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"top":[{"top":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"right":[{"right":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"bottom":[{"bottom":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"left":[{"left":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"visibility":["visible","invisible","collapse"],"z":[{"z":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"basis":[{"basis":[{"$v":"isFraction"},"full","auto",{"$t":"container"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"flex-direction":[{"flex":["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{"flex":["nowrap","wrap","wrap-reverse"]}],"flex":[{"flex":[{"$v":"isNumber"},{"$v":"isFraction"},"auto","initial","none",{"$v":"isArbitraryValue"}]}],"grow":[{"grow":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"shrink":[{"shrink":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"order":[{"order":[{"$v":"isInteger"},"first","last","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-cols":[{"grid-cols":[{"$v":"isInteger"},"none","subgrid",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-start-end":[{"col":["auto",{"span":["full",{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-start":[{"col-start":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-end":[{"col-end":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-rows":[{"grid-rows":[{"$v":"isInteger"},"none","subgrid",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-start-end":[{"row":["auto",{"span":["full",{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-start":[{"row-start":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-end":[{"row-end":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"auto-cols":[{"$t":"spacing"}]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"auto-rows":[{"$t":"spacing"}]}],"gap":[{"gap":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"gap-x":[{"gap-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"gap-y":[{"gap-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"justify-content":[{"justify":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{"content":["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{"items":["start","end","center","stretch","center-safe","end-safe",{"baseline":["","last"]}]}],"align-self":[{"self":["auto","start","end","center","stretch","center-safe","end-safe",{"baseline":["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"p":[{"p":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"px":[{"px":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"py":[{"py":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ps":[{"ps":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pe":[{"pe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pbs":[{"pbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pbe":[{"pbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pt":[{"pt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pr":[{"pr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pb":[{"pb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pl":[{"pl":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"m":[{"m":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mx":[{"mx":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"my":[{"my":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ms":[{"ms":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"me":[{"me":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mbs":[{"mbs":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mbe":[{"mbe":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mt":[{"mt":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mr":[{"mr":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mb":[{"mb":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ml":[{"ml":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-x":[{"space-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-y-reverse":["space-y-reverse"],"size":[{"size":[{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inline-size":[{"inline":["auto",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"inline":[{"$t":"container"}]}],"min-inline-size":[{"min-inline":["auto",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"min-inline":[{"$t":"container"}]}],"max-inline-size":[{"max-inline":["none",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"max-inline":[{"$t":"container"}]}],"block-size":[{"block":["auto",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-block-size":[{"min-block":["auto",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-block-size":[{"max-block":["none",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"w":[{"w":[{"$t":"container"},"screen",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-w":[{"min-w":[{"$t":"container"},"screen","none",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-w":[{"max-w":[{"$t":"container"},"screen","none","prose",{"screen":[{"$t":"breakpoint"}]},{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"h":[{"h":["screen","lh",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-h":[{"min-h":["screen","lh","none",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-h":[{"max-h":["screen","lh",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},"max-h-none"],"font-size":[{"text":["base",{"$t":"text"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{"font":[{"$t":"font-weight"},{"$v":"isArbitraryVariableWeight"},{"$v":"isArbitraryWeight"}]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",{"$v":"isPercent"},{"$v":"isArbitraryValue"}]}],"font-family":[{"font":[{"$v":"isArbitraryVariableFamilyName"},{"$v":"isArbitraryFamilyName"},{"$t":"font"}]}],"font-features":[{"font-features":[{"$v":"isArbitraryValue"}]}],"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":[{"$t":"tracking"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"line-clamp":[{"line-clamp":[{"$v":"isNumber"},"none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryNumber"}]}],"leading":[{"leading":[{"$t":"leading"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"list-image":[{"list-image":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"list-style-position":[{"list":["inside","outside"]}],"list-style-type":[{"list":["disc","decimal","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-alignment":[{"text":["left","center","right","justify","start","end"]}],"placeholder-color":[{"placeholder":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-color":[{"text":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{"decoration":["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{"decoration":[{"$v":"isNumber"},"from-font","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryLength"}]}],"text-decoration-color":[{"decoration":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"underline-offset":[{"underline-offset":[{"$v":"isNumber"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{"text":["wrap","nowrap","balance","pretty"]}],"indent":[{"indent":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"tab-size":[{"tab":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"vertical-align":[{"align":["baseline","top","middle","bottom","text-top","text-bottom","sub","super",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"whitespace":[{"whitespace":["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],"break":[{"break":["normal","words","all","keep"]}],"wrap":[{"wrap":["break-word","anywhere","normal"]}],"hyphens":[{"hyphens":["none","manual","auto"]}],"content":[{"content":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"bg-attachment":[{"bg":["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{"bg":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"},{"position":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"bg-repeat":[{"bg":["no-repeat",{"repeat":["","x","y","space","round"]}]}],"bg-size":[{"bg":["auto","cover","contain",{"$v":"isArbitraryVariableSize"},{"$v":"isArbitrarySize"},{"size":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"bg-image":[{"bg":["none",{"linear":[{"to":["t","tr","r","br","b","bl","l","tl"]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}],"radial":["",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}],"conic":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isArbitraryVariableImage"},{"$v":"isArbitraryImage"}]},{"bg-gradient-to":["t","tr","r","br","b","bl","l","tl"]},"bg-conic"],"bg-color":[{"bg":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-from-pos":[{"from":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-via-pos":[{"via":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-to-pos":[{"to":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-from":[{"from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-via":[{"via":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-to":[{"to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded":[{"rounded":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-s":[{"rounded-s":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-e":[{"rounded-e":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-t":[{"rounded-t":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-r":[{"rounded-r":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-b":[{"rounded-b":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-l":[{"rounded-l":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-ss":[{"rounded-ss":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-se":[{"rounded-se":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-ee":[{"rounded-ee":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-es":[{"rounded-es":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-tl":[{"rounded-tl":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-tr":[{"rounded-tr":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-br":[{"rounded-br":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-bl":[{"rounded-bl":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-w":[{"border":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-x":[{"border-x":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-y":[{"border-y":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-s":[{"border-s":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-e":[{"border-e":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-bs":[{"border-bs":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-be":[{"border-be":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-t":[{"border-t":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-r":[{"border-r":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-b":[{"border-b":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-l":[{"border-l":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-x":[{"divide-x":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{"border":["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{"divide":["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{"border":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-x":[{"border-x":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-y":[{"border-y":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-s":[{"border-s":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-e":[{"border-e":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-bs":[{"border-bs":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-be":[{"border-be":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-t":[{"border-t":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-r":[{"border-r":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-b":[{"border-b":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-l":[{"border-l":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"divide-color":[{"divide":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"outline-style":[{"outline":["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"outline-w":[{"outline":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"outline-color":[{"outline":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"shadow":[{"shadow":["","none",{"$t":"shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]},"shadow-inner"],"shadow-color":[{"shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"inset-shadow":[{"inset-shadow":["none",{"$t":"inset-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"inset-shadow-color":[{"inset-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ring-w":[{"ring":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"ring-w-inset":["ring-inset"],"ring-color":[{"ring":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ring-offset-w":[{"ring-offset":[{"$v":"isNumber"},{"$v":"isArbitraryLength"}]}],"ring-offset-color":[{"ring-offset":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"inset-ring-w":[{"inset-ring":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"inset-ring-color":[{"inset-ring":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-shadow":[{"text-shadow":["none",{"$t":"text-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"text-shadow-color":[{"text-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"opacity":[{"opacity":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{"mask":["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[{"$v":"isNumber"}]}],"mask-image-linear-from-pos":[{"mask-linear-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-linear-to-pos":[{"mask-linear-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-linear-from-color":[{"mask-linear-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-linear-to-color":[{"mask-linear-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-t-from-pos":[{"mask-t-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-t-to-pos":[{"mask-t-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-t-from-color":[{"mask-t-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-t-to-color":[{"mask-t-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-r-from-pos":[{"mask-r-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-r-to-pos":[{"mask-r-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-r-from-color":[{"mask-r-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-r-to-color":[{"mask-r-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-b-from-pos":[{"mask-b-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-b-to-pos":[{"mask-b-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-b-from-color":[{"mask-b-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-b-to-color":[{"mask-b-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-l-from-pos":[{"mask-l-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-l-to-pos":[{"mask-l-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-l-from-color":[{"mask-l-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-l-to-color":[{"mask-l-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-x-from-pos":[{"mask-x-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-x-to-pos":[{"mask-x-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-x-from-color":[{"mask-x-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-x-to-color":[{"mask-x-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-y-from-pos":[{"mask-y-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-y-to-pos":[{"mask-y-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-y-from-color":[{"mask-y-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-y-to-color":[{"mask-y-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial":[{"mask-radial":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-from-pos":[{"mask-radial-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-radial-to-pos":[{"mask-radial-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-radial-from-color":[{"mask-radial-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-to-color":[{"mask-radial-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{"closest":["side","corner"],"farthest":["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[{"$v":"isNumber"}]}],"mask-image-conic-from-pos":[{"mask-conic-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-conic-to-pos":[{"mask-conic-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-conic-from-color":[{"mask-conic-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-conic-to-color":[{"mask-conic-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-mode":[{"mask":["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{"mask":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"},{"position":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"mask-repeat":[{"mask":["no-repeat",{"repeat":["","x","y","space","round"]}]}],"mask-size":[{"mask":["auto","cover","contain",{"$v":"isArbitraryVariableSize"},{"$v":"isArbitrarySize"},{"size":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{"mask":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"filter":[{"filter":["","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"blur":[{"blur":["","none",{"$t":"blur"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"brightness":[{"brightness":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"contrast":[{"contrast":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"drop-shadow":[{"drop-shadow":["","none",{"$t":"drop-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"drop-shadow-color":[{"drop-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grayscale":[{"grayscale":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"hue-rotate":[{"hue-rotate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"invert":[{"invert":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"saturate":[{"saturate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"sepia":[{"sepia":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-filter":[{"backdrop-filter":["","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-blur":[{"backdrop-blur":["","none",{"$t":"blur"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-brightness":[{"backdrop-brightness":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-contrast":[{"backdrop-contrast":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-grayscale":[{"backdrop-grayscale":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-invert":[{"backdrop-invert":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-opacity":[{"backdrop-opacity":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-saturate":[{"backdrop-saturate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-sepia":[{"backdrop-sepia":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-collapse":[{"border":["collapse","separate"]}],"border-spacing":[{"border-spacing":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"border-spacing-x":[{"border-spacing-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"border-spacing-y":[{"border-spacing-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"table-layout":[{"table":["auto","fixed"]}],"caption":[{"caption":["top","bottom"]}],"transition":[{"transition":["","all","colors","opacity","shadow","transform","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transition-behavior":[{"transition":["normal","discrete"]}],"duration":[{"duration":[{"$v":"isNumber"},"initial",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ease":[{"ease":["linear","initial",{"$t":"ease"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"delay":[{"delay":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"animate":[{"animate":["none",{"$t":"animate"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backface":[{"backface":["hidden","visible"]}],"perspective":[{"perspective":[{"$t":"perspective"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"perspective-origin":[{"perspective-origin":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate":[{"rotate":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-x":[{"rotate-x":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-y":[{"rotate-y":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-z":[{"rotate-z":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale":[{"scale":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-x":[{"scale-x":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-y":[{"scale-y":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-z":[{"scale-z":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-3d":["scale-3d"],"skew":[{"skew":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"skew-x":[{"skew-x":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"skew-y":[{"skew-y":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transform":[{"transform":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},"","none","gpu","cpu"]}],"transform-origin":[{"origin":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transform-style":[{"transform":["3d","flat"]}],"translate":[{"translate":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-x":[{"translate-x":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-y":[{"translate-y":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-z":[{"translate-z":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-none":["translate-none"],"zoom":[{"zoom":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"accent":[{"accent":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"appearance":[{"appearance":["none","auto"]}],"caret-color":[{"caret":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"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",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],"resize":[{"resize":["none","","y","x"]}],"scroll-behavior":[{"scroll":["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scrollbar-track-color":[{"scrollbar-track":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{"scrollbar":["auto","thin","none"]}],"scroll-m":[{"scroll-m":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mx":[{"scroll-mx":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-my":[{"scroll-my":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ms":[{"scroll-ms":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-me":[{"scroll-me":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mbs":[{"scroll-mbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mbe":[{"scroll-mbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mt":[{"scroll-mt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mr":[{"scroll-mr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mb":[{"scroll-mb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ml":[{"scroll-ml":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-p":[{"scroll-p":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-px":[{"scroll-px":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-py":[{"scroll-py":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ps":[{"scroll-ps":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pe":[{"scroll-pe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pbs":[{"scroll-pbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pbe":[{"scroll-pbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pt":[{"scroll-pt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pr":[{"scroll-pr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pb":[{"scroll-pb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pl":[{"scroll-pl":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"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",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"fill":[{"fill":["none",{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"stroke-w":[{"stroke":[{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"},{"$v":"isArbitraryNumber"}]}],"stroke":[{"stroke":["none",{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}],"contain":[{"contain":["none","content","strict",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"contain-size":[{"contain":["size","inline-size"]}],"contain-layout":["contain-layout"],"contain-paint":["contain-paint"],"contain-style":["contain-style"]},"conflictingClassGroups":{"container-named":["container-type"],"overflow":["overflow-x","overflow-y"],"overscroll":["overscroll-x","overscroll-y"],"inset":["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],"px":["pr","pl"],"py":["pt","pb"],"m":["mx","my","ms","me","mbs","mbe","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-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","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-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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"],"contain":["contain-size","contain-layout","contain-paint","contain-style"],"contain-size":["contain"],"contain-layout":["contain"],"contain-paint":["contain"],"contain-style":["contain"]},"conflictingClassGroupModifiers":{"font-size":["leading"]},"orderSensitiveModifiers":["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"],"postfixLookupClassGroups":["container-type"]}`,nS=()=>JSON.parse(tS),rS=e=>`classGroups`in e&&`theme`in e&&`conflictingClassGroups`in e,iS=e=>e===void 0?{config:nS()}:typeof e==`function`?{config:e(nS())}:rS(e)?{config:e}:{config:Nx(nS(),e),cacheSize:e.cacheSize},aS=e=>{let{config:t,cacheSize:n}=iS(e),{tables:r,validatorImpls:i,prefix:a}=Wx(t);return Xx(r,i,{cacheSize:n,prefix:a})},$=(e=>{let t=null,n=()=>t??=aS(e);return eS(e=>n().mergeString(e),{seenBefore:e=>n().seenBefore(e),mergeUncached:e=>n().mergeUncached(e)})})({extend:{theme:{spacing:[...kb]}}});function oS(e,t){return typeof e==`function`?e(t):e}var sS={neutral:`alert-neutral`,primary:`alert-primary`,secondary:`alert-secondary`,accent:`alert-accent`,success:`alert-success`,info:`alert-info`,warning:`alert-warning`,error:`alert-error`},cS=(0,J.forwardRef)(function({action:e,children:t,className:n,description:r,title:i,tone:a=`neutral`,...o},s){return(0,X.jsxs)(`div`,{...o,className:$(`alert caps-alert`,sS[a],n),"data-tone":a,role:o.role??`alert`,ref:s,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[i?(0,X.jsx)(`h3`,{className:`font-semibold`,children:i}):null,r?(0,X.jsx)(`p`,{className:`text-sm`,children:r}):null,t]}),e?(0,X.jsx)(`div`,{className:`shrink-0`,children:e}):null]})}),lS=(0,J.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,X.jsx)(`ul`,{...n,className:$(`list`,t===`compact`&&`list-sm`,e),ref:r})}),uS=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`li`,{...t,className:$(`list-row`,e),ref:n})}),dS=(0,J.forwardRef)(function({aside:e,children:t,className:n,level:r=2,...i},a){return(0,X.jsxs)(r===3?`h3`:`h2`,{...i,className:$(`caps-data-list-heading`,n),ref:a,children:[(0,X.jsx)(`span`,{children:t}),e===void 0?null:(0,X.jsx)(`span`,{className:`caps-data-list-heading-aside`,children:e})]})}),fS=Pb(`card caps-card`,{variants:{variant:{surface:`caps-card-surface`,outline:`caps-card-outline`,interactive:`caps-card-interactive`,game:`caps-card-game caps-card-interactive`,fit:`caps-card-fit`},density:{regular:``,compact:`caps-card-compact`}},defaultVariants:{variant:`surface`,density:`regular`}}),pS=(0,J.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,X.jsx)(`div`,{...a,className:$(fS({density:t,variant:i}),n&&`caps-card-featured`,e),"data-state":r,ref:o})});(0,J.forwardRef)(function({className:e,density:t,variant:n,width:r=`default`,...i},a){return(0,X.jsx)(`main`,{className:`caps-centered-card-stage`,children:(0,X.jsx)(pS,{...i,className:$(`caps-centered-card`,r===`wide`&&`caps-centered-card-wide`,e),ref:a,variant:n??`surface`,...t?{density:t}:{}})})});var mS=(0,J.forwardRef)(function({alignment:e=`start`,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:$(`caps-card-header`,e===`center`&&`caps-card-header-centered`,t),ref:r})}),hS=(0,J.forwardRef)(function({className:e,level:t=3,...n},r){return(0,X.jsx)(t===2?`h2`:`h3`,{...n,className:$(`caps-card-title`,e),ref:r})});(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`p`,{...t,className:$(`caps-card-description`,e),ref:n})});var gS=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:$(`caps-card-content`,e),ref:n})}),_S=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:$(`caps-card-footer`,e),ref:n})});function vS(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function yS(...e){return t=>{let n=!1,r=e.map(e=>{let r=vS(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():vS(e[t],null)}}}}function bS(...e){return J.useCallback(yS(...e),e)}function xS(e){let t=J.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];kS(r)&&typeof NS==`function`&&(r=NS(r._payload)),J.Children.forEach(r,e=>{if(DS(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;kS(n)&&typeof NS==`function`&&(n=NS(n._payload)),a=wS(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=J.cloneElement(a,void 0,s):!o&&J.Children.count(r)===1&&J.isValidElement(r)&&(a=r);let c=a?ES(a):void 0,l=bS(n,c);if(!a){if(r||r===0)throw Error(o?MS(e):jS(e));return r}let u=TS(i,a.props??{});return a.type!==J.Fragment&&(u.ref=n?l:c),J.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var SS=xS(`Slot`),CS=Symbol.for(`radix.slottable`),wS=(e,t)=>{if(`child`in e.props){let t=e.props.child;return J.isValidElement(t)?J.cloneElement(t,void 0,e.props.children(t.props.children)):null}return J.isValidElement(t)?t:null};function TS(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ES(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function DS(e){return J.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===CS}var OS=Symbol.for(`react.lazy`);function kS(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===OS&&`_payload`in e&&AS(e._payload)}function AS(e){return typeof e==`object`&&!!e&&`then`in e}var jS=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,MS=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,NS=J.use,PS=Object.freeze({reduced:!1,squish:90,fast:120,normal:180,slow:280,springDuration:320,bounce:.3,stretch:.28,distance:4,stagger:24,blur:0,shake:3,steps:0,fuse:1,pressDepth:.5,pressScale:1,ease:`cubic-bezier(0.2, 0, 0, 1)`,easeExit:`cubic-bezier(0.4, 0, 1, 1)`}),FS=`(prefers-reduced-motion: reduce)`;function IS(e){let t=e.ownerDocument.defaultView;if(!t)return PS;let n=t.getComputedStyle(e),r=(e,t)=>{let r=n.getPropertyValue(e).trim(),i=Number.parseFloat(r);return Number.isFinite(i)?Math.max(0,i):t},i=(e,t)=>{let i=n.getPropertyValue(e).trim();return r(e,t)*(i.endsWith(`s`)&&!i.endsWith(`ms`)?1e3:1)},a=t.matchMedia?.(FS).matches??!1,o=(e,t)=>a?120:i(`--stipe-motion-${e}`,t),s=(e,t)=>a?0:r(`--stipe-motion-${e}`,t);return{reduced:a,squish:o(`squish`,PS.squish),fast:o(`fast`,PS.fast),normal:o(`normal`,PS.normal),slow:o(`slow`,PS.slow),springDuration:o(`spring-duration`,PS.springDuration),bounce:Math.min(1,s(`bounce`,PS.bounce)),stretch:s(`stretch`,PS.stretch),distance:s(`distance`,PS.distance),stagger:a?0:i(`--stipe-motion-stagger`,PS.stagger),blur:s(`blur`,PS.blur),shake:s(`shake`,PS.shake),steps:Math.floor(s(`steps`,PS.steps)),fuse:r(`--stipe-motion-fuse`,PS.fuse),pressDepth:a?0:r(`--stipe-press-depth`,PS.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,PS.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||PS.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||PS.easeExit}}function LS(e){let[t,n]=(0,J.useState)(()=>({...PS,reduced:!0}));return(0,J.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=IS(t);n(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};i();let a=new r.MutationObserver(i);for(let e=t;e;e=e.parentElement)a.observe(e,{attributes:!0,attributeFilter:[`data-theme`,`class`,`style`]});let o=r.matchMedia?.(FS);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function RS(e,t){return e.reduced?0:Math.round(t*e.normal/PS.normal)}function zS(e,t){if(e.reduced)return 0;let n=t*e.bounce/PS.bounce;return Math.min(.9,Math.max(0,n))}function BS(e,t){return e.reduced?0:Math.round(t*e.springDuration/PS.springDuration)}function VS(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function HS(e){return`animate`in e}var US=globalThis;function WS(){return US.matchMedia?.(FS).matches??!1}function GS(e){let t=US.matchMedia?.(FS);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function KS(){return!0}function qS(){return(0,J.useSyncExternalStore)(GS,WS,KS)}var JS=(0,J.forwardRef)(function({asChild:e=!1,className:t,...n},r){let i=$(`absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]`,t);return e?(0,X.jsx)(SS,{...n,className:i,ref:r}):(0,X.jsx)(`span`,{...n,className:i,ref:r})}),YS=typeof window<`u`,XS=YS?window:null,ZS=YS?document:null,QS={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},$S={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},eC={NONE:0,AUTO:1,FORCE:2},tC={replace:0,none:1,blend:2},nC=Symbol(),rC=Symbol(),iC=Symbol(),aC=Symbol(),oC=Symbol(),sC=1e-11,cC=0xe8d4a51000,lC=1e3,uC=[],dC=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),fC=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],pC=fC.reduce((e,t)=>({...e,[t]:t+`(`}),{}),mC=()=>{},hC=e=>e,gC=/\)\s*[-.\d]/,_C=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,vC=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,yC=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,bC=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,xC=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,SC=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,CC=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,wC=/([a-z])([A-Z])/g,TC=/(\*=|\+=|-=)/,EC=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,DC={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:lC,delay:0,loopDelay:0,ease:`out(2)`,composition:tC.replace,modifier:hC,onBegin:mC,onBeforeUpdate:mC,onUpdate:mC,onLoop:mC,onPause:mC,onComplete:mC,onRender:mC},OC={current:null,root:ZS},kC={defaults:DC,precision:4,timeScale:1,tickThreshold:200,editor:null},AC={version:`4.5.0`,engine:null};YS&&(XS.AnimeJS||=[],XS.AnimeJS.push(AC));var jC=e=>e.replace(wC,`$1-$2`).toLowerCase(),MC=(e,t)=>e.indexOf(t)===0,NC=Date.now,PC=Array.isArray,FC=e=>e&&e.constructor===Object,IC=e=>typeof e==`number`&&!isNaN(e),LC=e=>typeof e==`string`,RC=e=>typeof e==`function`,zC=e=>e===void 0,BC=e=>zC(e)||e===null,VC=e=>YS&&e instanceof SVGElement,HC=e=>_C.test(e),UC=e=>MC(e,`rgb`),WC=e=>MC(e,`hsl`),GC=e=>HC(e)||(UC(e)||WC(e))&&(e[e.length-1]===`)`||!gC.test(e)),KC=e=>!kC.defaults.hasOwnProperty(e),qC=[`opacity`,`rotate`,`overflow`,`color`],JC=(e,t)=>{if(qC.includes(t))return!1;if(e.getAttribute(t)||t in e){if(t===`scale`){let t=e.parentNode;return t&&t.tagName===`filter`}return!0}},YC=Math.pow,XC=Math.sqrt,ZC=Math.sin,QC=Math.cos,$C=Math.abs,ew=Math.exp,tw=Math.ceil,nw=Math.floor,rw=Math.asin,iw=Math.PI,aw=Math.round,ow=(e,t,n)=>e<t?t:e>n?n:e,sw=(e,t)=>{if(t<0)return e;if(!t)return aw(e);let n=10**t;return aw(e*n)/n},cw=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,lw=e=>e===1/0?cC:e===-1/0?-cC:e,uw=e=>e<=1e-11?sC:lw(sw(e,11)),dw=e=>PC(e)?[...e]:e,fw=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=zC(i)?t[r]:i}return n},pw=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._head,o=i;for(n&&(a=e._tail,o=r);a;){let e=a[o];t(a),a=e}},mw=(e,t,n=`_prev`,r=`_next`)=>{let i=t[n],a=t[r];i?i[r]=a:e._head=a,a?a[n]=i:e._tail=i,t[n]=null,t[r]=null},hw=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._tail;for(;a&&n&&n(a,t);)a=a[r];let o=a?a[i]:e._head;a?a[i]=t:e._head=t,o?o[r]=t:e._tail=t,t[r]=a,t[i]=o},gw=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[aC],a=0,o=r.length,s;for(;a<o;){for(;a<o&&r.charCodeAt(a)===32;)a++;if(a>=o)break;let e=a;for(;a<o&&r.charCodeAt(a)!==40;)a++;if(a>=o)break;let t=r.substring(e,a),n=1,c=a+1,l=-1,u=-1;for(a++;a<o&&n>0;){let e=r.charCodeAt(a);e===40?n++:e===41?n--:e===44&&n===1&&(l===-1?l=a:u===-1&&(u=a)),a++}let d=a-1;t===`translate`||t===`translate3d`?(l===-1?i.translateX=r.substring(c,d).trim():(i.translateX=r.substring(c,l).trim(),u===-1?i.translateY=r.substring(l+1,d).trim():(i.translateY=r.substring(l+1,u).trim(),i.translateZ=r.substring(u+1,d).trim())),s=r.substring(c,d)):t===`scale`||t===`scale3d`?l===-1?i.scale=r.substring(c,d).trim():(i.scaleX=r.substring(c,l).trim(),u===-1?i.scaleY=r.substring(l+1,d).trim():(i.scaleY=r.substring(l+1,u).trim(),i.scaleZ=r.substring(u+1,d).trim())):i[t]=r.substring(c,d)}if(t===`translate3d`&&s)return n&&(n[t]=s),s;let c=i[t];if(!zC(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:MC(t,`scale`)?`1`:MC(t,`rotate`)||MC(t,`skew`)?`0deg`:`0px`},_w=e=>{let t=``;for(let n=0,r=fC.length;n<r;n++){let r=fC[n],i=e[r];if(i!==void 0){if(r===`translateX`){let r=e.translateY;if(r!==void 0){let a=e.translateZ;a===void 0?(t+=`translate(${i},${r}) `,n+=1):(t+=`translate3d(${i},${r},${a}) `,n+=2);continue}}if(r===`scaleX`&&e.scale===void 0){let r=e.scaleY;if(r!==void 0){let a=e.scaleZ;a===void 0?(t+=`scale(${i},${r}) `,n+=1):(t+=`scale3d(${i},${r},${a}) `,n+=2);continue}}t+=`${pC[r]}${i}) `}r===`rotateZ`&&e.rotate3d!==void 0&&(t+=`rotate3d(${e.rotate3d}) `)}return e.matrix!==void 0&&(t+=`matrix(${e.matrix}) `),e.matrix3d!==void 0&&(t+=`matrix3d(${e.matrix3d}) `),t},vw=[];function yw(e,t){if(!e)return null;let n=vw.length;outer:for(let r=0;r<n;r++){let n=vw[r];if(n.detect&&!n.detect(e))continue;let i=n.targetAdapters;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(r.detect(e)){let n=r.props[t];if(n&&(!n.gate||n.gate(e)))return n;break outer}}}for(let r=0;r<n;r++){let n=vw[r];if(n.detect&&!n.detect(e))continue;let i=n.propertyResolvers;for(let n=0,r=i.length;n<r;n++){let r=i[n](e,t);if(r)return r}}return null}var bw=e=>{let t=vC.exec(e)||yC.exec(e),n=zC(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},xw=e=>{let t=e.length,n=t===4||t===5;return[+(`0x`+e[1]+e[n?1:2]),+(`0x`+e[n?2:3]+e[n?2:4]),+(`0x`+e[n?3:5]+e[n?3:6]),t===5||t===9?+((`0x`+e[n?4:7]+e[n?4:8])/255).toFixed(3):1]},Sw=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Cw=e=>{let t=bC.exec(e)||xC.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=zC(t[4])?1:+t[4],o,s,c;if(r===0)o=s=c=i;else{let e=i<.5?i*(1+r):i+r-i*r,t=2*i-e;o=sw(Sw(t,e,n+1/3)*255,0),s=sw(Sw(t,e,n)*255,0),c=sw(Sw(t,e,n-1/3)*255,0)}return[o,s,c,a]},ww=e=>UC(e)?bw(e):HC(e)?xw(e):WC(e)?Cw(e):[0,0,0,1],Tw=(e,t)=>zC(e)?t:e,Ew=(e,t)=>{let n=e.match(EC),r=t[rC]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},Dw=(e,t,n,r,i,a)=>{if(RC(e)){if(!i){let i=e(t,n,r,a);return isNaN(+i)?i||0:+i}let o=()=>{let i=e(t,n,r,a);return isNaN(+i)?i||0:+i};return i.func=o,o()}if(LC(e)&&MC(e,`var(`)){if(!i)return Ew(e,t);let n=()=>Ew(e,t);return i.func=n,n()}return e},Ow=(e,t)=>e[rC]?e[iC]&&JC(e,t)?QS.ATTRIBUTE:fC.includes(t)||dC.get(t)?QS.TRANSFORM:MC(t,`--`)?QS.CSS_VAR:t in e.style?QS.CSS:t in e?QS.OBJECT:QS.ATTRIBUTE:QS.OBJECT,kw=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[oC]||e).getPropertyValue(t);return i===`auto`?`0`:i},Aw=(e,t,n,r)=>{let i=zC(n)?Ow(e,t):n,a=yw(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===QS.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===QS.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===QS.TRANSFORM?gw(e,t,r):i===QS.CSS_VAR?kw(e,t,r).trimStart():kw(e,t,r)},jw=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,Mw=()=>({t:$S.NUMBER,n:0,u:null,o:null,d:null,s:null}),Nw=(e,t)=>{if(t.t=$S.NUMBER,t.n=0,t.u=null,t.o=null,t.d=null,t.s=null,!e)return t;let n=+e;if(!isNaN(n))return t.n=n,t;let r=e;r[1]===`=`&&(t.o=r[0],r=r.slice(2));let i=!r.includes(` `)&&CC.exec(r);if(i)return t.t=$S.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(GC(r))return t.t=$S.COLOR,t.d=ww(r),t;{let e=r.match(SC);return t.t=$S.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(SC)||[],t}},Pw=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=dw(e._toNumbers),t.s=dw(e._strings),t),Fw=Mw(),Iw=(e,t,n)=>{let r=e._modifier,i=e._fromNumbers,a=e._toNumbers,o=e._strings,s=o[0];for(let c=0,l=a.length;c<l;c++){let l=r(sw(cw(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},Lw=(e,t,n,r,i)=>{let a=e.parent,o=e.duration,s=e.completed,c=e.iterationDuration,l=e.iterationCount,u=e._currentIteration,d=e._loopDelay,f=e._reversed,p=e._alternate,m=e._hasChildren,h=e._delay,g=e._currentTime,_=h+c,v=t-h,y=ow(g,-h,o),b=ow(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=sC,T=i===eC.FORCE,E=0,D=v,O=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=ow(n,0,l),C&&e._currentIteration--,E=e._currentIteration%2,D=b-n*t||0}let k=f^(p&&E),A=e._ease,j=C?k?0:o:k?c-D:D;A&&(j=c*A(j/c)||0);let M=(a?a.backwards:v<g)?!k:!!k;if(e._currentTime=v,e._iterationTime=j,e.backwards=M,S&&!e.began?(e.began=!0,!n&&!(a&&(M||!a.began))&&e.onBegin(e)):v<=0&&(e.began=!1),!n&&!m&&S&&e._currentIteration!==u&&e.onLoop(e),T||i===eC.AUTO&&(t>=(a&&h>0?0:h)&&t<=_||t<=h&&y>h||t>=_&&y!==o)||j>=_&&y!==o||j<=h&&y>0&&!C||t<=y&&y===o&&s||C&&!s&&w){if(S&&(e.computeDeltaTime(y),n||e.onBeforeUpdate(e)),!m){let t=T||(M?x*-1:x)>=kC.tickThreshold,i=sw(e._offset+(a?a._offset:0)+h+j,12),o=e._head,s,c,l,u,d=0;for(;o;){let e=o._composition,n=o._currentTime,a=o._changeDuration,f=o._absoluteStartTime+o._changeDuration,p=o._nextRep,m=o._prevRep,h=e!==tC.none,g=m?m._absoluteStartTime+m._changeDuration:0,_=m&&m.parent!==o.parent,v=!p||p._isOverridden?f:p.parent===o.parent?f+p._delay:p._absoluteStartTime<p._absoluteUpdateStartTime?p._absoluteStartTime:p._absoluteUpdateStartTime;if((t||(n!==a||i<=v||m&&!_&&(!p||p.parent!==o.parent))&&(n!==0||i>=o._absoluteStartTime||_&&!o._hasFromValue&&!m._isOverridden&&i>=g||p&&!p._isOverridden&&p.parent===o.parent&&p._currentTime!==0&&j<p._startTime))&&(!m||_||j>=o._startTime)&&(!h||!o._isOverridden&&(!o._isOverlapped||i<=f)&&(!p||p._isOverridden||i<=v)&&(!m||m._isOverridden||(_?i>=o._absoluteStartTime||!o._hasFromValue&&i>=g:i>=g+o._delay)))){let t=o._currentTime=ow(j-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===QS.OBJECT,g=f===$S.NUMBER,_=g&&m||n===0||n===1?-1:kC.precision,v,y;if(g)v=y=i(sw(cw(o._fromNumber,o._toNumber,n),_));else if(f===$S.UNIT)y=i(sw(cw(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===$S.COLOR){let e=o._numbers,t=o._fromNumbers,a=o._toNumbers,s=1-n,c=t[0],l=t[1],u=t[2],d=a[0],f=a[1],p=a[2];e[0]=i(Math.sqrt(c*c*s+d*d*n)),e[1]=i(Math.sqrt(l*l*s+f*f*n)),e[2]=i(Math.sqrt(u*u*s+p*p*n)),e[3]=i(cw(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${sw(e[0],0)},${sw(e[1],0)},${sw(e[2],0)},${e[3]})`)}else f===$S.COMPLEX&&(v=Iw(o,n,_));if(h&&(o._number=y),!r&&e!==tC.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===QS.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===QS.TRANSFORM?(s!==l&&(l=s,u=s[aC]),u[e]=v,d=1):p===QS.CSS?c[e]=v:p===QS.CSS_VAR&&c.setProperty(e,v)),S&&(O=1)}else o._value=v}else n&&m&&!_&&j<o._startTime&&(o._currentTime=0);d&&o._renderTransforms&&(c.transform=_w(u),d=0),o=o._next}!n&&O&&e.onRender(e)}!n&&S&&e.onUpdate(e)}return a&&w?!n&&(a.began&&!M&&v>0&&!s||M&&v<=1e-11&&s)&&(e.onComplete(e),e.completed=!M):S&&C?l===1/0?e._startTime+=e.duration:e._currentIteration>=l-1&&(e.paused=!0,!s&&!m&&(e.completed=!0,!n&&!(a&&(M||!a.began))&&(e.onComplete(e),e._resolve(e)))):e.completed=!1,O},Rw=(e,t,n,r,i)=>{let a=e._currentIteration;if(Lw(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=NC(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;pw(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&Lw(t,e,n,1,eC.FORCE),t.began=!1,t.completed=!1;else{let r=t.duration,i=t._offset+t._delay,a=i+r;!n&&r<=1e-11&&(!i||a===e)&&t.onComplete(t)}}),n||o.onLoop(o)}pw(o,e=>{let t=sw((c-e._offset)*e._speed,12);if(s&&t>e._delay+e.duration)return;let a=e._fps<o._fps?e.requestTick(l):i;u+=Lw(e,t,n,r,a),!e.completed&&d&&(d=!1)},s),!n&&u&&o.onRender(o),(d||s)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,n||(o.onComplete(o),o._resolve(o))))}},zw={},Bw=(e,t,n)=>{if(n===QS.TRANSFORM)return dC.get(e)||e;if(n===QS.CSS||n===QS.ATTRIBUTE&&VC(t)&&e in t.style){let t=zw[e];if(t)return t;{let t=e&&jC(e);return zw[e]=t,t}}return e},Vw=(e,t=!1)=>{if(e._hasChildren)pw(e,e=>Vw(e,t),!0);else{let n=e;n.pause(),pw(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=BC(o)||o===``;if(e._setter){if(!t&&!s){if(Nw(o,Fw),Fw.d){let t=Fw.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=Fw.n;e._setter(e.target,e._number,e)}}else if(a===QS.OBJECT)!t&&!s&&(i[r]=o);else if(i[rC]){if(a===QS.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===QS.TRANSFORM){let n=i[aC];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=_w(n):t.removeProperty(`transform`))}else s?t.removeProperty(jC(r)):t[r]=o}}i[rC]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},Hw=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=lC/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(e){let t=+e,n=t<1e-11?sC:t,r=lC/n;n>DC.frameRate&&(DC.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?sC:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?eC.NONE:(this._lastTickTime=n>=t?e-n%t:e,eC.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},Uw={animation:null,update:mC},Ww=e=>{let t=Uw.animation;return t||(t={duration:sC,computeDeltaTime:mC,_offset:0,_delay:0,_head:null,_tail:null},Uw.animation=t,Uw.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===$S.COMPLEX||e===$S.COLOR?dw(r._fromNumbers):null,i=r._fromNumber,a=n._tail;for(;a&&a!==r;){if(t)for(let e=0,n=a._numbers.length;e<n;e++)t[e]+=a._numbers[e];else i+=a._number;a=a._prevAdd}r._toNumber=i,r._toNumbers=t}}}),Lw(t,1,1,0,eC.FORCE)}),t},Gw=YS?requestAnimationFrame:setImmediate,Kw=YS?cancelAnimationFrame:clearImmediate,qw=class extends Hw{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=DC,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=NC();if(this.requestTick(e)){this.computeDeltaTime(e);let t=this._speed,n=this._fps,r=this._head;for(;r;){let i=r._next;r.paused?(mw(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):Rw(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):eC.AUTO),r=i}Uw.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(NC()),this.reqId=Gw(Yw)),this}pause(){if(this.reqId)return this.paused=!0,Xw()}resume(){if(this.paused)return this.paused=!1,pw(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(kC.timeScale===1?1:lC)}set speed(e){let t=e*kC.timeScale;this._speed!==t&&(this._speed=t,pw(this,e=>e.speed=e._speed))}get timeUnit(){return kC.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(kC.timeScale!==r){kC.timeScale=r,kC.tickThreshold=200*r;let e=n?t:lC;this.defaults.duration*=e,this._speed*=e}}get precision(){return kC.precision}set precision(e){kC.precision=e}},Jw=(()=>{let e=new qw(NC());return YS&&(AC.engine=e,ZS.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(ZS.hidden?e.pause():e.resume())})),e})(),Yw=()=>{Jw._head?(Jw.reqId=Gw(Yw),Jw.update()):Jw.reqId=0},Xw=()=>(Kw(Jw.reqId),Jw.reqId=0,Jw),Zw={_rep:new WeakMap,_add:new Map},Qw=(e,t,n=`_rep`)=>{let r=Zw[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},$w=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,eT=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=sC,e._currentTime=sC},tT=(e,t)=>{let n=e._composition;if(n===tC.replace){let n=e._absoluteStartTime;hw(t,e,$w,`_prevRep`,`_nextRep`);let r=e._prevRep;if(r){let t=r.parent,i=r._absoluteEndTime;if(e.parent.id!==t.id&&t.iterationCount>1&&i+(t.duration-t.iterationDuration)>n){eT(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)eT(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=sw(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&eT(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(pw(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;pw(e,e=>{e!==t&&pw(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===tC.blend){let t=Qw(e.target,e.property,`_add`),n=Ww(Zw._add),r=t._head;r||(r={...e},r._composition=tC.replace,r._updateDuration=sC,r._startTime=0,r._numbers=dw(e._fromNumbers),r._number=0,r._next=null,r._prev=null,hw(t,r),hw(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=dw(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=dw(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}hw(t,e,null,`_prevAdd`,`_nextAdd`)}return e},nT=e=>{let t=e._composition;if(t!==tC.none){let n=e.target,r=e.property,i=Zw._rep.get(n)[r];if(mw(i,e,`_prevRep`,`_nextRep`),t===tC.blend){let t=Zw._add,i=t.get(n);if(!i)return;let a=i[r],o=Uw.animation;mw(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){mw(a,s,`_prevAdd`,`_nextAdd`),mw(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},rT=(e,t,n)=>{let r=!1;return pw(t,i=>{let a=i.target;if(e.includes(a)){let e=i.property,o=i._tweenType,s=Bw(n,a,o);(!s||s&&s===e)&&(i.parent._tail===i&&i._tweenType===QS.TRANSFORM&&i._prev&&i._prev._tweenType===QS.TRANSFORM&&(i._prev._renderTransforms=1),mw(t,i),nT(i),r=!0)}},!0),r},iT=(e,t,n)=>{let r=t||Jw,i;if(r._hasChildren){let t=0;pw(r,a=>{if(!a._hasChildren){if(i=rT(e,a,n),i&&!a._head)a.cancel(),mw(r,a);else{let e=a._offset+a._delay+a.duration;e>t&&(t=e)}}a._head?iT(e,a,n):a._hasChildren=!1},!0),zC(r.iterationDuration)||(r.iterationDuration=t)}else i=rT(e,r,n);i&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel())},aT=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),oT=e=>e._cancelled?(e._hasChildren?pw(e,oT):pw(e,e=>{e._composition!==tC.none&&tT(e,Qw(e.target,e.property))}),e._cancelled=0,e):e,sT=0,cT=(e,t)=>e._priority>t._priority,lT=class extends Hw{constructor(e={},t=null,n=0){super(0),++sT;let{id:r,delay:i,duration:a,reversed:o,alternate:s,loop:c,loopDelay:l,autoplay:u,frameRate:d,playbackRate:f,priority:p,onComplete:m,onLoop:h,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:y}=e;OC.current&&OC.current.register(this);let b=t?0:Jw._lastTickTime,x=t?t.defaults:kC.defaults,S=RC(i)||zC(i)?x.delay:+i,C=RC(a)||zC(a)?1/0:+a,w=Tw(c,x.loop),T=Tw(l,x.loopDelay),E=w===!0||w===1/0||w<0?1/0:w+1,D=0;t?D=n:(Jw.reqId||Jw.requestTick(NC()),D=(Jw._lastTickTime-Jw._startTime)*kC.timeScale),this.id=zC(r)?sT:r,this.parent=t,this.duration=lw((C+T)*E-T)||1e-11,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=y||x.onUpdate,this.onLoop=h||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=C,this.iterationCount=E,this._autoplay=!t&&Tw(u,x.autoplay),this._offset=D,this._delay=S,this._loopDelay=T,this._iterationTime=0,this._currentIteration=0,this._resolve=mC,this._running=!1,this._reversed=+Tw(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Tw(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=Tw(d,x.frameRate),this._speed=Tw(f,x.playbackRate),this._priority=+Tw(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return ow(sw(this._currentTime,kC.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return ow(sw(this._iterationTime,kC.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return ow(sw(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return ow(sw(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(e){let t=this.iterationDuration;this.currentTime=t*this._currentIteration+t*e}get currentIteration(){return this._currentIteration}set currentIteration(e){this.currentTime=this.iterationDuration*ow(+e,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(e){e?this.reverse():this.play()}get speed(){return super.speed}set speed(e){super.speed=e,this.resetTime()}reset(e=!1){return oT(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,Rw(this,0,1,~~e,eC.FORCE),aT(this),this._hasChildren&&pw(this,aT),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&Rw(this,this.duration,1,~~e,eC.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!zC(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*Jw._speed);return this._startTime=NC()-(this._currentTime+this._delay)*e,this}pause(){return this.paused?this:(this.paused=!0,this.onPause(this),this)}resume(){return this.paused?(this.paused=!1,this.duration<=1e-11&&!this._hasChildren?Rw(this,sC,0,0,eC.FORCE):(this._running||=(hw(Jw,this,cT),Jw._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,Jw.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){oT(this),this.completed=!1;let r=this.paused;return this.paused=!0,Rw(this,e+this._delay,~~t,~~n,eC.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?nw(cC/n):t;return this._reversed=+(this._alternate&&!(r%2)?e:!e),t===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(n*r-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?pw(this,e=>e.cancel(),!0):pw(this,nT),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=uw(e);if(t===n)return this;let r=e/t,i=e<=sC;return this.duration=i?sC:n,this.iterationDuration=i?sC:uw(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){Rw(this,0,1,0,eC.AUTO);let e=this._autoplay;return e&&e.linked&&e.linked===this&&e.revert(),this.cancel()}complete(e=0){return this.seek(this.duration,e).cancel()}then(e=mC){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=mC};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}},uT=e=>new lT(e,null,0).init();function dT(e){let t=LC(e)?OC.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function fT(e){if(BC(e))return[];if(!YS)return PC(e)&&e.flat(1/0)||[e];if(PC(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!BC(r)){let e=dT(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!BC(r)){let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}else{let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}}return n}let t=dT(e);return t?Array.from(t):[e]}function pT(e){let t=fT(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[nC]){n[nC]=!0;let e=VC(n);(n.nodeType||e)&&(n[rC]=!0,n[iC]=e,n[aC]={})}}return t}var mT={deg:1,rad:180/iw,turn:360},hT={},gT=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===$S.UNIT&&i===n)return t;let o=a+i+n,s=hT[o];if(!zC(s)&&!r)t.n=s;else{let r;if(i in mT)r=a*mT[i]/mT[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==ZS?o:ZS.body;s.appendChild(t);let c=t.style;c.width=100+i;let l=t.offsetWidth||100;c.width=100+n;let u=l/(t.offsetWidth||100);s.removeChild(t),r=u*a}t.n=r,hT[o]=r}return t.t,$S.UNIT,t.u=n,t},_T=e=>e,vT=(e=1.68)=>t=>YC(t,+e),yT={in:e=>t=>e(t),out:e=>t=>1-e(1-t),inOut:e=>t=>t<.5?e(t*2)/2:1-e(t*-2+2)/2,outIn:e=>t=>t<.5?(1-e(1-t*2))/2:(e(t*2-1)+1)/2},bT=iw/2,xT=iw*2,ST={"":vT,Quad:vT(2),Cubic:vT(3),Quart:vT(4),Quint:vT(5),Sine:e=>1-QC(e*bT),Circ:e=>1-XC(1-e*e),Expo:e=>e?YC(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=YC(2,--n))-1)/11;);return 1/YC(4,3-n)-7.5625*YC((t*3-2)/22-e,2)},Back:(e=1.7)=>t=>(+e+1)*t*t*t-+e*t*t,Elastic:(e=1,t=.3)=>{let n=ow(+e,1,10),r=ow(+t,sC,2),i=r/xT*rw(1/n),a=xT/r;return e=>e===0||e===1?e:-n*YC(2,-10*(1-e))*ZC((1-e-i)*a)}},CT=(()=>{let e={linear:_T,none:_T};for(let t in yT)for(let n in ST){let r=ST[n],i=yT[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),wT={linear:_T,none:_T},TT=e=>{if(wT[e])return wT[e];if(e.indexOf(`(`)<=-1){let t=yT[e]||e.includes(`Back`)||e.includes(`Elastic`)?CT[e]():CT[e];return t?wT[e]=t:_T}{let t=e.slice(0,-1).split(`(`),n=CT[t[0]];return n?wT[e]=n(...t[1].split(`,`)):_T}},ET=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],DT=e=>{if(LC(e)){for(let t=0,n=ET.length;t<n;t++)if(MC(e,ET[t]))return console.warn(`String syntax for \`ease: "${e}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${e}\``),_T}return RC(e)?e:LC(e)?TT(e):_T},OT=Mw(),kT=Mw(),AT={},jT={func:null},MT={func:null},NT=[null],PT=[null,null],FT={to:null},IT=0,LT=0,RT,zT,BT=(e,t)=>{let n={};if(PC(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(KC);for(let r=0,i=t.length;r<i;r++){let i=t[r];n[i]=e.map(e=>{let t={};for(let n in e){let r=e[n];KC(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=Tw(t.duration,kC.defaults.duration);Object.keys(e).map(t=>({o:parseFloat(t)/100,p:e[t]})).sort((e,t)=>e.o-t.o).forEach(e=>{let t=e.o,i=e.p;for(let e in i)if(KC(e)){let a=n[e];a||=n[e]=[];let o=t*r,s=a.length,c=a[s-1],l={to:i[e]},u=0;for(let e=0;e<s;e++)u+=a[e].duration;s===1&&(l.from=c.to),i.ease&&(l.ease=i.ease),l.duration=o-(s?u:0),a.push(l)}return e});for(let e in n){let t=n[e],r;for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.ease;n.ease=r||void 0,r=i}t[0].duration||t.shift()}}return n},VT=class extends lT{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++LT;let s=pT(e),c=s.length,l=t.keyframes,u=l?fw(BT(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:kC.defaults,b=Tw(m,y.ease),x=Tw(h,y.playbackEase),S=x?DT(x):null,C=!zC(b.ease),w=C?b.ease:Tw(m,S?`linear`:y.ease),T=C?b.settlingDuration:Tw(p,y.duration),E=Tw(f,y.delay),D=g||y.modifier,O=zC(_)&&c>=1e3?tC.none:zC(_)?y.composition:_,k=this._offset+(n?n._offset:0);C&&(b.parent=this);let A=NaN,j=NaN,M=0,N=0;for(let e=0;e<c;e++){let t=s[e],r=a||e,c=o||s,l=NaN,d=NaN;for(let e in u)if(KC(e)){let a=Ow(t,e),o=yw(t,e),s=Bw(e,t,a),f=u[e],p=PC(f);if(i&&!p&&(PT[0]=f,PT[1]=f,f=PT),p){let e=f.length,t=!FC(f[0]);e===2&&t?(FT.to=f,NT[0]=FT,RT=NT):e>2&&t?(RT=[],f.forEach((e,t)=>{t?t===1?(PT[1]=e,RT.push(PT)):RT.push(e):PT[0]=e})):RT=f}else NT[0]=f,RT=NT;let m=null,h=null,g=NaN,_=0,v=0;for(let e=RT.length;v<e;v++){let i=RT[v];FC(i)?zT=i:(FT.to=i,zT=FT),jT.func=null,MT.func=null;let l=Dw(Tw(zT.composition,O),t,r,c,null,null),u=IC(l)?l:tC[l];!m&&u!==tC.none&&(m=Qw(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=Dw(zT.to,t,r,c,jT,f),y;FC(p)&&!zC(p.to)?(zT=p,y=p.to):y=p;let b=Dw(zT.from,t,r,c,MT,f),x=zT.ease||w,S=Dw(x,t,r,c,null,f),C=RC(S)||LC(S)?S:x,A=!zC(C)&&!zC(C.ease),j=A?C.ease:C,P=A?C.settlingDuration:Dw(Tw(zT.duration,e>1?Dw(T,t,r,c,null,f)/e:T),t,r,c,null,f),F=Dw(Tw(zT.delay,v?0:E),t,r,c,null,f),ee=zT.modifier||D,I=!zC(b),te=!zC(y),L=PC(y),ne=L||I&&te,re=h?_:0,ie=h?_+F:F,ae=sw(k+ie,12),oe=sw(k+re,12);!N&&(I||L)&&(N=1);let R=h;if(u!==tC.none){let e=m._head;for(;e&&e._absoluteStartTime<=ae;)if(e._isOverridden||(R=e),e=e._nextRep,e&&e._absoluteStartTime>=ae)for(;e;)eT(e),e=e._nextRep}if(ne){Nw(L?Dw(y[0],t,r,c,MT,f):b,OT),Nw(L?Dw(y[1],t,r,c,jT,f):y,kT);let e=Aw(t,s,a,AT);OT.t===$S.NUMBER&&(R?R._valueType===$S.UNIT&&(OT.t=$S.UNIT,OT.u=R._unit):(Nw(e,Fw),Fw.t===$S.UNIT&&(OT.t=$S.UNIT,OT.u=Fw.u)))}else te?Nw(y,kT):h?Pw(h,kT):Nw(n&&R&&R.parent.parent===n?R._value:Aw(t,s,a,AT),kT),I?Nw(b,OT):h?Pw(h,OT):Nw(n&&R&&R.parent.parent===n?R._value:Aw(t,s,a,AT),OT);if(OT.o&&(OT.n=jw(R?R._toNumber:Nw(Aw(t,s,a,AT),Fw).n,OT.n,OT.o)),kT.o&&(kT.n=jw(OT.n,kT.n,kT.o)),OT.t!==kT.t){if(OT.t===$S.COMPLEX||kT.t===$S.COMPLEX){let e=OT.t===$S.COMPLEX?OT:kT,t=OT.t===$S.COMPLEX?kT:OT;t.t=$S.COMPLEX,t.s=dw(e.s),t.d=e.d.map(()=>t.n)}else if(OT.t===$S.UNIT||kT.t===$S.UNIT){let e=OT.t===$S.UNIT?OT:kT,t=OT.t===$S.UNIT?kT:OT;t.t=$S.UNIT,t.u=e.u}else if(OT.t===$S.COLOR||kT.t===$S.COLOR){let e=OT.t===$S.COLOR?OT:kT,t=OT.t===$S.COLOR?kT:OT;t.t=$S.COLOR,t.d=e.d.map(()=>0)}}if(OT.u!==kT.u){let e=kT.u?OT:kT;e=gT(t,e,kT.u?kT.u:OT.u,!1)}if(kT.d&&OT.d&&kT.d.length!==OT.d.length){let e=OT.d.length>kT.d.length?OT:kT,t=e===OT?kT:OT;t.d=e.d.map((e,n)=>zC(t.d[n])?0:t.d[n]),t.s=dw(e.s)}let se=sw(+P||1e-11,12),ce=AT[s];BC(ce)||(AT[s]=null);let le=o?o.set:null;_=sw(ie+se,12);let ue=OT.d,de=kT.d,fe=kT.s,pe={parent:this,id:IT++,property:s,target:t,_value:null,_toFunc:jT.func,_fromFunc:MT.func,_ease:DT(j),_fromNumbers:ue?dw(ue):uC,_toNumbers:de?dw(de):uC,_strings:fe?dw(fe):uC,_fromNumber:OT.n,_toNumber:kT.n,_numbers:ue?dw(ue):uC,_number:OT.n,_unit:kT.u,_modifier:ee,_currentTime:0,_startTime:ie,_delay:+F,_updateDuration:se,_changeDuration:se,_absoluteStartTime:ae,_absoluteUpdateStartTime:oe,_absoluteEndTime:sw(k+_,12),_hasFromValue:I||L?1:0,_tweenType:a,_setter:le,_valueType:kT.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:ce,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==tC.none&&tT(pe,m);let me=pe._valueType;if(me===$S.COMPLEX)pe._value=Iw(pe,1,-1);else if(me===$S.UNIT)pe._value=`${ee(pe._toNumber)}${pe._unit}`;else if(me===$S.COLOR){let e=kT.d;pe._value=`rgba(${sw(e[0],0)},${sw(e[1],0)},${sw(e[2],0)},${e[3]})`}else pe._value=ee(pe._toNumber);isNaN(g)&&(g=pe._startTime),h=pe,M++,hw(this,pe)}(isNaN(j)||g<j)&&(j=g),(isNaN(A)||_>A)&&(A=_),a===QS.TRANSFORM&&(l=M-v,d=M)}if(!isNaN(l)){let e=0;pw(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===tC.blend&&pw(Uw.animation,e=>{e.id===t.id&&(e._renderTransforms=1)})),e++})}}c||console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`),j?(pw(this,e=>{e._startTime-e._delay||(e._delay-=j),e._startTime-=j}),A-=j):j=0,A||(A=sC,this.iterationCount=0),this.targets=s,this.id=zC(d)?LT:d,this.duration=A===1e-11?sC:lw((A+this._loopDelay)*this.iterationCount-this._loopDelay)||1e-11,this.onRender=v||y.onRender,this._ease=S,this._delay=j,this.iterationDuration=A,!this._autoplay&&N&&this.onRender(this)}stretch(e){let t=this.duration;if(t===uw(e))return this;let n=e/t;return pw(this,e=>{e._updateDuration=uw(e._updateDuration*n),e._changeDuration=uw(e._changeDuration*n),e._currentTime*=n,e._delay*=n,e._startTime*=n,e._absoluteStartTime*=n,e._absoluteUpdateStartTime*=n,e._absoluteEndTime*=n}),super.stretch(e)}refresh(){return pw(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(Nw(n(),OT),OT.u!==e._unit&&e.target[rC]&&gT(e.target,OT,e._unit,!0),e._fromNumbers=dw(OT.d),e._fromNumber=OT.n):t&&(Nw(Aw(e.target,e.property,e._tweenType),Fw),e._fromNumbers=dw(Fw.d),e._fromNumber=Fw.n),t&&(Nw(t(),kT),e._toNumbers=dw(kT.d),e._strings=dw(kT.s),e._toNumber=kT.o?jw(e._fromNumber,kT.n,kT.o):kT.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),Vw(this)}then(e){return super.then(e)}},HT=(e,t)=>kC.editor?kC.editor.addAnimation(e,t):new VT(e,t,null,0,!1).init(),UT=lC*10,WT=class{constructor(e={}){let t=!zC(e.bounce)||!zC(e.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/lC,this.maxIterations=this.maxDuration/this.timeStep/lC,this.bn=ow(Tw(e.bounce,.5),-1,1),this.pd=ow(Tw(e.duration,628),10*kC.timeScale,UT*kC.timeScale),this.m=ow(Tw(e.mass,1),1,UT),this.s=ow(Tw(e.stiffness,100),sC,UT),this.d=ow(Tw(e.damping,10),sC,UT),this.v=ow(Tw(e.velocity,0),-UT,UT),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=e.onComplete||mC,t&&this.calculateSDFromBD(),this.compute(),this.ease=e=>{let t=e*this.settlingDuration,n=this.completed,r=this.pd;return t>=r&&!n&&(this.completed=!0,this.onComplete(this.parent)),t<r&&n&&(this.completed=!1),e===0||e===1?e:this.solve(e*this.solverDuration)}}solve(e){let{zeta:t,w0:n,wd:r,b:i}=this,a=e;return a=t<1?ew(-a*t*n)*(1*QC(r*a)+i*ZC(r*a)):t===1?(1+i*a)*ew(-a*n):((1+i)*ew((-t*n+r)*a)+(1-i)*ew((-t*n-r)*a))/2,1-a}calculateSDFromBD(){let e=kC.timeScale===1?this.pd/lC:this.pd;this.m=1,this.v=0,this.s=YC(2*iw/e,2),this.d=this.bn>=0?(1-this.bn)*4*iw/e:4*iw/(e*(1+this.bn)),this.s=sw(ow(this.s,sC,UT),3),this.d=sw(ow(this.d,sC,300),3)}calculateBDFromSD(){let e=2*iw/XC(this.s);this.pd=e*(kC.timeScale===1?lC:1),this.bn=this.d/(2*XC(this.s))<=1?1-this.d*e/(4*iw):4*iw/(this.d*e)-1,this.bn=sw(ow(this.bn,-1,1),3),this.pd=sw(ow(this.pd,10*kC.timeScale,UT*kC.timeScale),3)}compute(){let{maxRestSteps:e,maxIterations:t,restThreshold:n,timeStep:r,m:i,d:a,s:o,v:s}=this,c=this.w0=ow(XC(o/i),sC,lC),l=this.zeta=a/(2*XC(o*i));l<1?(this.wd=c*XC(1-l*l),this.b=(l*c+-s)/this.wd):l===1?(this.wd=0,this.b=-s+c):(this.wd=c*XC(l*l-1),this.b=(l*c+-s)/this.wd);let u=0,d=0,f=0;for(;d<=e&&f<=t;)$C(1-this.solve(u))<n?d++:d=0,this.solverDuration=u,u+=r,f++;this.settlingDuration=sw(this.solverDuration*lC,0)*kC.timeScale}get bounce(){return this.bn}set bounce(e){this.bn=ow(Tw(e,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(e){this.pd=ow(Tw(e,1),10*kC.timeScale,UT*kC.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(e){this.s=ow(Tw(e,100),sC,UT),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(e){this.d=ow(Tw(e,10),sC,UT),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(e){this.m=ow(Tw(e,1),1,UT),this.compute()}get velocity(){return this.v}set velocity(e){this.v=ow(Tw(e,0),-UT,UT),this.compute()}},GT=e=>new WT(e),KT=(e=10,t)=>{let n=t?tw:nw;return t=>n(ow(t,0,1)*e)*(1/e)},qT=(0,J.forwardRef)(function({id:e,transform:t},n){return(0,X.jsxs)(`radialGradient`,{ref:n,id:e,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`-1.6`,r:`5.6`,gradientTransform:t,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`color-mix(in oklab, var(--color-white) calc(var(--depth) * 50%), currentColor)`}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`})]})});function JT({id:e}){return(0,X.jsx)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:(0,X.jsx)(`feDropShadow`,{dx:`0`,dy:`1.5`,stdDeviation:`1`,floodColor:`currentColor`,style:{floodOpacity:`calc(var(--depth) * 0.6)`}})})}function YT({id:e}){return(0,X.jsxs)(`filter`,{id:e,x:`-10%`,y:`-10%`,width:`120%`,height:`120%`,colorInterpolationFilters:`sRGB`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.3`,result:`soft-edge`}),(0,X.jsx)(`feOffset`,{in:`soft-edge`,dx:`0.25`,dy:`0.45`,result:`lower-edge`}),(0,X.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`lower-edge`,operator:`out`,result:`inner-shadow`}),(0,X.jsx)(`feFlood`,{floodColor:`var(--color-black)`,floodOpacity:`calc(var(--depth) * 0.28)`}),(0,X.jsx)(`feComposite`,{in2:`inner-shadow`,operator:`in`,result:`shade`}),(0,X.jsx)(`feOffset`,{in:`soft-edge`,dx:`-0.2`,dy:`-0.35`,result:`upper-edge`}),(0,X.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`upper-edge`,operator:`out`,result:`inner-highlight`}),(0,X.jsx)(`feFlood`,{floodColor:`var(--color-white)`,floodOpacity:`calc(var(--depth) * 0.7)`}),(0,X.jsx)(`feComposite`,{in2:`inner-highlight`,operator:`in`,result:`highlight`}),(0,X.jsxs)(`feMerge`,{children:[(0,X.jsx)(`feMergeNode`,{in:`SourceGraphic`}),(0,X.jsx)(`feMergeNode`,{in:`shade`}),(0,X.jsx)(`feMergeNode`,{in:`highlight`})]})]})}var XT=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function ZT({id:e,values:t=Ob}){return(0,X.jsxs)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:t.blurStdDeviation,result:`blur`}),(0,X.jsx)(`feColorMatrix`,{in:`blur`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${String(t.alphaSlope)} ${String(t.alphaIntercept)}`,result:`gooey`}),(0,X.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`gooey`,operator:`atop`})]})}function QT(e,t){let n=e.ownerDocument,r=!0,i=()=>{t(r&&!n.hidden)},a=globalThis,o=`IntersectionObserver`in globalThis&&a.IntersectionObserver?new a.IntersectionObserver(t=>{let n=t.find(t=>t.target===e);n&&(r=n.isIntersecting,i())}):void 0;return o?.observe(e),n.addEventListener(`visibilitychange`,i),i(),()=>{o?.disconnect(),n.removeEventListener(`visibilitychange`,i)}}function $T(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function eE(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function tE(e,t,n){let r=n*Math.PI*2,i=t*2.1,a=Math.sin(r*2+i)*.15,o={rx:4*(1+a),ry:4/(1+a)};if(e===`line`){let e=7.5+4*Math.cos(r+(t===2?-.45:0));return{cx:(t-1)*e,cy:Math.sin(r+i)*.7,...o}}if(e===`square`){let e=4.7+2.7*Math.cos(r);return{cx:(t%2?1:-1)*e,cy:(t<2?-1:1)*e,...o}}if(e===`donut`){let e=$T(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=$T((n-.79)/.21),c=8+Math.sin(r*2+i)*.35*Math.sin(n*Math.PI);return{cx:Math.cos(o)*c*(1-s),cy:Math.sin(o)*c*(1-s)-8*s,rx:3.6*(1+a*Math.sin(n*Math.PI)),ry:3.6/(1+a*Math.sin(n*Math.PI))}}if(e===`bloom`){if(t===0){let e=[1,2,3,4].reduce((e,t)=>e+eE(t,n),0),t=Math.sqrt(49-e*4);return{cx:Math.sin(r)*.4,cy:Math.sin(r*2)*.4,rx:t*(1+a),ry:t/(1+a)}}let e=eE(t,n),i=(t-1)*Math.PI/2-Math.PI/4+Math.sin(r)*.22;return{cx:Math.cos(i)*14*e,cy:Math.sin(i)*14*e,rx:3.2*(1+a),ry:3.2/(1+a)}}return{cx:Math.sin(r+i)*6+Math.sin(r*3+i)*2.5,cy:Math.cos(r*2+i)*6,...o}}var nE={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800};function rE({variant:e}){let t=`caps-loader-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(null),i=LS(r),{reduced:a}=i,o=e===`donut`?16:e===`bloom`?5:e===`square`?4:3;return(0,J.useLayoutEffect)(()=>{if(a||!n.current||!r.current)return;let t=[...n.current.querySelectorAll(`ellipse`)].map((t,n)=>HT(t,{keyframes:Array.from({length:48},(t,r)=>({...tE(e,n,(r+1)/48),duration:RS(i,nE[e])/48})),ease:`linear`,loop:!0})),o=QT(r.current,e=>{for(let n of t)e?n.resume():n.pause()});return()=>{o();for(let e of t)e.revert()}},[e,a,i]),(0,X.jsxs)(`svg`,{ref:r,"aria-hidden":`true`,focusable:`false`,viewBox:e===`line`?`-20 -10 40 20`:`-20 -20 40 40`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(ZT,{id:t,values:XT}),(0,X.jsx)(qT,{id:`${t}-surface`,transform:e===`line`?`matrix(3.4 0 0 1.4 0 0)`:`matrix(3 0 0 3 0 0)`}),(0,X.jsx)(JT,{id:`${t}-shadow`}),(0,X.jsx)(`mask`,{id:`${t}-mask`,maskUnits:`userSpaceOnUse`,x:`-20`,y:`-20`,width:`40`,height:`40`,style:{maskType:`alpha`},children:(0,X.jsx)(`g`,{ref:n,fill:`currentColor`,filter:`url(#${t})`,children:Array.from({length:o},(t,n)=>(0,X.jsx)(`ellipse`,{...tE(e,n,0)},n))})})]}),(0,X.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,X.jsx)(`rect`,{x:`-20`,y:`-20`,width:`40`,height:`40`,fill:`url(#${t}-surface)`,mask:`url(#${t}-mask)`})})]})}var iE={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},aE={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`},oE=(0,J.forwardRef)(function({"aria-label":e,"aria-labelledby":t,className:n,decorative:r=!1,label:i=`Loading`,size:a=`md`,variant:o=`line`,tone:s=`neutral`,...c},l){let u=`${(0,J.useId)()}-label`,d=!r&&e===void 0&&t===void 0;return(0,X.jsxs)(`span`,{...c,"aria-label":r?void 0:e,"aria-hidden":r||void 0,"aria-labelledby":r?void 0:t??(e===void 0?u:void 0),className:$(`caps-loader`,iE[a],aE[s],n),"data-variant":o,role:r?void 0:`status`,ref:l,children:[(0,X.jsx)(rE,{variant:o}),d?(0,X.jsx)(JS,{id:u,children:i}):null]})}),sE=`disabled:bg-base-200 disabled:text-base-content disabled:outline-1 disabled:outline-solid disabled:outline-base-content/25 aria-disabled:bg-base-200 aria-disabled:text-base-content aria-disabled:outline-1 aria-disabled:outline-solid aria-disabled:outline-base-content/25`,cE=Pb(`btn caps-button disabled:pointer-events-none`,{variants:{variant:{primary:`btn-primary caps-button-filled`,secondary:`btn-secondary caps-button-filled`,accent:`btn-accent caps-button-filled`,destructive:`btn-error caps-button-filled`,outline:`btn-outline ${sE}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${sE}`},size:{xs:`btn-xs`,sm:`btn-sm`,default:`btn-md`,lg:`btn-lg`,icon:`btn-square btn-md`,menubar:`caps-button-menubar`}},defaultVariants:{variant:`primary`,size:`default`}}),lE=(0,J.forwardRef)(function({asChild:e=!1,children:t,className:n,disabled:r,loading:i=!1,result:a,resultLabel:o,onResultEnd:s,size:c=`default`,variant:l=`primary`,...u},d){let f=$(cE({size:c,variant:l}),n),p=(0,J.useRef)(a).current,m=(0,J.useRef)(null);return(0,J.useImperativeHandle)(d,()=>m.current),uE(m,[i,a,t]),e?(0,X.jsx)(SS,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,X.jsx)(`button`,{...u,"aria-busy":i?!0:u[`aria-busy`],className:f,disabled:r===!0||i,ref:m,type:u.type??`button`,children:a===void 0&&o===void 0?(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(oE,{className:`size-3`,decorative:!0,size:`sm`}):null,t]}):(0,X.jsx)(hE,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function uE(e,t){let n=(0,J.useRef)(null),r=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let i=r.current,a=i?t.getBoundingClientRect().width:n.current;i?.cancel(),r.current=null;let o=t.getBoundingClientRect().width;if(n.current=o,a===null||Math.abs(a-o)<1||!HS(t))return;let s=IS(t);if(s.reduced)return;let c=t.animate([{width:`${String(a)}px`},{width:`${String(o)}px`}],{duration:s.normal,easing:VS(s,s.ease)});r.current=c,t.style.overflow=`clip`,t.style.whiteSpace=`nowrap`;let l=()=>{r.current===c&&(r.current=null,t.style.removeProperty(`overflow`),t.style.removeProperty(`white-space`))};c.onfinish=l,c.oncancel=l},[e,...t])}var dE=1100;function fE(e,t){let n=t.bounce/.3,r=1+.05*Math.min(1.4,.4+n),i=1-.02*Math.min(1.4,n);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(r)})`,offset:.35},{transform:`scale(${String(i)})`,offset:.7},{transform:`scale(1)`}],{duration:t.springDuration,easing:VS(t,`ease-out`)})}function pE(e,t){let n=t.shake;return e.animate([{transform:`none`},{transform:`translateX(${String(-n)}px)`},{transform:`translateX(${String(n)}px)`},{transform:`translateX(${String(-n*.6)}px)`},{transform:`translateX(${String(n*.3)}px)`},{transform:`none`}],{duration:t.slow*1.3,easing:VS(t,`linear`)})}function mE(e,t,n){let r=n.distance+2,i=`blur(${String(n.blur)}px)`;return[e.animate([{opacity:1,transform:`none`,filter:`blur(0px)`},{opacity:0,transform:`translateY(${String(-r)}px)`,filter:i}],{duration:n.fast,easing:VS(n,n.ease)}),t.animate([{opacity:0,transform:`translateY(${String(r)}px)`,filter:i},{opacity:1,transform:`none`,filter:`blur(0px)`}],{duration:n.normal,easing:VS(n,n.ease),fill:`backwards`})]}function hE({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,J.useRef)(null),s=qS(),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1);c&&!u&&d(!0);let f=(0,J.useRef)(a),p=(0,J.useRef)(r);(0,J.useEffect)(()=>{p.current=r},[r]),(0,J.useLayoutEffect)(()=>{let e=f.current;if(f.current=i,i===e)return;if(i===`done`){l(!0);let e=setTimeout(()=>{p.current?p.current():l(!1)},dE);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!HS(t))return;let n=IS(t);if(n.shake<=0)return;let r=pE(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,J.useRef)(c);return(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e||m.current===c)return;m.current=c;let t=e.querySelector(`[data-face="label"]`),n=e.querySelector(`[data-face="result"]`);if(!t||!n||!HS(e)){c||d(!1);return}let r=IS(e),i=c?mE(t,n,r):mE(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(fE(e.closest(`button`)??e,r));let t=n.querySelector(`path`);t&&i.push(t.animate([{strokeDashoffset:1},{strokeDashoffset:0}],{duration:r.normal*1.4,delay:r.fast/2,easing:VS(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,X.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,X.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,X.jsx)(oE,{className:`size-3`,decorative:!0,size:`sm`}):null,e]}),u?(0,X.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,X.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,X.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var gE={...J},_E={};function vE(e,t){let n=J.useRef(_E);return n.current===_E&&(n.current=e(t)),n}var yE=gE.useInsertionEffect,bE=yE&&yE!==gE.useLayoutEffect?yE:e=>e();function xE(e){let t=vE(SE).current;return t.next=e,bE(t.effect),t.trampoline}function SE(){let e={next:void 0,callback:CE,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function CE(){}function wE(){}var TE=Object.freeze([]),EE=Object.freeze({});function DE(e){J.useEffect(e,TE)}var OE=0,kE=class e{static create(){return new e}currentId=OE;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=OE,t()},e)}isStarted(){return this.currentId!==OE}clear=()=>{this.currentId!==OE&&(clearTimeout(this.currentId),this.currentId=OE)};disposeEffect=()=>this.clear};function AE(){let e=vE(kE.create).current;return DE(e.disposeEffect),e}function jE(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var ME=jE(`https://base-ui.com/production-error`,`Base UI`),NE=J.createContext(void 0);function PE(){let e=J.useContext(NE);if(e===void 0)throw Error(ME(53));return e}function FE(e,t,n,r){let i=vE(LE).current;return RE(i,e,t,n,r)&&BE(i,[e,t,n,r]),i.callback}function IE(e){let t=vE(LE).current;return zE(t,e)&&BE(t,e),t.callback}function LE(){return{callback:null,cleanup:null,refs:[]}}function RE(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function zE(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function BE(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}var VE=18;function HE(e){return VE>=e}function UE(e){if(!J.isValidElement(e))return null;let t=e,n=t.props;return(HE(19)?n?.ref:t.ref)??null}function WE(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function GE(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function KE(e,t){return typeof e==`function`?e(t):e}function qE(e,t){return typeof e==`function`?e(t):e}var JE={};function YE(e,t,n,r,i){if(!n&&!r&&!i&&!e)return ZE(t);let a=ZE(e);return t&&(a=QE(a,t)),n&&(a=QE(a,n)),r&&(a=QE(a,r)),i&&(a=QE(a,i)),a}function XE(e){if(e.length===0)return JE;if(e.length===1)return ZE(e[0]);let t=ZE(e[0]);for(let n=1;n<e.length;n+=1)t=QE(t,e[n]);return t}function ZE(e){return nD(e)?{...e(JE)}:$E(e)}function QE(e,t){return nD(t)?t(e):eD(e,t)}function $E(e){let t={...e};for(let e in t){let n=t[e];tD(e,n)&&(t[e]=iD(n))}return t}function eD(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=WE(e.style,r);break;case`className`:e[n]=oD(e.className,r);break;default:e[n]=tD(n,r)?rD(e[n],r):r}}return e}function tD(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function nD(e){return typeof e==`function`}function rD(e,t){return t?e?(...n)=>{let r=n[0];if(sD(r)){let i=r;aD(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:iD(t):e}function iD(e){return e&&((...t)=>{let n=t[0];return sD(n)&&aD(n),e(...t)})}function aD(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function oD(e,t){return t?e?t+` `+e:t:e}function sD(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function cD(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=fD(r));let i=lD(t,n,r);if(n.enabled===!1)return null;let a=n.state??EE;return pD(e,r,i,a)}function lD(e,t,n){let{className:r,style:i}=e,{state:a=EE,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?KE(r,a):void 0,d=l?qE(i,a):void 0,f=l?GE(a,c):EE,p=l&&s?uD(s):void 0,m=l?WE(f,p)??{}:EE;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?IE([m.ref,UE(n),...o]):FE(m.ref,UE(n),o):FE(null,null)),l?(u!==void 0&&(m.className=oD(m.className,u)),d!==void 0&&(m.style=WE(m.style,d)),m):EE}function uD(e){return Array.isArray(e)?XE(e):YE(void 0,e)}var dD=Symbol.for(`react.lazy`);function fD(e){if(e?.$$typeof!==dD)return e;let t=J.Children.toArray(e)[0];return J.isValidElement(t)?t:e}function pD(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=YE(n,t.props);return e.ref=n.ref,J.cloneElement(t,e)}return mD(e,n)}function mD(e,t){return e===`button`?(0,J.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,J.createElement)(`img`,{alt:``,...t,key:t.key}):J.createElement(e,t)}function hD(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var gD=`base-ui-disable-scrollbar`,_D={className:gD,getElement(e){return(0,X.jsx)(`style`,{nonce:e,href:gD,precedence:`base-ui:low`,children:`.${gD}{scrollbar-width:none}.${gD}::-webkit-scrollbar{display:none}`})}};function vD(){let[,e]=J.useState({});return J.useCallback(()=>{e({})},[])}var yD=0;function bD(e,t=`mui`){let n=J.useRef(void 0),r=vD(),i=e??n.current;return J.useEffect(()=>{n.current??(yD+=1,n.current=`${t}-${yD}`,e??r())},[e,t,r]),i}var xD=gE.useId;function SD(e,t){if(xD!==void 0){let n=xD();return e??(t?`${t}-${n}`:n)}return bD(e,t)}function CD(e){return SD(e,`base-ui`)}var wD=`data-has-overflow-x`,TD=`data-has-overflow-y`,ED=`data-overflow-x-start`,DD=`data-overflow-x-end`,OD=`data-overflow-y-start`,kD=`data-overflow-y-end`,AD=e=>t=>t?{[e]:``}:null,jD={hasOverflowX:AD(wD),hasOverflowY:AD(TD),overflowXStart:AD(ED),overflowXEnd:AD(DD),overflowYStart:AD(OD),overflowYEnd:AD(kD),cornerHidden:()=>null};function MD(){return typeof window<`u`}function ND(e){return ID(e)?(e.nodeName||``).toLowerCase():`#document`}function PD(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function FD(e){return((ID(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ID(e){return MD()?e instanceof Node||e instanceof PD(e).Node:!1}function LD(e){return MD()?e instanceof Element||e instanceof PD(e).Element:!1}function RD(e){return MD()?e instanceof HTMLElement||e instanceof PD(e).HTMLElement:!1}function zD(e){return!MD()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof PD(e).ShadowRoot}function BD(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ZD(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function VD(e){return/^(table|td|th)$/.test(ND(e))}function HD(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var UD=/transform|translate|scale|rotate|perspective|filter/,WD=/paint|layout|strict|content/,GD=e=>!!e&&e!==`none`,KD;function qD(e){let t=LD(e)?ZD(e):e;return GD(t.transform)||GD(t.translate)||GD(t.scale)||GD(t.rotate)||GD(t.perspective)||!YD()&&(GD(t.backdropFilter)||GD(t.filter))||UD.test(t.willChange||``)||WD.test(t.contain||``)}function JD(e){let t=$D(e);for(;RD(t)&&!XD(t);){if(qD(t))return t;if(HD(t))return null;t=$D(t)}return null}function YD(){return KD??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),KD}function XD(e){return/^(html|body|#document)$/.test(ND(e))}function ZD(e){return PD(e).getComputedStyle(e)}function QD(e){return LD(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $D(e){if(ND(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||zD(e)&&e.host||FD(e);return zD(t)?t.host:t}function eO(e){let t=$D(e);return XD(t)?(e.ownerDocument||e).body:RD(t)&&BD(t)?t:eO(t)}function tO(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=eO(e),i=r===e.ownerDocument?.body,a=PD(r);if(i){let e=nO(a);return t.concat(a,a.visualViewport||[],BD(r)?r:[],e&&n?tO(e):[])}return t.concat(r,tO(r,[],n))}function nO(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function rO(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:iO,platform:aO,maxTouchPoints:oO}=rO(),sO=iO.toLowerCase(),cO=aO.toLowerCase(),lO=/^i(os$|p)/.test(cO)||cO===`macintel`&&oO>1,uO=`android`,dO=cO===uO||sO.includes(uO),fO=!lO&&cO.startsWith(`mac`);cO.startsWith(`win`),!dO&&/^(linux|chrome os)/.test(cO);var pO=fO||lO,mO=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!mO&&sO.includes(`firefox`),!mO&&sO.includes(`chrom`);var hO=pO,gO=/jsdom|happydom/.test(sO);function _O(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function vO(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&zD(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function yO(e,t){let n=e;for(;n;){if(LD(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(zD(n)?n.host:null)}return null}function bO(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var xO=`data-base-ui-focusable`,SO=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,CO=`data-starting-style`,wO=`data-ending-style`,TO={[CO]:``},EO={[wO]:``},DO={transitionStatus(e){return e===`starting`?TO:e===`ending`?EO:null}},OO=`data-open`,kO=`data-closed`,AO=`data-anchor-hidden`,jO=`data-popup-open`,MO=`data-pressed`,NO={[jO]:``},PO={[jO]:``,[MO]:``},FO={[OO]:``},IO={[kO]:``},LO={[AO]:``},RO={open(e){return e?NO:null}},zO={open(e){return e?PO:null}},BO={open(e){return e?FO:IO},anchorHidden(e){return e?LO:null}},VO={...BO,...DO},HO=`data-trigger-disabled`;function UO(e,t){if(!LD(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(HO);for(let[,e]of t.entries())if(vO(e,n))return!e.hasAttribute(HO);return!1}function WO(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function GO(e){return e.matches(`html,body`)}function KO(e){return RD(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function qO(e){return yO(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${SO}`)!=null}function JO(e){return e?e.getAttribute(`role`)===`combobox`&&KO(e):!1}function YO(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function XO(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...XO(e,t.id,n)])}function ZO(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function QO(e){e.preventDefault(),e.stopPropagation()}function $O(e){return`nativeEvent`in e}function ek(e){return e.pointerType===``&&e.isTrusted?!0:dO&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function tk(e){return gO?!1:!dO&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(dO||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function nk(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function rk(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var ik=Math.min,ak=Math.max,ok=Math.round,sk=Math.floor,ck=e=>({x:e,y:e}),lk={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function uk(e,t,n){return ak(e,ik(t,n))}function dk(e,t){return typeof e==`function`?e(t):e}function fk(e){return e.split(`-`)[0]}function pk(e){return e.split(`-`)[1]}function mk(e){return e===`x`?`y`:`x`}function hk(e){return e===`y`?`height`:`width`}function gk(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function _k(e){return mk(gk(e))}function vk(e,t,n){n===void 0&&(n=!1);let r=pk(e),i=_k(e),a=hk(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Dk(o)),[o,Dk(o)]}function yk(e){let t=Dk(e);return[bk(e),t,bk(t)]}function bk(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var xk=[`left`,`right`],Sk=[`right`,`left`],Ck=[`top`,`bottom`],wk=[`bottom`,`top`];function Tk(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Sk:xk:t?xk:Sk;case`left`:case`right`:return t?Ck:wk;default:return[]}}function Ek(e,t,n,r){let i=pk(e),a=Tk(fk(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(bk)))),a}function Dk(e){let t=fk(e);return lk[t]+e.slice(t.length)}function Ok(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function kk(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ok(e)}function Ak(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function jk(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Mk(e,t=e?ZD(e):null){return!e||!e.isConnected||!t||jk(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}function Nk(e){return e?.ownerDocument||document}var Pk=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Fk(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return zD(n)?n.host:null}function Ik(e){for(let t of Array.from(e.children))if(ND(t)===`summary`)return t;return null}function Lk(e,t){let n=Ik(t);return!!n&&(e===n||vO(n,e))}function Rk(e){let t=e?ND(e):``;return e!=null&&e.matches(Pk)&&(t!==`summary`||e.parentElement!=null&&ND(e.parentElement)===`details`&&Ik(e.parentElement)===e)&&(t!==`details`||Ik(e)==null)&&(t!==`input`||e.type!==`hidden`)}function zk(e){if(!Rk(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Fk(t)){let n=t!==e,r=ND(t)===`slot`;if(t.hasAttribute(`inert`)||n&&ND(t)===`details`&&!t.open&&!Lk(e,t)||t.hasAttribute(`hidden`)||!r&&!Bk(t,n))return!1}return!0}function Bk(e,t){let n=ZD(e);return t?n.display!==`none`:Mk(e,n)}function Vk(e){let t=e.tabIndex;if(t<0){let t=ND(e);if(t===`details`||t===`audio`||t===`video`||RD(e)&&e.isContentEditable)return 0}return t}function Hk(e){if(ND(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Uk(e,t){let n=Hk(e);if(!n)return!0;let r=t.find(e=>{let t=Hk(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Hk(e);return t?.name===n.name&&t.form===n.form})===n}function Wk(e){if(RD(e)&&ND(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return RD(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Gk(e,t){Wk(e).forEach(e=>{Rk(e)&&t.push(e),Gk(e,t)})}function Kk(e,t,n){Wk(e).forEach(e=>{RD(e)&&e.matches(t)&&n.push(e),Kk(e,t,n)})}function qk(e){return zk(e)&&Vk(e)>=0}function Jk(e){let t=[];return Gk(e,t),t.filter(zk)}function Yk(e){let t=Jk(e);return t.filter(e=>Vk(e)>=0&&Uk(e,t))}function Xk(e,t){let n=Yk(e),r=n.length;if(r===0)return;let i=_O(Nk(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Zk(e){return Xk(Nk(e).body,1)||e}function Qk(e){return Xk(Nk(e).body,-1)||e}function $k(e,t,n){if(!e)return null;let r=[];Gk(Nk(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(zk);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!vO(n,o)&&qk(o)&&Uk(o,a))return o}return r[i]}function eA(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!vO(n,r)}function tA(e){Yk(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function nA(e){let t=[];Kk(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var rA=J.createContext(void 0),iA={disableStyleElements:!1};function aA(){return J.useContext(rA)??iA}var oA=`--scroll-area-corner-height`,sA=`--scroll-area-corner-width`,cA=`data-orientation`,lA={x:0,y:0},uA={width:0,height:0},dA={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},fA={x:!0,y:!0,corner:!0},pA=J.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=mA(i),d=CD(),f=AE(),p=AE(),{nonce:m,disableStyleElements:h}=aA(),[g,_]=J.useState(!1),[v,y]=J.useState(!1),[b,x]=J.useState(!1),[S,C]=J.useState(!1),[w,T]=J.useState(!1),[E,D]=J.useState(uA),[O,k]=J.useState(uA),[A,j]=J.useState(dA),[M,N]=J.useState(fA),P=J.useRef(null),F=J.useRef(null),ee=J.useRef(null),I=J.useRef(null),te=J.useRef(null),L=J.useRef(null),ne=J.useRef(null),re=J.useRef(null),ie=J.useRef(0),ae=J.useRef(0),oe=J.useRef(0),R=J.useRef(0),se=J.useRef(`vertical`),ce=J.useRef(lA),le=J.useRef(null);function ue(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let de=xE(e=>{let t=e.x-ce.current.x,n=e.y-ce.current.y;ce.current=e,n!==0&&ue(!0),t!==0&&ue(!1)}),fe=xE(()=>{let e=F.current;e&&le.current===null&&(le.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),pe=xE(e=>{if(e.button!==0||re.current!==null&&(se.current===`vertical`?te.current:L.current)?.hasPointerCapture(re.current))return;re.current=e.pointerId,ie.current=e.clientY,ae.current=e.clientX,se.current=e.currentTarget.getAttribute(cA);let t=F.current;t&&(oe.current=t.scrollTop,R.current=t.scrollLeft,fe()),(se.current===`vertical`?te.current:L.current)?.setPointerCapture(e.pointerId)}),me=xE(e=>{if(e.pointerId!==re.current)return;re.current=null,(se.current===`vertical`?x:y)(!1),le.current!==null&&(F.current&&(F.current.style.scrollSnapType=le.current),le.current=null);let t=se.current===`vertical`?te.current:L.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),he=xE(e=>{if(e.pointerId!==re.current)return;if(e.buttons%2==0){me(e);return}let t=F.current;if(!t)return;let n=se.current===`vertical`,r=n?te.current:L.current,i=n?ee.current:I.current;if(!r||!i)return;let a=n?`y`:`x`,o=hD(i,`padding`,a),s=hD(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-ie.current:e.clientX-ae.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?oe.current:R.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),ue(n)});function ge(e){C(e.pointerType===`touch`)}function _e(e){if(ge(e),e.pointerType!==`touch`){let t=vO(P.current,e.target);_(t)}}let ve=J.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),ye={role:`presentation`,onPointerEnter:_e,onPointerMove:_e,onPointerDown:ge,onPointerLeave(){_(!1)},style:{position:`relative`,[oA]:`${E.height}px`,[sA]:`${E.width}px`}},be=cD(`div`,e,{state:ve,ref:[t,P],props:[ye,o],stateAttributesMapping:jD}),xe=J.useMemo(()=>({handlePointerDown:pe,handlePointerMove:he,handlePointerUp:me,handleScroll:de,disableViewportSnap:fe,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:ne,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:ee,scrollbarXRef:I,thumbYRef:te,thumbXRef:L,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:ve,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[pe,he,me,de,fe,E,O,w,S,v,b,g,d,M,A,ve,s,c,l,u]);return(0,X.jsxs)(NE.Provider,{value:xe,children:[!h&&_D.getElement(m),be]})});function mA(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var hA=typeof document<`u`?J.useLayoutEffect:()=>{};function gA(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var _A=J.createContext(void 0);function vA(){let e=J.useContext(_A);if(e===void 0)throw Error(ME(55));return e}var yA=J.createContext(void 0);function bA(){return J.useContext(yA)?.direction??`ltr`}function xA(e,t){if(t<=0)return 0;let n=gA(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function SA(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var CA=`--scroll-area-overflow-x-start`,wA=`--scroll-area-overflow-x-end`,TA=`--scroll-area-overflow-y-start`,EA=`--scroll-area-overflow-y-end`,DA=`--scroll-area-thumb-height`,OA=`--scroll-area-thumb-width`,kA=[CA,wA,TA,EA],AA=!1;function jA(){AA||mO||(typeof CSS<`u`&&`registerProperty`in CSS&&kA.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),AA=!0)}var MA=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=PE(),T=bA(),E=J.useRef(!0),D=J.useRef([NaN,NaN,NaN,NaN]),O=AE(),k=AE(),A=xE(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=NA(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),ee=0,I=0;j||(ee=xA(T===`rtl`?-w:w,P),I=P-ee);let te=A?0:xA(x,F),L=A?0:F-te,ne=j?0:b,re=A?0:y,ie=0,ae=0;!j&&!A&&(ie=t?.offsetWidth||0,ae=n?.offsetHeight||0);let oe=f.width===0&&f.height===0,R=oe?ie:0,se=oe?ae:0,ce=hD(n,`padding`,`x`),le=hD(t,`padding`,`y`),ue=hD(i,`margin`,`x`),de=hD(r,`margin`,`y`),fe=ne-ce-ue,pe=re-le-de,me=n?Math.min(n.offsetWidth-R,fe):fe,he=t?Math.min(t.offsetHeight-se,pe):pe,ge=Math.max(16,me*M),_e=Math.max(16,he*N);if(m(e=>PA(e,{width:ge,height:_e})),t&&r){let e=FA(r,DA,x,F,h,_e,t.offsetHeight-_e-le-de);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-ge-ce-ue,t=FA(i,OA,T===`rtl`?-w:w,P,_,ge,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let ve=[ee,I,te,L];kA.forEach((t,n)=>{e.style.setProperty(t,`${ve[n]}px`)}),a&&p(e=>PA(e,{width:ie,height:ae})),g(e=>PA(e,k));let ye={xStart:!j&&ee>C.xStart,xEnd:!j&&I>C.xEnd,yStart:!A&&te>C.yStart,yEnd:!A&&L>C.yEnd};S(e=>PA(e,ye))});hA(()=>{jA()},[]),hA(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),hA(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),hA(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=SA(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(wE))).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:_D.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=cD(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:jD}),P=J.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,X.jsx)(_A.Provider,{value:P,children:N})});function NA(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function PA(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function FA(e,t,n,r,i,a,o){let s=gA(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}function IA(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var LA=J.createContext(void 0);function RA(){let e=J.useContext(LA);if(e===void 0)throw Error(ME(54));return e}var zA=J.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=PE(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=bA(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;J.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return IA(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=bO(e.nativeEvent),n=T?h.current:g.current;if(n&&vO(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=hD(n,`margin`,a),s=hD(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${oA})`,insetInlineEnd:0,[DA]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${sA})`,bottom:0,[OA]:`${S.width}px`}}},M=cD(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:jD});return A?(0,X.jsx)(LA.Provider,{value:i,children:M}):null}),BA=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=vA(),{hasMeasuredScrollbar:s,viewportState:c}=PE(),l=J.useRef(null),u=J.useRef(s);return hA(()=>{if(typeof ResizeObserver>`u`)return;let e=!1,t=new ResizeObserver(()=>{!e&&(e=!0,!u.current)||o()});return l.current&&t.observe(l.current),()=>{t.disconnect()}},[o]),cD(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:jD,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),VA=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=PE(),m=RA(),h=m===`vertical`;return cD(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),HA=Object.freeze({ease:`linear`,duration:0});function UA(e,t){let n=BS(e,t.duration);return n<=0?HA:e.steps>0?{ease:KT(e.steps),duration:n}:{ease:GT({bounce:zS(e,t.bounce),duration:n}),duration:n}}function WA(e,t){let n=RS(e,t.duration);return{ease:e.steps>0?KT(e.steps):t.ease,duration:n}}function GA(e,t,n){let r=(Math.abs(t)-Math.abs(e))/Math.max(16,n);if(Math.abs(r)<.035)return null;let i=Math.min(.04,Math.abs(r)*.3),a=r>0,o=Math.sign(t||e);return{scaleY:1+(a?i:-i),scaleX:1+(a?-i/2:i/2),origin:(a?o>0:o<0)?`center top`:`center bottom`}}function KA(e,t,n){if(t<=0||Math.abs(n)<4)return null;let r=e<=0&&n<0,i=e>=t-1&&n>0;if(!r&&!i)return null;let a=Math.min(.06,Math.abs(n)/120*.06);return{scaleY:1-a,scaleX:1+a/2,origin:r?`center top`:`center bottom`}}var qA=(0,J.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,X.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:$(`caps-surface`,e)})}),JA=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:$(`caps-screen`,e)})}),YA=(0,J.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,X.jsx)(qA,{...a,className:$(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,X.jsx)(`div`,{className:$(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,X.jsx)(JA,{className:$(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})});(0,J.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,X.jsxs)(`header`,{...i,className:$(`caps-screen-header`,e),ref:a,children:[t?(0,X.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,X.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,X.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),(0,J.forwardRef)(function({appearance:e,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:$(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,J.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,X.jsxs)(`div`,{...s,className:$(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,X.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,X.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,X.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,X.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});var XA=(0,J.forwardRef)(function({children:e,className:t,surface:n=!1,surfaceSize:r,surfaceDepth:i,screen:a=!1,...o},s){let c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=qS();(0,J.useEffect)(()=>{let e=c.current,t=e?.querySelector(`.caps-scroll-viewport`);if(!t||!e)return;let n=null,r,i=t.scrollTop,a=performance.now(),o=0,s=e=>{let t=l.current;if(!e||u||!t)return;n?.cancel(),t.style.transformOrigin=e.origin;let r=IS(t),i=WA(r,{ease:`outQuad`,duration:45}),a=UA(r,{bounce:.18,duration:180});n=HT(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=GA(o,e,t);o=e,s(n)},f=e=>{if(e.ctrlKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let n=e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1,i=KA(t.scrollTop,t.scrollHeight-t.clientHeight,e.deltaY*n);i&&(clearTimeout(r),o=0,s(i))},p=()=>{let e=performance.now(),n=e-a,s=n>100?16:Math.max(16,n),c=t.scrollTop-i;n>100&&(o=0),d(c/s,s),i=t.scrollTop,a=e,clearTimeout(r),r=setTimeout(()=>{d(0,32)},64)};return t.addEventListener(`scroll`,p,{passive:!0}),e.addEventListener(`wheel`,f,{passive:!0}),()=>{clearTimeout(r),n?.cancel(),l.current&&(l.current.style.transform=`none`),t.removeEventListener(`scroll`,p),e.removeEventListener(`wheel`,f)}},[a,n,u]);let d=(0,X.jsx)(MA,{render:a?(0,X.jsx)(JA,{}):(0,X.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,X.jsx)(BA,{style:{minWidth:0},children:e})});return(0,X.jsxs)(pA,{render:n?(0,X.jsx)(qA,{size:r??`md`,depth:i??`shallow`}):(0,X.jsx)(`div`,{}),ref:c,className:$(`caps-scroll-area`,t),children:[a?(0,X.jsx)(`div`,{className:`caps-display-gasket caps-scroll-display`,children:d}):d,(0,X.jsx)(qA,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,X.jsx)(zA,{className:`caps-scroll-track`,children:(0,X.jsx)(VA,{className:`caps-scroll-thumb`,children:(0,X.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})});function ZA(e){let t=`${e.provider}/`;return e.model.startsWith(t)?e.model:`${t}${e.model}`}function QA(e){return e<1e3?String(e):e<1e6?`${String(Math.round(e/1e3))}K`:`${String(Math.round(e/1e5)/10)}M`}function $A(e){return e.window===null?QA(e.tokens):`${QA(e.tokens)}/${QA(e.window)}`}var ej=()=>void 0;function tj(e){let t=new Map;for(let{id:n,name:r}of e){let e=t.get(r)??new Set;e.add(n),t.set(r,e)}return new Map(e.map(({id:e,name:n})=>[e,(t.get(n)?.size??0)>1?`${n} · ${e.slice(-6)}`:n]))}var nj=fn.mapFields(({extensionId:e,correlation:t})=>({extensionId:e,correlation:t})),rj=W({meta:Bt(cr),origin:Bt(nj),id:q,sequence:Ln.check(Nn(0)),commandId:Sr(q),value:dn}),ij=Gn([`manual`,`threshold`,`overflow`]),aj=W({queue:Yt([W({state:G(`idle`)}),W({state:G(`queued`),commandId:Tr,runningWork:Sr(Yt([W({kind:G(`session`),sessionId:Tr,commandId:Tr}),W({kind:G(`host`),lane:Tr,jobId:Tr})]))}),W({state:G(`running`),commandId:Tr})]),cancellationRequested:Fn,retry:Sr(W({attempt:Ln.check(Nn(0)),maxAttempts:Ln.check(Nn(0)),delayMs:Ln.check(In(0)),errorMessage:q,scheduledAt:Ln.check(In(0))})),activeTool:Sr(q),lastModelChoiceSequence:Sr(Ln.check(Nn(0))),compaction:Sr(W({trigger:ij}))}),oj=q,sj=Yt([W({status:G(`running`),revision:oj,value:cr,catalog:Bt(cr)}),W({status:G(`stopped`),revision:oj,reason:q})]),cj=kt(q,sj),lj=W({id:q,version:q,revision:oj,status:Gn([`running`,`stopped`]),reason:Sr(q),stoppedAt:Sr(sn)}),uj=W({commandId:q,outcome:Gn([`completed`,`cancelled`,`failed`,`interrupted`]),sequence:Ln.check(Nn(0)),diagnostic:Sr(q),meta:Bt(cr)}),dj=W({id:q,sequence:Ln.check(Nn(0)),at:Ln.check(In(0)),tokensBefore:sn,tokensAfter:Sr(sn),trigger:Sr(ij)}),fj=W({id:q,sequence:Ln.check(Nn(0)),at:Ln.check(In(0)),trigger:ij,result:Gn([`nothing_to_compact`,`failed`]),diagnostic:Sr(q)}),pj=W({messageId:q,revision:Ln.check(In(0)),text:q,thinking:q,textTruncated:Fn,thinkingTruncated:Fn}),mj=W({total:Ln.check(In(0)),prompts:K(W({commandId:q,meta:Bt(cr),origin:Bt(nj),text:q,images:Bt(K(br)),delivery:Gn([`steer`,`followUp`])})),hasMore:Fn}),hj=W({tokens:Ln.check(In(0)),window:Sr(Ln.check(Nn(0)))}),gj=W({sessionId:q,cursor:Sr(q),hasMore:Fn,oldestCursor:Bt(Sr(q)),messages:K(rj),terminals:K(uj),sandboxFailures:Bt(K(Pn)),compactions:Bt(K(dj)),compactionNotices:Bt(K(fj)),pending:mj,activity:aj,progress:Sr(pj),extensions:cj,attention:on,context:Bt(hj)}),_j=Yt([W({kind:G(`update`),delivery:Gn([`replay`,`live`]),cursor:Sr(q),messages:K(rj),terminals:K(uj),sandboxFailures:Bt(K(Pn)),compactions:Bt(K(dj)),compactionNotices:Bt(K(fj)),pending:mj,activity:aj,extensions:cj,attention:on,context:Bt(hj)}),W({kind:G(`progress`),progress:pj,activity:aj}),W({kind:G(`reset`),reason:G(`history_unavailable`),cursor:Sr(q),baseline:gj})]),vj=W({status:G(`accepted`),commandId:q}),yj=Yt([vj,W({status:G(`too_late`),commandId:q})]),bj=W({sessionId:q}),xj=_n(bn(gj),{onExcessProperty:`error`}),Sj=_n(bn(_j),{onExcessProperty:`error`}),Cj=_n(bn(vj)),wj=_n(bn(yj)),Tj=_n(bn(bj)),Ej=_n(bn(en)),Dj=_n(bn(lj)),Oj=_n(bn(K(lj))),kj=_n(bn(cr));function Aj(e){return Dj(e)}function jj(e){return Oj(e)}function Mj(e){return kj(e)}function Nj(e){return Cj(e)}function Pj(e){return wj(e)}function Fj(e){return Tj(e)}function Ij(e){return xj(e)}function Lj(e){return Sj(e)}function Rj(e){let t=Ej(e);return new Xt(t.boundary,t.cause,t.message,t.requestId)}var zj=_n(bn(W({sessions:K(Yt([W({sessionId:Tr,createdAt:sn,lastActivityAt:sn,settledAt:Bt(sn),title:q,state:Gn([`needs_you`,`running`,`errored`,`done`])}),W({sessionId:Tr,state:G(`unavailable`)})])),next:V(Tr)})));function Bj(e){let t=zj(e);return{sessions:t.sessions,next:t.next}}var Vj=_n(bn(W({sessionId:Tr}))),Hj=_n(bn(W({deleted:Fn})));function Uj(e){return Hj(e).deleted}function Wj(e){return Vj(e).sessionId}function Gj(e){return at(e).then(e=>{if(xr(e))return e.value;let t=$e(At(e.cause))??$n(e.cause);return Promise.reject(t instanceof Error?t:Error(String(t)))})}function Kj(e){let t=ze(e);if(xr(t))return t.value;let n=$e(At(t.cause))??$n(t.cause);throw n instanceof Error?n:Error(String(n))}function qj(e){let t=Sn(e);return Object.freeze({[Symbol.asyncIterator]:()=>{let e=t[Symbol.asyncIterator]();return{next:()=>e.next(),return:()=>e.return?.()??Promise.resolve({done:!0,value:void 0})}}})}function Jj(e,t){function n(e){return Gj(t.command(e))}return Object.freeze({address:e,command:n,abort:()=>Gj(t.abort),send:(e,n)=>Gj(t.send(e,n)),cancel:e=>Gj(t.cancel(e)),modelPreference:Object.freeze({read:()=>Gj(t.modelPreference.read),set:e=>Gj(t.modelPreference.set(e))}),extension:e=>{let n=t.extension(e);return Object.freeze({call:(e,t)=>Gj(n.call(e,t))})},read:e=>Gj(t.read(e)),subscribe:e=>qj(t.subscribe(e)),watch:e=>Gj(t.watch(e)).then(e=>Object.freeze({snapshot:e.snapshot,changes:qj(e.changes),close:()=>Gj(e.close)}))})}function Yj(e,t){let n=t??`local:${An()}`;return Object.freeze({createSession:t=>Gj(e.createSession(t)),deleteSession:t=>Gj(e.deleteSession(t)),listSessions:t=>Gj(e.listSessions(t)),extensions:Object.freeze({list:()=>Gj(e.extensions.list),resume:t=>Gj(e.extensions.resume(t)),call:(t,n,r)=>Gj(e.extensions.call(t,n,r))}),session:t=>Jj(`${n}/sessions/${encodeURIComponent(t)}`,e.session(t)),close:()=>Gj(e.close)})}function Xj(e){let t=`local:${An()}`;return Object.freeze({...Yj(e,t),grants:Object.freeze({deliver:(t,n)=>Kj(e.grants.deliver(t,n)),read:t=>Kj(e.grants.read(t))}),withMeta:n=>Yj(e.withMeta(n),t)})}function Zj(e=`Remote Shiitake operation is unavailable`){return new Xt(`runtime`,`unavailable`,e)}function Qj(e){return new Xt(`runtime`,`invalid`,e)}function $j(){return new Xt(`runtime`,`closed`,`Shiitake client is closed`)}var eM=2,tM=_n(q);function nM(e){if(!(e instanceof MessageEvent))throw Qj(`Session stream event is invalid`);return tM(e.data)}function rM(e){return e.kind===`source-error`?je(Zj(`Session stream is unavailable`)):e.kind===`snapshot`?Ne({try:()=>({kind:`snapshot`,value:Ij(nM(e.event))}),catch:()=>Qj(`Session snapshot is invalid`)}):e.kind===`frame`?Ne({try:()=>({kind:`frame`,value:Lj(nM(e.event))}),catch:()=>Qj(`Session frame is invalid`)}):Ne({try:()=>Rj(nM(e.event)),catch:()=>Qj(`Session runtime error is invalid`)}).pipe(ht(je))}function iM(e,t){return ct(()=>{e.closed||(e.closed=!0,t.delete(e),e.source.close())})}function aM(e,t,n,r){return Et(t=>rt(Ne({try:()=>{let i={source:new(r??EventSource)(e),closed:!1},a=(e,n)=>{pr(t,{kind:e,event:n})};return i.source.addEventListener(`snapshot`,e=>{a(`snapshot`,e)}),i.source.addEventListener(`frame`,e=>{a(`frame`,e)}),i.source.addEventListener(`runtime-error`,e=>{a(`runtime-error`,e)}),i.source.addEventListener(`error`,e=>{i.source.readyState===eM&&a(`source-error`,e)}),n.add(i),i},catch:()=>Zj(`Session stream could not open`)}),e=>iM(e,n))).pipe(Kt(rM),It(t.await))}function oM(e,t){return`${e}/sessions/${encodeURIComponent(t)}`}function sM(e,t,n=!1){let r=new URLSearchParams({mode:`subscribe`});return t!==void 0&&r.set(`after`,t),n&&r.set(`includeSandboxFailures`,`true`),`${e}?${r.toString()}`}function cM(e,t,n,r){return aM(e,t,n,r).pipe(Kt(e=>e.kind===`frame`?we(e.value):je(Qj(`Session subscription received a snapshot`))))}function lM(e,t,n,r,a,o){return i(function*(){yield*n;let i=yield*wn(!1),s=yield*rr();yield*ct(()=>t.add(s)),yield*Bn(s,ct(()=>{t.delete(s)}));let c=yield*Pe(aM(e,r,a,o).pipe(Ut(Kg()),Un(s)));if(jn(c))return yield*lr(s,c),yield*ge(c.cause);let[l,u]=c.value;if(w(l)||l.value.kind!==`snapshot`){let e=Qj(`Session stream did not begin with a snapshot`);return yield*lr(s,Cr(e)),yield*je(e)}let d=u.pipe(Kt(e=>e.kind===`frame`?we(e.value):we({kind:`reset`,reason:`history_unavailable`,cursor:e.value.cursor,baseline:e.value})),It(i.await),pn(e=>i.isOpen()&&Qt(e)?Rt:gn(e)));return Object.freeze({snapshot:l.value.value,changes:d,close:i.open.pipe(ye(lr(s,Ot)))})})}function uM(e,t,n){return Le({try:async t=>{let n=await e(t);return{response:n,body:await n.text()}},catch:()=>Zj(`${n} request failed`)}).pipe(ht(({response:e,body:r})=>e.ok?Ne({try:()=>t(r),catch:()=>Qj(`${n} response is invalid`)}):Ne({try:()=>Rj(r),catch:()=>Qj(`${n} error response is invalid`)}).pipe(ht(je))))}function dM(e){let t=e.baseUrl.replace(/\/+$/u,``),n=e.fetch??globalThis.fetch,r=new Set,i=new Set,a=rn(!1),o=!1,s=Ge(()=>o?je($j()):_t),c=(e,t,n)=>me(uM(e,t,n),a.await.pipe(ye(je($j())))),l=(e,t)=>s.pipe(ye(c(r=>n(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:r}),Mj,`Extension command`)));return Object.freeze({createSession:e=>s.pipe(ht(()=>{let r=er({requestId:e});return c(e=>n(`${t}/sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({requestId:r}),signal:e}),Wj,`Session creation`)})),deleteSession:e=>s.pipe(ht(()=>{let r=wt(e);return c(e=>n(`${t}/sessions/${encodeURIComponent(r)}`,{method:`DELETE`,signal:e}),Uj,`Session deletion`)})),listSessions:e=>s.pipe(ht(()=>{let r=new URLSearchParams;e!==void 0&&r.set(`after`,Pt(e));let i=r.size===0?``:`?${r.toString()}`;return c(e=>n(`${t}/sessions${i}`,{signal:e}),Bj,`Session discovery`)})),extensions:Object.freeze({list:s.pipe(ye(c(e=>n(`${t}/extensions`,{signal:e}),jj,`Extension list`))),resume:e=>s.pipe(ye(c(r=>n(`${t}/extensions/${encodeURIComponent(e)}/resume`,{method:`POST`,signal:r}),Aj,`Extension resume`))),call:(e,n,r)=>l(`${t}/extensions/${encodeURIComponent(e)}/commands/${encodeURIComponent(n)}`,r)}),session:o=>{let u=wt(o),d=oM(t,u),f=`${d}/events`;function p(e){return s.pipe(ye(c(t=>n(`${d}/command`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:e}),signal:t}),e.type===`prompt`||e.type===`compact`?Nj:e.type===`cancel`?Pj:e.type===`fork`?Fj:()=>void 0,`Command`)))}return Object.freeze({command:p,abort:p({type:`abort`}),send:(e,t)=>ct(()=>t?.requestId??An()).pipe(ht(n=>{let r={type:`prompt`,delivery:t?.delivery??`steer`,requestId:n,text:e};return p(t?.images===void 0?r:{...r,images:t.images}).pipe(y(e=>e.requestId===n?e:new Xt(e.boundary,e.cause,e.message,n)))})),cancel:e=>p({type:`cancel`,...e}),modelPreference:Object.freeze({read:s.pipe(ye(c(e=>n(`${d}/model-preference`,{signal:e}),Vt,`Model preference read`))),set:e=>s.pipe(ye(c(t=>n(`${d}/model-preference`,{signal:t,method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),()=>void 0,`Model preference set`)))}),extension:e=>Object.freeze({call:(t,n)=>l(`${d}/extensions/${encodeURIComponent(e)}/commands/${encodeURIComponent(t)}`,n)}),read:e=>s.pipe(ye(Ne({try:()=>Mt(e),catch:e=>e instanceof Xt?e:Qj(`Read options are invalid`)})),ht(({limit:e,before:t,includeSandboxFailures:r})=>{let i=new URLSearchParams({limit:String(e)});return t!==void 0&&i.set(`before`,t),r===!0&&i.set(`includeSandboxFailures`,`true`),c(e=>n(`${d}?${i.toString()}`,{signal:e}),Ij,`Session read`)})),subscribe:t=>yn(s.pipe(ye(Ne({try:()=>Zn(t),catch:e=>e instanceof Xt?e:Qj(`Subscribe options are invalid`)})),F(({after:t,includeSandboxFailures:n})=>cM(sM(f,t,n===!0),a,i,e.eventSource)))),watch:t=>lM(t?.includeSandboxFailures===!0?`${f}?includeSandboxFailures=true`:f,r,s,a,i,e.eventSource)})},close:Ge(()=>o?_t:(o=!0,a.open.pipe(ye(dt([...r],e=>lr(e,Ot),{discard:!0})),ye(dt([...i],e=>iM(e,i),{discard:!0})))))})}function fM(e){return Yj(dM(e),e.baseUrl.replace(/\/+$/u,``))}un(cr);function pM(e,t){if(t===void 0)return{status:`unavailable`};if(t.status===`stopped`)return{status:`stopped`,reason:t.reason};if(t.value===null||e.projection===null)return{status:`running`,value:null};let n=un(e.projection.schema)(t.value);return n._tag===`Success`?{status:`running`,value:n.success}:{status:`stopped`,reason:`Extension projection does not match this client`}}var mM=Ln.check(In(0)),hM=Ln.check(Nn(0)),gM=kt(q,Vn),_M=W({id:C_,label:S_,input:V(gM)}),vM=W({...T_.fields,actions:V(K(_M).check(B(8)))}),yM=T_.check(U(e=>e.open===void 0,{message:`Client chips are display only`})),bM=W({...vM.fields,inspection:Bt(W({commandId:C_,title:S_,rows:K(yM).check(B(200))}))}),xM=W({id:C_,order:sn.check(mr()),row:yM,compact:V(S_)}),SM=W({id:C_,sequence:hM,at:mM,commandId:Sr(q),rows:K(vM).check(B(200))}).check(U(e=>e.id===String(e.sequence),{message:`Client event identity must equal its sequence`})),CM=e=>new Set(e).size===e.length,wM=W({chips:K(xM).check(B(4)),panel:K(bM).check(B(16)),timeline:W({cells:K(SM).check(B(32)),omitted:mM}),waiting:Sr(W({summary:S_,cancel:_M}))}).check(U(e=>e.chips.length+e.panel.reduce((e,t)=>e+1+(t.inspection?.rows.length??0),0)+e.timeline.cells.reduce((e,t)=>e+t.rows.length,0)<=200,{message:`Client contribution exceeds 200 rows`}),U(e=>CM(e.chips.map(e=>e.id))&&CM(e.panel.map(e=>e.id))&&e.panel.every(e=>CM((e.inspection?.rows??[]).map(e=>e.id)))&&CM(e.timeline.cells.map(e=>e.id))&&e.timeline.cells.every(e=>CM(e.rows.map(e=>e.id))),{message:`Client contribution contains duplicate identities`})),TM=W({protocol:G(`shiitake.client/v1`),id:Kn,correlatedPrompts:Bt(G(`note`)),attach:Bt(Ht(e=>xe(e))),contribute:Bt(Ht(e=>xe(e)))}).check(U(e=>e.attach!==void 0||e.contribute!==void 0,{message:`Client entry requires attach or contribute`})),EM=_n(TM,{onExcessProperty:`error`});function DM(e,t){if(t.contribute!==void 0&&e.projection===null)throw Error(`Client contribution requires a projection`);let n={protocol:`shiitake.client/v1`,id:e.id};t.correlatedPrompts!==void 0&&Object.assign(n,{correlatedPrompts:t.correlatedPrompts});let r=t.attach,i=t.contribute;return r!==void 0&&Object.assign(n,{attach:e=>ir(()=>r(e))}),i!==void 0&&Object.assign(n,{contribute:t=>i(pM(e,t))}),Object.freeze(EM(n))}var OM=`whistle.catalog/v1`,kM=128,AM=16,jM=et({protocol:n(OM),commands:T(Zi).max(kM)}).strict().transform(e=>{let t=new Set;for(let n of e.commands){if(t.has(n.id))throw Error(`Catalog command ${n.id} is repeated`);t.add(n.id)}return Object.freeze({protocol:OM,commands:Object.freeze(e.commands)})}),MM=e=>jM.parse(e),NM=de(`type`,[et({type:n(`done`),notice:aa.optional(),result:Ii.optional()}).strict(),et({type:n(`prompt`),prompt:ia,notice:aa.optional(),next:et({arguments:Li,answer:z().min(1).max(120)}).strict()}).strict()]).transform(e=>Object.freeze(e)),PM=e=>NM.parse(e);function FM(e,t){if(t.arguments!==void 0)try{return zi(t.arguments)}catch{throw new Rr(`invalid_arguments`,`${e.title}: arguments must be an object`)}let n=e.action?.presentation,r=t.interaction;if(r===void 0||n===void 0)return{};if(n.type===`choice`){let t=n.options;return r.prompt({type:`choice`,message:e.title,options:t.map((e,t)=>{let n={value:String(t),label:e.label};return e.description===void 0?n:{...n,description:e.description}})}).then(e=>zi(t[Number(e)]?.value))}if(n.type===`confirmation`){let e={type:`confirmation`,message:n.message};return n.confirmLabel!==void 0&&(e.confirmLabel=n.confirmLabel),n.cancelLabel!==void 0&&(e.cancelLabel=n.cancelLabel),r.prompt(e).then(e=>e?{}:void 0)}return{}}function IM(e,t){return e.commands.map(e=>{let{availability:n,...r}=e,i={id:r.id,title:r.title,category:r.category,handler:async n=>{let r=n.signal??new AbortController().signal,i=n.interaction,a=await FM(e,n);if(a===void 0)return{cancelled:!0};for(let n=0;n<AM;n+=1){r.throwIfAborted();let n=PM(await t(e.id,a,r));if(n.notice!==void 0&&i?.notify(n.notice),n.type===`done`)return n.result;if(i===void 0)throw new Rr(`interaction_required`,`${e.title} needs a person to answer: ${n.prompt.message}`);let o=await i.prompt(n.prompt);a={...n.next.arguments,[n.next.answer]:o}}throw new Rr(`flow_too_long`,`${e.title} asked too many questions.`)}};return r.description!==void 0&&(i.description=r.description),r.projections!==void 0&&(i.projections=r.projections),r.action!==void 0&&(i.action=r.action),n!==void 0&&(i.availability=()=>n),i})}var LM=_n(wM,{onExcessProperty:`error`});function RM(e){return[...e.panel.flatMap(e=>e.actions??[]),...e.timeline.cells.flatMap(e=>e.rows.flatMap(e=>e.actions??[])),...e.waiting===null?[]:[e.waiting.cancel]]}function zM(e,t){let n=RM(e),r=e.panel.flatMap(e=>e.inspection===void 0?[]:[e.inspection]);if(n.length===0&&r.length===0)return;if(t?.status!==`running`||t.catalog===void 0)throw Error(`Client row actions require a running advertised catalog`);let i=MM(t.catalog),a=new Set(i.commands.map(e=>e.id));for(let e of r)if(!a.has(e.commandId))throw Error(`Client inspection ${e.commandId} is not advertised by its entry`);for(let e of n)if(!a.has(e.id))throw Error(`Client row action ${e.id} is not advertised by its entry`)}function BM(e,t){try{let n=LM(e(t));return zM(n,t),{status:`admitted`,value:n}}catch(e){return{status:`failed`,error:e instanceof Error?e:Error(`Client contribution failed`,{cause:e})}}}function VM(e,t){let n=e.map(e=>EM(e));if(new Set(n.map(e=>e.id)).size!==n.length)throw Error(`Duplicate client contribution entry`);let r=new Map,i=new Map,a=new Map,o=new Set,s=[],c=!1;return{snapshot:()=>s,subscribe:e=>c?()=>void 0:(o.add(e),()=>{o.delete(e)}),update:e=>{if(c)return;let l=!1;for(let o of n){if(o.contribute===void 0)continue;let n=e[o.id];if(r.has(o.id)&&r.get(o.id)===n)continue;r.set(o.id,n),i.delete(o.id),l=!0;let s=BM(o.contribute,n);if(s.status===`admitted`)i.set(o.id,{entryId:o.id,value:s.value}),a.delete(o.id);else{let{error:e}=s,n=`${e.name}: ${e.message}`;a.get(o.id)!==n&&t(o.id,e),a.set(o.id,n)}}if(l){s=n.flatMap(e=>{let t=i.get(e.id);return t===void 0?[]:[t]});for(let e of o)e()}},dispose:()=>{c=!0,r.clear(),a.clear(),i.clear(),s=[];for(let e of o)e();o.clear()}}}function HM(e){let t=new Set,n={title:e.title,status:`working`,links:[]},r,i,a=0,o=e=>{n={...n,...e};for(let e of t)e()},s=t=>{i=void 0,t.status===`failed`?o({status:`failed`,failure:t.message,prompt:void 0}):o({status:t.status===`handled`?`done`:`cancelled`,prompt:void 0}),e.onEnd?.(t)};return{snapshot:()=>n,subscribe:e=>(t.add(e),()=>{t.delete(e)}),begin:()=>{r?.abort();let t=new AbortController;r=t;let c=t.signal;i=void 0,n={title:e.title,status:`working`,links:[]},o({});let l=()=>r===t&&!c.aborted;return{interaction:{signal:c,prompt:(e,t)=>{let n=t?.signal===void 0?c:AbortSignal.any([c,t.signal]);n.throwIfAborted();let r=oa(e),s=la(e),u=Promise.withResolvers(),d=++a,f=()=>{i?.sequence===d&&(i=void 0,l()&&o({status:`working`,prompt:void 0})),u.reject(n.reason)};return n.addEventListener(`abort`,f,{once:!0}),i={sequence:d,request:r,resolve:e=>{let t=s(e);return t.kind!==`invalid`&&(n.removeEventListener(`abort`,f),u.resolve(t.value),!0)}},o({status:`prompting`,prompt:{sequence:d,request:r}}),u.promise},notify:e=>{if(!l())return;let t=sa(e);t.type===`handoff`?o({handoff:t}):o({message:t,links:t.type===`info`?t.links??[]:n.links})}},settle:e=>{r===t&&(r=void 0,s(c.aborted?{status:`cancelled`}:e))}}},answer:(e,t)=>{let n=i;return n?.sequence!==e||!n.resolve(t)?!1:(i=void 0,o({status:`working`,prompt:void 0}),!0)},cancel:()=>{if(r!==void 0){o({prompt:void 0}),r.abort(Error(`Interaction cancelled`));return}n.status===`failed`&&s({status:`cancelled`})}}}function UM(){let e={},t=0,n,r=new Set,i=t=>{e=t;for(let e of r)e()},a=t=>{e.open?.key===t&&i({...e,open:void 0})},o=({title:r,retry:o})=>{let s=++t,c=!1,l=HM({title:r,onEnd:t=>{n=t.status;let r=l.snapshot().message;if(!c){t.status===`failed`?i({...e,notice:{tone:`error`,message:t.message}}):r!==void 0&&r.type!==`progress`&&i({...e,notice:{tone:r.type===`success`?`success`:`info`,message:r.message}});return}t.status===`failed`||t.status===`handled`&&r!==void 0&&r.type!==`progress`||a(s)}}),u=l.subscribe(()=>{if(c)return;let t=l.snapshot();if(t.prompt===void 0&&t.handoff===void 0&&t.message?.type!==`progress`)return;c=!0;let n=e.open;i({...e,open:{key:s,host:l,retry:o},notice:void 0}),n?.host.cancel()}),d=l.begin();return{interaction:d.interaction,settle:e=>{u(),d.settle(e)}}};return{snapshot:()=>e,subscribe:e=>(r.add(e),()=>{r.delete(e)}),close:()=>{let t=e.open;t!==void 0&&(i({...e,open:void 0}),t.host.cancel())},inspect:t=>{i({...e,inspection:t})},report:t=>{n=void 0,i({...e,notice:t})},attach:e=>e(o),lastEnd:()=>n}}function WM(e){return`init`in e}function GM(e){return typeof e.write==`function`}function KM(e){return!!e.onMount}function qM(e){return`v`in e||`e`in e}function JM(e){if(`e`in e)throw e.e;return e.v}function YM(e){return typeof e?.then==`function`}function XM(e){if(!(e instanceof Error))return!1;let t=e.name,n=e.message.toLowerCase();return(t===`RangeError`||t===`InternalError`)&&(n.includes(`call stack`)||n.includes(`too much recursion`)||n.includes(`stack overflow`))}function ZM(e,t,n){if(!n.p.has(e)){n.p.add(e);let r=()=>n.p.delete(e);t.then(r,r)}}function QM(e,t,n){let r=n.get(e)?.t,i=t.p;if(!r?.size)return i;if(!i.size)return r;let a=new Set(r);for(let e of i)a.add(e);return a}function $M(e){return!!e.INTERNAL_onInit}var eN=(e,t,n,...r)=>n.read(...r),tN=(e,t,n,...r)=>n.write(...r),nN=(e,t,n)=>n.INTERNAL_onInit(t),rN=(e,t,n,r)=>n.onMount?.call(n,r),iN=(e,t,n)=>{var r;let i=e[0],a=i.get(n);if(!a){let o=e[6],s=e[9];a={d:new Map,p:new Set,n:0},i.set(n,a),(r=o.i)==null||r.call(o,n),$M(n)&&s(e,t,n)}return a},aN=(e,t)=>{let n=e[1],r=e[3],i=e[4],a=e[5],o=e[6],s=e[13];if(!o.f&&!r.size&&!i.size&&!a.size)return;let c=[],l=e=>{try{e()}catch(e){c.push(e)}};do{o.f&&l(o.f);let c=new Set;for(let e of r){let t=n.get(e)?.l;if(t)for(let e of t)c.add(e)}r.clear();for(let e of a)c.add(e);a.clear();for(let e of i)c.add(e);i.clear();for(let e of c)l(e);r.size&&s(e,t)}while(r.size||a.size||i.size);if(c.length)throw AggregateError(c)},oN=(e,t)=>{let n=e[1],r=e[2],i=e[3],a=e[11],o=e[14],s=e[17];if(!i.size)return;let c=[],l=[],u=new WeakSet,d=new WeakSet,f=[],p=[];for(let n of i)f.push(n),p.push(a(e,t,n));for(;f.length;){let i=f.length-1,o=f[i],s=p[i];if(d.has(o)){f.pop(),p.pop();continue}if(u.has(o)){r.get(o)===s.n&&(c.push(o),l.push(s)),d.add(o),f.pop(),p.pop();continue}u.add(o);for(let r of QM(o,s,n))u.has(r)||(f.push(r),p.push(a(e,t,r)))}for(let n=c.length-1;n>=0;--n){let a=c[n],u=l[n],d=!1;for(let e of u.d.keys())if(e!==a&&i.has(e)){d=!0;break}d&&(r.set(a,u.n),o(e,t,a),s(e,t,a)),r.delete(a)}},sN=(e,t,n)=>{var r,i;let a=e[1],o=e[2],s=e[3],c=e[6],l=e[7],u=e[11],d=e[12],f=e[13],p=e[14],m=e[16],h=e[17],g=e[20],_=e[26],v=e[28],y=u(e,t,n),b=v[0];if(qM(y)){if(a.has(n)&&o.get(n)!==y.n||y.m===b)return y.m=b,y;let r=!1;for(let[n,i]of y.d)if(p(e,t,n).n!==i){r=!0;break}if(!r)return y.m=b,y}let x=!0,S=new Set(y.d.keys()),C=()=>{for(let e of S)y.d.delete(e)},w=()=>{if(a.has(n)){let r=!s.size;h(e,t,n),r&&(f(e,t),d(e,t))}},T=r=>{var i;if(r===n){let n=u(e,t,r);if(!qM(n)){if(WM(r))g(e,t,r,r.init);else throw Error(`no atom init`)}return JM(n)}let o=p(e,t,r);try{return JM(o)}finally{S.delete(r),y.d.set(r,o.n),YM(y.v)&&ZM(n,y.v,o),a.has(n)&&((i=a.get(r))==null||i.t.add(n)),x||w()}},E,D,O={get signal(){return E||=new AbortController,E.signal},get setSelf(){return!D&&GM(n)&&(D=(...r)=>{if(!x)try{return m(e,t,n,r)}finally{f(e,t),d(e,t)}}),D}},k=y.n,A=o.get(n)===k;try{let i=l(e,t,n,T,O);if(g(e,t,n,i),YM(i)){_(e,t,i,()=>E?.abort());let n=()=>{C(),w()};i.then(n,n)}else C();return(r=c.r)==null||r.call(c,n),y.m=b,y}catch(e){if(XM(e))throw e;return delete y.v,y.e=e,++y.n,y.m=b,y}finally{x=!1,y.n!==k&&A&&(o.set(n,y.n),s.add(n),(i=c.c)==null||i.call(c,n))}},cN=(e,t,n)=>{let r=e[1],i=e[2],a=e[11],o=[n];for(;o.length;){let n=o.pop(),s=a(e,t,n);for(let c of QM(n,s,r)){let n=a(e,t,c);i.get(c)!==n.n&&(i.set(c,n.n),o.push(c))}}},lN=(e,t,n,r)=>{let i=e[3],a=e[6],o=e[8],s=e[11],c=e[12],l=e[13],u=e[14],d=e[15],f=e[16],p=e[17],m=e[20],h=e[28],g=!0,_=n=>JM(u(e,t,n)),v=(r,...o)=>{var u;let _=s(e,t,r);try{if(r===n){if(!WM(r))throw Error(`atom not writable`);let n=_.n,s=o[0];m(e,t,r,s),p(e,t,r),n!==_.n&&(++h[0],i.add(r),d(e,t,r),(u=a.c)==null||u.call(a,r));return}return f(e,t,r,o)}finally{g||(l(e,t),c(e,t))}};try{return o(e,t,n,_,v,...r)}finally{g=!1}},uN=(e,t,n)=>{var r;let i=e[1],a=e[3],o=e[6],s=e[11],c=e[15],l=e[18],u=e[19],d=s(e,t,n),f=i.get(n);if(f&&d.d.size>0){for(let[i,u]of d.d)if(!f.d.has(i)){let d=s(e,t,i);l(e,t,i).t.add(n),f.d.add(i),u!==d.n&&(a.add(i),c(e,t,i),(r=o.c)==null||r.call(o,i))}for(let r of f.d)d.d.has(r)||(f.d.delete(r),u(e,t,r)?.t.delete(n))}},dN=(e,t,n)=>{var r;let i=e[1],a=e[4],o=e[6],s=e[10],c=e[11],l=e[12],u=e[13],d=e[14],f=e[16],p=e[18],m=c(e,t,n),h=i.get(n);if(!h){d(e,t,n);for(let r of m.d.keys())p(e,t,r).t.add(n);h={l:new Set,d:new Set(m.d.keys()),t:new Set},i.set(n,h),GM(n)&&KM(n)&&a.add(()=>{let r=!0,i=(...i)=>{try{return f(e,t,n,i)}finally{r||(u(e,t),l(e,t))}};try{let a=s(e,t,n,i);a&&(h.u=()=>{r=!0;try{a()}finally{r=!1}})}finally{r=!1}}),(r=o.m)==null||r.call(o,n)}return h},fN=(e,t,n)=>{var r;let i=e[1],a=e[5],o=e[6],s=e[11],c=e[19],l=s(e,t,n),u=i.get(n);if(!u||u.l.size)return u;let d=!1;for(let e of u.t)if(i.get(e)?.d.has(n)){d=!0;break}if(!d){u.u&&a.add(u.u),u=void 0,i.delete(n);for(let r of l.d.keys())c(e,t,r)?.t.delete(n);(r=o.u)==null||r.call(o,n);return}return u},pN=(e,t,n,r)=>{let i=e[11],a=e[27],o=i(e,t,n),s=`v`in o,c=o.v;if(YM(r))for(let a of o.d.keys())ZM(n,r,i(e,t,a));o.v=r,delete o.e,(!s||!Object.is(c,o.v))&&(++o.n,YM(c)&&a(e,t,c))},mN=(e,t,n)=>{let r=e[14];return JM(r(e,t,n))},hN=(e,t,n,...r)=>{let i=e[3],a=e[12],o=e[13],s=e[16],c=i.size;try{return s(e,t,n,r)}finally{i.size!==c&&(o(e,t),a(e,t))}},gN=(e,t,n,r)=>{let i=e[12],a=e[13],o=e[18],s=e[19],c=o(e,t,n).l;return c.add(r),a(e,t),i(e,t),()=>{c.delete(r),s(e,t,n),a(e,t),i(e,t)}},_N=(e,t,n,r)=>{let i=e[25],a=i.get(n);if(!a){a=new Set,i.set(n,a);let e=()=>i.delete(n);n.then(e,e)}a.add(r)},vN=(e,t,n)=>{e[25].get(n)?.forEach(e=>e())},yN=new WeakMap;function bN(...e){let t={get(e){return r(n,t,e)},set(e,...r){return i(n,t,e,...r)},sub(e,r){return a(n,t,e,r)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,void 0,new WeakMap,_N,vN,[0]].map((t,n)=>e[n]||t);yN.set(t,Object.freeze(n));let r=n[21],i=n[22],a=n[23];return t}var xN=0;function SN(e,t){let n=`atom${++xN}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=CN,r.write=wN),t&&(r.write=t),r}function CN(e){return e(this)}function wN(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}function TN(){return bN()}var EN=SN(new No),DN=(e,t,n)=>e?.suspense&&ON(t),ON=(e,t)=>e.isPending&&!0,kN=({result:e,throwOnError:t,query:n})=>e.isError&&!e.isFetching&&AN(t,[e.error,n]);function AN(e,t){return typeof e==`function`?e(...t):!!e}var jN=e=>e.suspense&&typeof e.staleTime!=`number`?{...e,staleTime:1e3}:e;function MN(e,t,n=e=>e(EN)){let r=SN(0),i=SN(n),a=SN(()=>new WeakMap),o=SN(t=>{let n=t(i),r=e(t),o=n.defaultQueryOptions(r),s=t(a).get(n);return o._optimisticResults=`optimistic`,s&&s.setOptions(o),jN(o)}),s=SN(e=>{let n=e(i),r=e(o),s=e(a),c=s.get(n);if(c)return c;let l=new t(n,r);return s.set(n,l),l}),c=SN(e=>{let t=e(s),n=e(o),r=SN(t.getOptimisticResult(n));return r.onMount=e=>{let n=t.subscribe(to.batchCalls(e));return()=>{t.getCurrentResult().isError&&t.getCurrentQuery().reset(),n()}},r});return SN(e=>{e(r);let t=e(s),n=e(o),i=e(e(c));if(DN(n,i))return t.fetchOptimistic(n);if(kN({result:i,query:t.getCurrentQuery(),throwOnError:n.throwOnError}))throw i.error;return i},(e,t)=>{t(r,e=>e+1)})}function NN(e,t=e=>e(EN)){return MN(e,vo,t)}function PN(e,t=e=>e(EN)){return MN(e,wo,t)}function FN(e,t=e=>e(EN)){let n=Symbol(),r=SN(n=>{let r=t(n),i=e(n);return r.defaultMutationOptions(i)}),i=SN(()=>new WeakMap),a=SN(e=>{let a=e(r),o=t(e),s=e(i),c=s.get(o);if(c)return c[n]=!0,c.setOptions(a),delete c[n],c;let l=new ko(o,a);return s.set(o,l),l}),o=SN(e=>{let t=e(a),n=SN(t.getCurrentResult());return n.onMount=e=>(t.subscribe(to.batchCalls(e)),()=>{t.reset()}),n}),s=SN(e=>{let t=e(a);return(e,n)=>{t.mutate(e,n).catch(IN)}});return SN(e=>{let t=e(a),n=e(e(o)),r=e(s);if(n.isError&&AN(t.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:r,mutateAsync:n.mutate}})}function IN(){}var LN=160,RN=200;function zN(e,t){return e.replace(/\s+/gu,` `).trim().slice(0,t)}function BN({activity:e,terminals:t}){let n;for(let e of t)(n===void 0||e.sequence>n.sequence)&&(n=e);return n===void 0?{kind:`idle`}:e.lastModelChoiceSequence!==null&&e.lastModelChoiceSequence>n.sequence?{kind:`waiting_for_you`}:n.outcome===`failed`||n.outcome===`interrupted`?{kind:`error`,cause:zN(n.diagnostic??(n.outcome===`interrupted`?`Run was interrupted`:`Run failed without a diagnostic`),RN)}:{kind:`waiting_for_you`}}function VN(e){let{activity:t,progress:n}=e,{queue:r}=t;return r.state===`idle`?BN(e):t.cancellationRequested?{kind:`cancelling`}:r.state===`queued`?{kind:`queued`,queuedCommandId:r.commandId,runningWork:r.runningWork}:t.compaction===null?t.retry===null?t.activeTool===null?{kind:n===null||n.text===``?`thinking`:`responding`}:{kind:`running_tool`,tool:t.activeTool}:{kind:`retrying`,attempt:t.retry.attempt,maxAttempts:t.retry.maxAttempts,cause:zN(t.retry.errorMessage,LN),nextRetryAt:t.retry.scheduledAt+t.retry.delayMs}:{kind:`compacting`,trigger:t.compaction.trigger}}function HN(e,t){return e===null||t===null?e===t:e.kind===`session`&&t.kind===`session`?e.sessionId===t.sessionId&&e.commandId===t.commandId:e.kind===`host`&&t.kind===`host`&&e.lane===t.lane&&e.jobId===t.jobId}function UN(e){let t=e.runningWork;return t===null?`Queued for host`:t.kind===`session`?`Waiting for Session ${zN(t.sessionId,256)}`:`Waiting for host job ${zN(t.lane,256)} · ${zN(t.jobId,256)}`}function WN(e,t){return e.kind===t.kind?e.kind===`queued`&&t.kind===`queued`?e.queuedCommandId===t.queuedCommandId&&HN(e.runningWork,t.runningWork):e.kind===`running_tool`&&t.kind===`running_tool`?e.tool===t.tool:e.kind===`compacting`&&t.kind===`compacting`?e.trigger===t.trigger:e.kind===`retrying`&&t.kind===`retrying`?e.attempt===t.attempt&&e.maxAttempts===t.maxAttempts&&e.cause===t.cause&&e.nextRetryAt===t.nextRetryAt:e.kind===`error`&&t.kind===`error`?e.cause===t.cause:!0:!1}function GN(e){switch(e.kind){case`cancelling`:case`queued`:case`retrying`:return e.kind;case`responding`:return`streaming`;case`thinking`:case`running_tool`:case`compacting`:return`thinking`;case`idle`:case`waiting_for_you`:case`error`:return`idle`}}var KN=new WeakMap;function qN(e){let t=KN.get(e);if(t!==void 0)return t;let n=new Set(e.map(({id:e})=>e));return KN.set(e,n),n}function JN(e,t){if(t.length===0)return e;let n=new Set(e.map(({id:e})=>e)),r=t.filter(({id:e})=>!n.has(e));return r.length===0?e:[...e,...r].sort((e,t)=>e.sequence-t.sequence)}function YN(e,t){return JN(e,t)}function XN(e,t){return e===null||qN(t).has(e.messageId)?null:e}function ZN(e,t){let n=[],r=new Map;for(let i of[...e,...t])r.get(i.commandId)===void 0&&(r.set(i.commandId,n.length),n.push(i));return n.length===e.length&&n.every((t,n)=>t===e[n])?e:n}function QN(e,t){return JN(e,t)}function $N(e,t){return JN(e,t)}function eP(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.extensionId===r?.extensionId&&e.id===r.id&&e.kind===r.kind&&e.summary===r.summary&&e.since===r.since&&e.expiresAt===r.expiresAt})}function tP(e,t){return e.total===t.total&&e.hasMore===t.hasMore&&e.prompts.length===t.prompts.length&&e.prompts.every((e,n)=>{let r=t.prompts[n];return r!==void 0&&e.commandId===r.commandId&&e.delivery===r.delivery&&e.text===r.text})}function nP(e,t){return e===t||e.queue.state===t.queue.state&&(e.queue.state===`idle`||t.queue.state===`idle`||e.queue.commandId===t.queue.commandId&&(e.queue.state!==`queued`||t.queue.state!==`queued`||HN(e.queue.runningWork,t.queue.runningWork)))&&e.cancellationRequested===t.cancellationRequested&&e.activeTool===t.activeTool&&e.lastModelChoiceSequence===t.lastModelChoiceSequence&&(e.retry===t.retry||e.retry!==null&&t.retry!==null&&e.retry.attempt===t.retry.attempt&&e.retry.maxAttempts===t.retry.maxAttempts&&e.retry.delayMs===t.retry.delayMs&&e.retry.errorMessage===t.retry.errorMessage&&e.retry.scheduledAt===t.retry.scheduledAt)&&(e.compaction===t.compaction||e.compaction!==null&&t.compaction!==null&&e.compaction.trigger===t.compaction.trigger)}function rP(e,t){return e===t||JSON.stringify(e)===JSON.stringify(t)}function iP(e,t){if(t.kind===`reset`)return{...t.baseline,terminals:ZN([],t.baseline.terminals),compactions:QN([],t.baseline.compactions??[]),compactionNotices:$N([],t.baseline.compactionNotices??[])};if(t.kind===`progress`){let n=qN(e.messages).has(t.progress.messageId),r=e.progress,i=r!==null&&r.messageId===t.progress.messageId,a=i&&r.revision>t.progress.revision;if(n||a)return e;let o=nP(e.activity,t.activity)?e.activity:t.activity;return i&&r.revision===t.progress.revision?o===e.activity?e:{...e,activity:o}:{...e,progress:t.progress,activity:o}}let n=tP(e.pending,t.pending)?e.pending:t.pending,r=YN(e.messages,t.messages),i=ZN(e.terminals,t.terminals),a=e.compactions??[],o=QN(a,t.compactions??[]),s=e.compactionNotices??[],c=$N(s,t.compactionNotices??[]),l=t.activity.queue.state===`idle`?null:XN(e.progress,r),u=t.context===void 0||e.context?.tokens===t.context.tokens&&e.context.window===t.context.window?e.context:t.context;if(r===e.messages&&i===e.terminals&&o===a&&c===s&&l===e.progress&&n===e.pending&&rP(t.extensions,e.extensions)&&eP(t.attention,e.attention)&&t.cursor===e.cursor&&nP(t.activity,e.activity)&&u===e.context)return e;let d={...e,cursor:t.cursor,messages:r,terminals:i,compactions:o,compactionNotices:c,progress:l,activity:nP(e.activity,t.activity)?e.activity:t.activity,pending:n,attention:eP(t.attention,e.attention)?e.attention:t.attention,extensions:rP(t.extensions,e.extensions)?e.extensions:t.extensions};return u===void 0?d:{...d,context:u}}var aP=be(z(),he());function oP(e){return e.text.trim()!==``||(e.thinking?.trim()??``)!==``}var sP=[[`*** Add File: `,`add`],[`*** Delete File: `,`delete`],[`*** Update File: `,`update`]],cP=/^\*\*\* Move to: (.+)$/u;function lP(e){if(e.startsWith(`+`))return{kind:`add`,text:e.slice(1)};if(e.startsWith(`-`))return{kind:`remove`,text:e.slice(1)};if(e.startsWith(` `))return{kind:`context`,text:e.slice(1)}}function uP(e){let t=[],n;for(let r of e.split(`
|
|
32
|
-
`)){let e=sP.find(([e])=>r.startsWith(e));if(e!==void 0){let[i,a]=e;n={operation:a,path:r.slice(i.length).trim(),hunks:[]},t.push(n);continue}if(n===void 0)continue;let i=cP.exec(r);if(i!==null){n.moveTo=(i[1]??``).trim();continue}if(r.startsWith(`@@`)){let e=r.slice(2).trim();n.hunks.push(e===``?{lines:[]}:{context:e,lines:[]});continue}let a=lP(r);if(a===void 0)continue;let o=n.hunks.at(-1)??{lines:[]};n.hunks.length===0&&n.hunks.push(o),o.lines.push(a)}return t}var dP=131072,fP=new TextEncoder,pP=L(()=>z().min(1).max(4096).refine(e=>!e.includes(`\0`),`Path cannot contain null bytes`));function mP(e=0){return z().min(e).refine(e=>fP.encode(e).byteLength<=dP,`Text exceeds the ${String(dP)}-byte Files bound`)}L(()=>Xe({path:pP,offset:Je().int().min(0).default(0),limit:Je().int().min(4).max(dP).default(dP)}));var hP=L(()=>Xe({path:pP,content:mP(),offset:Je().int().min(0),nextOffset:Je().int().min(0).nullable(),truncated:C(),file:Xe({computerId:z().min(1).max(256),path:pP.refine(e=>e.startsWith(`/`),`Computer file paths must be absolute`)}).exactOptional()})),gP=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends gP{};function _P(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function vP(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function yP(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function bP(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function xP(e,t){return yP(e,t,``)}function SP(e,t){return bP(e,t,``)}function CP(e,t){return t.slice(0,wP(e,t))}function wP(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function TP(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function EP(e,t){if(t)return OP(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function DP(e,t){if(t)return OP(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function OP(e,t){if(!t)return[DP(e),EP(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=TP(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var kP=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,AP=RegExp(`[${kP}]+|\\s+|[^${kP}]`,`ug`);new class extends gP{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=TP(e,r)}else n=e.match(AP)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&jP(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&jP(n,i,r,null,t.intlSegmenter),e}};function jP(e,t,n,r,i){if(t&&n){let[a,o]=OP(t.value,i),[s,c]=OP(n.value,i);if(e){let r=_P(a,s);e.value=bP(e.value,s,r),t.value=xP(t.value,r),n.value=xP(n.value,r)}if(r){let e=vP(o,c);r.value=yP(r.value,c,e),t.value=SP(t.value,e),n.value=SP(n.value,e)}}else if(n){if(e){let e=DP(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=DP(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=DP(r.value,i),[a,o]=OP(t.value,i),s=_P(n,a);t.value=xP(t.value,s);let c=vP(xP(n,s),o);t.value=SP(t.value,c),r.value=yP(r.value,n,c),e.value=bP(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=DP(r.value,i),n=CP(EP(t.value,i),e);t.value=SP(t.value,n)}else if(e){let n=CP(EP(e.value,i),DP(t.value,i));t.value=xP(t.value,n)}}new class extends gP{tokenize(e){let t=RegExp(`(\\r?\\n)|[${kP}]+|[^\\S\\n\\r]+|[^${kP}]`,`ug`);return e.match(t)||[]}};var MP=new class extends gP{constructor(){super(...arguments),this.tokenize=PP}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
33
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
34
|
-
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
35
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
36
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function NP(e,t,n){return MP.diff(e,t,n)}function PP(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
37
|
-
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function FP(e){return e==`.`||e==`!`||e==`?`}new class extends gP{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(FP(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends gP{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends gP{constructor(){super(...arguments),this.tokenize=PP}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(IP(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function IP(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=IP(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=IP(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends gP{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function LP(e){let t=e.split(/\n/),n=[],r=0;function i(){let e={};for(n.push(e);r<t.length;){let n=t[r];if(/^(---|\+\+\+|@@)\s/.test(n))break;let i=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(n);i&&(e.index=n.substring(i[0].length).trim()),r++}for(a(e),a(e),e.hunks=[];r<t.length;){let n=t[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(n))break;if(/^@@/.test(n))e.hunks.push(o());else if(n)throw Error(`Unknown line `+(r+1)+` `+JSON.stringify(n));else r++}}function a(e){let n=/^(---|\+\+\+)\s+/.exec(t[r]);if(n){let i=n[1],a=t[r].substring(3).trim().split(` `,2),o=(a[1]||``).trim(),s=a[0].replace(/\\\\/g,`\\`);s.startsWith(`"`)&&s.endsWith(`"`)&&(s=s.substr(1,s.length-2)),i===`---`?(e.oldFileName=s,e.oldHeader=o):(e.newFileName=s,e.newHeader=o),r++}}function o(){let e=r,n=t[r++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),i={oldStart:+n[1],oldLines:n[2]===void 0?1:+n[2],newStart:+n[3],newLines:n[4]===void 0?1:+n[4],lines:[]};i.oldLines===0&&(i.oldStart+=1),i.newLines===0&&(i.newStart+=1);let a=0,o=0;for(;r<t.length&&(o<i.oldLines||a<i.newLines||t[r]?.startsWith(`\\`));r++){let n=t[r].length==0&&r!=t.length-1?` `:t[r][0];if(n===`+`||n===`-`||n===` `||n===`\\`)i.lines.push(t[r]),n===`+`?a++:n===`-`?o++:n===` `&&(a++,o++);else throw Error(`Hunk at line ${e+1} contained invalid line ${t[r]}`)}if(!a&&i.newLines===1&&(i.newLines=0),!o&&i.oldLines===1&&(i.oldLines=0),a!==i.newLines)throw Error(`Added line count did not match for hunk at line `+(e+1));if(o!==i.oldLines)throw Error(`Removed line count did not match for hunk at line `+(e+1));return i}for(;r<t.length;)i();return n}var RP={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function zP(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;NP(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(NP(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||VP(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
|
|
38
|
-
`)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function BP(e,t){if(t||=RP,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders)throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>BP(e,t)).join(`
|
|
39
|
-
`)}let n=[];t.includeIndex&&e.oldFileName==e.newFileName&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`),t.includeFileHeaders&&(n.push(`--- `+e.oldFileName+(e.oldHeader===void 0?``:` `+e.oldHeader)),n.push(`+++ `+e.newFileName+(e.newHeader===void 0?``:` `+e.newHeader)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t];r.oldLines===0&&--r.oldStart,r.newLines===0&&--r.newStart,n.push(`@@ -`+r.oldStart+`,`+r.oldLines+` +`+r.newStart+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
|
|
40
|
-
`)+`
|
|
41
|
-
`}function VP(e){let t=e.endsWith(`
|
|
42
|
-
`),n=e.split(`
|
|
43
|
-
`).map(e=>e+`
|
|
44
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var HP=512,UP=256;new TextEncoder,Xe({path:pP,limit:Je().int().min(1).max(UP).default(UP)});var WP=L(()=>Xe({path:pP,name:z().min(1),type:c([`file`,`directory`,`symlink`]),size:Je().int().nonnegative(),modifiedAt:Je()}));L(()=>Xe({path:pP,entries:T(WP).max(UP),truncated:C()})),L(()=>Xe({path:pP,pattern:z().min(1).max(HP),limit:Je().int().min(1).max(UP).default(UP)})),L(()=>Xe({path:pP,matches:T(pP).max(UP),truncated:C()})),L(()=>Xe({path:pP,pattern:z().min(1).max(HP),regex:C().default(!1),ignoreCase:C().default(!1),limit:Je().int().min(1).max(UP).default(UP)})),L(()=>Xe({path:pP,matches:T(Xe({path:pP,line:Je().int().positive(),text:z()})).max(UP),truncated:C()})),L(()=>Xe({path:pP,oldText:mP(1),newText:mP()}));var GP=L(()=>Xe({path:pP,bytes:Je().int().nonnegative(),diff:z(),firstChangedLine:Je().int().positive().nullable(),unifiedPatch:z().nullable(),unifiedPatchBytes:Je().int().nonnegative(),unifiedPatchAddedLines:Je().int().nonnegative(),unifiedPatchRemovedLines:Je().int().nonnegative(),unifiedPatchTruncated:C()})),KP=L(()=>Xe({status:n(`failed`),error:Xe({kind:c([`not-found`,`ambiguous`,`file-too-large`,`partial-character`,`unchanged`,`conflict`]),path:pP,message:z()})}));ot([GP,KP]),new Intl.Segmenter(void 0,{granularity:`grapheme`});function qP({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}var JP=qP();function YP(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(``)?e:e.replace(JP,``)}function XP(e,t){console.error(JSON.stringify({event:`parakeet_operation_failed`,operation:e,causeKind:t instanceof Error?`error`:`non_error`}),Yn(t))}function ZP(e){return e===`error`?`error`:e===`unknown`?`neutral`:e===`running`?`info`:`success`}var QP={code:`computer`,command:`run`,edit:`write`,other:`working`,read:`read`,search:`search`},$P=40,eF=6,tF=400,nF=72,rF=new Map([[`apply_patch`,`edit`],[`bash`,`command`],[`edit`,`edit`],[`execute`,`code`],[`find`,`search`],[`grep`,`search`],[`ls`,`search`],[`read`,`read`],[`write`,`edit`]]),iF={code:[`Ran script`,`Running script`],command:[`Ran`,`Running`],edit:[`Updated`,`Updating`],other:[`Called`,`Calling`],read:[`Read`,`Reading`],search:[`Searched`,`Searching`]},aF=Oe({path:z()}),oF=Oe({file_path:z()}),sF=Oe({command:z()}),cF=Oe({code:z()}),lF=Oe({patch:z()}),uF=Oe({pattern:z()}),dF=Oe({oldText:z(),newText:z()}),fF=Oe({content:z()}),pF=z(),mF=Oe({content:z(),offset:Je().int().min(0).optional()}),hF=Oe({matches:T(Oe({path:z(),line:Je().int(),text:z()}))}),gF=Oe({stdout:z().optional(),stderr:z().optional(),exitCode:Je().int().nullable().optional()}).refine(e=>e.stdout!==void 0||e.stderr!==void 0||e.exitCode!==void 0),_F=Xe({path:z(),bytes:Je().int().nonnegative(),diff:z(),firstChangedLine:Je().int().positive().nullable(),unifiedPatch:z().nullable(),unifiedPatchBytes:Je().int().nonnegative(),unifiedPatchAddedLines:Je().int().nonnegative(),unifiedPatchRemovedLines:Je().int().nonnegative(),unifiedPatchTruncated:C()}),vF=/^(.+?:\d+)[:-]\s?(.*)$/u;function yF(e){return rF.get(e)??`other`}function bF(e){let t=e.split(`
|
|
45
|
-
`).map(e=>e.trim()).find(e=>e!==``)??``;return t.length>nF?`${t.slice(0,71)}…`:t}function xF(e){return e.slice(0,tF)}function SF(e){return xF(YP(e).replace(/\n$/u,``).split(`
|
|
46
|
-
`))}function CF(e){let t=aF.safeParse(e);if(t.success)return t.data.path;let n=oF.safeParse(e);return n.success?n.data.file_path:void 0}function wF(e){try{return{kind:`parsed`,value:JSON.parse(e)}}catch(e){return{kind:`invalid`,cause:e}}}function TF(e){if(e===void 0)return{kind:`none`};let t=e.content.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
|
|
47
|
-
`);if(t.trim()===``)return{kind:`none`};let n=wF(t);if(n.kind===`invalid`)return{kind:`text`,text:t};let r=n.value,i=pF.safeParse(r);if(i.success)return{kind:`text`,text:i.data};let a=he().safeParse(r);return a.success?{kind:`json`,value:a.data}:{kind:`text`,text:t}}function EF(e,t){let n=t===void 0||t===0;return{kind:`excerpt`,lines:SF(e).map((e,t)=>n?{number:t+1,text:e}:{text:e}),preview:12}}function DF(e){return{kind:`matches`,matches:SF(e).filter(e=>e.trim()!==``).map(e=>{let t=vF.exec(e);return t===null?{location:``,text:e}:{location:t[1]??``,text:t[2]??``}}),preview:12}}function OF(e,t){let n=[];if(e!==void 0&&e.trim()!==``)for(let t of SF(e))n.push({stream:`stdout`,text:t});if(t!==void 0&&t.trim()!==``)for(let e of SF(t))n.push({stream:`stderr`,text:e});return n.length===0?void 0:{kind:`output`,lines:xF(n),preview:12}}function kF(e,t){return{kind:`text`,label:t,language:`json`,lines:SF(JSON.stringify(e,null,2)),preview:12}}function AF(e,t){if(e.kind===`none`)return{sections:[]};if(e.kind===`text`){if(t===`read`)return{sections:[EF(e.text,void 0)]};if(t===`search`)return{sections:[DF(e.text)]};if(t===`command`){let t=OF(e.text,void 0);return{failure:bF(e.text),sections:t===void 0?[]:[t]}}return{failure:bF(e.text),sections:[{kind:`text`,lines:SF(e.text),preview:12}]}}let n=mF.safeParse(e.value);if(n.success)return{sections:[EF(n.data.content,n.data.offset)]};let r=hF.safeParse(e.value);if(r.success)return{sections:[{kind:`matches`,matches:xF(r.data.matches).map(e=>({location:`${e.path}:${String(e.line)}`,text:YP(e.text)})),preview:12}]};let i=KP.safeParse(e.value);if(i.success)return{failure:i.data.error.message,sections:[{kind:`text`,lines:[i.data.error.message],preview:12}]};let a=_F.safeParse(e.value);if(a.success){let{unifiedPatch:e,unifiedPatchBytes:t,unifiedPatchTruncated:n}=a.data;if(n&&e===null)return{sections:[{kind:`text`,lines:[`Diff omitted (${String(t)} bytes, ${String(a.data.unifiedPatchAddedLines)} added, ${String(a.data.unifiedPatchRemovedLines)} removed).`],preview:12}]};if(!n&&e!==null&&t<=65536&&new TextEncoder().encode(e).byteLength===t)try{let t=LP(e),n=t[0];if(t.length===1&&n?.oldFileName===a.data.path&&n.newFileName===a.data.path)return{sections:[NF([{operation:`update`,path:a.data.path,moveTo:void 0,lineNumbers:!0,unified:e,hunks:n.hunks.map(e=>({header:`-${String(e.oldStart)},${String(e.oldLines)} +${String(e.newStart)},${String(e.newLines)}`,lines:e.lines.flatMap(e=>{let t=IF.get(e.charAt(0));return t===void 0?[]:[{kind:t,text:e.slice(1)}]})}))}])]}}catch(e){XP(`render tool patch`,e)}}let o=gF.safeParse(e.value);if(o.success){let{stdout:e,stderr:t,exitCode:n}=o.data,r=OF(e,t),i=n!=null&&n!==0;return{exitCode:i?n:void 0,failure:t!==void 0&&t.trim()!==``?bF(YP(t)):i?`Exited with code ${String(n)}`:void 0,sections:r===void 0?[]:[r]}}return{sections:[kF(e.value)]}}var jF={add:`Add`,delete:`Delete`,update:`Update`};function MF(e){let t=e.length>1;return e.flatMap(e=>[...t?[{kind:`file`,text:`${jF[e.operation]} ${e.path??``}${e.moveTo===void 0?``:` → ${e.moveTo}`}`}]:[],...e.hunks.flatMap(e=>[...e.header===void 0?[]:[{kind:`hunk`,text:e.header}],...e.lines])])}function NF(e){return{kind:`diff`,files:e,lines:xF(MF(e)),preview:$P}}var PF={add:`+`,context:` `,remove:`-`};function FF(e){return e.map(e=>{let t=1,n=1,r=e.hunks.map(e=>{let r=t=>e.lines.filter(e=>e.kind===t).length,i=r(`context`)+r(`remove`),a=r(`context`)+r(`add`),o={oldStart:t,oldLines:i,newStart:n,newLines:a,lines:e.lines.map(e=>`${PF[e.kind]}${e.text}`)};return t+=i,n+=a,o}),i={oldFileName:e.path,newFileName:e.moveTo??e.path,oldHeader:void 0,newHeader:void 0,hunks:r};return{hunks:e.hunks.map(e=>({header:e.context,lines:e.lines})),lineNumbers:!1,moveTo:e.moveTo,operation:e.operation,path:e.path,unified:i.hunks.length===0?``:BP(i)}})}var IF=new Map([[`+`,`add`],[`-`,`remove`],[` `,`context`]]);function LF(e,t,n){let r=e??`file`,i=zP(r,r,t,n,``,``,{context:3});return{lineNumbers:!0,unified:BP(i),hunks:i.hunks.map(e=>({header:`-${String(e.oldStart)},${String(e.oldLines)} +${String(e.newStart)},${String(e.newLines)}`,lines:e.lines.flatMap(e=>{let t=IF.get(e.charAt(0));return t===void 0?[]:[{kind:t,text:e.slice(1)}]})})),operation:t===``?`add`:`update`,path:e}}function RF(e,t){let n=lF.safeParse(e.args);if(n.success){let t=uP(n.data.patch),r=[...new Set(t.flatMap(e=>e.path?[e.path]:[]))];return{get input(){return[NF(FF(t))]},label:r.length<=1?r[0]??e.name:`${r[0]??``} +${String(r.length-1)}`,paths:r}}let r={label:t??e.name,paths:t===void 0?[]:[t]},i=dF.safeParse(e.args);if(i.success)return{...r,get input(){return[NF([LF(t,i.data.oldText,i.data.newText)])]}};let a=fF.safeParse(e.args);return{...r,get input(){return a.success?[NF([LF(t,``,a.data.content)])]:[]}}}function zF(e){return{get input(){return Object.keys(e.args).length===0?[]:[kF(e.args,`Arguments`)]},label:e.name,paths:[]}}function BF(e,t){let n=CF(e.args);switch(t){case`code`:{let t=cF.safeParse(e.args);return t.success?{get input(){return[{kind:`script`,lines:SF(t.data.code),preview:eF}]},label:bF(t.data.code),paths:[]}:zF(e)}case`command`:{let t=sF.safeParse(e.args);return t.success?{get input(){return[{kind:`command`,lines:SF(t.data.command),preview:eF}]},label:bF(t.data.command),paths:[]}:zF(e)}case`edit`:return RF(e,n);case`read`:return{input:[],label:n??e.name,paths:n===void 0?[]:[n]};case`search`:{let t=uF.safeParse(e.args);return{input:[],label:bF(t.success?n===void 0?t.data.pattern:`${t.data.pattern} in ${n}`:n??`.`),paths:[]}}case`other`:return zF(e)}}function VF(e){let t=yF(e.name),n=BF(e,t),[r,i]=iF[t],a=e.status===`completed`?TF(e.result):void 0,o=a?.kind===`json`&&KP.safeParse(a.value).success,s,c=()=>{if(s!==void 0)return s;let r=AF(TF(e.result),t),i=e.status===`error`||o,a=i?r.failure??`The tool reported an error.`:void 0,c=r.sections.some(e=>e.kind===`diff`),l=(t===`edit`&&!i&&!c?[]:r.sections).filter(e=>e.kind!==`text`||e.lines.length!==1||e.lines[0]!==a);return s={error:a,exitCode:r.exitCode,sections:[...t===`edit`&&c?[]:n.input,...l]},s},l=e.status===`error`||o;return{activeVerb:i,durationMs:e.startedAt===void 0||e.result===void 0?void 0:Math.max(0,e.result.timestamp-e.startedAt),get error(){return l?c().error:void 0},get exitCode(){return c().exitCode},id:e.id,kind:t,label:n.label,name:e.name,paths:n.paths,get sections(){return c().sections},status:l?`error`:e.status,verb:r}}function HF(e){if(e<1e3)return`${String(Math.round(e))}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);return`${String(Math.floor(t/60))}m ${String(t%60)}s`}var UF={code:[`ran`,`script`,`scripts`],command:[`ran`,`command`,`commands`],edit:[`edited`,`file`,`files`],other:[`called`,`tool`,`tools`],read:[`read`,`file`,`files`],search:[`searched`,`pattern`,`patterns`]};function WF(e){let t=new Map;for(let n of e){let e=t.get(n.kind)??{calls:0,paths:new Set};e.calls+=1;for(let t of n.paths)e.paths.add(t);t.set(n.kind,e)}let n=[...t].map(([e,t])=>{let[n,r,i]=UF[e],a=(e===`read`||e===`edit`)&&t.paths.size>0?t.paths.size:t.calls;return`${n} ${String(a)} ${a===1?r:i}`}).join(`, `);return n.charAt(0).toUpperCase()+n.slice(1)}function GF(e){return e.some(e=>e.status===`running`)?`running`:e.some(e=>e.status===`error`)?`error`:e.some(e=>e.status===`unknown`)?`unknown`:`completed`}function KF(e){let t,n;for(let r of e)r.startedAt!==void 0&&(t=Math.min(t??r.startedAt,r.startedAt)),r.result!==void 0&&(n=Math.max(n??r.result.timestamp,r.result.timestamp));return t===void 0||n===void 0?void 0:Math.max(0,n-t)}function qF(e){let t=e.map(VF),n=GF(t);return{active:[...t].reverse().find(e=>e.status===`running`),calls:t,durationMs:n===`running`?void 0:KF(e),failedCount:t.filter(e=>e.status===`error`).length,id:`tools:${e[0].id}`,kind:`tool_group`,status:n,summary:t.length===1&&t[0]!==void 0?`${t[0].verb} ${t[0].label}`:WF(t),tools:e}}function JF(e){let t=[],n=[],r=[],i=()=>{let[e,...i]=n;e!==void 0&&t.push(qF([e,...i])),t.push(...r),n=[],r=[]};for(let a of e){if(a.kind===`tool`){n.push(a);continue}if(a.kind===`assistant_message`&&!oP(a)&&n.length>0){r.push(a);continue}i(),t.push(a)}return i(),t}var YF=Object.freeze({mode:`default`,overrides:new Map});function XF(e){return e.status!==`completed`}function ZF(e,t){return t?e.calls:e.calls.slice(-3)}function QF(e){return e.status===`error`}function $F(e,t,n){let r=e.overrides.get(t);return r===void 0?e.mode==="default"?n:e.mode===`expanded`:r}function eI(e,t,n){let r=new Map(e.overrides);return r.set(t,!$F(e,t,n)),{...e,overrides:r}}function tI(e,t,n){return[...e.map(e=>({sequence:e.sequence,tie:1,kind:`message`,message:e})),...t.map(e=>({sequence:e.sequence,tie:0,kind:`marker`,marker:e})),...n.map(e=>({sequence:e.sequence,tie:2,kind:`notice`,notice:e}))].sort((e,t)=>e.sequence-t.sequence||e.tie-t.tie)}var nI=()=>void 0;function rI(e,t){return t===void 0?e:{...e,requestId:t}}function iI(e){return Array.isArray(e)?e.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
|
|
48
|
-
`):e}function aI(e,t){return{args:aP.parse(e.arguments),id:e.id,kind:`tool`,name:e.name,startedAt:t,status:`unknown`}}function oI(e){let t={id:e.messageId,kind:`assistant_message`,pending:!0,text:e.text};return e.thinking===``?t:{...t,thinking:e.thinking}}function sI(e){let t=[],n=[],r=[];for(let i of e.content)i.type===`text`&&t.push(i.text),i.type===`thinking`&&n.push(i.thinking),i.type===`toolCall`&&r.push(aI(i,e.timestamp));return{text:t,thinking:n,tools:r}}function cI(e,t,n){if(n.text.length===0&&n.thinking.length===0&&n.tools.length>0)return;let r={id:e,isError:t.stopReason===`error`||t.stopReason===`aborted`,kind:`assistant_message`,pending:!1,at:t.timestamp,text:n.text.length===0?t.stopReason===`error`?`This run couldn’t finish.`:t.stopReason===`aborted`?`The run was cancelled.`:``:n.text.join(``),usage:{cost:t.usage.cost.total,tokens:t.usage.totalTokens}};return n.thinking.length===0?r:{...r,thinking:n.thinking.join(`
|
|
49
|
-
`)}}function lI(e,t,n){let r=sI(t),i=cI(e,t,r);return{items:i===void 0?r.tools:[{...i,author:n},...r.tools],model:{model:t.model,provider:t.provider},usage:{cost:t.usage.cost.total,tokens:t.usage.totalTokens}}}function uI(e,t,n){for(let r of n.items)r.kind===`tool`&&t.set(r.id,e.length),e.push(r)}function dI(e,t,n){let r=t.get(n.toolCallId);if(r===void 0)return;let i=e[r];i?.kind===`tool`&&(e[r]={...i,result:n,status:n.isError?`error`:`completed`})}function fI(e,t=[],n,r=ej,i=nI,a=[]){let o=[],s=new Map,c=new Set,l=new Map,u,d=0,f=0;for(let n of tI(e,t,a)){if(n.kind===`marker`){o.push({id:n.marker.id,kind:`compaction_divider`,at:n.marker.at,tokensBefore:n.marker.tokensBefore,tokensAfter:n.marker.tokensAfter});continue}if(n.kind===`notice`){o.push({id:n.notice.id,kind:`compaction_notice`,at:n.notice.at,trigger:n.notice.trigger,result:n.notice.result,diagnostic:n.notice.diagnostic});continue}let e=n.message,t=e.value;e.commandId!==null&&c.add(e.commandId);let a=o.length;switch(t.role){case`user`:{let n=e.commandId??e.id,a={id:e.id,kind:`user_message`,commandId:n,status:`confirmed`,at:t.timestamp,text:iI(t.content),author:r(e.meta),origin:e.origin};o.push(rI(a,i(n)));break}case`assistant`:{let n=lI(e.id,t,r(e.meta));u=n.model,d+=n.usage.tokens,f+=n.usage.cost,uI(o,s,n);break}case`toolResult`:if(dI(o,s,t),e.commandId!==null){let n=l.get(t.toolCallId)??new Set;n.add(e.commandId),l.set(t.toolCallId,n)}}if(e.commandId!==null)for(let t of o.slice(a))l.set(t.id,new Set([e.commandId]))}let p=n?.queue;if(p?.state===`running`&&n?.activeTool!==null){let e=!1,t=-1;for(let r=0;r<o.length;r++){let i=o[r];i?.kind===`user_message`&&(e=i.commandId===p.commandId,e&&(t=-1)),e&&i?.kind===`tool`&&i.status===`unknown`&&i.name===n?.activeTool&&(t=r)}let r=o[t];r?.kind===`tool`&&(o[t]={...r,status:`running`})}let m=JF(o),h=new Map;for(let e of m){if(e.kind===`assistant_message`&&!oP(e))continue;let t=e.kind===`tool_group`?e.tools:[e];for(let n of t)for(let t of l.get(n.id)??[])h.set(t,e.id)}let g={commandAnchors:h,completedMessageIds:qN(e),items:m,commandIds:c};return u===void 0?g:{...g,model:u,usage:{cost:f,tokens:d}}}function pI(e,t,n,r=[],i=ej,a=nI){let o=t===null||e.completedMessageIds.has(t.messageId)||t.text===``&&t.thinking===``?void 0:t;if(r.length===0&&o===void 0&&n.length===0)return[];let s=[],c=new Set(n.map(({commandId:e})=>e));for(let t of n){if(e.commandIds.has(t.commandId))continue;let n={id:t.commandId,kind:`user_message`,commandId:t.commandId,status:`queued`,delivery:t.delivery,text:t.text,origin:t.origin,author:i(t.meta)};s.push(rI(n,a(t.commandId)))}for(let t of r){if(t.commandId!==void 0&&(c.has(t.commandId)||e.commandIds.has(t.commandId)))continue;let n={id:t.requestId,kind:`user_message`,requestId:t.requestId,status:t.status===`failed`?`failed`:t.status===`accepted`?`accepted`:`pending`,delivery:t.delivery,text:t.content},r=t.commandId===void 0?n:{...n,commandId:t.commandId},i=t.error===void 0?r:{...r,error:t.error};s.push(i)}return[...o===void 0?[]:[oI(o)],...s.filter(e=>e.status!==`failed`&&e.delivery===`steer`),...s.filter(e=>e.status!==`failed`&&e.delivery===`followUp`),...s.filter(e=>e.status===`failed`)]}var mI=Object.freeze({observation:`connecting`,snapshot:void 0,latestPrompt:void 0}),hI=200,gI=400;function _I(e,t){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.value.role!==`user`||n.commandId===null)continue;let r=n.value.content,i=Array.isArray(r)?r.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
|
|
50
|
-
`):r;return[n.commandId,i]}return t}async function*vI(e,t){yield{kind:`opening`};let n=await e.watch({limit:hI}),r,i=()=>(r??=n.close(),r),a=()=>{i().catch(e=>{XP(`close aborted Session watch`,e)})};t.addEventListener(`abort`,a,{once:!0});try{if(t.aborted)return;let r=n.snapshot;yield{kind:`snapshot`,value:r};for await(let t of n.changes)r=iP(r,t),r.messages.length>gI?(r=await e.read({limit:hI}),yield{kind:`snapshot`,value:r}):yield{kind:`frame`,value:t};throw Error(`Session watch ended; current activity is unavailable`)}catch(e){if(!t.aborted)throw e}finally{t.removeEventListener(`abort`,a),await i()}}function yI(e,t){if(t.kind===`opening`)return{...e,observation:`connecting`};if(t.kind===`snapshot`)return{observation:`live`,snapshot:t.value,latestPrompt:_I(t.value.messages,e.latestPrompt)};if(e.snapshot===void 0)return t.value.kind===`reset`?{observation:`live`,snapshot:t.value.baseline,latestPrompt:_I(t.value.baseline.messages)}:e;let n=iP(e.snapshot,t.value);return{observation:`live`,snapshot:n,latestPrompt:_I(n.messages,e.latestPrompt)}}function bI(e){return Yo({queryKey:[`shiitake-session`,e.address],queryFn:Po({streamFn:({signal:t})=>vI(e,t),reducer:yI,initialValue:mI,refetchMode:`append`}),refetchOnMount:`always`,retry:!1,staleTime:1/0})}function xI(e,t,n){e.setQueryData(bI(t).queryKey,{observation:`connecting`,snapshot:n,latestPrompt:_I(n.messages)})}function SI(e,t=null){let n={before:t,newerBefore:[],newerOverflow:!1};return Xo({queryKey:[`shiitake-session-history`,e.address],initialPageParam:n,queryFn:async({pageParam:t,signal:n})=>{if(t.before===null)throw Error(`Session has no older history cursor`);let r=await e.read({before:t.before,limit:100});return n.throwIfAborted(),r},getNextPageParam:(e,t,n)=>{if(e.oldestCursor===null||e.oldestCursor===void 0)return;let r=n.before===null?n.newerBefore:[...n.newerBefore,n.before];return{before:e.oldestCursor,newerBefore:r.slice(-2048),newerOverflow:n.newerOverflow||r.length>2048}},getPreviousPageParam:(e,t,n)=>{let r=n.newerBefore.at(-1);return r===void 0?void 0:{before:r,newerBefore:n.newerBefore.slice(0,-1),newerOverflow:n.newerOverflow}},select:e=>({pages:e.pages,newerOverflow:e.pageParams[0]?.newerOverflow??!1}),maxPages:4,enabled:!1,retry:!1,staleTime:1/0})}function CI(e,t=/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)){return e.split(` `).map((n,r)=>n===`<leader>`?`Ctrl K`:r>0&&e.startsWith(`<leader> `)?n:n.split(`+`).map(e=>e===`mod`?t?`⌘`:`Ctrl`:e===`escape`?`Esc`:e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)).join(n===`ctrl+k`||n===`mod+k`?` `:`+`)).join(` `)}function wI(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],CI(n.binding)]);return e.slash.map(e=>({alias:e.alias,commandId:e.commandId,title:e.title,description:e.description,category:e.category,order:e.order,grammar:e.arguments,consumesDraft:e.consumesDraft,keys:t.get(e.commandId)??[],availability:e.availability}))}function TI(e){let t=new Map;for(let n of e.bindings){let e=t.get(n.commandId);t.set(n.commandId,{commandId:n.commandId,keys:e===void 0?CI(n.binding):`${e.keys}, ${CI(n.binding)}`,title:n.title,order:e?.order??n.order})}return[...t.values()]}function EI(e){let t=e.grammar?.words?.map(({word:e})=>e)??[];return e.grammar===void 0?`/${e.alias} takes no arguments.`:e.grammar.text===void 0?`Use /${e.alias} ${t.join(` or `)}.`:`Use /${e.alias} ${e.grammar.hint}.`}function DI(e,t){if(!t.startsWith(`/`))return{kind:`prompt`};let n=/^\/(\S*)(?:\s+([\s\S]*))?$/u.exec(t.trimEnd()),r=n?.[1]??``,i=(n?.[2]??``).trim(),a=e.find(e=>e.alias===r);if(a===void 0)return{kind:`invalid`,message:`Unsupported command: /${r}. Use /help for available commands.`};if(i.length===0)return{kind:`command`,command:a};let o=a.grammar,s=o?.words?.find(e=>e.word===i);return s===void 0?o?.text===void 0?{kind:`invalid`,message:EI(a)}:{kind:`command`,command:a,arguments:{...o.text.arguments,[o.text.field]:i},requestIdField:o.text.requestIdField}:{kind:`command`,command:a,arguments:s.arguments}}function OI(e,t){let n=e.toLocaleLowerCase(),r=t.toLocaleLowerCase();if(r.length===0)return{tier:0,spread:0,indices:[]};let i=e=>Array.from({length:r.length},(t,n)=>e+n);if(n.startsWith(r))return{tier:0,spread:n.length-r.length,indices:i(0)};let a=n.search(RegExp(`[-_\\s]${r.replaceAll(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}`,`u`));if(a>=0)return{tier:1,spread:a,indices:i(a+1)};let o=n.indexOf(r);if(o>=0)return{tier:2,spread:o,indices:i(o)};let s=[],c=0;for(let e of r){let t=n.indexOf(e,c);if(t<0)return;s.push(t),c=t+1}let l=s[0]??0;return{tier:3,spread:(s.at(-1)??0)-l-r.length+1,indices:s}}function kI(e,t,n,r){return e.map(e=>({entry:e,match:OI(t(e),n)})).filter(e=>e.match!==void 0).sort((e,n)=>e.match.tier-n.match.tier||e.match.spread-n.match.spread||r(e.entry)-r(n.entry)||t(e.entry).localeCompare(t(n.entry))).map(({entry:e,match:t})=>({entry:e,indices:t.indices}))}var AI=[`help`,`login`,`model`];function jI(e,t,n={}){if(!t.startsWith(`/`)||t.includes(`
|
|
51
|
-
`))return{kind:`none`};let r=t.search(/\s/u);if(r<0){let r=t.slice(1);return{kind:`commands`,query:r,items:kI(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`)||AI.includes(e.alias):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>{let t=AI.indexOf(e.alias);return r.length===0&&t>=0?t-AI.length:e.order}).map(({entry:e,indices:t})=>({command:e,label:`/${e.alias}`,matches:t.map(e=>e+1),insert:e.grammar===void 0?`/${e.alias}`:`/${e.alias} `}))}}let i=t.slice(1,r),a=e.find(e=>e.alias===i);if(a?.grammar===void 0||a.availability.status!==`available`)return{kind:`none`};let o=t.slice(r).trimStart(),s=(o.includes(` `)?[]:a.grammar.words??[]).filter(e=>e.word.toLocaleLowerCase().startsWith(o.toLocaleLowerCase())).map(e=>({word:e,label:e.word,matches:Array.from({length:o.length},(e,t)=>t),insert:`/${i} ${e.word}`}));return{kind:`arguments`,command:a,query:o,hint:`/${i} ${a.grammar.hint}`,items:s}}var MI=new WeakMap;function NI(e){return e.status===`handled`&&Oe({cancelled:n(!0)}).safeParse(e.result).success}async function PI(e,t,n,r,i){let a=DI(wI(t.snapshot()),e);if(a.kind===`prompt`){n();return}if(a.kind===`invalid`)return{status:`failed`,error:{code:`invalid_arguments`,message:a.message}};let{command:o,requestIdField:s}=a;if(o.consumesDraft&&o.availability.status===`available`&&i?.(),a.arguments===void 0)return t.execute(o.commandId,{origin:r});if(s===void 0)return t.execute(o.commandId,{origin:r,arguments:a.arguments});let c=MI.get(t)??new Map;MI.set(t,c);let l=c.get(o.commandId);if(l?.draft===e&&l.running!==void 0)return l.running;let u={draft:e,requestId:l?.draft===e?l.requestId:An()};c.set(o.commandId,u);let d=t.execute(o.commandId,{origin:r,arguments:{...a.arguments,[s]:u.requestId}}).then(e=>c.get(o.commandId)===u?(u.running=void 0,e.status===`handled`&&!NI(e)&&c.delete(o.commandId),e):e);return u.running=d,d}var FI=Object.freeze([]),II=Object.freeze([]),LI=Object.freeze([]),RI=Object.freeze([]),zI=Object.freeze([]),BI=Object.freeze({}),VI=Object.freeze({total:0,hasMore:!1,prompts:Object.freeze([])}),HI=Object.freeze({status:`connecting`}),UI=Object.freeze({status:`live`}),WI=32;function GI(e){return e instanceof Error&&e.message.trim().length>0?e.message:`Prompt admission failed`}function KI(e){return(e instanceof Error&&e.message.trim().length>0?e.message.trim():`Session history is unavailable`).slice(0,500)}function qI(e,t,n){if(e===void 0)return`connecting`;let r=VN(e),i=GN(r);return i===`idle`?n!==void 0||r.kind===`error`?`error`:t.some(({status:e})=>e===`accepted`)?`queued`:t.some(({status:e})=>e===`admitting`)?`sending`:i:i}function JI(e){if(e===void 0)return;let t;for(let n of e)n.value.role===`user`&&n.commandId!==null&&(t===void 0||n.sequence>t.sequence)&&(t={commandId:n.commandId,sequence:n.sequence});return t?.commandId}function YI(e,t){let n=e.find(e=>e.commandId===t&&e.value.role===`user`);if(n?.value.role!==`user`)return;let r=n.value.content,i=Array.isArray(r)?r.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
|
|
52
|
-
`):r;return i.trim()===``?void 0:i}function XI(e,t,n){let r=NN(()=>bI(e),()=>t),i=SN(e=>e(r).data?.snapshot),a=SN(void 0),o=SN(e=>(e(a)??e(i))?.oldestCursor??null),s=PN(t=>SI(e,t(o)),()=>t),c=SN(e=>{let t=e(s);return t.data===void 0?e(o)!==null:t.hasNextPage}),l=SN(e=>e(s).isFetching),u=SN(e=>{let t=e(s);return t.hasPreviousPage||t.data?.newerOverflow===!0}),d=SN(null,e=>{!e(c)||e(l)||e(s).fetchNextPage({cancelRefetch:!1,throwOnError:!0}).catch(e=>{e instanceof ao||XP(`read older Session history`,e)})}),f=SN(null,(n,r)=>{r(a,void 0),t.resetQueries({queryKey:SI(e).queryKey,exact:!0})}),p=SN(null,(e,t)=>{let n=e(s);if(!n.isFetching){if(!n.hasPreviousPage){e(u)&&t(f);return}n.fetchPreviousPage({cancelRefetch:!1,throwOnError:!0}).catch(e=>{e instanceof ao||XP(`read newer Session history`,e)})}}),m=SN(null,(e,t)=>{e(a)===void 0&&t(a,e(i))}),h=SN(e=>{let t=e(s),n=e(i)?.messages??FI,r=t.data?.pages.flatMap(e=>e.messages)??FI,o=e(a)?.messages??FI;return r.length===0?o.length===0?n:YN(o,n):e(u)?r:YN(YN(r,o),n)}),g=SN(e=>{let t=e(s),n=e(i)?.compactions??II,r=t.data?.pages.flatMap(e=>e.compactions??II)??II,o=e(a)?.compactions??II;return r.length===0?o.length===0?n:QN(o,n):e(u)?r:QN(QN(r,o),n)}),_=SN(e=>{let t=e(s),n=e(i)?.compactionNotices??LI,r=t.data?.pages.flatMap(e=>e.compactionNotices??LI)??LI,o=e(a)?.compactionNotices??LI;return r.length===0?o.length===0?n:$N(o,n):e(u)?r:$N($N(r,o),n)}),v=SN(e=>e(r).data?.latestPrompt?.[0]??JI(e(h))),y=SN(e=>e(i)?.pending??VI),b=SN(e=>e(i)?.extensions??BI),x,S=SN(e=>{let t=e(r),n=e(i)?.activity;if(t.isError||t.data?.observation!==`live`||n?.queue.state!==`running`||n.activeTool===null){x=void 0;return}return x?.queue.state===`running`&&x.queue.commandId===n.queue.commandId&&x.activeTool===n.activeTool||(x=n),x}),C=SN(new Map),w=SN(e=>{let t=e(C);return e=>t.get(e)}),T=SN(e=>fI(e(h),e(g),e(S),n,e(w),e(_))),E=SN(``),D=SN(0),O=SN([]),k=SN(void 0),A=SN(e=>new Set([...e(T).commandIds,...e(y).prompts.map(({commandId:e})=>e),...e(i)?.terminals.map(({commandId:e})=>e)??[]])),j=SN(e=>{let t=e(A);return e(O).filter(e=>e.status===`failed`||e.commandId===void 0||!t.has(e.commandId))}),M=SN(null,(e,t)=>{let n=e(A);t(O,e=>{let t=e.filter(({status:e,commandId:t})=>e!==`accepted`||t===void 0||!n.has(t));return t.length===e.length?e:t})}),N=SN(void 0),P=SN(null,(e,t,n)=>{e(E)!==n&&t(D,e=>e+1),t(E,n),t(N,void 0)}),F=SN(null,(e,t,n)=>{e(D)===n.revision&&t(E,e=>e===n.draft?``:e)}),ee=FN(()=>({mutationFn:t=>e.command({type:`cancel`,commandId:t})}),()=>t),I=SN(e=>{if(e(u))return[];let t=e(i),r=e(y);return pI(e(T),t?.progress??null,r.prompts,e(j),n,e(w))}),te=SN(e=>{let t=e(T),n={pendingHasMore:e(y).hasMore,queued:e(y),commandAnchors:t.commandAnchors,hasMoreHistory:e(c),hasNewerHistory:e(u),loadingOlderHistory:e(l),settled:t.items,tail:e(I)};return t.model===void 0||t.usage===void 0?n:{...n,model:t.model,usage:t.usage}}),L=SN(e=>{let t=e(j),n=e(i),r=e(y),a=e(O).find(({requestId:t})=>t===e(k)),o=r.prompts.length>0||t.some(({status:e})=>e!==`failed`);if(a?.status===`failed`&&n!==void 0&&GN(VN(n))===`idle`&&!o)return`admission`;if(a?.status===`admitting`||a?.status===`accepted`&&!e(T).commandIds.has(a.commandId??``)&&!r.prompts.some(({commandId:e})=>e===a.commandId)&&!n?.terminals.some(({commandId:e})=>e===a.commandId)||o)return;let s=e(v),c=n?.terminals.find(({commandId:e})=>e===s)?.outcome;return c===`completed`?void 0:c}),ne=SN(e=>{let t=e(r);return t.isError?{status:`unavailable`,reason:t.error instanceof Error&&t.error.message.trim().length>0?t.error.message:`Session history is unavailable`}:t.data?.observation===`live`?UI:HI}),re=SN(e=>e(ne).status===`unavailable`?`disconnected`:e(ne).status===`connecting`?`connecting`:qI(e(i),e(j),e(L))),ie=SN(e=>e(i)?.context),ae=SN(e=>{let t=e(i)?.activity.queue;return t?.state===`idle`?void 0:t?.commandId}),oe,R=SN(e=>{let t=e(ne);if(t.status===`unavailable`)return{kind:`disconnected`,cause:t.reason};if(t.status===`connecting`)return{kind:`connecting`};if(e(L)===`admission`)return{kind:`error`,cause:([...e(O)].reverse().find(e=>e.status===`failed`)?.error??`Prompt admission failed`).slice(0,200)};let n=e(i);if(n===void 0)return{kind:`connecting`};let r=VN(n);return oe!==void 0&&WN(oe,r)?oe:(oe=r,r)}),se=SN(null,(t,n,r)=>{e.command({type:`prompt`,text:r.content,requestId:r.requestId,delivery:r.delivery}).then(e=>{if(e.status===`recorded`){n(O,e=>e.filter(e=>e.requestId!==r.requestId)),n(F,{draft:r.submittedDraft,revision:r.submittedDraftRevision});return}n(C,t=>new Map(t).set(e.commandId,r.requestId)),n(O,t=>t.map(t=>t.requestId===r.requestId?{requestId:t.requestId,content:t.content,submittedDraft:t.submittedDraft,submittedDraftRevision:t.submittedDraftRevision,delivery:t.delivery,commandId:e.commandId,status:`accepted`}:t));let i=t(O),a=i.findIndex(e=>e.requestId===r.requestId),o=i.slice(a+1).some(e=>e.status===`admitting`&&e.submittedDraft===r.submittedDraft);n(M),o||n(F,{draft:r.submittedDraft,revision:r.submittedDraftRevision})}).catch(e=>{n(O,t=>t.map(t=>t.requestId===r.requestId?{...t,status:`failed`,error:GI(e)}:t))})}),ce=SN(null,(e,t,n=`steer`)=>{let r=e(E),i=r.trim();if(i===``)return;let a=e(j),o=e(D);if(e(O).some(e=>e.status===`admitting`&&e.submittedDraft===r&&e.submittedDraftRevision===o))return;if(a.filter(({status:e})=>e!==`failed`).length>=WI){t(N,`queue_full`);return}let s={content:i,delivery:n,requestId:An(),submittedDraft:r,submittedDraftRevision:o,status:`admitting`};t(O,[...a,s]),t(k,s.requestId),t(N,void 0),t(se,s)}),le=SN(null,async(e,t,n)=>{let r={draft:e(E),revision:e(D)},i=await n(r.draft,()=>{t(F,r)});return i?.status===`handled`&&!NI(i)&&t(F,r),i}),ue=SN(null,(e,t)=>{let n=e(j);if(e(L)===`interrupted`||e(L)===`failed`){let a=e(i),o=e(v);if(a===void 0||o===void 0)return;let s=YI(a.messages,o)??e(r).data?.latestPrompt?.[1];if(s===void 0)return;if(n.filter(({status:e})=>e!==`failed`).length>=WI){t(N,`queue_full`);return}let c={content:s,delivery:`followUp`,requestId:An(),submittedDraft:s,submittedDraftRevision:e(D),status:`admitting`};t(O,[...e(O),c]),t(k,c.requestId),t(N,void 0),t(se,c);return}let a=n.filter(e=>e.status===`failed`).at(-1);if(a===void 0)return;if(n.filter(({status:e})=>e!==`failed`).length>=WI){t(N,`queue_full`);return}let o={content:a.content,delivery:a.delivery,requestId:a.requestId,submittedDraft:a.submittedDraft,submittedDraftRevision:a.submittedDraftRevision,status:`admitting`};t(O,e=>e.map(e=>e.requestId===a.requestId?o:e)),t(k,o.requestId),t(N,void 0),t(se,o)}),de=SN(null,(e,t,n)=>{let r=e(O),i=r.filter(e=>e.requestId!==n||e.status!==`failed`);i.length!==r.length&&(t(O,i),e(k)===n&&t(k,i.at(-1)?.requestId))}),fe,pe=SN(null,e=>{if(fe!==void 0)return fe;let t=e(i)?.activity.queue;if(t?.state!==`running`)return Promise.resolve();let n=e(ee).mutateAsync(t.commandId).then(()=>void 0).finally(()=>{fe===n&&(fe=void 0)});return fe=n,n}),me;return{abortAtom:ee,commandIdAtom:ae,contextAtom:ie,admissionErrorAtom:N,admissionsAtom:j,cancelAtom:pe,draftAtom:E,dismissFailedAtom:de,extensionsAtom:b,failureAtom:L,jumpToLatestAtom:f,loadOlderHistoryAtom:d,loadNewerHistoryAtom:p,observationAtom:ne,observedCommandIdsAtom:A,pinVisibleHistoryAtom:m,queryAtom:r,reconcileAdmissionsAtom:M,reconnectAtom:SN(null,n=>{let i=n(ne);if(i.status!==`unavailable`)return Promise.resolve({kind:`nothing_to_reconnect`,state:i.status===`live`?`connected`:`connecting`});if(me!==void 0)return me;let a=t.getQueryCache().find({queryKey:bI(e).queryKey});if(a===void 0)return Promise.resolve({kind:`failed`,cause:`Session observation is unavailable`});let o=a.state.dataUpdateCount,s=a.state.errorUpdateCount;return me=new Promise(i=>{let c=()=>void 0,l=!1,u=e=>{l||(l=!0,c(),clearTimeout(f),i(e))},d=()=>{if(a.state.dataUpdateCount>o&&t.getQueryData(bI(e).queryKey)?.observation===`live`){u({kind:`reconnected`});return}a.state.errorUpdateCount>s&&u({kind:`failed`,cause:KI(a.state.error)})};c=t.getQueryCache().subscribe(e=>{e.query===a&&d()});let f=setTimeout(()=>{u({kind:`failed`,cause:`Session history did not reopen within 10 seconds`})},1e4);n(r).refetch({cancelRefetch:!0}).catch(e=>{u({kind:`failed`,cause:KI(e)})}),d()}).finally(()=>{me=void 0}),me}),retryAtom:ue,setDraftAtom:P,sendAtom:ce,snapshotAtom:i,statusAtom:re,viewStateAtom:R,submitCommandAtom:le,timelineAtom:te}}var ZI=(0,J.createContext)(null);function QI(){let e=(0,J.useContext)(ZI);if(e===null)throw Error(`Parakeet hooks require a ParakeetProvider`);return e}function $I(e){let{store:t}=QI(),n=(0,J.useCallback)(n=>t.sub(e,n),[e,t]),r=(0,J.useCallback)(()=>t.get(e),[e,t]);return(0,J.useSyncExternalStore)(n,r,r)}function eL(e){let{store:t}=QI();return(0,J.useCallback)((...n)=>t.set(e,...n),[e,t])}function tL({children:e,session:t,clients:n=RI,interactionStore:r,authorOf:i=ej}){let a=ya(),o=(0,J.useMemo)(()=>({atoms:XI(t,a,i),session:t,store:TN(),contributions:SN(zI),interactions:r??UM()}),[a,t,r,i]);return(0,J.useEffect)(()=>{let e=()=>{o.store.set(o.atoms.reconcileAdmissionsAtom)},t=o.store.sub(o.atoms.observedCommandIdsAtom,e);return e(),()=>{t()}},[o]),(0,J.useEffect)(()=>{let e=VM(n,(e,t)=>{XP(`client contribution ${e}`,t),o.interactions.report({tone:`error`,message:t.message})}),t=e.subscribe(()=>{o.store.set(o.contributions,e.snapshot())}),r=()=>{e.update(o.store.get(o.atoms.extensionsAtom))},i=o.store.sub(o.atoms.extensionsAtom,r);return r(),()=>{i(),e.dispose(),t()}},[n,o]),(0,X.jsx)(ZI.Provider,{value:o,children:e})}function nL(){let{atoms:e}=QI(),t=$I(e.timelineAtom),n=eL(e.loadOlderHistoryAtom),r=eL(e.loadNewerHistoryAtom),i=eL(e.jumpToLatestAtom),a=eL(e.pinVisibleHistoryAtom);return(0,J.useMemo)(()=>({...t,jumpToLatest:i,loadNewerHistory:r,loadOlderHistory:n,pinVisibleHistory:a}),[t,i,r,n,a])}function rL(){let{atoms:e}=QI(),t=$I(e.draftAtom),n=$I(e.failureAtom),r=$I(e.admissionErrorAtom),i=eL(e.setDraftAtom),a=eL(e.sendAtom),o=eL(e.submitCommandAtom),s=eL(e.retryAtom),c=(0,J.useCallback)(()=>{s()},[s]),l=eL(e.dismissFailedAtom),u=eL(e.cancelAtom);return(0,J.useMemo)(()=>({admissionError:r,cancel:u,draft:t,dismissFailed:l,failure:n,retry:c,send:a,setDraft:i,submitCommand:o}),[r,u,t,l,n,c,a,i,o])}function iL(){let{atoms:e}=QI();return eL(e.dismissFailedAtom)}function aL(){return QI().session}function oL(){return $I(QI().atoms.extensionsAtom)}function sL(){let{atoms:e}=QI(),t=$I(e.commandIdAtom),n=$I(e.statusAtom),r=$I(e.viewStateAtom),i=$I(e.observationAtom),a=eL(e.reconnectAtom),o=$I(e.contextAtom);return(0,J.useMemo)(()=>({commandId:t,context:o,observation:i,reconnect:a,status:n,viewState:r}),[t,o,i,a,n,r])}function cL(){return $I(QI().contributions)}function lL(){return QI().interactions}var uL=e(ts(),1),dL=class extends Error{_tag=`WatchdogError`;cause;underlying;constructor(e,t){super(`Watchdog ${e.replaceAll(`_`,` `)}`),this.name=this._tag,this.cause=e,this.underlying=t}},fL=Jn({family:`watchdog`,version:1,kinds:{claim:{prefix:`watchdog_claim`}}});function pL(e){if(Qt(e))return`execution_interrupted`;let t=At(e);return t._tag===`Some`?t.value.cause:`execution_defect`}var mL=(e,t)=>{let n=`idle`,r,a=e=>t.ingest(e),o=e=>t.read(e).pipe(F(e=>e.status===`missing`?e:{status:`found`,job:e.job,cancellation:e.cancellation})),s=e=>t.readQueueHead(e),c=(e,n)=>t.readSettled(e,n),l=n=>t.recordCancellation(n).pipe(De(t=>{if(t.status!==`recorded`&&t.status!==`replayed`)return _t;let i=r;return i?.jobId===n.jobId?ct(()=>{i.fiber.interruptUnsafe()}):e.wake.recompute()})),u=n=>t.failLane(n).pipe(De(t=>{let n=r,i=t.jobs.find(e=>e.jobId===n?.jobId);return n!==void 0&&i!==void 0&&(n.failed=i,n.fiber.interruptUnsafe()),t.jobs.length===0?_t:e.wake.recompute()}),F(({jobs:e,more:t})=>({settled:e.length,more:t}))),d=e=>t.purgeQueued(e),p=()=>Ne({try:()=>fL.claim.generate(),catch:()=>new dL(`claim_unavailable`)}).pipe(ht(e=>t.selectAndClaim(e))),m=()=>i(function*(){let n=yield*t.nextRunningClaim();if(n===void 0)return{status:`none`};let r=yield*te(e.isAlive(n.job));if(r._tag===`Failure`)return{status:`liveness_unknown`,jobId:n.job.jobId,reason:r.failure.cause};if(r.success)return{status:`none`};let i=n.job.recovery!==void 0&&n.recoveryCount<n.job.recovery.maxRecoveries?`requeue`:`interrupted`,a=yield*t.reconcileDisappearedClaim({...n,disposition:i});switch(a.status){case`requeued`:return yield*e.wake.recompute(),{status:`none`};case`settled`:return yield*e.wake.recompute(),{status:`recovered`,job:a.job};case`conflict`:case`missing`:{let e=yield*t.read(n.job.jobId);return e.status===`found`&&(e.job.state!==`running`||e.claimToken!==n.claimToken||e.recoveryCount!==n.recoveryCount)?{status:`none`}:yield*je(new dL(`settlement_rejected`))}}});return Object.freeze({hasPendingWork:t.hasPendingWork,ingest:a,read:o,readQueueHead:s,readSettled:c,tick:()=>Ge(()=>n===`idle`?(n=`running`,m().pipe(ht(e=>e.status===`recovered`?we({status:`recovered`,job:e.job}):p().pipe(F(t=>t.status===`no_ready`&&e.status===`liveness_unknown`?e:t))),ht(n=>n.status===`no_ready`?we({status:`no_ready`}):n.status===`liveness_unknown`?we(n):n.status===`claim_unavailable`?je(new dL(`claim_unavailable`)):n.status===`cancelled`?e.wake.recompute().pipe(nt({status:`settled`,job:n.job})):n.status===`recovered`?we({status:`settled`,job:n.job}):i(function*(){let i=yield*En(),a=yield*f(Hn(i).pipe(ye(e.executor.execute(n.job)))),o={jobId:n.job.jobId,fiber:a};r=o;let s=yield*t.read(n.job.jobId);s.status!==`found`||s.job.state!==`running`||s.cancellation.status===`present`?(s.status===`found`&&s.job.state===`settled`&&s.job.outcome===`failed`&&(o.failed=s.job),yield*zn(a)):yield*yr(i,void 0);let c=yield*St(a).pipe(Ke(ct(()=>{r?.fiber===a&&(r=void 0)})));if(o.failed!==void 0)return yield*e.wake.recompute().pipe(nt({status:`settled`,job:o.failed}));let l=xr(c)?c.value:{kind:`failed`,reason:pL(c.cause)},u=yield*t.settleExactClaim({jobId:n.job.jobId,claimToken:n.claimToken,decision:l});switch(u.status){case`settled`:case`replayed`:return yield*e.wake.recompute().pipe(nt({status:`settled`,job:u.job}));case`conflict`:case`missing`:return yield*je(new dL(`settlement_rejected`))}})),Ke(ct(()=>{n=`idle`})))):we({status:`busy`})),cancel:l,failLane:u,purge:d})},hL=q.check(jt(1),B(512)),gL=q.check(jt(1),B(256)),_L=Ln.check(In(-(2**53-1)),wr(2**53-1)),vL=Ln.check(In(0),wr(2**53-1)),yL=q.check(jt(1),B(200)),bL=W({lane:hL,reason:yL});function xL(e){try{return _n(bL,{onExcessProperty:`error`})(e)}catch(e){throw new dL(`store_invalid`,e)}}var SL=W({sequence:Ln,job_id:gL,queue_name:gL,lane:hL,priority:_L,payload_json:q,recovery_max:Sr(vL),state:Gn([`queued`,`running`,`settled`]),outcome:Sr(Gn([`completed`,`failed`,`cancelled`,`outcome_unknown`,`interrupted`])),claim_token:Sr(gL),recovery_count:vL,cancellation_id:Sr(gL),failure_reason:Sr(yL)}),CL=bn(Zt),wL=mn(SL,{onExcessProperty:`error`}),TL=mn(CL),EL=Wt(CL);function DL(e){return e===void 0?{predicate:`1 = 1`,values:[]}:{predicate:e.include?`lane = ?`:`lane <> ?`,values:[e.lane]}}var OL=`sequence, job_id, queue_name, lane, priority, payload_json,
|
|
53
|
-
recovery_max, state, outcome, claim_token, recovery_count,
|
|
54
|
-
cancellation_id, failure_reason`;function kL(e){return new dL(`store_unavailable`,e)}function AL(e){return Ne({try:e,catch:e=>e instanceof dL?e:kL(e)})}function jL(e){let t=EL(e);if(t._tag===`Failure`)throw kL($n(t.cause));return t.value}function ML(e){let t=wL(e);if(t._tag===`Failure`)throw kL($n(t.cause));let n=t.value,r=TL(n.payload_json);if(r._tag===`Failure`)throw kL($n(r.cause));let i=n.recovery_max===null?{jobId:n.job_id,queue:n.queue_name,lane:n.lane,priority:n.priority,payload:r.value}:{jobId:n.job_id,queue:n.queue_name,lane:n.lane,priority:n.priority,payload:r.value,recovery:{maxRecoveries:n.recovery_max}};if(n.state===`queued`)return{row:n,job:{...i,state:`queued`}};if(n.state===`running`){if(n.claim_token===null)throw kL();return{row:n,job:{...i,state:`running`}}}if(n.outcome===null)throw kL();let a={...i,state:`settled`,outcome:n.outcome};return{row:n,job:(n.outcome===`failed`||n.outcome===`interrupted`)&&n.failure_reason!==null?{...a,failureReason:n.failure_reason}:a}}function NL(e,t){let n=e.sql.exec(`SELECT ${OL}
|
|
55
|
-
FROM watchdog_jobs
|
|
56
|
-
WHERE job_id = ?`,t).toArray()[0];return n===void 0?void 0:ML(n)}function PL(e,t,n,r){let i=DL(r);return e.sql.exec(`SELECT ${OL} FROM watchdog_jobs NOT INDEXED WHERE state = 'settled' AND ${i.predicate} AND sequence > ?
|
|
57
|
-
AND sequence < COALESCE(
|
|
58
|
-
(SELECT MIN(sequence) FROM watchdog_jobs INDEXED BY idx_watchdog_ready
|
|
59
|
-
WHERE state IN ('queued', 'running') AND ${i.predicate}),
|
|
60
|
-
9223372036854775807)
|
|
61
|
-
ORDER BY sequence ASC LIMIT ?`,...i.values,n??0,...i.values,t).toArray().map(e=>{let t=ML(e);if(t.job.state!==`settled`)throw kL();return{sequence:t.row.sequence,job:t.job}})}function FL(e,t){let n=e.sql.exec(`SELECT ${OL}
|
|
62
|
-
FROM watchdog_jobs
|
|
63
|
-
WHERE queue_name = ? AND state IN ('running', 'queued')
|
|
64
|
-
ORDER BY CASE state WHEN 'running' THEN 0 ELSE 1 END,
|
|
65
|
-
priority DESC, sequence ASC
|
|
66
|
-
LIMIT 1`,t).toArray()[0];if(n===void 0)return{state:`idle`};let r=ML(n);if(r.job.state===`settled`)throw kL();return{state:r.job.state,jobId:r.job.jobId,cancellationRequested:r.row.cancellation_id!==null}}function IL(e,t){let n=e.sql.exec(`SELECT ${OL}
|
|
67
|
-
FROM watchdog_jobs
|
|
68
|
-
WHERE queue_name = ? AND state = 'settled'
|
|
69
|
-
ORDER BY sequence DESC
|
|
70
|
-
LIMIT 1`,t).toArray()[0];if(n===void 0)return;let r=ML(n);if(r.job.state!==`settled`)throw kL();return r.job}function LL(e,t,n,r){if(t===void 0)return;let i=FL(e,n);t(r===void 0?{queue:n,head:i}:{queue:n,head:i,settled:r})}function RL(e){e.transactionSync(()=>{e.sql.exec(`
|
|
71
|
-
CREATE TABLE IF NOT EXISTS watchdog_jobs (
|
|
72
|
-
sequence INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
73
|
-
job_id TEXT UNIQUE NOT NULL,
|
|
74
|
-
queue_name TEXT NOT NULL,
|
|
75
|
-
lane TEXT NOT NULL,
|
|
76
|
-
priority INTEGER NOT NULL,
|
|
77
|
-
payload_json TEXT NOT NULL,
|
|
78
|
-
recovery_max INTEGER,
|
|
79
|
-
state TEXT NOT NULL CHECK (state IN ('queued', 'running', 'settled')),
|
|
80
|
-
outcome TEXT CHECK (
|
|
81
|
-
outcome IS NULL OR outcome IN (
|
|
82
|
-
'completed', 'failed', 'cancelled', 'outcome_unknown', 'interrupted'
|
|
83
|
-
)
|
|
84
|
-
),
|
|
85
|
-
claim_token TEXT,
|
|
86
|
-
recovery_count INTEGER NOT NULL DEFAULT 0,
|
|
87
|
-
cancellation_id TEXT UNIQUE,
|
|
88
|
-
failure_reason TEXT,
|
|
89
|
-
CHECK (recovery_max IS NULL OR recovery_max >= 0),
|
|
90
|
-
CHECK (
|
|
91
|
-
(state = 'queued' AND outcome IS NULL AND claim_token IS NULL) OR
|
|
92
|
-
(state = 'running' AND outcome IS NULL AND claim_token IS NOT NULL) OR
|
|
93
|
-
(state = 'settled' AND outcome IS NOT NULL)
|
|
94
|
-
)
|
|
95
|
-
)
|
|
96
|
-
`),e.sql.exec(`CREATE INDEX IF NOT EXISTS idx_watchdog_lane_failure
|
|
97
|
-
ON watchdog_jobs(lane, state DESC, sequence ASC)`),e.sql.exec(`CREATE INDEX IF NOT EXISTS idx_watchdog_ready
|
|
98
|
-
ON watchdog_jobs(state, priority DESC, sequence ASC)`),e.sql.exec(`CREATE INDEX IF NOT EXISTS idx_watchdog_queue_head
|
|
99
|
-
ON watchdog_jobs(queue_name, state, priority DESC, sequence ASC)`)})}function zL(e,t,n){let r=jL(n.payload),i=NL(e,n.jobId);if(i!==void 0){let e=i.job.recovery?.maxRecoveries,t=n.recovery?.maxRecoveries;if(i.job.queue!==n.queue||i.job.lane!==n.lane||i.job.priority!==n.priority||i.row.payload_json!==r||e!==t)throw kL();return!1}return e.sql.exec(`INSERT INTO watchdog_jobs
|
|
100
|
-
(job_id, queue_name, lane, priority, payload_json, recovery_max,
|
|
101
|
-
state, outcome, claim_token, recovery_count, cancellation_id)
|
|
102
|
-
VALUES (?, ?, ?, ?, ?, ?, 'queued', NULL, NULL, 0, NULL)`,n.jobId,n.queue,n.lane,n.priority,r,n.recovery?.maxRecoveries??null),LL(e,t,n.queue),!0}function BL(e,t,n){let r=NL(e,n.jobId);return r===void 0?{status:`missing`}:r.row.cancellation_id===null?n.onlyIfQueued===!0&&r.job.state!==`queued`?{status:`conflict`}:(e.sql.exec(`UPDATE watchdog_jobs
|
|
103
|
-
SET cancellation_id = ?
|
|
104
|
-
WHERE job_id = ? AND cancellation_id IS NULL`,n.cancellationId,n.jobId),LL(e,t,r.job.queue),{status:`recorded`,intent:n}):r.row.cancellation_id===n.cancellationId?{status:`replayed`,intent:n}:{status:`conflict`}}function VL(e,t,n,r){let i=DL(r);return e.transactionSync(()=>{let r=e.sql.exec(`SELECT ${OL}
|
|
105
|
-
FROM watchdog_jobs
|
|
106
|
-
WHERE state = 'queued' AND ${i.predicate}
|
|
107
|
-
AND (cancellation_id IS NOT NULL OR NOT EXISTS (
|
|
108
|
-
SELECT 1 FROM watchdog_jobs predecessor INDEXED BY idx_watchdog_queue_head
|
|
109
|
-
WHERE predecessor.queue_name = watchdog_jobs.queue_name
|
|
110
|
-
AND predecessor.state IN ('queued', 'running')
|
|
111
|
-
AND (predecessor.state = 'running' OR
|
|
112
|
-
(predecessor.state = 'queued' AND
|
|
113
|
-
(predecessor.priority > watchdog_jobs.priority OR
|
|
114
|
-
(predecessor.priority = watchdog_jobs.priority AND
|
|
115
|
-
predecessor.sequence < watchdog_jobs.sequence))))))
|
|
116
|
-
ORDER BY priority DESC, sequence ASC
|
|
117
|
-
LIMIT 1`,...i.values).toArray()[0];if(r===void 0)return{status:`no_ready`};let a=ML(r);if(a.job.state!==`queued`)return{status:`claim_unavailable`};if(a.row.cancellation_id!==null){e.sql.exec(`UPDATE watchdog_jobs
|
|
118
|
-
SET state = 'settled', outcome = 'cancelled'
|
|
119
|
-
WHERE job_id = ? AND state = 'queued' AND cancellation_id = ?`,a.job.jobId,a.row.cancellation_id);let n=NL(e,a.job.jobId)?.job;return n?.state!==`settled`||n.outcome!==`cancelled`?{status:`claim_unavailable`}:(LL(e,t,n.queue,n),{status:`cancelled`,job:n})}e.sql.exec(`UPDATE watchdog_jobs
|
|
120
|
-
SET state = 'running', claim_token = ?
|
|
121
|
-
WHERE job_id = ? AND state = 'queued'`,n,a.job.jobId);let o=NL(e,a.job.jobId)?.job;return o?.state===`running`?(LL(e,t,o.queue),{status:`claimed`,job:o,claimToken:n}):{status:`claim_unavailable`}})}function HL(e,t,n){return e.transactionSync(()=>{let r=NL(e,n.jobId);if(r===void 0)return{status:`missing`};let i=r.row.cancellation_id===null?n.decision.kind:`cancelled`;if(r.job.state===`settled`)return r.row.claim_token===n.claimToken&&r.job.outcome===i?{status:`replayed`,job:r.job}:{status:`conflict`};if(r.job.state!==`running`||r.row.claim_token!==n.claimToken)return{status:`conflict`};e.sql.exec(`UPDATE watchdog_jobs
|
|
122
|
-
SET state = 'settled', outcome = ?, failure_reason = ?
|
|
123
|
-
WHERE job_id = ? AND state = 'running' AND claim_token = ?`,i,i===`failed`&&n.decision.kind===`failed`?n.decision.reason??null:null,n.jobId,n.claimToken);let a=NL(e,n.jobId)?.job;return a?.state===`settled`?(LL(e,t,a.queue,a),{status:`settled`,job:a}):{status:`conflict`}})}function UL(e,t,n){RL(e);let r=Object.freeze({readQueueHead:t=>FL(e,t),readLatestSettledJob:t=>IL(e,t),enqueueAcceptedJob:n=>{zL(e,t,n)},recordCancellationIntent:n=>BL(e,t,n)}),i=n=>{let r=DL(n);return Object.freeze({hasPendingWork:AL(()=>e.sql.exec(`SELECT 1 FROM watchdog_jobs WHERE state IN ('queued', 'running') LIMIT 1`).toArray().length!==0),ingest:n=>AL(()=>e.transactionSync(()=>({status:zL(e,t,n)?`queued`:`duplicate`}))),read:t=>AL(()=>{let n=NL(e,t);return n===void 0?{status:`missing`}:{status:`found`,job:n.job,claimToken:n.row.claim_token,recoveryCount:n.row.recovery_count,cancellation:n.row.cancellation_id===null?{status:`absent`}:{status:`present`,cancellation:{jobId:t,cancellationId:n.row.cancellation_id}}}}),readQueueHead:t=>AL(()=>FL(e,t)),readSettled:(t,r)=>AL(()=>PL(e,t,r,n)),selectAndClaim:r=>AL(()=>VL(e,t,r,n)),settleExactClaim:n=>AL(()=>HL(e,t,n)),recordCancellation:n=>AL(()=>e.transactionSync(()=>({status:BL(e,t,n).status}))),failLane:n=>AL(()=>{let r=xL(n);return e.transactionSync(()=>{let n=e.sql.exec(`SELECT ${OL} FROM watchdog_jobs
|
|
124
|
-
WHERE lane = ? AND state IN ('queued', 'running')
|
|
125
|
-
ORDER BY state DESC, sequence ASC LIMIT ?`,r.lane,256).toArray(),i=[];for(let a of n){let n=ML(a);e.sql.exec(`UPDATE watchdog_jobs SET state = 'settled', outcome = 'failed', failure_reason = ?, claim_token = NULL
|
|
126
|
-
WHERE job_id = ? AND state IN ('queued', 'running')`,r.reason,n.job.jobId);let o=NL(e,n.job.jobId)?.job;if(o?.state!==`settled`||o.outcome!==`failed`)throw kL();LL(e,t,o.queue,o),i.push(o)}return{jobs:i,more:e.sql.exec(`SELECT 1 FROM watchdog_jobs WHERE lane = ? AND state IN ('queued', 'running') LIMIT 1`,r.lane).toArray().length!==0}})}),purgeQueued:n=>AL(()=>{e.transactionSync(()=>{e.sql.exec(`DELETE FROM watchdog_jobs
|
|
127
|
-
WHERE queue_name = ? AND state = 'queued'`,n),LL(e,t,n)})}),nextRunningClaim:()=>AL(()=>{let t=e.sql.exec(`SELECT ${OL}
|
|
128
|
-
FROM watchdog_jobs
|
|
129
|
-
WHERE state = 'running' AND ${r.predicate}
|
|
130
|
-
ORDER BY sequence ASC
|
|
131
|
-
LIMIT 1`,...r.values).toArray()[0];if(t===void 0)return;let n=ML(t);if(n.job.state!==`running`||n.row.claim_token===null)throw kL();return{job:n.job,claimToken:n.row.claim_token,recoveryCount:n.row.recovery_count}}),reconcileDisappearedClaim:n=>AL(()=>e.transactionSync(()=>{let r=NL(e,n.job.jobId);if(r===void 0)return{status:`missing`};if(r.job.state!==`running`||r.row.claim_token!==n.claimToken||r.row.recovery_count!==n.recoveryCount)return{status:`conflict`};if(n.disposition===`requeue`&&r.row.cancellation_id===null)return e.sql.exec(`UPDATE watchdog_jobs
|
|
132
|
-
SET state = 'queued', claim_token = NULL,
|
|
133
|
-
recovery_count = recovery_count + 1
|
|
134
|
-
WHERE job_id = ? AND state = 'running' AND claim_token = ?`,n.job.jobId,n.claimToken),LL(e,t,n.job.queue),{status:`requeued`};let i=r.row.cancellation_id!==null,a=i?null:r.job.recovery===void 0?`Execution disappeared without a recovery policy`:`Restart recovery budget exhausted (${String(r.job.recovery.maxRecoveries)} recoveries)`;e.sql.exec(`UPDATE watchdog_jobs
|
|
135
|
-
SET state = 'settled', outcome = ?, failure_reason = ?
|
|
136
|
-
WHERE job_id = ? AND state = 'running' AND claim_token = ?`,i?`cancelled`:`interrupted`,a,n.job.jobId,n.claimToken);let o=NL(e,n.job.jobId)?.job;return o?.state===`settled`?(LL(e,t,o.queue,o),{status:`settled`,job:o}):{status:`conflict`}}))})};return Object.freeze({store:i(n),partition:i,transactional:r})}var WL=q.check(jt(1),B(256)),GL=q.check(jt(1),B(200)),KL=Ln.check(In(-(2**53-1)),wr(2**53-1)),qL=Ln.check(In(0),wr(2**53-1)),JL=W({maxRecoveries:qL}),YL={jobId:WL,queue:WL,lane:hL,priority:KL,payload:Zt,recovery:V(JL)},XL=W({...YL,state:G(`queued`)}),ZL=W({...YL,state:G(`settled`),outcome:Gn([`completed`,`failed`,`cancelled`,`outcome_unknown`,`interrupted`]),failureReason:Bt(GL)}),QL=W({...YL,state:G(`running`)}),$L=Yt([XL,QL,ZL]);Yt([W({kind:G(`completed`)}),W({kind:G(`failed`),reason:Bt(GL)}),W({kind:G(`cancelled`)}),W({kind:G(`outcome_unknown`)})]);var eR=W({jobId:WL,cancellationId:WL,onlyIfQueued:V(Fn)}),tR=Yt([W({status:G(`absent`)}),W({status:G(`present`),cancellation:eR})]);Yt([W({status:G(`found`),job:$L,cancellation:tR}),W({status:G(`missing`)})]),Yt([W({state:G(`idle`)}),W({state:Gn([`queued`,`running`]),jobId:WL,cancellationRequested:Fn})]),Yt([W({status:G(`queued`)}),W({status:G(`duplicate`)})]),Yt([W({status:Gn([`recorded`,`replayed`])}),W({status:Gn([`conflict`,`missing`])})]);var nR=Yt([Tn(ArrayBuffer),q,sn,Mn]);kt(q,nR);function rR(e){return Ne({try:()=>{let t=e.concurrentLane===void 0?void 0:_n(hL)(e.concurrentLane),n=UL(e.owner,e.project,t===void 0?void 0:{lane:t,include:!1}),r=mL(e,n.store),i={...r,transactional:n.transactional};if(t===void 0)return Object.freeze(i);let a=mL(e,n.partition({lane:t,include:!0}));return Object.freeze({...i,tickConcurrent:a.tick,failLane:e=>e.lane===t?a.failLane(e):r.failLane(e),cancel:e=>r.read(e.jobId).pipe(ht(n=>n.status===`found`&&n.job.lane===t?a.cancel(e):r.cancel(e)))})},catch:e=>new dL(`store_unavailable`,e)})}var iR=e=>({owner:e.owner,project:e.project,isAlive:t=>Le({try:()=>e.isAlive(t),catch:e=>new dL(`liveness_unavailable`,e)}),executor:{execute:t=>Le({try:n=>e.execute(t,n),catch:()=>new dL(`execution_failed`)})},wake:{recompute:()=>Le({try:()=>e.wake.recompute(),catch:()=>new dL(`wake_unavailable`)})}}),aR=e=>at(e).then(e=>{if(xr(e))return e.value;let t=$e(At(e.cause))??$n(e.cause);return Promise.reject(t instanceof Error?t:Error(String(t)))});function oR(e){let t=iR(e);return e.concurrentLane===void 0?aR(rR(t)).then(sR):aR(rR({...t,concurrentLane:e.concurrentLane})).then(e=>Object.freeze({...sR(e),tickConcurrent:()=>aR(e.tickConcurrent())}))}function sR(e){return Object.freeze({hasPendingWork:()=>aR(e.hasPendingWork),ingest:t=>aR(e.ingest(t)),read:t=>aR(e.read(t)),readQueueHead:t=>aR(e.readQueueHead(t)),tick:()=>aR(e.tick()),cancel:t=>aR(e.cancel(t)),failLane:t=>aR(e.failLane(t)),purge:t=>aR(e.purge(t)),transactional:e.transactional})}Object.freeze({make:oR});function cR(e){return S(()=>Ar(()=>import(`./runtime-core-GKyHklNK.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]))).pipe(ht(({openRuntimeCore:t})=>t(e)),F(({agent:e})=>e))}function lR(e){return e instanceof Xt?e:new Xt(`model`,`rejected`,`Model acquisition failed`,void 0,e)}function uR(e){return new Xt(`model`,`rejected`,`Model release failed`,void 0,e)}function dR(e){let t=Le({try:()=>e.release(),catch:uR}),n={model:e.model,release:t};return e.stream===void 0?e.retryAfterMs===void 0?Object.freeze(n):Object.freeze({...n,retryAfterMs:e.retryAfterMs}):e.retryAfterMs===void 0?Object.freeze({...n,stream:e.stream}):Object.freeze({...n,stream:e.stream,retryAfterMs:e.retryAfterMs})}function fR(e){return We((t,n)=>{if(n.aborted)return;let r;try{r=Promise.resolve(e(n))}catch(e){t(je(lR(e)));return}let i=r.then(e=>{if(n.aborted)return Promise.resolve(e.release()).then(()=>void 0);t(we(dR(e)))},e=>{n.aborted?kn(`late-model-acquisition`,e):t(je(lR(e)))});return Le({try:()=>i,catch:uR}).pipe(Qe)})}function pR(e){let t,n=ut(n=>ht(n(e),e=>ct(()=>(t=e,e))));return rt(n,()=>t===void 0?_t:t.release.pipe(Qe),{interruptible:!0})}function mR(e){let t=({sessionId:t,preference:n})=>fR(r=>e.acquire({sessionId:t,preference:n,signal:r})),n=e.describe;return Object.freeze(n===void 0?{acquire:t}:{acquire:t,describe:({sessionId:e,preference:t})=>Le({try:r=>n({sessionId:e,preference:t,signal:r}),catch:lR})})}function hR(e,t){return new Xt(e,`rejected`,t)}var gR=q.pipe(H(jt(1)),H(B(256))),_R=q.pipe(H(jt(1)),H(U(e=>new TextEncoder().encode(e).byteLength<=32e3))),vR=W({revision:gR,text:_R,modules:Bt(Ht(e=>Array.isArray(e)&&e.every(st)))}),yR=Ht(e=>xe(e)),bR=Ht(e=>xe(e)),xR=W({bind:yR}),SR=Ht(e=>xe(e)),CR=W({commit:SR,requestWake:bR,close:bR}),wR=W({close:bR}),TR=un(vR),ER=un(xR),DR=un(CR),OR=un(wR);function kR(e){return new Xt(`runtime`,`invalid`,`Runtime host is invalid`,void 0,e)}function AR(){return new Xt(`runtime`,`unavailable`,`Runtime host is unavailable`)}function jR(e,t){return Ne({try:()=>t.call(e),catch:AR}).pipe(ht(e=>Le({try:()=>Promise.resolve(e),catch:AR})),ht(e=>e===void 0?_t:je(kR())))}function MR(e,t,n){let r=OR({close:t});return r._tag===`Failure`?je(kR(n)):ve(jR(e,r.success.close)).pipe(vt({onFailure:e=>je(kR({cause:n,cleanup:e})),onSuccess:()=>je(kR(n))}))}function NR(e){return Ge(()=>{if(!st(e))return je(kR());let t=e,n;try{n=t.close}catch(e){return je(kR(e))}let r;try{r=t.requestWake}catch(e){return MR(t,n,e)}let i=DR({commit:t.commit,requestWake:r,close:n});return i._tag===`Failure`?MR(t,n):we(Object.freeze({commit:e=>Le({try:()=>t.commit(()=>Gj(e)),catch:e=>e instanceof Xt?e:AR()}),requestWake:jR(t,i.success.requestWake),close:jR(t,i.success.close)}))})}function PR(e){return Ne({try:()=>{let t=e.runtime;if(!st(t))throw kR();let n=ER(t);if(n._tag===`Failure`)throw kR();return{receiver:t,bind:n.success.bind}},catch:kR}).pipe(F(({receiver:e,bind:t})=>Object.freeze({bind:({reconcile:n,pendingWork:r})=>Ne({try:()=>t.call(e,{reconcile:()=>Gj(n),pendingWork:()=>Gj(r)}),catch:AR}).pipe(ht(e=>Le({try:()=>Promise.resolve(e),catch:AR})),ht(NR))})))}function FR(e,t){let n={store:e.store,runtime:t,extensions:e.extensions,instructions:{load:({sessionId:t,commandId:n})=>Le({try:r=>e.instructions.load({sessionId:t,commandId:n,signal:r}),catch:()=>hR(`instructions`,`Instruction acquisition failed`)}).pipe(ht(e=>{let t=TR(e);return t._tag===`Success`?we(t.success):je(new Xt(`contract`,`invalid`,`Instruction revision is invalid`))}))},model:mR(e.model)};e.meta!==void 0&&Object.assign(n,{meta:e.meta}),e.storageBudget!==void 0&&Object.assign(n,{storageBudget:e.storageBudget}),e.compaction!==void 0&&Object.assign(n,{compaction:e.compaction});let r=e.tools;if(r===void 0)return n;let i={modules:r.modules??[],sources:r.sources??[],sandbox:nr(r.sandbox),access:r.access??{}};return{...n,tools:r.execution===void 0?i:{...i,execution:r.execution}}}function IR(e,t){return Gj(PR(e).pipe(ht(n=>t(FR(e,n))))).then(Xj)}Object.freeze({make:e=>IR(e,cR)});var LR=200,RR=de(`action`,[Xe({action:n(`list`)}),Xe({action:n(`editLast`)})]),zR=be(z(),he()).parse(structuredClone(qe(RR))),BR=120,VR=Xe({title:z()}).optional().transform(e=>e?.title.trim().replaceAll(/\s+/gu,` `)??``),HR=4096,UR=Xe({instructions:z()}).optional().transform(e=>e?.instructions.trim()??``);function WR(e,t){return e?.notify({type:`info`,message:t}),t}function GR(e,t,n){let r=e=>{throw Error(`${e} is unavailable in this host.`)},i={sourceId:n.sourceId,namespace:n.namespace,commands:[{id:`session`,title:`Session status`,category:`Advanced`,projections:{help:{order:1},palette:{order:1},slash:{aliases:[`session`],order:1}},handler:async({interaction:e})=>{let n=await t.read();return WR(e,`Session ${n.sessionId} is ${GN(VN(n))}; ${String(n.pending.prompts.length)} queued prompt${n.pending.prompts.length===1?``:`s`}.`)}},{id:`queue`,title:`Queued prompts`,category:`Advanced`,projections:{help:{order:3},palette:{order:3},slash:{aliases:[`queue`],order:3,arguments:{hint:`list | edit-last`,words:[{word:`list`,description:`List accepted queued prompts`,arguments:{action:`list`}},{word:`edit-last`,description:`Return the last queued prompt to the composer`,arguments:{action:`editLast`}}]}}},action:{inputSchema:zR},handler:async({arguments:e,interaction:r})=>{let i=RR.safeParse(e??{action:`list`});if(!i.success)throw Error(`/queue requires list or editLast.`);let a=await t.read();if(i.data.action===`list`){let e=a.pending.prompts,t=a.terminals.map(e=>`${e.outcome} · ${e.commandId}`);WR(r,e.length===0&&t.length===0?`No queued prompts.`:[...e.map((e,t)=>`${String(t+1)}. queued · accepted: ${e.text}`),...t,...a.pending.hasMore===!0?[`More accepted prompts are waiting outside this view.`]:[]].join(`
|
|
137
|
-
`));return}if(a.pending.hasMore===!0)throw Error(`The queue view is incomplete; refresh it before editing the last prompt.`);let o=[...a.pending.prompts].reverse().find(e=>e.delivery===`followUp`);if(o===void 0)throw Error(`There is no queued follow-up to edit.`);if(t.cancel===void 0)throw Error(`Queue editing is unavailable in this host.`);if(n.onEditQueued===void 0)throw Error(`Editing queued prompts is unavailable in this host.`);if(n.canEditQueued?.()===!1)throw Error(`Clear or submit the current draft before editing a queued prompt.`);if((await t.cancel({commandId:o.commandId,onlyIfPending:!0})).status===`too_late`)throw Error(`That queued prompt has already started; it can no longer be edited.`);n.onEditQueued(o.text),WR(r,`Queued prompt returned to the composer for editing.`)}},{id:`resume`,title:`Resume a conversation`,category:`Conversation`,projections:{help:{order:5},palette:{order:5},slash:{aliases:[`resume`],order:5}},handler:async()=>{if(!n.sessionResumeAvailable||n.sessionResume===void 0){r(`/resume`);return}await n.sessionResume()}},{id:`fork`,title:`Fork conversation`,category:`Conversation`,projections:{help:{order:7},palette:{order:7},slash:{aliases:[`fork`],order:7}},handler:async({interaction:e})=>{if(!n.forkAvailable||n.onForked===void 0){r(`/fork`);return}let i=await t.read();if(GN(VN(i))!==`idle`)throw Error(`Wait for the current run to finish, then fork.`);let a=fI(i.messages??[],i.compactions??[]).items.filter(e=>e.kind===`user_message`);if(a.length===0)throw Error(`No messages to fork from.`);if(e===void 0)throw Error(`Forking a Session needs a person.`);let o=[...a].reverse().slice(0,LR),s=await e.prompt({type:`choice`,message:`Fork from message`,options:o.map(e=>({value:e.id,label:e.text.slice(0,100)||`(empty message)`}))}),c;try{c=await t.command({type:`fork`,entryId:s})}catch(e){if(e instanceof Xt){if(e.boundary===`runtime`&&e.cause===`conflict`)throw Error(`Wait for the current run to finish, then fork.`,{cause:e});if(e.boundary===`store`&&e.cause===`unavailable`)throw Error(`That message is no longer available to fork from.`,{cause:e});if(e.boundary===`runtime`&&e.cause===`rejected`)throw Error(`This Session is bound to a channel and cannot be forked.`,{cause:e})}throw e}await n.onForked(c.sessionId),WR(e,`Forked into a new Session.`)}},{id:`compact`,title:`Compact conversation`,category:`Conversation`,description:`Summarize older context now; optional text sets its focus`,projections:{help:{order:8},palette:{order:8},slash:{aliases:[`compact`],order:8,arguments:{hint:`[instructions]`,text:{field:`instructions`,arguments:{}}}}},handler:async({arguments:e,interaction:n})=>{let r=UR.safeParse(e);if(!r.success)throw Error(`Use /compact, or /compact <what to focus on>.`);let i=r.data;if(i.length>HR)throw Error(`Compaction instructions are at most ${String(HR)} characters.`);return await t.command(i.length===0?{type:`compact`,requestId:An()}:{type:`compact`,requestId:An(),instructions:i}),WR(n,`Compaction queued; it runs after any current work.`)}},{id:`name`,title:`Name conversation`,category:`Conversation`,description:`Set the conversation title; no text restores it`,projections:{help:{order:9},palette:{order:9},slash:{aliases:[`name`],order:9,arguments:{hint:`[title]`,text:{field:`title`,arguments:{}}}}},handler:async({arguments:e,interaction:r})=>{let i=VR.safeParse(e);if(!i.success)throw Error(`Use /name <title>, or /name to clear it.`);let a=i.data;if(Array.from(a).length>BR)throw Error(`A conversation title is at most ${String(BR)} characters.`);let o=a.length===0?null:a;return await t.command({type:`title`,title:o}),await n.onTitled?.(o),WR(r,o===null?`Conversation title cleared; it follows the first prompt again.`:`Conversation named "${o}".`)}}]};return e.contribute(i)}var KR=new Set([`Esc`,`Ctrl+C`]);function qR(e){let{completion:t}=e;if(t.kind===`commands`&&t.items.length>0)return[{keys:`↑↓`,label:`choose`,priority:1},{keys:`Tab`,label:`complete`,priority:0},{keys:`Enter`,label:`run`,priority:0},{keys:`Esc`,label:`dismiss`,priority:2}];if(t.kind===`arguments`)return t.items.length>0?[{keys:`↑↓`,label:`choose`,priority:1},{keys:`Tab`,label:`complete`,priority:0},{keys:`Enter`,label:`run`,priority:0},{keys:`Esc`,label:`dismiss`,priority:2}]:[{keys:`Enter`,label:`run`,priority:0},{keys:`Esc`,label:`dismiss`,priority:2}];let n=[{keys:`Enter`,label:`send`,priority:0}];e.busy&&e.keys.queue!==void 0&&n.push({keys:e.keys.queue,label:`queue`,priority:0}),e.keys.newline!==void 0&&n.push({keys:e.keys.newline,label:`newline`,priority:1}),e.keys.scroll!==void 0&&n.push({keys:e.keys.scroll,label:`scroll`,priority:2});for(let t of e.bindings){let r=t.keys.split(`, `).some(e=>KR.has(e));r&&!e.busy||n.push({keys:t.keys,label:t.title.toLocaleLowerCase(),priority:r?0:3})}return n.push({keys:`/`,label:`commands`,priority:4}),n}var JR=` · `;function YR(e){return e.map(e=>`${e.keys} ${e.label}`).join(JR)}function XR(e,t,n){setTimeout(()=>{e.execute(t,{origin:n})},0)}function ZR(e,t){return[{id:`help`,title:`Show commands`,category:`Advanced`,projections:{help:{order:-3},slash:{aliases:[`help`],order:-3}},handler:async n=>{if(t.showCommands!==void 0){await t.showCommands();return}let r=wI(e.snapshot()).filter(e=>e.alias!==`help`);if(n.interaction===void 0)return r.map(e=>`/${e.alias}`);XR(e,await n.interaction.prompt({type:`choice`,message:`Commands`,options:r.map(e=>({value:e.commandId,label:`/${e.alias}`,description:e.keys.length===0?e.title:`${e.title} · ${e.keys.join(`, `)}`}))}),n.origin)}},{id:`keys`,title:`Show key bindings`,category:`Advanced`,projections:{help:{order:-2},slash:{aliases:[`keys`],order:-2,consumesDraft:!0}},handler:async t=>{let n=TI(e.snapshot());if(t.interaction===void 0)return n.map(e=>`${e.keys} ${e.title}`);if(n.length===0){t.interaction.notify({type:`info`,message:`No key bindings are active.`});return}XR(e,await t.interaction.prompt({type:`choice`,message:`Key bindings`,options:n.map(e=>({value:e.commandId,label:e.title,description:e.keys}))}),t.origin)}},{id:`clear`,title:`Clear the composer`,category:`Advanced`,projections:{help:{order:-1},slash:{aliases:[`clear`],order:-1}},handler:()=>{t.clear()}}]}var QR=an(W({cancelled:G(!0)})),$R=an(Qn(kt(q,Dn)));function ez(e,t,n){let r=new Map,i=e=>{r.get(e)?.lease.dispose(),r.delete(e)};return{update:a=>{let o=[];for(let e of r.keys()){let t=Object.hasOwn(a,e)?a[e]:void 0;(t?.status!==`running`||t.catalog===void 0)&&i(e)}for(let[s,c]of Object.entries(a)){if(c.status!==`running`||c.catalog===void 0)continue;let a=JSON.stringify(c.catalog);if(r.get(s)?.catalog!==a){i(s);try{let i=t.extension(s),o=IM(MM(c.catalog),(e,t)=>i.call(e,t));r.set(s,{catalog:a,lease:e.contribute({sourceId:`extension:${s}`,namespace:s,commands:o.map(e=>({...e,handler:async t=>{let i=await e.handler(t);return t.origin!==`agent`&&$R(t.arguments)&&!QR(i)&&!t.signal?.aborted&&r.get(s)?.catalog===a&&n?.(s,e.id),i}}))})})}catch(e){o.push({extensionId:s,message:e instanceof Error?e.message:`The advertised catalog is invalid`})}}}return o},dispose:()=>{for(let e of r.keys())i(e)}}}function tz(e){if(e!==void 0&&e.status!==`handled`)return e.status===`failed`?e.error.message:e.status===`unavailable`?e.reason:`Command ${e.status}`}function nz(e){let{commands:t,origin:n}=e,r=e.enabled??!0,i=aL(),a=rL(),o=oL(),s=cL(),c=(0,J.useRef)(s);c.current=s;let l=lL(),u=(0,J.useMemo)(()=>e.interactionStore??l,[e.interactionStore,l]),d=(0,J.useSyncExternalStore)(u.subscribe,u.snapshot,u.snapshot);(0,J.useEffect)(()=>{let e=d.inspection;e!==void 0&&!s.some(t=>t.entryId===e.entryId&&t.value.panel.some(t=>t.id===e.rowId&&t.inspection!==void 0))&&u.inspect(void 0)},[s,d.inspection,u]);let f=(0,J.useSyncExternalStore)(t.subscribe,t.snapshot,t.snapshot),p=(0,J.useRef)(a);p.current=a;let m=(0,J.useRef)(e.showCommands);m.current=e.showCommands;let h=e.showCommands!==void 0;(0,J.useEffect)(()=>{if(r)return u.attach(t.present)},[t,r,u]),(0,J.useEffect)(()=>{if(!r)return;let e=t.contribute({sourceId:`parakeet`,namespace:`parakeet`,commands:ZR(t,{showCommands:h?()=>m.current?.():void 0,clear:()=>{p.current.setDraft(``),u.report(void 0)}})});return()=>{e.dispose()}},[t,r,u,h]);let g=(0,J.useMemo)(()=>ez(t,i,(e,t)=>{let n=c.current.find(t=>t.entryId===e)?.value.panel.find(e=>e.inspection?.commandId===t);n!==void 0&&u.inspect({entryId:e,rowId:n.id})}),[t,i,u]);(0,J.useEffect)(()=>()=>{g.dispose()},[g]),(0,J.useEffect)(()=>{if(!r){g.dispose();return}let[e]=g.update(o);e!==void 0&&u.report({tone:`error`,message:`${e.extensionId} commands are unavailable: ${e.message}`})},[g,r,o,u]);let _=(0,J.useMemo)(()=>wI(f),[f]),[v,y]=(0,J.useState)(),[b,x]=(0,J.useState)({draft:``,index:0}),S=a.draft,C=!r||v===S||d.open!==void 0?{kind:`none`}:jI(_,S),w=C.kind===`none`?0:C.items.length,T=C.kind===`arguments`||C.kind===`commands`&&w>0,E=b.draft===S?Math.min(b.index,Math.max(0,w-1)):0,D=qR({completion:C,busy:e.busy,bindings:TI(f),keys:e.keys}),O=(0,J.useCallback)((e,i)=>{let a=p.current;if(!r){a.send(e);return}i!==void 0&&a.setDraft(i);let o=i??a.draft;u.report(void 0),y(o),a.submitCommand((r,i)=>PI(r,t,()=>{a.send(e)},n,i)).then(e=>{let t=tz(e);t!==void 0&&u.snapshot().open===void 0&&u.lastEnd()!==`cancelled`&&u.report({tone:`error`,message:`${o}: ${t}`})})},[t,r,n,u]),k=e=>{if(C.kind===`commands`||C.kind===`arguments`)return C.items[e]?.insert};return{completion:C,open:T,selected:E,hints:D,interactions:d,store:u,move:e=>w!==0&&(x({draft:S,index:(E+e+w)%w}),!0),highlight:e=>{x({draft:S,index:e})},complete:()=>{let e=k(E);return e!==void 0&&(a.setDraft(e),!0)},dismiss:()=>d.open===void 0?d.inspection===void 0?T?(y(S),!0):d.notice!==void 0&&(u.report(void 0),!0):(u.inspect(void 0),!0):(u.close(),!0),submit:(t=e.busy?`followUp`:`steer`)=>{let n=(C.kind===`commands`||C.kind===`arguments`&&C.query.length>0)&&w>0?k(E):void 0;O(t,n?.trimEnd())},choose:t=>{let n=k(t);n!==void 0&&O(e.busy?`followUp`:`steer`,n.trimEnd())}}}function rz(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
|
|
138
|
-
`)}function iz(e){return/^\s*$/.test(e)}function az(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function oz(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=oz(n.children):n.type===`image`&&(t+=n.alt);return t}function sz(){let e=new Map;return t=>{let n=t.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`,r=e.get(n)??0;return e.set(n,r+1),r===0?n:`${n}-${r+1}`}}function cz(e){let t=e.trim().replace(/[\u0000-\u001F\u007F\s]+/g,``);return t?/^(#|\/|\.\/|\.\.\/)/.test(t)||/^(https?:|mailto:|tel:)/i.test(t)?t:/^[a-z][a-z0-9+.-]*:/i.test(t)?``:t:``}function lz(e){return e.trim().toLowerCase()}function uz(e){return lz(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function dz(e,t={}){let n=jz(mz(e,t));for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var fz=32,pz=16;function mz(e,t,n={scans:Math.max(e.length*pz,1024),depth:0}){if(n.depth>=fz)return e?[{type:`text`,value:e}]:[];n.depth++;let r=[],i=0,a=``,o=()=>{a&&=(r.push({type:`text`,value:a}),``)};for(;i<e.length;){let s=e[i],c=e[i+1];if(s===`\\`){if(c===`
|
|
139
|
-
`){o(),r.push({type:`break`}),i+=2;continue}if(c&&/[\\`*_[\]{}()#+\-.!|~<>]/.test(c)){a+=c,i+=2;continue}}if(s==="`"){let t=bz(e,i,"`"),s=xz(e,i+t,"`",t,n);if(s!==-1){o(),r.push({type:`inlineCode`,value:e.slice(i+t,s).replace(/\s+/g,` `).trim()}),i=s+t;continue}a+=e.slice(i,i+t),i+=t;continue}if(s===`!`&&c===`[`){let a=gz(e,i+1,t,n);if(a){o(),r.push({type:`image`,src:cz(a.href),alt:Az(a.label,n),...a.title?{title:a.title}:{}}),i=a.end;continue}}if(s===`[`){let a=hz(e,i,t,n);if(a){o(),r.push(a.node),i=a.end;continue}let s=gz(e,i,t,n);if(s){let e=cz(s.href);o(),e?r.push({type:`link`,href:e,...s.title?{title:s.title}:{},children:mz(s.label,t,n)}):r.push(...mz(s.label,t,n)),i=s.end;continue}}if(s===`*`&&c===`*`&&e[i+2]===`*`){let a=Sz(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:mz(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`*`&&c===`*`||s===`_`&&c===`_`){let l=s===`_`&&!Ez(e,i,2,!0)?-1:Sz(e,i+2,s+s,n);if(l!==-1){o(),r.push({type:`strong`,children:mz(e.slice(i+2,l),t,n)}),i=l+2;continue}a+=s+c,i+=2;continue}if(s===`~`&&c===`~`&&e[i+2]===`~`){let t=bz(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`~`&&c===`~`){let s=Sz(e,i+2,`~~`,n);if(s!==-1){o(),r.push({type:`strike`,children:mz(e.slice(i+2,s),t,n)}),i=s+2;continue}a+=`~~`,i+=2;continue}if(s===`~`){let a=Cz(e,i+1,n);if(a!==-1){o(),r.push({type:`strike`,children:mz(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`*`||s===`_`){let a=s===`_`&&!Ez(e,i,1,!0)?-1:Sz(e,i+1,s,n);if(a!==-1){o(),r.push({type:`emphasis`,children:mz(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`<`&&t.allowHtml){let t=wz(e,i+1,`>`,n);if(t!==-1&&_z(e.slice(i,t+1))){o(),r.push({type:`inlineHtml`,value:e.slice(i,t+1)}),i=t+1;continue}}a+=s,i++}return o(),n.depth--,r}function hz(e,t,n,r){if(e[t+1]!==`^`)return;let i=wz(e,t+2,`]`,r);if(i===-1)return;let a=lz(e.slice(t+2,i)),o=n.footnotes?.[a];if(!o||!n.footnoteOrder)return;let s=n.footnoteOrder.indexOf(a);s===-1&&(n.footnoteOrder.push(a),s=n.footnoteOrder.length-1);let c=(n.footnoteCounts?.[a]??0)+1;return n.footnoteCounts&&(n.footnoteCounts[a]=c),{node:{type:`footnoteReference`,id:o.id??(uz(o.label)||`footnote`),number:s+1,...c>1?{referenceIndex:c}:{}},end:i+1}}function gz(e,t,n,r){let i=yz(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i);if(e[i+1]===`(`){let t=yz(e,i+1,`(`,`)`,r);if(t===-1)return;let n=vz(e.slice(i+2,t).trim());return n?{label:a,href:n.href,...n.title?{title:n.title}:{},end:t+1}:void 0}if(e[i+1]===`[`){let t=yz(e,i+1,`[`,`]`,r);if(t===-1)return;let o=e.slice(i+2,t),s=n.references?.[lz(o||a)];return s?{label:a,href:s.href,...s.title?{title:s.title}:{},end:t+1}:void 0}let o=n.references?.[lz(a)];if(o)return{label:a,href:o.href,...o.title?{title:o.title}:{},end:i+1}}function _z(e){return/^<!--(?:[\s\S]*--|-?)>$/.test(e)||/^<\?[\s\S]*\?>$/.test(e)||/^<![A-Z][\s\S]*>$/.test(e)||/^<!\[CDATA\[[\s\S]*\]\]>$/.test(e)||/^<\/[A-Za-z][\w:-]*\s*>$/.test(e)?!0:/^<[A-Za-z][\w:-]*(?:\s+[A-Za-z_:][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?>$/.test(e)}function vz(e){let t=e.match(/^(\S+)(?:\s+["']([^"']*)["'])?$/);return t?{href:t[1].replace(/^<|>$/g,``),...t[2]?{title:t[2]}:{}}:{href:e}}function yz(e,t,n,r,i){let a=0;for(let o=t;o<e.length;o++){if(!Tz(i))return-1;if(e[o-1]!==`\\`&&(e[o]===n&&a++,e[o]===r&&(a--,a===0)))return o}return-1}function bz(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&!Tz(r));)i++;return i}function xz(e,t,n,r,i){for(let a=t;a<e.length;a++){if(!Tz(i))return-1;if(e[a]===n&&bz(e,a,n,i)>=r)return a}return-1}function Sz(e,t,n,r){for(let i=t;i<e.length;i++){if(!Tz(r))return-1;if(e[i-1]!==`\\`&&(n!==`~~`||e[i-1]!==`~`&&e[i+2]!==`~`)&&!(n[0]===`_`&&!Ez(e,i,n.length,!1))&&e.startsWith(n,i))return i}return-1}function Cz(e,t,n){if(kz(e[t]??``)||/\d/.test(e[t]??``))return-1;for(let r=t;r<e.length;r++){if(!Tz(n))return-1;if(e[r-1]!==`\\`&&e[r]===`~`&&e[r-1]!==`~`&&e[r+1]!==`~`)return kz(e[r-1]??``)?-1:r}return-1}function wz(e,t,n,r){for(let i=t;i<e.length;i++){if(!Tz(r))return-1;if(e[i]===n)return i}return-1}function Tz(e){return e.scans<=0?!1:(e.scans--,!0)}function Ez(e,t,n,r){let i=e[t-1],a=e[t+n],o=!Dz(a)&&(!Oz(a)||Dz(i)||Oz(i)),s=!Dz(i)&&(!Oz(i)||Dz(a)||Oz(a));return r?o&&(!s||Oz(i)):s&&(!o||Oz(a))}function Dz(e){return e===void 0||/\s/.test(e)}function Oz(e){return e!==void 0&&/[^\p{L}\p{N}\s]/u.test(e)}function kz(e){return/\s/.test(e)}function Az(e,t){return mz(e,{},t).map(e=>e.type===`text`||e.type===`inlineCode`?e.value:``).join(``)}function jz(e){let t=[];for(let n of e){let e=t.at(-1);e?.type===`text`&&n.type===`text`?e.value+=n.value:t.push(n)}return t}var Mz=64;function Nz(e,t={}){let n=rz(e),r=t.frontmatter!==!1,i=n.split(`
|
|
140
|
-
`),a;if(r&&i[0]===`---`){let e=i.findIndex((e,t)=>t>0&&e===`---`);e>0&&(a=i.slice(1,e).join(`
|
|
141
|
-
`),i=i.slice(e+1))}let o=Iz(i);i=o.lines;let s=[],c=Object.create(null),l=Object.keys(o.references).length>0,u=Object.keys(o.footnotes).length>0,d=l||u?{...t,...l?{references:o.references}:{},...u?{footnotes:o.footnotes,footnoteOrder:s,footnoteCounts:c}:{}}:t,f=new Pz(i,d,sz()).parse();u&&s.length>0&&f.push(Lz(o.footnotes,s,d));let p=a===void 0?{type:`root`,children:f}:{type:`root`,frontmatter:a,children:f};for(let e of d.extensions??[])p=e.transformDocument?.(p,{options:d})??p;return p}var Pz=class e{lines;options;slugger;budget;index=0;constructor(e,t,n,r={depth:0}){this.lines=e,this.options=t,this.slugger=n,this.budget=r}parse(){if(this.budget.depth>=Mz){let e=this.lines.slice(this.index).join(`
|
|
142
|
-
`);return this.index=this.lines.length,e?[{type:`paragraph`,children:dz(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(iz(this.current())){this.index++;continue}let t=this.parseExtensionBlock();if(t){e.push(t);continue}let n=this.parseFence()??this.parseHeading()??this.parseThematicBreak()??this.parseBlockquote()??this.parseList()??this.parseTable()??this.parseHtmlBlock()??this.parseParagraph();e.push(n)}return this.budget.depth--,e}parseExtensionBlock(){for(let t of this.options.extensions??[]){let n=0,r=t.parseBlock?.({lines:this.lines,index:this.index,options:this.options,parseInline:e=>dz(e,this.options),parseBlocks:t=>new e(rz(t).split(`
|
|
143
|
-
`),this.options,this.slugger,this.budget).parse(),consume:e=>{n=e}});if(r)return this.index+=Math.max(n,1),r}}parseFence(){let e=this.current().match(/^ {0,3}(`{3,}|~{3,})(.*)$/);if(!e)return;let t=e[1],n=t[0],r=t.length,i=e[2].trim(),a=[];for(this.index++;this.index<this.lines.length;){let e=this.current(),t=e.match(/^ {0,3}(`{3,}|~{3,})\s*$/);if(t&&t[1][0]===n&&t[1].length>=r){this.index++;break}a.push(e),this.index++}return{type:`code`,value:a.join(`
|
|
144
|
-
`),...Fz(i)}}parseHeading(){let e=this.current().match(/^ {0,3}(#{1,6})(?:[ \t]+(.*)|[ \t]*)$/);if(!e)return;let t=e[1].length,n=e[2]??``,r=dz((/^#+[ \t]*$/.test(n)?``:n.replace(/[ \t]+#+[ \t]*$/,``)).trim(),this.options),i=this.createHeadingId(r);return this.index++,i?{type:`heading`,depth:t,id:i,children:r}:{type:`heading`,depth:t,children:r}}parseThematicBreak(){if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(this.current()))return this.index++,{type:`thematicBreak`}}parseBlockquote(){if(!/^ {0,3}>\s?/.test(this.current()))return;let t=[];for(;this.index<this.lines.length;){let e=this.current();if(iz(e)){t.push(``),this.index++;continue}let n=e.match(/^ {0,3}>\s?(.*)$/);if(!n)break;t.push(n[1]),this.index++}return{type:`blockquote`,children:new e(t,this.options,this.slugger,this.budget).parse()}}parseList(){let t=zz(this.current());if(!t)return;let n=[],r=t.ordered,i=t.indent,a=r?t.number:void 0,o=!1;for(;this.index<this.lines.length;){let r=zz(this.current());if(!r||!Bz(r,t)||r.indent!==i)break;let a=r.content,s=a.match(/^\[([ xX])\]\s+(.*)$/),c=s?s[1].toLowerCase()===`x`:void 0;s&&(a=s[2]);let l=[a];for(this.index++;this.index<this.lines.length;){let e=this.current(),n=zz(e);if(n&&n.indent===i)break;if(iz(e)){let e=this.index;for(;e<this.lines.length&&iz(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let a=zz(n);if(a?.indent===i){if(!Bz(a,t))break;o=!0,this.index=e;break}if(Vz(n)<r.contentIndent)break;o=!0,l.push(``),this.index=e;continue}if(Vz(e)>=r.contentIndent){l.push(az(e,r.contentIndent)),this.index++;continue}if(Hz(e,this.next()))break;l.push(e.trimStart()),this.index++}let u={type:`listItem`,children:new e(l,this.options,this.slugger,this.budget).parse()};c!==void 0&&(u.checked=c),n.push(u)}return{type:`list`,ordered:r,...r&&a!==void 0?{start:a}:{},...o&&{loose:!0},items:n}}parseTable(){let e=this.current(),t=this.next();if(!t||!Uz(e,t))return;let n=Wz(e),r=Wz(t).map(Gz),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(iz(e)||Hz(e,this.next()))break;let t=Wz(e);a.push(Array.from({length:i},(e,n)=>Kz(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>Kz(e,this.options)),rows:a}}parseHtmlBlock(){if(!this.options.allowHtml||!/^ {0,3}<([A-Za-z][\w:-]*|!--|\/[A-Za-z])/.test(this.current()))return;let e=[];if(/^ {0,3}<!--/.test(this.current())){for(;this.index<this.lines.length;){let t=this.current();if(e.push(t),this.index++,t.includes(`-->`))break}return{type:`html`,value:e.join(`
|
|
145
|
-
`)}}for(;this.index<this.lines.length&&!iz(this.current());)e.push(this.current()),this.index++;return{type:`html`,value:e.join(`
|
|
146
|
-
`)}}parseParagraph(){let e=[];for(;this.index<this.lines.length;){let t=this.current();if(iz(t)||e.length>0&&Hz(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:dz(e.join(`
|
|
147
|
-
`),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=oz(e);return typeof this.options.headingIds==`function`?this.options.headingIds(t,this.index):this.slugger(t)}current(){return this.lines[this.index]??``}next(){return this.lines[this.index+1]}};function Fz(e){if(!e)return{};let t=e.match(/^([A-Za-z0-9_+.#-]+)/)?.[1],n=t?e.slice(t.length).trim():e,r=n.match(/(?:^|\s)(?:title|file)=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),i=n.match(/(?:^|\s)framework=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),a=n.match(/\{([^}]+)\}|(?:^|\s)lines=([^\s]+)/),o=Rz(a?.[1]??a?.[2]??``),s=r?r[1]??r[2]??r[3]:void 0,c=i?i[1]??i[2]??i[3]:void 0;return{...t?{lang:t}:{},...n?{meta:n}:{},...s?{title:s,file:s}:{},...c?{framework:c.toLowerCase()}:{},...o.length?{highlightLines:o}:{}}}function Iz(e){let t=Object.create(null),n=Object.create(null),r=new Map,i=[],a,o=0,s=0;for(;s<e.length;){let c=e[s],l=c.match(/^ {0,3}(`{3,}|~{3,})/);if(l){let e=l[1][0];a?e===a&&l[1].length>=o&&(a=void 0,o=0):(a=e,o=l[1].length),i.push(c),s++;continue}if(!a){let i=c.match(/^ {0,3}\[\^([^\]\n]+)\]:[ \t]*(.*)$/);if(i){let t=i[1],a=[i[2]??``];for(s++;s<e.length;){let t=e[s];if(!/^(?: {4,}|\t)/.test(t))break;a.push(t.replace(/^(?: {4}|\t)/,``)),s++}let o=lz(t);if(!n[o]){let e=uz(t)||`footnote`,i=(r.get(e)??0)+1;r.set(e,i),n[o]={label:t,content:a.join(`
|
|
148
|
-
`),id:i===1?e:`${e}-${i}`}}continue}let a=c.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S+)(?:[ \t]+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?[ \t]*$/);if(a){let e=a[3]??a[4]??a[5];t[lz(a[1])]={href:a[2].replace(/^<|>$/g,``),...e===void 0?{}:{title:e}},s++;continue}}i.push(c),s++}return{lines:i,references:t,footnotes:n}}function Lz(e,t,n){let r=[];for(let i=0;i<t.length;i++){let a=e[t[i]];a&&r.push({id:a.id??(uz(a.label)||`footnote`),number:i+1,children:new Pz(rz(a.content).split(`
|
|
149
|
-
`),n,sz()).parse()})}for(let e of r){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:r}}function Rz(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function zz(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r?{number:Number.parseInt(n,10)}:{},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function Bz(e,t){return e.ordered===t.ordered&&e.marker===t.marker}function Vz(e){return e.match(/^ */)?.[0].length??0}function Hz(e,t){let n=zz(e);return/^ {0,3}(`{3,}|~{3,})/.test(e)||/^ {0,3}#{1,6}(?:\s+|$)/.test(e)||/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(e)||/^ {0,3}>\s?/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&Uz(e,t)}function Uz(e,t){if(!e.includes(`|`))return!1;let n=Wz(t);return n.length===Wz(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function Wz(e){let t=e.trim();t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1));let n=[],r=``;for(let e=0;e<t.length;e++){let i=t[e];if(i===`\\`&&t[e+1]===`|`){r+=`|`,e++;continue}if(i===`|`){n.push(r.trim()),r=``;continue}r+=i}return n.push(r.trim()),n}function Gz(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function Kz(e,t){return{type:`tableCell`,children:dz(e,t)}}function qz(e){return[...e.value.panel.flatMap(e=>e.actions??[]),...e.value.timeline.cells.flatMap(e=>e.rows.flatMap(e=>e.actions??[])),...e.value.waiting===null?[]:[e.value.waiting.cancel]]}function Jz(e){let t=new AbortController,n=()=>t.signal.aborted,r=new Set,i=new Map,a=new Map,o=(e,t)=>JSON.stringify([e,t.id,t.input??{}]),s=()=>{if(n())return;let t=new Map,s=new Set;for(let n of e.contributions())for(let e of qz(n)){let r=o(n.entryId,e);s.add(r);let i=a.get(r);i!==void 0&&t.set(e,i)}for(let[e,t]of a)!s.has(e)&&!t.pending&&a.delete(e);i=t;for(let e of r)e()},c=(e,t)=>{n()||(a.set(e,t),s())};return{snapshot:()=>i,refresh:s,subscribe:e=>(r.add(e),()=>{r.delete(e)}),execute:async(r,i,s=!1)=>{let l=e.contributions().find(e=>e.entryId===r);if(n()||!e.online()||l===void 0||!qz(l).includes(i)||s&&l.value.waiting?.cancel!==i)return;let u=o(r,i);if(a.get(u)?.pending)return;c(u,{pending:!0});let d={signal:t.signal,prompt:()=>Promise.reject(new Rr(`client_waiting_prompt`,`A waiting cancellation cannot request an answer`)),notify:t=>{n()||e.interactions.report({tone:t.type===`success`?`success`:`info`,message:t.type===`handoff`?t.message??t.url:t.message})}},f;try{let n={origin:`menu`,signal:t.signal};i.input!==void 0&&(n={...n,arguments:i.input}),s&&(n={...n,interaction:d}),f=await e.commands.execute(`${r}:${i.id}`,n)}catch(t){if(XP(`client row command`,t),n())return;let r=t instanceof Error?t:Error(`Client row command failed`,{cause:t});c(u,{pending:!1,error:r.message}),e.interactions.report({tone:`error`,message:r.message});return}if(n())return;let p=f.status===`handled`?void 0:f.status===`failed`?f.error.message:f.status===`unavailable`?f.reason:`Client row command ${f.status}`;c(u,p===void 0?{pending:!1}:{pending:!1,error:p}),p!==void 0&&e.interactions.report({tone:`error`,message:p})},dispose:()=>{t.abort(),i=new Map,a.clear(),r.clear()}}}var Yz=new Map,Xz=()=>Yz,Zz=()=>()=>void 0;function Qz(e){let t=cL(),{observation:n}=sL(),r=lL(),i=aL(),[a,o]=(0,J.useState)(),s=(0,J.useRef)({contributions:t,observation:n});return s.current={contributions:t,observation:n},(0,J.useEffect)(()=>{let t=Jz({commands:e,contributions:()=>s.current.contributions,online:()=>s.current.observation.status===`live`,interactions:r});return o(t),()=>{t.dispose()}},[e,r,i]),(0,J.useEffect)(()=>{a?.refresh()},[a,t]),{state:(0,J.useSyncExternalStore)(a?.subscribe??Zz,a?.snapshot??Xz,a?.snapshot??Xz),enabled:a!==void 0&&n.status===`live`,execute:(e,t,n=!1)=>a?.execute(e,t,n)??Promise.resolve()}}function $z(e){let t=new Map;for(let n of e){let e=t.get(n.entryId);e===void 0?t.set(n.entryId,[n]):e.push(n)}for(let e of t.values())e.sort((e,t)=>e.cell.sequence-t.cell.sequence);let n=[];for(;t.size>0;){let e=[...t.values()].flatMap(e=>e[0]===void 0?[]:[e[0]]);e.sort((e,t)=>e.cell.at-t.cell.at||(e.entryId<t.entryId?-1:+(e.entryId>t.entryId))||e.cell.sequence-t.cell.sequence);let r=e[0];if(r===void 0)break;n.push(r);let i=t.get(r.entryId);i?.shift(),i?.length===0&&t.delete(r.entryId)}return n}function eB(e,t){let n=new Map,r=[];for(let{entryId:i,value:a}of e)for(let e of a.timeline.cells){let a={entryId:i,cell:e};if(e.commandId===null){r.push(a);continue}let o=t.get(e.commandId);if(o===void 0)continue;let s=n.get(o);s===void 0?n.set(o,[a]):s.push(a)}return{after:new Map([...n].map(([e,t])=>[e,$z(t)])),unanchored:$z(r),omitted:e.flatMap(({entryId:e,value:t})=>t.timeline.omitted===0?[]:[{entryId:e,count:t.timeline.omitted}])}}var tB=J.createContext(void 0);function nB(e){let t=J.useContext(tB);if(!e&&t===void 0)throw Error(ME(27));return t}var rB=J.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=nB(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return cD(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:VO,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),iB=J.createContext(void 0);function aB(e=!1){let t=J.useContext(iB);if(t===void 0&&!e)throw Error(ME(16));return t}function oB(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:J.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function sB(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(PD(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function cB(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=J.useRef(null),s=aB(!0),c=a??s!==void 0,{props:l}=oB({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=J.useCallback(()=>{let e=o.current;lB(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return hA(u,[u]),{getButtonProps:J.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return YE({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(aD(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=lB(r),s=!i&&uB(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),sB(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),sB(r,e)))},onKeyUp(e){if(!t){if(aD(e),a?.(e),e.target===e.currentTarget&&i&&c&&lB(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),sB(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:xE(e=>{o.current=e,u()})}}function lB(e){return RD(e)&&e.tagName===`BUTTON`}function uB(e){return RD(e)&&e.tagName===`A`&&!!e.href}function dB(e,t,n,r){let i=!1,a=!1,o=r??EE;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var fB=`none`,pB=`trigger-press`,mB=`trigger-hover`,hB=`outside-press`,gB=`close-press`,_B=`focus-out`,vB=`escape-key`,yB=`imperative-action`,bB=J.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=nB(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=cB({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,dB(gB,e.nativeEvent))}return cD(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),xB=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=nB(),c=CD(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),cD(`p`,e,{ref:t,props:[{id:c},o]})});function SB(e,t){return t!=null&&!nk(t)?0:typeof e==`function`?e():e}function CB(e,t,n){let r=SB(e,n);return typeof r==`number`?r:r?.[t]}function wB(e){return typeof e==`function`?e():e}function TB(e,t){return t||e===`click`||e===`mousedown`}function EB(e){return e?.includes(`mouse`)&&e!==`mousedown`}function DB(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function OB(e){let t=vE(kB,e).current;return t.next=e,hA(t.effect),t}function kB(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var AB=null;globalThis.requestAnimationFrame;var jB=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},MB=class e{static create(){return new e}static request(e){return jB.request(e)}static cancel(e){return jB.cancel(e)}currentId=AB;request(e){this.cancel(),this.currentId=jB.request(()=>{this.currentId=AB,e()})}cancel=()=>{this.currentId!==AB&&(jB.cancel(this.currentId),this.currentId=AB)};disposeEffect=()=>this.cancel};function NB(){let e=vE(MB.create).current;return DE(e.disposeEffect),e}var PB={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},FB={...PB,position:`fixed`,margin:0,top:0,left:0};({...PB});var IB=J.forwardRef(function(e,t){let[n,r]=J.useState();hA(()=>{hO&&mO&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,X.jsx)(`span`,{...e,ref:t,style:FB,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function LB(e){return`data-base-ui-${e}`}var RB=0;function zB(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(RB);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),wE;let o=requestAnimationFrame(a);return RB=o,()=>{RB===o&&(cancelAnimationFrame(o),RB=0)}}var BB=`data-base-ui-inert`,VB=new WeakMap,HB=new WeakSet,UB=new WeakMap,WB=0;function GB(e){return e?zD(e)?e.host:GB(e.parentNode):null}var KB=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=GB(t);return e.contains(n)?n:null}).filter(e=>e!=null),qB=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},JB=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{ND(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function YB(e,t,n,{mark:r=!0}){let i=KB(t,e),a=r?JB(t,qB(i),new Set(i)):[],o=[],s=[];if(n){let e=KB(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);JB(t,qB(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(VB.get(e)||0)+1;VB.set(e,r),o.push(e),r===1&&n&&HB.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(UB.get(e)||0)+1;UB.set(e,t),s.push(e),t===1&&e.setAttribute(BB,``)}),WB+=1,()=>{o.forEach(e=>{let t=(VB.get(e)||0)-1;VB.set(e,t),t||(HB.has(e)||e.removeAttribute(`aria-hidden`),HB.delete(e))}),r&&s.forEach(e=>{let t=(UB.get(e)||0)-1;UB.set(e,t),t||e.removeAttribute(BB)}),--WB,WB||(VB=new WeakMap,HB=new WeakSet,UB=new WeakMap)}}function XB(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=Nk(e[0]).body;return YB(e,i,n,{mark:r})}var ZB={style:{transition:`none`}},QB=`data-base-ui-click-trigger`,$B={fallbackAxisSide:`end`},eV={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},tV=J.createContext(null),nV=()=>J.useContext(tV),rV=LB(`portal`);function iV(e={}){let{ref:t,container:n,componentProps:r=EE,elementProps:i}=e,a=SD(),o=nV()?.portalNode,[s,c]=J.useState(null),[l,u]=J.useState(null),d=xE(e=>{e!==null&&u(e)}),f=J.useRef(null);hA(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(ID(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=cD(`div`,r,{ref:[t,d],props:[{id:a,[rV]:``},i]}),m=s&&p?uL.createPortal(p,s):null;return{node:l,nodeId:J.isValidElement(p)?p.props.id:void 0,subtree:m}}var aV=J.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=iV({container:o,ref:t,componentProps:e,elementProps:c}),f=J.useRef(null),p=J.useRef(null),m=J.useRef(null),h=J.useRef(null),[g,_]=J.useState(null),v=J.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;J.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&eA(e)&&(e.type===`focusin`?v.current&&=(nA(l),!1):(tA(l),v.current=!0))}return DB(IA(l,`focusin`,e,!0),IA(l,`focusout`,e,!0))},[l,y]),hA(()=>{!l||b!==!0||!v.current||(nA(l),v.current=!1)},[b,l]);let S=J.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,X.jsxs)(J.Fragment,{children:[d,(0,X.jsxs)(tV.Provider,{value:S,children:[x&&l&&(0,X.jsx)(IB,{"data-type":`outside`,ref:f,onFocus:e=>{eA(e,l)?m.current?.focus():Qk(g?g.domReference:null)?.focus()}}),x&&l&&(0,X.jsx)(`span`,{role:s,"aria-owns":u,style:eV}),l&&uL.createPortal(a,l),x&&l&&(0,X.jsx)(IB,{"data-type":`outside`,ref:p,onFocus:e=>{eA(e,l)?h.current?.focus():(Zk(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,dB(`focus-out`,e.nativeEvent)))}})]})]})});function oV(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var sV=class{nodesRef={current:[]};events=oV();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},cV=J.createContext(null),lV=J.createContext(null),uV=()=>J.useContext(cV)?.id||null,dV=e=>{let t=J.useContext(lV);return e??t};function fV(e){let t=SD(),n=dV(e),r=uV();return hA(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function pV(e){let{children:t,id:n}=e,r=uV();return(0,X.jsx)(cV.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function mV(e){let{children:t,externalTree:n}=e,r=vE(()=>n??new sV).current;return(0,X.jsx)(lV.Provider,{value:r,children:t})}function hV(e){return e==null?e:`current`in e?e.current:e}function gV(e,t){let n=PD(bO(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(ek(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var _V=20,vV=[];function yV(){vV=vV.filter(e=>e.deref()?.isConnected)}function bV(e){yV(),e&&ND(e)!==`body`&&(vV.push(new WeakRef(e)),vV.length>_V&&(vV=vV.slice(-20)))}function xV(){return yV(),vV[vV.length-1]?.deref()}function SV(e){return e?qk(e)?e:Yk(e)[0]||e:null}function CV(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Jk(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return qk(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function wV(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=xE(()=>b.current.floatingContext?.nodeId),S=i===!1,C=JO(_)&&S,w=OB(i),T=OB(a),E=OB(o),D=OB(u),O=OB(g),k=dV(m),A=nV(),j=J.useRef(!1),M=J.useRef(!1),N=J.useRef(!1),P=J.useRef(null),F=J.useRef(``),ee=J.useRef(``),I=J.useRef(null),te=J.useRef(null),L=FE(I,p,A?.beforeInsideRef),ne=FE(te,A?.afterInsideRef),re=AE(),ie=AE(),ae=NB(),oe=A!=null,R=YO(v),se=xE((e=R)=>e?Yk(e):[]),ce=xE(()=>h?.().filter(e=>e!=null)??[]);J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&vO(R,_O(Nk(R)))&&se().length===0&&!C&&QO(e)}return IA(Nk(R),`keydown`,e)},[r,R,c,C,se]),J.useEffect(()=>{if(r||!g)return;let e=Nk(R);function t(){N.current=!1}function n(e){let t=bO(e),n=ce(),r=vO(v,t)||vO(_,t)||vO(A?.portalNode,t)||n.some(e=>e===t||vO(e,t));N.current=!r,ee.current=e.pointerType||`keyboard`,yO(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,ie.start(0,()=>{M.current=!1}))}function i(){ee.current=`keyboard`}return DB(IA(e,`pointerdown`,n,!0),IA(e,`pointerup`,t,!0),IA(e,`pointercancel`,t,!0),IA(e,`keydown`,i,!0),t)},[r,v,_,R,g,A,ie,ce]),J.useEffect(()=>{if(r||!l)return;let e=Nk(R);function n(){M.current=!0,ie.start(0,()=>{M.current=!1})}function i(e){let t=bO(e);qk(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=bO(n);c&&r==null&&a!=null&&vO(v,a)&&bV(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ce(),p=r?.hasAttribute(LB(`focus-guard`))&&[I.current,te.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,hV(f),hV(d)].includes(r),m=!(vO(_,r)||vO(v,r)||vO(r,v)||vO(A?.portalNode,r)||u.some(e=>e===r||vO(e,r))||l.hasMatchingElement(e=>vO(e,r))||p||k&&(XO(k.nodesRef.current,o).find(e=>vO(e.context?.elements.floating,r)||vO(e.context?.elements.domReference,r))||ZO(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,YO(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&R&&CV(R),s&&i!==_&&!Mk(a)&&_O(e)===e.body){if(RD(R)&&(R.focus(),s===`popup`)){ae.request(()=>{R.focus()});return}let e=se(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||R;RD(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==xV())&&(j.current=!0,t.setOpen(!1,dB(_B,n)))})}function o(){N.current||(b.current.insideReactTree=!0,re.start(0,()=>{b.current.insideReactTree=!1}))}let u=RD(_)?_:null;if(!(!v&&!u))return DB(u&&IA(u,`focusout`,a),u&&IA(u,`pointerdown`,n),v&&IA(v,`focusin`,i),v&&IA(v,`focusout`,a),v&&A&&IA(v,`focusout`,o,!0))},[r,_,v,R,c,k,A,t,l,s,se,C,x,b,re,ie,ae,d,f,ce]),J.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${LB(`portal`)}]`)||[]),t=(k?ZO(k.nodesRef.current,x()):[]).find(e=>JO(e.context?.elements.domReference||null))?.context?.elements.domReference,n=XB([v,...e,I.current,te.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ce(),t,hV(f),hV(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=XB([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ce]),hA(()=>{if(!g||r||!RD(R))return;F.current=``,ee.current=``;let e=Nk(R),t=_O(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||vO(R,t))return;let i=null,a=()=>(i??=se(R),i[0]||R),o;o=r===!0||r===null?a():hV(r),o||=a();let s=vO(R,_O(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&ek(c);zB(o,{sync:l,preventScroll:o===R,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=_O(e);return!(t!==o&&vO(R,t))}})})},[r,g,R,se,w,D,O,b]);let le=J.useRef(null);hA(()=>{if(r||!R){le.current=null;return}le.current&&=(le.current.cancelled=!0,null);let e=Nk(R),t=_O(e),n=D.current==null;bV(t);function i(e){if(e.open||(F.current=gV(e.nativeEvent,ee.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(LB(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(ek(e.nativeEvent)||tk(e.nativeEvent))j.current=!1;else{let e=!1;Nk(R).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&ND(t)!==`body`?t:null,s=n?o||a:a||o;return s||=xV()||null,typeof i==`boolean`?s:hV(i)||s||null}return()=>{y.off(`openchange`,i);let t=_O(e),n=ce(),r=vO(v,t)||n.some(e=>e===t||vO(e,t))||k&&XO(k.nodesRef.current,x(),!1).some(e=>vO(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};le.current=l,queueMicrotask(()=>{le.current===l&&(le.current=null);let n=SV(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&RD(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,R,T,E,D,y,k,_,x,ce]),hA(()=>{if(!mO||g||!v)return;let e=_O(Nk(v));!RD(e)||!KO(e)||vO(v,e)&&e.blur()},[g,v]),hA(()=>{if(!(r||!A))return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),hA(()=>{if(!(r||!R))return CV(R),()=>{queueMicrotask(yV)}},[r,R]);let ue=!r&&(!c||!C)&&(oe||c);return(0,X.jsxs)(J.Fragment,{children:[ue&&(0,X.jsx)(IB,{"data-type":`inside`,ref:L,onFocus:e=>{if(c){let e=se();zB(e[e.length-1])}else A?.portalNode&&(j.current=!1,eA(e,A.portalNode)?Zk(_)?.focus():hV(f??A.beforeOutsideRef)?.focus())}}),n,ue&&(0,X.jsx)(IB,{"data-type":`inside`,ref:ne,onFocus:e=>{c?zB(se()[0]):A?.portalNode&&(l&&(j.current=!0),eA(e,A.portalNode)?Qk(_)?.focus():hV(d??A.afterOutsideRef)?.focus())}})]})}function TV(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=pB}=t,l=e.context.dataRef,u=J.useRef(void 0),d=NB(),f=AE(),p=J.useMemo(()=>{function t(t,n,r,i){let a=dB(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=nk(e.pointerType,!0)&&tk(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||nk(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=bO(s),p=KO(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;if(r===`mousedown`&&o){u.current=void 0;return}nk(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return J.useMemo(()=>n?{reference:p}:EE,[n,p])}function EV(){return!1}function DV(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function OV(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=EV,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=dV(c),m=xE(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=xE(()=>a),{escapeKey:v,outsidePress:y}=DV(s),b=J.useRef(!1),x=J.useRef(!1),S=J.useRef(!1),C=J.useRef(!1),w=J.useRef(!1),T=J.useRef(``),E=J.useRef(null),D=AE(),O=AE(),k=AE(),A=xE(()=>{O.clear(),d.current.insideReactTree=!1}),j=xE(e=>{let t=d.current.floatingContext?.nodeId;return(p?XO(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=xE(t=>WO(t,e.select(`floatingElement`))||WO(t,e.select(`domReferenceElement`))),N=xE(t=>{o()&&e.setOpen(!1,dB(pB,t.nativeEvent))}),P=xE(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=$O(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=dB(vB,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=xE(()=>{d.current.insideReactTree=!0,O.start(0,A)}),ee=xE(t=>{if(!l||!n||t.button!==0)return;let r=bO(t.nativeEvent);vO(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),I=xE(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});J.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),J.useEffect(()=>A,[A]),J.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new kE,i=Nk(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(mO?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&XO(p.nodesRef.current,t).some(t=>WO(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=bO(n),i=`[${LB(`inert`)}]`,a=LD(r)?r.getRootNode():null,o=Array.from((zD(a)?a:Nk(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>vO(e,r))))return;let c=LD(r)?r:null;for(;c&&!XD(c);){let e=$D(c);if(XD(e)||!LD(e))break;c=e}if(!(o.length&&LD(r)&&!GO(r)&&!vO(r,e.select(`floatingElement`))&&o.every(e=>!vO(c,e)))){if(RD(r)&&!(`touches`in n)){let e=XD(r),t=ZD(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!ek(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,dB(hB,n)),A())}}}function F(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function ee(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function I(e,t){let n=bO(e);if(!n)return;let r=IA(n,e.type,()=>{t(e),r()})}function te(e){T.current=`touch`,I(e,ee)}function L(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&I(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function ne(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;if(c(),f()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!O(e)){if(n){s();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,A())}}}function re(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function ie(e){I(e,re)}function ae(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function oe(e){I(e,ae)}let R=DB(r&&DB(IA(i,`keydown`,P),IA(i,`compositionstart`,a),IA(i,`compositionend`,o)),g&&DB(IA(i,`click`,L,!0),IA(i,`pointerdown`,L,!0),IA(i,`pointerup`,ne,!0),IA(i,`pointercancel`,ne,!0),IA(i,`mousedown`,L,!0),IA(i,`mouseup`,ne,!0),IA(i,`touchstart`,te,{capture:!0,passive:!0}),IA(i,`touchmove`,ie,{capture:!0,passive:!0}),IA(i,`touchend`,oe,{capture:!0,passive:!0})));return()=>{R(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let te=J.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),L=J.useMemo(()=>({onKeyDown:P,onPointerDown:I,onMouseDown:I,onClickCapture:F,onMouseDownCapture(e){F(),ee(e)},onPointerDownCapture(e){F(),ee(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,ee,I]);return J.useMemo(()=>n?{reference:te,floating:L,trigger:te}:{},[n,te,L])}function kV(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),hA(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};LD(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function AV(e,t=!1,n=!1,r=!1){let[i,a]=J.useState(e&&t?`idle`:void 0),[o,s]=J.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),hA(()=>{if(!e&&o&&i!==`ending`&&n){let e=MB.request(()=>{a(`ending`)});return()=>{MB.cancel(e)}}},[e,o,i,n]),hA(()=>{if(!e||t||i===void 0)return;let n=MB.request(()=>{a(void 0)});return()=>{MB.cancel(n)}},[t,e,i]),hA(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=MB.request(()=>{a(`idle`)});return()=>{MB.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var jV=null;function MV(e){if(!jV){let e=[];jV=e,queueMicrotask(()=>{jV=null,uL.flushSync(()=>{for(let t of e)t()})})}jV.push(e)}function NV(e,t=!1,n=!1){let r=NB();return xE((i,a=null)=>{r.cancel();let o=hV(e);if(o==null)return;let s=o,c=()=>{if(!n){uL.flushSync(i);return}MV(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(SA(s).map(e=>e.finished.then(wE))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(SA(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=CO;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function PV(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=xE(a),s=NV(r,n,i);J.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function FV(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=xE(i),{mounted:c,setMounted:l,transitionStatus:u}=AV(t,!1,!1,o),d=!t&&r;hA(()=>{t&&s(!1)},[t,s]);let f=J.useRef(c),p=J.useRef(!1),m=vD(),h=()=>{f.current=!1,l(!1),a()};hA(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=xE(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return PV({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var IV={tabIndex:-1,[xO]:``};function LV(e){return t=>t!==`touch`||e.current}function RV(e,t=!1){let n=SD(),r=uV()!=null,i=vE(()=>e(n,r)).current;return kV({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function zV({handle:e,store:t}){return hA(()=>e.attachStore(t),[e,t]),null}function BV(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function VV(e,t){let n=J.useRef(null);return xE(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),BV(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),BV(t))})}function HV(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function UV(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function WV(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=VV(e,n),o=xE(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=xE(e=>{a(e),e&&o(e)});return hA(()=>(s(t.current),()=>s(null)),[s,t,n,e]),hA(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function GV(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=J.useRef(null),i=e.useState(`open`);hA(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=dB(fB);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function KV(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=FV({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return vE(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function qV(e,t){e.useSyncedValues(t),hA(()=>()=>{e.update({activeTriggerProps:EE,inactiveTriggerProps:EE,popupProps:EE})},[e])}function JV(e,t){hA(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),hA(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var YV=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},XV=t((e=>{var t=Lr();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),ZV=t(((e,t)=>{t.exports=XV()})),QV=t((e=>{var t=Lr(),n=ZV();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),$V=t(((e,t)=>{t.exports=QV()})),eH=[],tH=void 0;function nH(){return tH}function rH(e){eH.push(e)}function iH(e){let t=(t,n)=>{let r=vE(oH).current,i;try{tH=r;for(let e of eH)e.before(r);i=e(t,n);for(let e of eH)e.after(r);r.didInitialize=!0}finally{tH=void 0}return i};return t.displayName=e.displayName||e.name,t}function aH(e){return J.forwardRef(iH(e))}function oH(){return{didInitialize:!1}}var sH=ZV(),cH=$V(),lH=HE(19)?fH:pH;function uH(e,t,n,r,i){return lH(e,t,n,r,i)}function dH(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,sH.useSyncExternalStore)(e.subscribe,a,a)}rH({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,sH.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function fH(e,t,n,r,i){let a=nH();if(!a)return dH(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function pH(e,t,n,r,i){return(0,cH.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var mH=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return uH(this,e,t,n,r)}},hH=class extends mH{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){J.useDebugValue(e);let n=this;hA(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;hA(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;hA(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){J.useDebugValue(e);let n=this,r=t!==void 0;hA(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return J.useDebugValue(e),uH(this,this.selectors[e],t,n,r)}useContextCallback(e,t){J.useDebugValue(e);let n=xE(t??wE);this.context[e]=n}useStateSetter(e){let t=J.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},gH={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},_H=class extends hH{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:oV(),nested:n,triggerElements:i},gH),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&rk(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function vH(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new _H({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:EE,inactiveTriggerProps:EE,popupProps:EE}}var yH=e=>e.triggerIdProp??e.activeTriggerId,bH=e=>e.openProp??e.open,xH=e=>(e.popupElement?.id??e.floatingId)||void 0;function SH(e,t){return t!==void 0&&bH(e)&&yH(e)===t}function CH(e,t){return SH(e,t)?!0:t!==void 0&&bH(e)&&yH(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var wH={open:bH,mounted:e=>e.mounted,transitionStatus:e=>bH(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:yH,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:xH,isTriggerActive:(e,t)=>t!==void 0&&yH(e)===t,isOpenedByTrigger:(e,t)=>SH(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&yH(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>CH(e,t)?xH(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function TH(e){let t=J.useCallback(t=>e===void 0?wE:e.subscribeStore(t),[e]),n=J.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,sH.useSyncExternalStore)(t,n,()=>e?.serverStore)}var EH=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new kE;restTimeout=new kE;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},DH=new WeakMap;function OH(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&DH.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),DH.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function kH(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=DH.get(n);a&&a!==e&&OH(a),OH(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,DH.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function AH(e){let t=e.context.dataRef.current,n=vE(()=>t.hoverInteractionState??EH.create()).current;return t.hoverInteractionState||=n,DE(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function jH(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=dV(),u=uV(),d=AH(e),f=AE(),p=xE(()=>TB(c.current.openEvent?.type,d.interactedInside)),m=xE(()=>EB(c.current.openEvent?.type)),h=xE(()=>{OH(d)});hA(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),J.useEffect(()=>h,[h]),hA(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&LD(s)&&o){let e=s,t=o,n=Nk(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??yO(e,`[data-rootownerid]`)??n.body;return kH(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),J.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&XO(l.nodesRef.current,u).length>0)}function a(t){let n=CB(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,dB(mB,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=bO(e);if(!qO(t)){d.interactedInside=!1;return}d.interactedInside=yO(t,`[aria-haspopup]`)!=null}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(UO(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&LD(o)&&XO(l.nodesRef.current,r,!1).some(e=>vO(e.context?.elements.floating,o)))){if(d.handler){d.handler(n);return}h(),m()&&!p()&&a(n)}}function v(n){!l||!u||t()||f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,dB(mB,n)),l.events.emit(`floating.closed`,n)})}let y=o;return DB(y&&IA(y,`mouseenter`,g),y&&IA(y,`mouseleave`,_),y&&IA(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var MH={current:null};function NH(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=MH,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=dV(l),v=AH(e),y=J.useRef(!1),b=OB(i),x=OB(r),S=OB(o),C=OB(n),w=OB(p),T=OB(f),E=xE(()=>TB(h.current.openEvent?.type,v.interactedInside)),D=xE(()=>w.current?.()!==!1),O=xE((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!vO(t,n);if(!LD(r))return!1;let a=r;return i.hasMatchingElement(e=>vO(e,a))&&(!t||!vO(t,a))}),k=xE(()=>{v.handler&&=(Nk(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=xE(()=>{OH(v)});return u&&(v.handleCloseOptions=i?.__options),J.useEffect(()=>k,[k]),J.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===mB,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),J.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=CB(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,dB(mB,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,dB(mB,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!LD(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!nk(v.pointerType))return;let n=wB(S.current),r=CB(x.current,`open`,v.pointerType),i=bO(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(LD(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(vO(t,i)){c=t;break}}LD(o)&&LD(s)&&!e.context.triggerElements.hasElement(o)&&vO(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&LD(c)&&LD(s)&&vO(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,dB(mB,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,dB(mB,t,c))}):g&&D()&&e.setOpen(!0,dB(mB,t,c)))}function o(n){if(E()){A();return}k();let r=Nk(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!UO(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n);return}(v.pointerType!==`touch`||!vO(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){vO(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?IA(r,`mouseout`,l):void 0;return s?DB(IA(r,`mousemove`,i,{once:!0}),IA(r,`mouseenter`,i),IA(r,`mouseleave`,o),f):DB(IA(r,`mouseenter`,i),IA(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),J.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!nk(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;kH(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=wB(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,dB(mB,n,r))}v.pointerType===`touch`?uL.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}var PH=.1,FH=PH*PH,IH=.5;function LH(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function RH(e,t,n,r,i,a,o,s,c,l){let u=!1;return LH(e,t,n,r,i,a)&&(u=!u),LH(e,t,i,a,o,s)&&(u=!u),LH(e,t,o,s,c,l)&&(u=!u),LH(e,t,c,l,n,r)&&(u=!u),u}function zH(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function BH(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function VH(e={}){let{blockPointerEvents:t=!1}=e,n=new kE,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*FH;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=bO(r),g=r.type===`mouseleave`,_=vO(u,h),v=vO(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&LD(r.relatedTarget)&&vO(u,r.relatedTarget))return;function y(){return!!(s&&XO(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=BH(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=BH(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=BH(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=BH(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!zH(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?IH/2:IH*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+IH+1,o=C||T?S.bottom-IH:S.top,s=C?T?S.bottom-IH:S.top:S.bottom-IH;M=RH(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?IH/2:IH*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-IH,o=C||T?S.top+IH:S.bottom,s=C?T?S.top+IH:S.bottom:S.top+IH;M=RH(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?IH/2:IH*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+IH+1,o=w||E?S.right-IH:S.left,s=w?E?S.right-IH:S.left:S.right-IH;M=RH(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?IH/2:IH*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-IH,o=w||E?S.left+IH:S.right,s=w?E?S.left+IH:S.right:S.left+IH;M=RH(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function HH(e,t,n){let{reference:r,floating:i}=e,a=gk(t),o=_k(t),s=hk(o),c=fk(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=pk(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function UH(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=dk(t,e),p=kk(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ak(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ak(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var WH=50,GH=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:UH},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=HH(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<WH&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=HH(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},KH=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=dk(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=fk(r),_=gk(o),v=fk(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Dk(o)]:yk(o)),x=p!==`none`;!d&&x&&b.push(...Ek(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=vk(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===gk(t)||T.every(e=>gk(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=gk(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},qH=new Set([`left`,`top`]);async function JH(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=fk(n),s=pk(n),c=gk(n)===`y`,l=qH.has(o)?-1:1,u=a&&c?-1:1,d=dk(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var YH=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await JH(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},XH=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=dk(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=gk(i),p=mk(f),m=u[p],h=u[f],g=(e,t)=>uk(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ZH=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=dk(e,t),u={x:n,y:r},d=gk(i),f=mk(d),p=u[f],m=u[d],h=dk(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=qH.has(fk(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},QH=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=dk(e,t),c=await i.detectOverflow(t,s),l=fk(n),u=pk(n),d=gk(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=ik(p-c[m],g),y=ik(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*ak(c.left,c.right):S=p-2*ak(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function $H(e){let t=ZD(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=RD(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ok(n)!==a||ok(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function eU(e){return LD(e)?e:e.contextElement}function tU(e){let t=eU(e);if(!RD(t))return ck(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$H(t),o=(a?ok(n.width):n.width)/r,s=(a?ok(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var nU=ck(0);function rU(e){let t=PD(e);return!YD()||!t.visualViewport?nU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iU(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===PD(e)}function aU(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=eU(e),o=ck(1);t&&(r?LD(r)&&(o=tU(r)):o=tU(e));let s=iU(a,n,r)?rU(a):ck(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=PD(a),t=LD(r)?PD(r):r,n=e,i=nO(n);for(;i&&t!==n;){let e=tU(i),t=i.getBoundingClientRect(),r=ZD(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=PD(i),i=nO(n)}}return Ak({width:u,height:d,x:c,y:l})}function oU(e,t){let n=QD(e).scrollLeft;return t?t.left+n:aU(FD(e)).left+n}function sU(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-oU(e,n),y:n.top+t.scrollTop}}function cU(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=FD(r),s=t?HD(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ck(1),u=ck(0),d=RD(r);if((d||!a)&&((ND(r)!==`body`||BD(o))&&(c=QD(r)),d)){let e=aU(r);l=tU(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?sU(o,c):ck(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function lU(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function uU(e){let t=QD(e),n=e.ownerDocument.body,r=ak(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ak(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+oU(e),o=-t.scrollTop;return ZD(n).direction===`rtl`&&(a+=ak(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var dU=25;function fU(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=PD(e),a=FD(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!YD()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(oU(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=dU&&(s-=o)}return{width:s,height:c,x:l,y:u}}function pU(e,t){let n=aU(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=tU(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function mU(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=fU(e,n,t);else if(t===`document`)r=uU(FD(e));else if(LD(t))r=pU(t,n);else{let n=rU(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ak(r)}function hU(e,t){let n=t.get(e);if(n)return n;let r=tO(e,[],!1).filter(e=>LD(e)&&ND(e)!==`body`),i=null,a=ZD(e).position===`fixed`,o=a?$D(e):e;for(;LD(o)&&!XD(o);){let e=ZD(o),t=qD(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=$D(o)}return t.set(e,r),r}function gU(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?HD(t)?[]:hU(t,this._c):[].concat(n),r],o=mU(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=mU(t,a[e],i);s=ak(n.top,s),c=ik(n.right,c),l=ik(n.bottom,l),u=ak(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function _U(e){let{width:t,height:n}=$H(e);return{width:t,height:n}}function vU(e,t,n){let r=RD(t),i=FD(t),a=n===`fixed`,o=aU(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ck(0);if((r||!a)&&((ND(t)!==`body`||BD(i))&&(s=QD(t)),r)){let e=aU(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=oU(i));let l=i&&!r&&!a?sU(i,s):ck(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function yU(e){return ZD(e).position===`static`}function bU(e,t){if(!RD(e)||ZD(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return FD(e)===n&&(n=n.ownerDocument.body),n}function xU(e,t){let n=PD(e);if(HD(e))return n;if(!RD(e)){let t=$D(e);for(;t&&!XD(t);){if(LD(t)&&!yU(t))return t;t=$D(t)}return n}let r=bU(e,t);for(;r&&VD(r)&&yU(r);)r=bU(r,t);return r&&XD(r)&&yU(r)&&!qD(r)?n:r||JD(e)||n}var SU=async function(e){let t=this.getOffsetParent||xU,n=this.getDimensions,r=await n(e.floating);return{reference:vU(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function CU(e){return ZD(e).direction===`rtl`}var wU={convertOffsetParentRelativeRectToViewportRelativeRect:cU,getDocumentElement:FD,getClippingRect:gU,getOffsetParent:xU,getElementRects:SU,getClientRects:lU,getDimensions:_U,getScale:tU,isElement:LD,isRTL:CU};function TU(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function EU(e,t,n){let r=null,i,a=FD(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=sk(d),h=sk(a.clientWidth-(u+f)),g=sk(a.clientHeight-(d+p)),_=sk(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ak(0,ik(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!TU(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=PD(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function DU(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=eU(e),u=i||a?[...l?tO(l):[],...t?tO(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?EU(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?aU(e):null;c&&g();function g(){let t=aU(e);h&&!TU(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var OU=YH,kU=XH,AU=KH,jU=QH,MU=ZH,NU=(e,t,n)=>{let r=new Map,i=n??{},a={...wU,...i.platform,_c:r};return GH(e,t,{...i,platform:a})},PU=typeof document<`u`?J.useLayoutEffect:function(){};function FU(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!FU(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!FU(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function IU(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function LU(e,t){let n=IU(e);return Math.round(t*n)/n}function RU(e){let t=J.useRef(e);return PU(()=>{t.current=e}),t}function zU(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);FU(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=RU(c),D=RU(i),O=RU(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),NU(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!FU(w.current,t)&&(w.current=t,uL.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);PU(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);PU(()=>(A.current=!0,()=>{A.current=!1}),[]),PU(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=LU(M.floating,u.x),r=LU(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...IU(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var BU=(e,t)=>{let n=OU(e);return{name:n.name,fn:n.fn,options:[e,t]}},VU=(e,t)=>{let n=kU(e);return{name:n.name,fn:n.fn,options:[e,t]}},HU=(e,t)=>({fn:MU(e).fn,options:[e,t]}),UU=(e,t)=>{let n=AU(e);return{name:n.name,fn:n.fn,options:[e,t]}},WU=(e,t)=>{let n=jU(e);return{name:n.name,fn:n.fn,options:[e,t]}},GU=J.createContext(void 0);function KU(){let e=J.useContext(GU);if(e===void 0)throw Error(ME(26));return e}var qU=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),JU=`--nested-dialogs`,YU=`data-nested-dialog-open`,XU={...BO,...DO,nestedDialogOpen(e){return e?{[YU]:``}:null}},ZU=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=nB(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);KU(),PV({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?LV(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=cD(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...IV,hidden:!m,onKeyDown(e){qU.has(e.key)&&e.stopPropagation()},style:{[JU]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:XU});return(0,X.jsx)(wV,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function QU(e){return HE(19)?e:e?`true`:void 0}var $U=J.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,X.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),eW=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=nB(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,X.jsx)(GU.Provider,{value:n,children:(0,X.jsxs)(aV,{ref:t,...r,children:[a&&o===!0&&(0,X.jsx)($U,{ref:i.context.internalBackdropRef,inert:QU(!s)}),e.children]})}):null}),tW={},nW={},rW=``;function iW(e,t){return BD(e)?e:t}function aW(e,t,n){return/hidden|clip/.test(e.getComputedStyle(iW(t,n)).overflowY)}function oW(e){if(typeof document>`u`)return!1;let t=Nk(e);return PD(t).innerWidth-t.documentElement.clientWidth>0}function sW(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Nk(e),n=t.documentElement,r=t.body,i=iW(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function cW(e){let t=Nk(e),n=t.documentElement,r=t.body,i=iW(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function lW(e){let t=Nk(e),n=t.documentElement,r=t.body,i=PD(n),a=0,o=0,s=!1,c=MB.create();if(mO&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,tW={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},rW=n.style.scrollBehavior,nW={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=iW(n,r);if(s=sW(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,tW),Object.assign(r.style,nW),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=rW)}function d(){u(),c.request(l)}l();let f=IA(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var uW=new class{lockCount=0;restore=null;timeoutLock=kE.create();timeoutUnlock=kE.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Nk(e),n=t.documentElement,r=t.body,i=PD(n);if(aW(i,n,r)){let t=new i.MutationObserver(()=>{aW(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=lO||!oW(e);this.restore=a?cW(e):lW(e)}};function dW(e=!0,t=null){hA(()=>{if(e)return uW.acquire(t)},[e,t])}function fW({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=J.useState(0),[d,f]=J.useState(0),p=l===0,m=OV(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=bO(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||vO(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return dW(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{!e.select(`open`)&&!e.select(`mounted`)||(u(t),f(n))}),hA(()=>{!r&&!i&&(u(0),f(0))},[r,i]),hA(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),qV(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var pW={...wH,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},mW=class extends hH{constructor(e,t,n){let r=new YV,i=hW(e,r,t,n);super(i,gW(r),pW)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(HV(this.state,e,t.trigger)))}};function hW(e,t,n,r=!1){return{...vH(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function gW(e){return{popupRef:J.createRef(),backdropRef:J.createRef(),internalBackdropRef:J.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function _W(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=nB(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=RV((e,t)=>new mW({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);JV(b,x),GV(b);let{forceUnmount:w}=KV(x,b);J.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,dB(yB))}),[w,b]);let T=x||S||u!=null;return(0,X.jsxs)(tB.Provider,{value:b,children:[u&&(0,X.jsx)(zV,{handle:u,store:b}),T&&(0,X.jsx)(fW,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var vW=iH(function(e){return _W(`dialog`,e)}),yW=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=nB(),c=CD(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),cD(`h2`,e,{ref:t,props:[{id:c},o]})});function bW(e){let t=J.useRef(``),n=J.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:J.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function xW(e,t){let{onClick:n,onPointerDown:r}=bW(xE((n,r)=>{(typeof e==`function`?e():e)||t(r||(lO?`touch`:``))}));return J.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var SW=aH(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=nB(!0),f=TH(l)??d;if(!f)throw Error(ME(79));let p=CD(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=J.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=WV(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=cB({disabled:a,native:o}),S=TV(m),C=xW(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return cD(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[QB]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:RO})}),CW=(0,J.createContext)(void 0),wW=(0,J.createContext)(null);function TW(e){let t=(0,J.useContext)(wW);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function EW(e){let t=(0,J.useContext)(CW),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>t?.(()=>{n.current()}),[t])}var DW=(0,J.createContext)(null);function OW({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,X.jsx)(DW.Provider,{value:{interactionOwner:t,modal:n},children:(0,X.jsx)(vW,{...i,modal:n,onOpenChange:(e,n)=>{if(t===`host`&&!e&&n.reason===`escape-key`){n.cancel(),n.allowPropagation();return}r?.(e,n)},children:e})})}function kW(){let e=(0,J.useContext)(DW);if(!e)throw Error(`Dialog parts must be used inside <Dialog>`);return e}(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(SW,{...n,className:t=>$(`btn`,oS(e,t)),ref:r,type:t})});var AW=(0,J.forwardRef)(function({container:e,...t},n){let r=TW(`dialog`);return e==null&&r===null?null:(0,X.jsx)(eW,{...t,container:e??r,ref:n})}),jW=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(rB,{...t,ref:n,className:t=>$(`caps-dialog-backdrop fixed inset-0 bg-black/40`,oS(e,t))})}),MW=(0,J.forwardRef)(function({className:e,finalFocus:t,...n},r){let i=kW();return(0,X.jsx)(ZU,{...n,className:t=>$(`caps-dialog-popup max-h-screen w-11/12 max-w-(--container-lg) overflow-y-auto overscroll-contain rounded-box bg-base-100 p-lg text-base-content shadow-xl`,oS(e,t)),finalFocus:i.interactionOwner===`host`?!1:t??!0,ref:r})}),NW=(0,J.forwardRef)(function({container:e,keepMounted:t=!0,className:n,...r},i){let{modal:a}=kW();return(0,X.jsxs)(AW,{container:e,keepMounted:t,children:[a===!0?(0,X.jsx)(jW,{}):null,(0,X.jsx)(MW,{...r,className:e=>$(`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,oS(n,e)),ref:i})]})});function PW({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:$(`flex justify-end gap-sm`,e)})}function FW({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:$(`flex flex-col gap-sm`,e)})}var IW=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(yW,{...t,className:t=>$(`text-lg font-semibold`,oS(e,t)),ref:n})}),LW=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(xB,{...t,className:t=>$(`text-sm text-base-content`,oS(e,t)),ref:n})}),RW=(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(bB,{...n,className:t=>$(`btn btn-ghost`,oS(e,t)),ref:r,type:t})}),zW=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),BW=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),VW={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`},HW=(0,J.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,J.createElement)(`svg`,{ref:c,...VW,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:BW(`lucide`,i),...s},[...o.map(([e,t])=>(0,J.createElement)(e,t)),...Array.isArray(a)?a:[a]])),UW=(e,t)=>{let n=(0,J.forwardRef)(({className:n,...r},i)=>(0,J.createElement)(HW,{ref:i,iconNode:t,className:BW(`lucide-${zW(e)}`,n),...r}));return n.displayName=`${e}`,n},WW=UW(`ArrowDownToLine`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),GW=UW(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),KW=UW(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),qW=UW(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),JW=UW(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),YW=UW(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),XW=UW(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ZW=UW(`FileImage`,[[`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`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),QW=UW(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),$W=UW(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),eG=UW(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),tG=UW(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),nG=UW(`SquarePen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),rG=UW(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),iG=UW(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function aG(e,t){return Math.max(0,t===`reverse`?-e.scrollTop:e.scrollHeight-e.clientHeight-e.scrollTop)}function oG(){return{phase:`hidden`,shown:!1,jumped:!1,velocity:0,y:0,vy:0,volume:0,vv:0,opacity:0,unread:0,bead:0}}function sG(e){return 1+Math.min(.15,.06*Math.log2(1+Math.max(0,e)))}function cG(e,t,n,r,i,a){let o=t+(-i*i*(e-n)-2*a*i*t)*r;return[e+o*r,o]}function lG(e,t,n,r){let i={...e},a=Math.max(1,Math.min(64,n)),o=t.jump===!0||e.jumped;i.jumped=o,o?(i.phase=`merging`,i.shown=!1,i.unread=0,i.velocity=0):(t.distance>48?i.shown=!0:t.distance<8&&(i.shown=!1),i.unread=i.shown?Math.max(0,t.unread):0,i.unread>e.unread&&i.shown&&!r.reduced&&(i.bead=1),i.velocity+=(t.delta/a-i.velocity)*(1-Math.exp(-a/50))),!i.shown&&e.phase!==`hidden`&&(i.phase=`merging`),i.shown&&!e.shown&&(i.phase=`welling`);let s=i.shown?sG(i.unread):0;if(e.phase===`hidden`&&i.shown&&(i.phase=`welling`,i.y=r.reduced?0:5),r.reduced){i.y=0,i.vy=0,i.velocity=0,i.vv=0,i.bead=0,i.volume=sG(i.unread);let e=a/Math.max(1,r.fast);i.opacity=i.shown?Math.min(1,i.opacity+e):Math.max(0,i.opacity-e)}else{let e=2*Math.PI/Math.max(.08,r.springDuration/1e3),t=Math.max(.08,1-r.bounce),n=Math.max(-9,Math.min(9,-i.velocity*7)),c=o?12:i.shown?n:4,l=Math.ceil(a/8);for(let n=0;n<l;n++)[i.y,i.vy]=cG(i.y,i.vy,c,a/l/1e3,e,t),[i.volume,i.vv]=cG(i.volume,i.vv,s,a/l/1e3,o?e/1.7:e,o?1:t);i.opacity=Math.min(1,Math.max(0,i.volume*1.4)),i.bead=Math.max(0,i.bead-a/580)}return!i.shown&&(r.reduced?i.opacity===0:i.volume<.002&&Math.abs(i.vv)<.02)?oG():(i.shown&&Math.abs(i.volume-s)<.001&&Math.abs(i.vv)<.01&&Math.abs(i.y)<.02&&Math.abs(i.vy)<.2&&i.bead===0?(i.phase=`resting`,i.volume=s,i.vv=0,i.y=0,i.vy=0,i.velocity=0):i.shown&&i.volume>.95&&(i.phase=`tugged`),i)}var uG=(0,J.memo)(function({direction:e=`forward`,scrollerRef:t,onJump:n,unread:r=0,focusAfterJump:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(oG()),p=(0,J.useRef)(()=>void 0),m=(0,J.useRef)(!1),h=(0,J.useRef)(r),g=LS(a),_=`caps-drop-${(0,J.useId)().replaceAll(`:`,``)}`;return(0,J.useEffect)(()=>{h.current=r,p.current()},[r]),(0,J.useEffect)(()=>{let n=t.current,r=o.current,i=s.current,_=c.current,v=l.current,y=u.current,b=d.current,x=a.current;if(!n||!r||!i||!_||!v||!y||!b||!x)return;let S=0,C=0,w=n.scrollTop,T=!0,E=()=>{let e=f.current;if(r.dataset.motionState=e.phase,r.style.display=e.phase===`hidden`?`none`:``,y.tabIndex=e.phase===`hidden`||e.phase===`merging`?-1:0,y.disabled=e.phase===`merging`,y.setAttribute(`aria-label`,`Jump to bottom${e.unread?`, ${String(e.unread)} new message${e.unread===1?``:`s`}`:``}`),r.style.opacity=g.reduced?String(e.opacity):``,_.style.display=g.reduced||e.phase===`resting`||e.phase===`hidden`?`none`:``,v.style.display=g.reduced||e.bead===0?`none`:``,g.reduced){i.style.transform=``,i.style.transformOrigin=``,i.style.width=e.unread?`${String(y.clientWidth*e.volume)}px`:``,i.style.height=e.unread?`${String(y.clientWidth*e.volume)}px`:``,b.style.transform=``,b.style.opacity=``,_.style.transform=``,v.style.transform=``;return}if(i.style.width=``,i.style.height=``,e.phase===`resting`&&e.unread===0){i.style.transform=``,i.style.transformOrigin=``,b.style.transform=``,b.style.opacity=``,_.style.transform=``,v.style.transform=``;return}let t=Math.min(1,Math.abs(e.y)/9*.7+Math.abs(e.vy)/120*.3),n=1+g.stretch*t,a=Math.max(.001,e.volume),o=Math.max(0,1-a);i.style.transformOrigin=e.y>=0?`50% 0%`:`50% 100%`,i.style.transform=`translateY(${String(e.y)}px) scale(${String(a/Math.sqrt(n)*(1-.12*o))}, ${String(a*n*(1+.1*o))})`,_.style.transform=`scale(${String(Math.min(1,Math.abs(e.y)/3)*a*.55)})`,v.style.transform=`translateY(${String(-34*e.bead*e.bead)}px) scale(${String(.62*Math.min(1,e.bead*3))})`,b.style.transform=`translateY(${String(e.y*.8)}px)`,b.style.opacity=String(e.opacity)},D=t=>{S=0;let r=C?t-C:16;C=t;let i=n.scrollTop;f.current=lG(f.current,{distance:aG(n,e),delta:i-w,unread:h.current,jump:m.current},r,g),w=i,m.current=!1,E();let a=f.current;a.phase!==`hidden`&&(!a.shown||a.phase!==`resting`||a.opacity<1)&&O()};function O(){!T||S||(S=requestAnimationFrame(D))}let k=()=>{S||(C=0),O()};p.current=k;let A=QT(x,e=>{T=e,e?(C=0,w=n.scrollTop,O()):(cancelAnimationFrame(S),S=0)}),j=globalThis,M=j.ResizeObserver?new j.ResizeObserver(k):void 0;return M?.observe(n),n.firstElementChild&&M?.observe(n.firstElementChild),n.addEventListener(`scroll`,k,{passive:!0}),O(),()=>{p.current=()=>void 0,cancelAnimationFrame(S),n.removeEventListener(`scroll`,k),M?.disconnect(),A()}},[e,t,g]),(0,X.jsx)(`div`,{ref:a,className:`absolute bottom-4 right-4 z-1 h-8 w-8 md:h-6 md:w-6`,children:(0,X.jsxs)(`div`,{ref:o,className:`relative h-full w-full`,"data-motion-state":`hidden`,style:{display:`none`},children:[(0,X.jsxs)(`div`,{className:`absolute -inset-1.5`,style:{filter:`url(#${_})`,willChange:`filter`},children:[(0,X.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute h-0 w-0`,children:(0,X.jsx)(`defs`,{children:(0,X.jsxs)(`filter`,{id:_,x:`-60%`,y:`-60%`,width:`220%`,height:`220%`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,result:`blur`,stdDeviation:`4`}),(0,X.jsx)(`feColorMatrix`,{in:`blur`,type:`matrix`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -9`})]})})}),(0,X.jsx)(`div`,{className:`absolute inset-0 m-auto h-8 w-8 md:h-6 md:w-6`,ref:s,"data-drop-body":``,children:(0,X.jsx)(`div`,{className:`absolute inset-0 rounded-full border border-base-300 bg-base-200 shadow-sm`})}),(0,X.jsx)(`div`,{ref:c,className:`absolute inset-0 m-auto h-8 w-8 rounded-full bg-base-200 md:h-6 md:w-6`,style:{display:`none`}}),(0,X.jsx)(`div`,{ref:l,className:`absolute inset-0 m-auto h-8 w-8 rounded-full bg-base-200 md:h-6 md:w-6`,style:{display:`none`},"data-drop-incoming":``})]}),(0,X.jsx)(`button`,{ref:u,"aria-label":`Jump to bottom`,className:`absolute inset-0 z-1 grid place-items-center rounded-full caps-focus-color`,"data-testid":`jump-to-bottom`,onClick:()=>{if(f.current.phase!==`hidden`&&f.current.phase!==`merging`){if(m.current=!0,h.current=0,p.current(),document.activeElement===u.current){let e=i?.current??t.current;e&&(e===t.current&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=-1),e.focus({preventScroll:!0}))}n()}},title:`Jump to bottom`,type:`button`,tabIndex:-1,children:(0,X.jsx)(WW,{ref:d,className:`text-base-content`,size:13})})]})})});function dG(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function fG(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function pG(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var mG=(e,t)=>Math.abs(e-t)<1.01,hG=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},gG,_G=()=>{if(gG!==void 0)return gG;if(typeof navigator>`u`)return gG=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return gG=!0;let e=navigator.maxTouchPoints;return gG=navigator.platform===`MacIntel`&&e!==void 0&&e>0},vG=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},yG=e=>e,bG=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},xG=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(vG(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(vG(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},SG={passive:!0},CG=typeof window>`u`||`onscrollend`in window,wG=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&CG,o=0,s=a?null:hG(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,SG),a&&r.addEventListener(`scrollend`,u,SG),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},TG=(e,t)=>wG(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),EG=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},DG=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},OG=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:yG,rangeExtractor:bG,onChange:()=>{},measureElement:EG,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=Math.max(0,e.start+t);n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=fG(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!_G()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,SG),e.addEventListener(`touchend`,n,SG),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(_G()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=fG(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=fG(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=dG(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=fG(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=jG(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=fG(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(!this.isIndexInRange(e))return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=this.itemSizeCache.get(i)??n,s=t-o;if(s!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=a?this.getTotalSize():0,l=this.getScrollOffset()+this.scrollAdjustments,u=this.itemSizeCache.has(i)?r+o<=l&&this.scrollDirection!==`backward`:r<l,d=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?u:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},s,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++;let f=!1;a?f=this.applyScrollAdjustment(this.getTotalSize()-c):d&&(f=this.applyScrollAdjustment(s)),this.notify(f)}},this.getVirtualItems=fG(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return pG(t[kG(0,t.length-1,r?e=>n[e*2]:e=>pG(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){return e===0?!1:_G()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&mG(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},kG=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function AG(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function jG(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=AG(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=kG(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var MG=typeof document<`u`?J.useLayoutEffect:J.useEffect;function NG({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=J.useReducer(e=>e+1,0)[1],a=J.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},s=e=>{let t=a.current;if(!t.enabled||!t.container)return;o(e);let n=!!e.options.horizontal,r=t.mode===`transform`,i=n?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let a of c){let o=a.start-s,c=e.elementsCache.get(a.key);c&&t.lastPositions.get(c)!==o&&(t.lastPositions.set(c,o),r?c.style.transform=n?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:c.style[i]=`${o}px`)}},c={...r,onChange:(t,n)=>{var o;let c=a.current,l=!0;if(c.enabled){s(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,uL.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[l]=J.useState(()=>{let e=new OG(c);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return l.setOptions(c),MG(()=>l._didMount(),[]),MG(()=>(o(l),l._willUpdate())),MG(()=>{s(l)}),l}function PG(e){return NG({observeElementRect:xG,observeElementOffset:TG,scrollToFn:DG,...e})}function FG(e){return e<1e3?`${String(e)} tok`:`${(e/1e3).toFixed(1)}K`}var IG=(0,J.forwardRef)(function({action:e,className:t,input:n,leading:r,rowClassName:i,...a},o){return(0,X.jsx)(`div`,{...a,ref:o,className:[`caps-composer flex min-w-0 flex-1 items-end gap-sm`,t].filter(Boolean).join(` `),children:(0,X.jsxs)(`div`,{className:[`join w-full p-2xs`,i].filter(Boolean).join(` `),children:[r,n,e]})})}),LG=Z_({keyCode:iv(229)});function RG(e){return e.nativeEvent.isComposing||h(LG,e.nativeEvent).success}var zG={admission:`Your prompt didn’t make it through. Let’s give it another go.`,failed:`The run stopped. Check the message above before trying again.`,interrupted:`The worker stopped before this run finished. Your prompt is still here.`,cancelled:`The run was cancelled. Send a new prompt when you’re ready.`};function BG({failure:e,cause:t,onRetry:n}){return(0,X.jsx)(cS,{tone:`warning`,title:e===`cancelled`?`Taking a breather`:`A little tangle`,description:(0,X.jsxs)(X.Fragment,{children:[zG[e],` If the model didn’t start, there’s no charge. Model work already done can still use credits.`,t?(0,X.jsx)(`span`,{className:`block`,children:t}):null]}),action:e===`cancelled`?void 0:(0,X.jsx)(lE,{"aria-label":`Retry prompt`,variant:`outline`,onClick:n,children:`Retry`})})}var VG=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),HG=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:5});function UG(e){if(!Number.isFinite(e))throw RangeError(`Money amount must be finite`);return e!==0&&Math.abs(e)<1e-5?e<0?`>-$0.01`:`<$0.01`:e!==0&&Math.abs(e)<.01?HG.format(e):VG.format(e)}var WG=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:$(`caps-popover-anchor`,e)})}),GG=(0,J.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,X.jsx)(`div`,{...r,ref:i,className:$(`caps-popover`,e),"data-side":n}):null}),KG=(0,J.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,X.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:$(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})}),qG={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function JG({className:e,glyph:t,motion:n}){let r=`caps-status-${(0,J.useId)().replaceAll(`:`,``)}`,i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(qG[t]).current,d=(0,J.useRef)(t===`dot`?1:4).current,f=(0,J.useRef)(+(t===`bang`)).current,p=(0,J.useRef)(t),m=LS(s),{reduced:h}=m;return(0,J.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=qG[t],n=h||p.current===t;p.current=t;let r=IS(i.current),o=n?{duration:0}:UA(r,{bounce:.3,duration:360}),s=HT(i.current,{y:e.y,height:e.height,...o}),u=HT(a.current,{cy:e.cy,...n?{duration:0}:{delay:RS(r,35),...UA(r,{bounce:.3,duration:420})}}),d=HT(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=HT(l.current,{opacity:+(t===`bang`),...n?HA:WA(r,{ease:`inOutSine`,duration:220})});return()=>{s.cancel(),u.cancel(),d.cancel(),f.cancel()}},[t,h]),(0,J.useLayoutEffect)(()=>{if(!o.current||!s.current||h||n===`none`)return;let e=n===`pulse`?HT(o.current,{opacity:[1,.45],...WA(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):HT(o.current,{keyframes:{"0%":{translateY:0,scaleX:1,scaleY:1},"18%":{translateY:.25,scaleX:1.1,scaleY:.91},"42%":{translateY:-1.3,scaleX:.94,scaleY:1.06},"62%":{translateY:-1.65,scaleX:1,scaleY:1},"82%":{translateY:.15,scaleX:1.06,scaleY:.95},"100%":{translateY:0,scaleX:1,scaleY:1}},...WA(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=QT(s.current,t=>{t?e.resume():e.pause()});return()=>{t(),e.revert()}},[n,h,m]),(0,X.jsxs)(`svg`,{ref:s,"aria-hidden":`true`,className:`caps-status-bead ${e??``}`,width:`8`,height:`8`,viewBox:`-4 -4 8 8`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(ZT,{id:r,values:XT}),(0,X.jsx)(qT,{ref:c,id:`${r}-surface`,transform:`matrix(1 0 0 ${String(d)} 0 0)`}),(0,X.jsxs)(`radialGradient`,{id:`${r}-drop-light`,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`10.4`,r:`5.6`,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`var(--color-white)`,style:{stopOpacity:`calc(var(--depth) * 0.5)`}}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`var(--color-white)`,stopOpacity:`0`})]}),(0,X.jsx)(JT,{id:`${r}-shadow`}),(0,X.jsx)(`mask`,{id:`${r}-silhouette`,maskUnits:`userSpaceOnUse`,x:`-12`,y:`-24`,width:`24`,height:`48`,style:{maskType:`alpha`},children:(0,X.jsxs)(`g`,{fill:`var(--color-white)`,filter:`url(#${r})`,children:[(0,X.jsx)(`rect`,{ref:i,x:`-4`,y:u.y,width:`8`,height:u.height,rx:`4`}),(0,X.jsx)(`circle`,{ref:a,cx:`0`,cy:u.cy,r:`4`})]})})]}),(0,X.jsx)(`g`,{ref:o,filter:`url(#${r}-shadow)`,children:(0,X.jsxs)(`g`,{mask:`url(#${r}-silhouette)`,children:[(0,X.jsx)(`rect`,{x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-surface)`}),(0,X.jsx)(`rect`,{ref:l,x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-drop-light)`,opacity:f})]})})]})}var YG=.28;function XG(e,t){switch(e){case`ring`:return{dashes:1,track:0,arc:0,sweep:0,disc:0,tick:0,cross:0};case`arc`:return{dashes:0,track:1,arc:1,sweep:t===void 0?YG:Math.min(1,Math.max(0,t)),disc:0,tick:0,cross:0};case`check`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:1,cross:0};case`cross`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:0,cross:1}}}var ZG=7.25;function QG({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,J.useId)().replaceAll(`:`,``)}`,i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(XG(t,n)).current,p=(0,J.useRef)(t),m=qS();(0,J.useLayoutEffect)(()=>{let e=i.current,r=a.current,c=o.current,f=s.current,h=l.current,g=u.current,_=d.current;if(!e||!r||!c||!f||!h||!g||!_)return;let v=XG(t,n),y=p.current;p.current=t;let b=IS(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:HA:WA(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=WA(b,{ease:`inOutSine`,duration:220}),T=[HT(r,{opacity:v.dashes,...S}),HT(c,{opacity:v.track*.28,...S}),HT(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?HA:S:w}),HT(h,{r:v.disc*ZG,...C?{delay:w.duration*.7,...UA(b,{bounce:.35,duration:360})}:m?HA:WA(b,{ease:`inCubic`,duration:140})}),HT(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...WA(b,{ease:`outCubic`,duration:240})}:HA}),HT(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...WA(b,{ease:`outCubic`,duration:240})}:HA})];return t===`cross`&&C&&b.shake>0&&T.push(HT(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...WA(b,{ease:`linear`,duration:300})})),()=>{for(let e of T)e.cancel()}},[t,n,m]);let h=t===`arc`&&n===void 0&&!m;return(0,J.useLayoutEffect)(()=>{if(!h||!c.current||!i.current)return;let e=IS(i.current),t=HT(c.current,{rotate:[0,360],...WA(e,{ease:`linear`,duration:900}),loop:!0}),n=QT(i.current,e=>{e?t.resume():t.pause()});return()=>{n(),t.revert()}},[h]),(0,X.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,className:`caps-status-mark ${e??``}`,viewBox:`0 0 16 16`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(qT,{id:`${r}-surface`,transform:`matrix(1.6 0 0 1.6 8 8)`}),(0,X.jsxs)(`mask`,{id:`${r}-knock`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`16`,height:`16`,children:[(0,X.jsx)(`rect`,{width:`16`,height:`16`,fill:`var(--color-white)`}),(0,X.jsx)(`path`,{ref:u,d:`M4.9 8.3 7.1 10.5 11.2 5.9`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-f.tick}),(0,X.jsx)(`path`,{ref:d,d:`M5.4 5.4 10.6 10.6 M10.6 5.4 5.4 10.6`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-f.cross})]})]}),(0,X.jsx)(`circle`,{ref:a,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`1.7 2.2`,opacity:f.dashes}),(0,X.jsx)(`circle`,{ref:o,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,opacity:f.track*.28}),(0,X.jsx)(`g`,{ref:c,className:`caps-status-mark-spin`,children:(0,X.jsx)(`circle`,{ref:s,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`${String(f.sweep)} 1`,transform:`rotate(-90 8 8)`,opacity:f.arc})}),(0,X.jsx)(`circle`,{ref:l,cx:`8`,cy:`8`,r:f.disc*ZG,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var $G=new Set([`ring`,`arc`,`check`,`cross`]);function eK(e){return $G.has(e)}var tK={neutral:`text-base-content`,primary:`text-primary`,secondary:`text-secondary`,accent:`text-accent`,success:`text-success`,info:`text-info`,warning:`text-warning`,error:`text-error`},nK=(0,J.forwardRef)(function({className:e,label:t,glyph:n=`dot`,motion:r=`none`,tone:i=`neutral`,size:a=`default`,appearance:o=`plain`,progress:s,...c},l){return(0,X.jsxs)(`span`,{...c,className:$(`caps-status`,a===`compact`&&`caps-status-compact`,o===`chip`&&`caps-status-chip`,e),"data-tone":o===`chip`?i:void 0,"data-glyph":n,"data-motion":r,ref:l,children:[eK(n)?(0,X.jsx)(QG,{className:tK[i],glyph:n,progress:s}):(0,X.jsx)(JG,{className:tK[i],glyph:n,motion:r}),t===void 0?null:(0,X.jsx)(`span`,{children:t})]})}),rK=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:$(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function iK(e,t){if(t.length===0)return e;let n=new Set(t),r=[];for(let t=0;t<e.length;t+=1){let i=n.has(t),a=r.at(-1);a?.marked===i?a.text+=e.charAt(t):r.push({text:e.charAt(t),marked:i,start:t})}return r.map(e=>e.marked?(0,X.jsx)(`mark`,{className:`parakeet-slash-match`,children:e.text},e.start):(0,X.jsx)(`span`,{children:e.text},e.start))}function aK(e,t){return`${e}-${String(t)}`}function oK({slash:e,listId:t}){let{completion:n,selected:r}=e;if(n.kind===`none`)return null;let i=n.kind===`commands`?n.items.map(e=>({key:e.command.commandId+e.label,label:iK(e.label,e.matches),detail:e.command.grammar===void 0?e.command.title:`${e.command.title} · ${e.command.grammar.hint}`,keys:e.command.keys.join(`, `),disabled:e.command.availability.status===`unavailable`})):n.items.map(e=>({key:e.label,label:iK(e.label,e.matches),detail:e.word.description??``,keys:``,disabled:!1}));return(0,X.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":n.kind,children:[n.kind===`arguments`?(0,X.jsx)(`p`,{className:`parakeet-slash-hint`,children:n.hint}):null,i.length===0?null:(0,X.jsx)(`div`,{id:t,role:`listbox`,"aria-label":`Commands`,children:i.map((n,i)=>(0,X.jsxs)(KG,{id:aK(t,i),active:i===r,"aria-disabled":n.disabled||void 0,"data-disabled":n.disabled,onMouseEnter:()=>{e.highlight(i)},onClick:()=>{e.choose(i)},children:[(0,X.jsx)(`span`,{className:`parakeet-slash-label`,children:n.label}),(0,X.jsx)(`span`,{className:`parakeet-slash-detail`,children:n.detail}),n.keys.length===0?null:(0,X.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:n.keys})]},n.key))})]})}var sK={connecting:{busy:!1,tone:`neutral`},cancelling:{busy:!0,tone:`warning`},error:{busy:!1,tone:`error`},idle:{busy:!1,tone:`neutral`},queued:{busy:!0,tone:`warning`},retrying:{busy:!0,tone:`warning`},sending:{busy:!0,tone:`success`},streaming:{busy:!0,tone:`success`},thinking:{busy:!0,tone:`warning`},disconnected:{busy:!1,tone:`neutral`}};function cK({placeholder:e,onChange:t,onSend:n,onAbort:r,slash:i,slashListId:a,textareaId:o,textareaRef:s,value:c}){let l=(0,J.useRef)(c),[u,d]=(0,J.useState)([]),[f,p]=(0,J.useState)(-1);l.current=c,(0,J.useLayoutEffect)(()=>{let e=s.current;e&&(e.style.height=`auto`,e.style.height=`${String(Math.min(e.scrollHeight,320))}px`)},[s,c]);let m=(0,J.useCallback)(()=>{let e=l.current.trim();e&&(n(),d(t=>t.at(-1)===e?t:[...t,e]),p(-1))},[n]),h=(0,J.useCallback)(e=>{if(!RG(e)){if(i?.open===!0&&(e.key===`ArrowDown`?i.move(1):e.key===`ArrowUp`?i.move(-1):e.key===`Tab`?i.complete():e.key===`Escape`&&i.dismiss())){e.preventDefault();return}if(e.key===`Escape`){e.preventDefault(),r();return}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),m();return}if(e.key===`ArrowUp`&&s.current?.selectionStart===0&&u.length>0&&(f===-1||f>0)){e.preventDefault();let n=f===-1?u.length-1:f-1;p(n);let r=u[n];r!==void 0&&t(r);return}if(e.key===`ArrowDown`&&f!==-1){e.preventDefault();let n=f+1;if(n>=u.length)p(-1),t(``);else{p(n);let e=u[n];e!==void 0&&t(e)}}}},[u,f,r,t,m,i,s]),g=i?.open===!0&&i.completion.kind!==`none`&&i.completion.items.length>0;return(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,X.jsx)(`label`,{className:`sr-only`,htmlFor:o,children:`Message`}),(0,X.jsx)(rK,{"aria-autocomplete":`list`,"aria-controls":g?a:void 0,"aria-expanded":g,"aria-activedescendant":g&&i!==void 0?aK(a,i.selected):void 0,className:`join-item min-h-[48px] max-h-[320px] w-full resize-none overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words px-3 py-[calc((3rem-1.25rem)/2)] font-sans text-xs text-base-content !border-0 !bg-transparent !shadow-none focus:!outline-none`,id:o,onChange:e=>{t(e.target.value),p(-1)},onKeyDown:h,placeholder:e??(i===void 0?`Ask agent...`:`Ask agent… (/ for commands)`),role:i===void 0?void 0:`combobox`,ref:s,rows:1,value:c})]})}function lK(e,t){if(t.kind===`connecting`)return`connecting`;if(t.kind===`disconnected`)return`unavailable`;if(e===`sending`)return`sending prompt`;if(e===`queued`&&(t.kind===`idle`||t.kind===`waiting_for_you`||t.kind===`error`))return`prompt accepted`;switch(t.kind){case`waiting_for_you`:return`waiting for you`;case`responding`:return`writing`;case`running_tool`:return`running ${t.tool}`;case`retrying`:return`retrying ${String(t.attempt)}/${String(t.maxAttempts)}`;case`error`:return`failed`;case`queued`:return`queued`;case`cancelling`:return`cancelling`;case`compacting`:return`compacting`;case`thinking`:return`thinking`;case`idle`:return`idle`}}function uK({statusChips:e,model:t,status:n,viewState:r,usage:i,context:a}){let o=r.kind===`error`?`error`:sK[n].tone,s=lK(n,r);return(0,X.jsxs)(`div`,{className:`composer-footer`,children:[(0,X.jsx)(nK,{label:s,title:s,tone:o}),e?.map((e,t)=>(0,X.jsx)(`span`,{className:`min-w-0 truncate`,title:e,children:e},t)),t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono font-semibold`,children:ZA(t)})]}):null,a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono`,title:`Context used / model context`,children:$A(a)})]}):null,i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono`,children:FG(i.tokens)}),(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono`,children:UG(i.cost)})]}):null]})}var dK=(0,J.memo)(function({placeholder:e,showFooter:t=!0,statusChips:n,actionVariant:r=`primary`,draft:i,failure:a,failureCause:o,admissionError:s,model:c,onAbort:l,onChange:u,onRetry:d,onSend:f,status:p,viewState:m,textareaRef:h,usage:g,context:_,slash:v}){let y=(0,J.useId)(),b=`${y}-commands`,{busy:x}=sK[p],S={action:x?(0,X.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,X.jsx)(lE,{"aria-label":`Stop current turn`,className:`join-item h-auto min-h-0 self-stretch`,"data-testid":`composer-stop`,disabled:p===`queued`||p===`cancelling`,onClick:l,title:`Stop the current turn. Queued messages keep running in order.`,size:`lg`,variant:`ghost`,children:`Stop`}),(0,X.jsx)(lE,{"aria-label":`Queue follow-up`,className:`join-item h-auto min-h-0 self-stretch`,disabled:i.trim().length===0,onClick:()=>{f(`followUp`)},size:`lg`,variant:r,children:`Queue`})]}):(0,X.jsx)(lE,{"aria-label":`Send message`,className:`join-item h-auto min-h-0 self-stretch`,disabled:i.trim().length===0,onClick:()=>{f(`steer`)},title:`Send`,size:`lg`,variant:r,children:`Send`}),input:(0,X.jsx)(cK,{placeholder:e,onChange:u,onAbort:l,onSend:()=>{f(x?`followUp`:`steer`)},slash:v,slashListId:b,textareaId:y,textareaRef:h,value:i})},C={status:p,viewState:m,statusChips:n};return c&&(C.model=c),g&&(C.usage=g),_&&(C.context=_),(0,X.jsxs)(`div`,{className:`chat-composer not-prose flex-shrink-0 border-t border-base-300`,children:[(0,X.jsxs)(`div`,{className:`relative`,children:[s===`queue_full`?(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-error`,role:`alert`,children:`Too many prompts are still awaiting admission. Try again shortly.`}):null,a===void 0?null:(0,X.jsx)(BG,{failure:a,cause:o,onRetry:d}),v?.interactions.notice===void 0?null:(0,X.jsx)(`div`,{className:`parakeet-command-notice px-3 py-1.5 text-xs`,"data-tone":v.interactions.notice.tone,role:v.interactions.notice.tone===`error`?`alert`:`status`,children:v.interactions.notice.message}),(0,X.jsxs)(WG,{className:`composer-body`,children:[v===void 0?null:(0,X.jsx)(GG,{open:v.open,side:`top`,"data-parakeet-slash":``,children:(0,X.jsx)(oK,{slash:v,listId:b})}),(0,X.jsx)(IG,{...S})]})]}),t?(0,X.jsx)(uK,{...C}):null,v===void 0?null:(0,X.jsx)(`p`,{className:`parakeet-key-hints`,"aria-live":`polite`,children:YR(v.hints)})]})}),fK={attention:`text-warning`,running:`text-info`,error:`text-error`,settled:`text-success`,muted:`text-dim`};function pK({entryId:e,rows:t,actions:n,onOpen:r}){let i=lL(),{inspection:a}=(0,J.useSyncExternalStore)(i.subscribe,i.snapshot,i.snapshot);return t.length===0?null:(0,X.jsx)(`div`,{className:`px-3 text-xs text-base-content`,"data-client-entry":e,children:t.map(t=>(0,X.jsxs)(`div`,{"data-client-row":t.id,className:`py-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsxs)(`details`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`summary`,{className:`cursor-pointer break-words leading-4 ${t.tone===void 0?``:fK[t.tone]}`,children:[t.title,t.inspection===void 0||t.detail===void 0?null:` · ${t.detail}`]}),t.detail===void 0?null:(0,X.jsx)(`p`,{className:`max-h-32 overflow-y-auto overscroll-contain whitespace-pre-wrap break-words pb-2`,children:t.detail})]}),t.open===void 0?null:(0,X.jsx)(lE,{size:`xs`,variant:`outline`,disabled:r===void 0,onClick:()=>{t.open!==void 0&&r?.(t.open)},children:`Open`}),t.actions?.map(t=>{let r=n.state.get(t);return(0,X.jsx)(lE,{size:`xs`,variant:`outline`,className:`shrink-0`,disabled:!n.enabled||r?.pending===!0,loading:r?.pending===!0,onClick:()=>{n.execute(e,t)},children:t.label},t.id)})]}),t.inspection!==void 0&&a?.entryId===e&&a.rowId===t.id?(0,X.jsxs)(`section`,{"aria-label":t.title,"data-client-inspection":t.id,children:[(0,X.jsx)(dS,{aside:(0,X.jsx)(lE,{size:`xs`,variant:`ghost`,onClick:()=>{i.inspect(void 0)},children:`Close`}),children:t.title}),(0,X.jsx)(lS,{density:`compact`,tabIndex:0,className:`max-h-64 overflow-y-auto overscroll-contain`,children:t.inspection.rows.map(e=>(0,X.jsxs)(uS,{children:[(0,X.jsx)(nK,{glyph:`dot`,size:`compact`,tone:e.tone===`settled`?`success`:e.tone===`running`?`info`:e.tone===`error`?`error`:e.tone===`attention`?`warning`:`neutral`,label:e.title}),e.detail===void 0?null:(0,X.jsx)(`span`,{children:e.detail})]},e.id))})]}):null,t.actions?.map(e=>{let t=n.state.get(e)?.error;return t===void 0?null:(0,X.jsx)(`p`,{className:`text-error`,role:`alert`,children:t},e.id)})]},t.id))})}var mK=(0,J.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,X.jsxs)(`label`,{...i,className:$(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,X.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),hK=(0,J.forwardRef)(function({children:e,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:$(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:J.Children.map(e,e=>(0,J.isValidElement)(e)?(0,J.cloneElement)(e,{className:$(`join-item caps-input-group-control`,e.props.className)}):e)})}),gK=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:$(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function _K(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,J.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,J.useRef)(null);(0,J.useImperativeHandle)(a,()=>o.current);let s=qS(),[c,l]=(0,J.useState)(e),u=(0,J.useRef)(!0);return e&&!c&&l(!0),(0,J.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!HS(n)){e||l(!1);return}let i=IS(n),a=`translateY(${String(i.distance)}px)`,c=VS(i,i.ease),d=n.getBoundingClientRect().height,f=_K(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:VS(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,X.jsx)(`div`,{...i,ref:o,className:$(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var vK=(0,J.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,X.jsx)(`div`,{...r,ref:i,className:$(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,X.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,J.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,J.useRef)(null);(0,J.useImperativeHandle)(a,()=>o.current);let s=qS(),[c,l]=(0,J.useState)({key:e,content:n}),[u,d]=(0,J.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,J.useRef)(null);return(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!HS(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=IS(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:VS(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:VS(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:VS(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,X.jsx)(`div`,{...i,ref:o,className:$(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,X.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,X.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function yK({children:e,...t}){let[n,r]=(0,J.useState)(e);return e&&e!==n&&r(e),(0,X.jsx)(vK,{...t,className:$(`caps-field-error-reveal`,t.className),open:!!e,children:(0,X.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function bK({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,X.jsxs)(`footer`,{...a,className:$(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,X.jsx)(yK,{children:n}),(0,X.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,X.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,X.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var xK=(0,J.forwardRef)(function({busy:e=!1,children:t,className:n,...r},i){return(0,X.jsx)(`form`,{...r,"aria-busy":e||void 0,className:$(`caps-form`,n),ref:i,children:(0,X.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),SK={2:`h2`,3:`h3`,4:`h4`},CK=(0,J.forwardRef)(function({children:e,className:t,description:n,level:r=3,title:i,...a},o){let s=(0,J.useId)(),c=SK[r];return(0,X.jsxs)(`section`,{...a,"aria-labelledby":`${s}-title`,className:$(`caps-form-section`,t),ref:o,children:[(0,X.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,X.jsx)(c,{className:`caps-form-section-title`,id:`${s}-title`,children:i}),n?(0,X.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,X.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),wK=(0,J.forwardRef)(function({children:e,className:t,description:n,error:r,legend:i,...a},o){let s=(0,J.useId)(),c=[n?`${s}-description`:a[`aria-describedby`],r?`${s}-error`:null].filter(Boolean).join(` `)||void 0;return(0,X.jsxs)(`fieldset`,{...a,"aria-describedby":c,"aria-invalid":r?!0:a[`aria-invalid`],className:$(`caps-fieldset`,t),ref:o,children:[(0,X.jsx)(`legend`,{className:`caps-fieldset-legend`,children:i}),n?(0,X.jsx)(`p`,{className:`caps-fieldset-description`,id:`${s}-description`,children:n}):null,(0,X.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,X.jsx)(yK,{id:`${s}-error`,children:r})]})});function TK(e){let t=[];return J.Children.forEach(e.props.children,e=>{(0,J.isValidElement)(e)&&e.type!==gK&&t.push(e)}),t[0]??null}var EK=(0,J.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,optional:o,orientation:s=`vertical`,readout:c=!1,required:l,...u},d){let f=(0,J.useId)(),p=(0,J.isValidElement)(e)?e:null,m=p?.type===hK,h=m?TK(p):p,g=h?.props.id??f,_=`${g}-description`,v=`${g}-error`,y=[h?.props[`aria-describedby`],n?_:null,r?v:null].filter(Boolean).join(` `)||void 0,b=l===!0||h?.props.required,x=r?!0:h?.props[`aria-invalid`],S=l===!0||h?.props[`aria-required`],C={id:g};b!==void 0&&(C.required=b),y!==void 0&&(C[`aria-describedby`]=y),x!==void 0&&(C[`aria-invalid`]=x),S!==void 0&&(C[`aria-required`]=S);let w=p&&h&&!c?m?(0,J.cloneElement)(p,void 0,J.Children.map(p.props.children,e=>e===h?(0,J.cloneElement)(h,C):e)):(0,J.cloneElement)(p,C):e,T=a?(0,X.jsx)(mK,{htmlFor:c?void 0:g,className:s===`inline`?`font-normal`:void 0,...l===void 0?{}:{required:l},...o===void 0?{}:{optional:o},children:a}):null,E=a||n?(0,X.jsxs)(`div`,{className:`caps-field-copy`,children:[T,n?(0,X.jsx)(`p`,{className:`caps-field-description`,id:_,children:n}):null]}):null,D=i?(0,X.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,X.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),E]}):E;return(0,X.jsxs)(`div`,{...u,className:$(`caps-field`,t),"data-orientation":s,ref:d,children:[s===`horizontal`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[D,w]}):s===`inline`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[w,D]}):(0,X.jsxs)(X.Fragment,{children:[D,w]}),(0,X.jsx)(yK,{id:v,children:r})]})});function DK(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var OK=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,kK=6,AK=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),jK=(0,J.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,J.useState)(n),[y,b]=(0,J.useState)(null),x=p===void 0?_:p,S=DK(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,J.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/kK),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,X.jsxs)(`span`,{className:$(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,X.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,X.jsx)(`path`,{className:`caps-number-field-dial-track`,d:OK,pathLength:100}),(0,X.jsx)(`path`,{className:`caps-number-field-dial-level`,d:OK,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,X.jsx)(lE,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,X.jsx)(QW,{"aria-hidden":`true`})}),(0,X.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,X.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=AK.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,X.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,X.jsx)(lE,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,X.jsx)(eG,{"aria-hidden":`true`})})]})}),MK=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:$(`input caps-input w-full`,e),ref:r})});(0,J.forwardRef)(function({leading:e,className:t,...n},r){return(0,X.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,X.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,X.jsx)(MK,{...n,type:`search`,className:t,ref:r})]})});var NK=`data-glide-stand-in`;function PK(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left+e.scrollLeft-e.clientLeft,y:r.top-n.top+e.scrollTop-e.clientTop,width:r.width,height:r.height}}function FK(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function IK(e){let t=(0,J.useRef)(null);return(0,J.useCallback)(n=>{t.current?.(),t.current=n?LK(n,e):null},[e])}function LK(e,t){if(!HS(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?PK(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(NK);s.clear(),a&&(a.hidden=!0),o=null},l=()=>{if(a)return a;let t=n.createElement(`span`);return t.className=`caps-glide`,t.setAttribute(`aria-hidden`,`true`),e.prepend(t),e.classList.add(`caps-glide-host`),getComputedStyle(e).position===`static`&&e.classList.add(`caps-glide-anchor`),a=t,t},u=(t,n)=>{let r=IS(e),u=PK(e,t),d=o&&a?PK(e,a):i;if(i=u,o?.cancel(),c(),r.reduced||d===null||Math.abs(d.y-u.y)<1&&Math.abs(d.x-u.x)<1)return;t.setAttribute(NK,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(NK,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([FK(d),FK(u)],{duration:r.normal,easing:VS(r,r.ease),fill:`forwards`});o=g,g.addEventListener(`finish`,()=>{o===g&&c()})},d=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&u(n,i)},f=new MutationObserver(d);return f.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,d),e.addEventListener(`pointerout`,d),()=>{f.disconnect(),e.removeEventListener(`pointerover`,d),e.removeEventListener(`pointerout`,d),o?.cancel(),c(),a?.remove()}}function RK({getKey:e,isDisabled:t=()=>!1,items:n}){let r=(0,J.useMemo)(()=>{let r=n.map(e);if(r.some(e=>!e))throw Error(`Selectable items require non-empty keys`);if(new Set(r).size!==r.length)throw Error(`Selectable items require unique keys`);return n.filter(e=>!t(e))},[e,t,n]),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{i!==null&&!r.some(t=>e(t)===i)&&a(null)},[i,r,e]);let o=r.find(t=>e(t)===i),s=o?r.findIndex(t=>e(t)===i):-1;return{activeIndex:s,activeItem:o,activeKey:i,enabledItems:r,move:(t,n)=>{if(r.length===0)return;let i=n?n===`start`?0:r.length-1:s<0?t>0?0:r.length-1:(s+t+r.length)%r.length,o=r[i];o&&a(e(o))},setActiveKey:a}}function zK(e){let{className:t,defaultValue:n,emptyMessage:r=`No options`,getKey:i,getLabel:a,id:o,isDisabled:s=()=>!1,items:c,multiple:l,onClick:u,onKeyDown:d,renderItem:f,rootRef:p,value:m,...h}=e,g=(0,J.useId)(),_=o??g,v=(0,J.useRef)(null);(0,J.useImperativeHandle)(p,()=>v.current);let y=IK(`[role="option"][data-active]`),b=(0,J.useCallback)(e=>{v.current=e,y(e)},[y]),x=l===!0,S=x?[]:null,[C,w]=(0,J.useState)(()=>n??S),T=BK(VK(m,C),x),E=RK({getKey:i,isDisabled:s,items:c}),{enabledItems:D}=E,O=c.find(e=>T.includes(i(e))),{activeKey:k,activeItem:A,setActiveKey:j}=E,M=A,N=m===void 0?void 0:JSON.stringify(x?[...new Set(T)].sort():T),P=(0,J.useRef)(N),F=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(F.current||k!==null)return;let e=O??D[0];e&&(F.current=!0,j(i(e)))},[k,D,O,i,j]),(0,J.useEffect)(()=>{if(N!==void 0&&N!==P.current){let e=c.find(e=>T.includes(i(e))&&!s(e));j(e?i(e):null)}P.current=N},[N,i,s,c,T]);let ee=t=>{if(!t||s(t))return;let n=i(t),r;if(r=x?T.includes(n)?T.filter(e=>e!==n):[...T,n]:[n],e.multiple)m===void 0&&w(r),e.onValueChange?.(r,c.filter(e=>r.includes(i(e))));else{let n=r[0]??null;m===void 0&&w(n),e.onValueChange?.(n,t)}},I=e=>{if(d?.(e),!e.defaultPrevented&&e.key!==`Escape`){if(e.key===`Enter`||e.key===` `){e.preventDefault(),ee(M);return}if(D.length!==0){if(e.key===`ArrowDown`)E.move(1);else if(e.key===`ArrowUp`)E.move(-1);else if(e.key===`Home`)E.move(-1,`start`);else if(e.key===`End`)E.move(1,`end`);else return;e.preventDefault()}}};return(0,X.jsx)(`div`,{...h,"aria-activedescendant":M?`${_}-option-${encodeURIComponent(i(M))}`:void 0,"aria-multiselectable":x?!0:void 0,className:$(`max-h-72 w-full overflow-auto rounded-box border border-base-300 bg-base-100 p-xs shadow-lg focus-visible:outline-none focus-visible:ring-2 caps-focus-color`,t),id:_,onClick:u,onKeyDown:I,ref:b,role:`listbox`,tabIndex:h.tabIndex??0,children:c.length===0?(0,X.jsx)(`div`,{className:`px-md py-sm text-sm text-base-content`,children:r}):c.map(e=>{let t=i(e),n=s(e),r=T.includes(t),o=M?i(M)===t:!1,c={active:o,disabled:n,selected:r};return(0,X.jsx)(`div`,{"aria-disabled":n||void 0,"aria-selected":r,"data-active":o&&!n||void 0,className:$(`cursor-pointer rounded-field px-md py-sm text-sm outline-none`,o&&`bg-base-200`,r&&`font-medium`,n&&`cursor-not-allowed bg-base-200 text-base-content outline outline-1 outline-dashed outline-base-300`),id:`${_}-option-${encodeURIComponent(t)}`,onClick:r=>{if(n){r.preventDefault();return}j(t),ee(e)},role:`option`,children:f?.(e,o,c)??a(e)},t)})})}function BK(e,t){return t?Array.isArray(e)?e.slice():[]:e==null||Array.isArray(e)?[]:[e]}function VK(e,t){switch(e){case void 0:return t;default:return e}}function HK({host:e,pending:t}){let[n,r]=(0,J.useState)(``),i=t.request;return i.type===`choice`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:i.message}),(0,X.jsx)(zK,{"aria-label":i.message,items:i.options,getKey:e=>e.value,getLabel:e=>e.label,onValueChange:n=>{n!==null&&e.answer(t.sequence,n)},renderItem:e=>(0,X.jsxs)(`span`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:e.label}),e.description===void 0?null:(0,X.jsx)(`span`,{className:`text-sm opacity-70`,children:e.description})]})})]}):i.type===`confirmation`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(`p`,{children:i.message}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-xs`,children:[(0,X.jsx)(lE,{variant:`ghost`,onClick:()=>e.answer(t.sequence,!1),children:i.cancelLabel??`Cancel`}),(0,X.jsx)(lE,{onClick:()=>e.answer(t.sequence,!0),children:i.confirmLabel??`Confirm`})]})]}):(0,X.jsxs)(`form`,{className:`flex flex-col gap-sm`,onSubmit:r=>{r.preventDefault(),e.answer(t.sequence,n)},children:[(0,X.jsx)(EK,{label:i.message,children:(0,X.jsx)(MK,{autoComplete:`off`,autoFocus:!0,placeholder:i.placeholder,type:i.secret===!0?`password`:`text`,value:n,onChange:e=>{r(e.target.value)}})}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(lE,{type:`submit`,children:`Continue`})})]})}function UK({host:e,onClose:t,onRetry:n}){let r=(0,J.useSyncExternalStore)(e.subscribe,e.snapshot),i=r.status===`working`||r.status===`prompting`;return(0,X.jsxs)(`section`,{"aria-label":r.title,className:`flex flex-col gap-sm`,"data-status":r.status,children:[(0,X.jsx)(`h2`,{className:`text-lg font-semibold`,children:r.title}),r.handoff===void 0?null:(0,X.jsx)(YA,{density:`compact`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-xs p-sm`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:r.handoff.message??(r.handoff.code===void 0?`Continue in your browser`:`Open this page and enter the code`)}),(0,X.jsx)(`a`,{className:`link break-all font-mono`,href:r.handoff.url,rel:`noreferrer`,target:`_blank`,children:r.handoff.url}),r.handoff.code===void 0?null:(0,X.jsx)(`span`,{className:`font-mono text-2xl tracking-widest`,children:r.handoff.code})]})}),r.message===void 0||r.status===`failed`?null:(0,X.jsxs)(`p`,{className:`flex items-center gap-xs`,children:[(0,X.jsx)(nK,{tone:r.message.type===`success`?`success`:`info`,motion:r.message.type===`progress`&&i?`pulse`:`none`}),r.message.message]}),r.links.map(e=>(0,X.jsx)(`a`,{className:`link break-all`,href:e.url,rel:`noreferrer`,target:`_blank`,children:e.label??e.url},e.url)),r.prompt===void 0?null:(0,X.jsx)(HK,{host:e,pending:r.prompt},r.prompt.sequence),r.status===`failed`?(0,X.jsx)(cS,{tone:`error`,title:`That did not work`,description:r.failure}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-xs`,children:[i?(0,X.jsx)(lE,{variant:`ghost`,onClick:e.cancel,children:`Cancel`}):null,r.status===`failed`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(lE,{variant:`ghost`,onClick:()=>{e.cancel(),t?.()},children:`Close`}),n===void 0?null:(0,X.jsx)(lE,{onClick:n,children:`Try again`})]}):null,r.status===`done`||r.status===`cancelled`?(0,X.jsx)(lE,{onClick:t,children:`Done`}):null]})]})}function WK({waiting:e}){return e===null?null:(0,X.jsx)(`div`,{role:`status`,className:`flex items-center justify-between gap-2 px-3 py-1.5 text-xs text-dim`,"data-parakeet-waiting":`waiting`,children:(0,X.jsx)(`span`,{children:UN(e)})})}function GK({children:e,...t}){return(0,J.createElement)(J.Fragment,null,KK(e,t))}function KK(e,t={}){return(typeof e==`string`?Nz(e,t):e).children.map((e,n)=>qK(e,t,`b:${n}`))}function qK(e,t={},n){switch(e.type){case`heading`:return iq(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},YK(e.children,t),oq(e.id,t));case`paragraph`:return iq(t,`p`,{key:n},YK(e.children,t));case`code`:return XK(e,t,n);case`list`:return iq(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>iq(t,`li`,{key:r},ZK(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return iq(t,`blockquote`,{key:n},e.children.map((e,r)=>qK(e,t,`${n}:${r}`)));case`table`:return iq(t,`table`,{key:n},iq(t,`thead`,null,iq(t,`tr`,null,e.header.map((n,r)=>$K(`th`,n,e.align[r],t,r)))),e.rows.length?iq(t,`tbody`,null,e.rows.map((n,r)=>iq(t,`tr`,{key:r},n.map((n,r)=>$K(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return eq(e.items,t,n);case`thematicBreak`:return iq(t,`hr`,{key:n});case`html`:return t.allowHtml?iq(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):iq(t,`p`,{key:n},e.value);case`callout`:return iq(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},iq(t,`p`,{className:`markdown-alert-title`},e.title),iq(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>qK(e,t,`${n}:${r}`))));case`component`:return aq(e,t,n)}}function JK(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return iq(t,`code`,{key:n},e.value);case`strong`:return iq(t,`strong`,{key:n},YK(e.children,t));case`emphasis`:return iq(t,`em`,{key:n},YK(e.children,t));case`strike`:return iq(t,`del`,{key:n},YK(e.children,t));case`footnoteReference`:return iq(t,`sup`,{key:n},iq(t,`a`,{id:`user-content-fnref-${rq(e)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return iq(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},YK(e.children,t));case`image`:return iq(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return iq(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?iq(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function YK(e,t){return e.map((e,n)=>JK(e,t,`i:${n}`))}function XK(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a={className:`language-${r}`},o=i?void 0:e.value,s=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,c=iq(t,`pre`,{className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.title?{"data-code-title":e.title}:{},...e.file?{"data-filename":e.file}:{},...e.framework?{"data-framework":e.framework}:{}},iq(t,`code`,{...a,...s},o));return e.title?iq(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},iq(t,`figcaption`,null,e.title),c):iq(t,J.Fragment,{key:n},c)}function ZK(e,t,n,r,i){let[a,...o]=e,s=t===void 0?[]:[iq(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];if(a?.type===`paragraph`){let e=[...s,...YK(a.children,r)];return[...n?[iq(r,`p`,{key:`${i}:paragraph`},e)]:e,...o.flatMap((e,t)=>QK(e,n,r,`${i}:${t+1}`))]}return[...s,...e.flatMap((e,t)=>QK(e,n,r,`${i}:${t}`))]}function QK(e,t,n,r){return!t&&e.type===`paragraph`?YK(e.children,n):[qK(e,n,r)]}function $K(e,t,n,r,i){return iq(r,e,{key:i,...n?{style:{textAlign:n}}:{}},YK(t.children,r))}function eq(e,t,n){return iq(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},iq(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,oq(`footnote-label`,t)),iq(t,`ol`,null,e.map(e=>iq(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},tq(e,t)))))}function tq(e,t){let n=e.children.length-1,r=nq(e,t);return n<0?[iq(t,`p`,{key:`backref-wrapper`},r.slice(1))]:e.children.map((e,i)=>i===n&&e.type===`paragraph`?iq(t,`p`,{key:i},YK(e.children,t),r):qK(e,t,`${i}`))}function nq(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=r===1?e.id:`${e.id}-${r}`,a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,iq(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function rq(e){return e.referenceIndex&&e.referenceIndex>1?`${e.id}-${e.referenceIndex}`:e.id}function iq(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,J.createElement)(i,n,...r)}function aq(e,t,n){let r=e.tagName??`md-comment-component`,i={...e.properties??{}};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),iq(t,r,{key:n,...i},e.children.map((e,r)=>qK(e,t,`${n}:${r}`)))}function oq(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return iq(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function sq(e){return e}function cq({fallbackLanguage:e=`plaintext`,languages:t}){let n=new Map,r=new Map;for(let e of t){let t=fq(e.name);n.set(t,e),r.set(t,t);for(let n of e.aliases||[])r.set(fq(n),t)}let i=fq(e);function a(e){return r.get(fq(e||i))||i}function o(e,t,i=0){let s=n.get(a(t));return!s||i>24?[]:pq(e.length,s.tokenize(e,{hasLanguage(e){let t=r.get(fq(e));return!!(t&&n.has(t))},tokenize(e,t){return o(e,t,i+1)}}))}function s(e,t={}){let n=a(t.lang),r=o(e,n);return{code:e,lang:n,tokens:r.length?mq(e,r):[{value:e}]}}function c(e,t={}){let n=s(e,t),r=uq(lq(n.tokens,t));return{...n,html:`<pre class="th-code th-code--${Tq(n.lang)}${t.lineNumbers?` th-code--line-numbers`:``}" data-language="${Tq(n.lang)}"><code>${r}</code></pre>`}}function l({code:e,decorations:t,lang:n,lineNumbers:r,title:i}){let a=e.trimEnd(),o=c(a,{decorations:t,lang:n,lineNumbers:r});return{copyText:a,htmlMarkup:o.html,lang:o.lang,title:i,tokens:o.tokens}}return{highlight:c,highlightToHtml(e,t={}){return c(e,t).html},listLanguages(){return[...n.keys()]},normalizeLanguage:a,renderCodeBlockData:l,tokenize:s}}function lq(e,t={}){let n=e.map(e=>e.value).join(``),r=t.decorations||[],i=r.filter(gq),a=r.filter(_q);if(!(t.lineNumbers||a.length))return hq(e,0,n.length,i);let o=[],s=vq(n);for(let t=0;t<s.length;t++){let r=t+1,c=s[t],l=s[t+1]??n.length,u=l>c&&n[l-1]===`
|
|
150
|
-
`,d=u?l-1:l,f=a.filter(e=>yq(e.lines,r));o.push({type:`element`,classNames:[`th-line`,...f.flatMap(e=>Cq(e.className))],data:{...bq(f),line:String(r)},children:hq(e,c,d,i)}),u&&o.push({type:`text`,value:`
|
|
151
|
-
`})}return o}function uq(e){let t=``;for(let n of e){if(n.type===`text`){t+=dq(n.value);continue}let e=n.classNames.map(Tq).join(` `),r=Object.entries(n.data||{}).map(([e,t])=>` data-${Tq(wq(e))}="${Tq(t)}"`).join(``);t+=`<span${e?` class="${e}"`:``}${r}>${uq(n.children)}</span>`}return t}function dq(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`)}function fq(e){return e.trim().toLowerCase()}function pq(e,t){let n=[],r=t.map(t=>({...t,start:Math.max(0,Math.min(e,t.start)),end:Math.max(0,Math.min(e,t.end))})).sort((e,t)=>e.start-t.start),i=0;for(let e of r)e.start>=e.end||e.start<i||(n.push(e),i=e.end);return n}function mq(e,t){let n=[],r=0;for(let i of t)i.start>r&&n.push({value:e.slice(r,i.start)}),n.push({className:i.className,value:e.slice(i.start,i.end)}),r=i.end;return r<e.length&&n.push({value:e.slice(r)}),n}function hq(e,t,n,r){let i=[],a=0;for(let o of e){let e=a+o.value.length,s=Math.max(t,a),c=Math.min(n,e);if(s<c){let e=new Set([s,c]);for(let t of r){let[n,r]=t.range;r<=s||n>=c||(e.add(Math.max(s,n)),e.add(Math.min(c,r)))}let t=[...e].sort((e,t)=>e-t);for(let e=0;e<t.length-1;e++){let n=t[e],s=t[e+1],c={type:`text`,value:o.value.slice(n-a,s-a)};o.className&&(c={type:`element`,classNames:[`th-token`,`th-${o.className}`],children:[c]});let l=r.filter(e=>e.range[0]<=n&&e.range[1]>=s);for(let e of l)c={type:`element`,classNames:[`th-decoration`,...Cq(e.className)],data:xq(e.data),children:[c]};i.push(c)}}if(a=e,a>=n)break}return i}function gq(e){return`range`in e}function _q(e){return`lines`in e}function vq(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
152
|
-
`&&n+1<e.length&&t.push(n+1);return t}function yq(e,t){return typeof e==`number`?e===t:t>=e[0]&&t<=e[1]}function bq(e){let t={};for(let n of e)Object.assign(t,xq(n.data));return t}function xq(e){if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>[Sq(e),String(t)]))}function Sq(e){return wq(e).replace(/[^a-z0-9_.:-]/gi,`-`)}function Cq(e){return e?.trim().split(/\s+/).filter(Boolean)||[]}function wq(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Tq(e){return dq(e)}function Eq(e){return t=>Dq(t,e)}function Dq(e,t,n=[]){let r=[...n],i=new Uint8Array(e.length);for(let e of n)i.fill(1,e.start,e.end);for(let n of t){if(`collect`in n){for(let t of n.collect(e))kq(r,i,t);continue}let t=Aq(n.regex),a;for(;a=t.exec(e);){let e=n.group?a[n.group]:a[0];if(!e){a[0].length||t.lastIndex++;continue}let o=n.group?a[0].indexOf(e):0,s=a.index+o;kq(r,i,{start:s,end:s+e.length,className:typeof n.className==`function`?n.className(a):n.className})}}return r}function Oq(e,t){return e.map(e=>({...e,start:e.start+t,end:e.end+t}))}function kq(e,t,n){return n.start>=n.end||n.start<0||n.end>t.length||jq(t,n.start,n.end)?!1:(e.push(n),t.fill(1,n.start,n.end),!0)}function Aq(e){return new RegExp(e.source,e.flags.includes(`g`)?e.flags:`${e.flags}g`)}function jq(e,t,n){for(let r=t;r<n;r++)if(e[r])return!0;return!1}var Mq=sq({name:`css`,tokenize:Eq([{className:e=>e[0].startsWith(`/*`)?`comment`:`string`,regex:/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g},{className:`variable`,regex:/--[A-Za-z0-9_-]+/g},{className:`selector`,regex:/(^|[}\n])\s*([^@{}\n][^{}\n]*)(?=\s*\{)/g,group:2},{className:`property`,regex:/(?:^|[;{]\s*)([A-Za-z-]+)(?=\s*:)/gm,group:1},{className:`function`,regex:/\b[A-Za-z-]+(?=\()/g},{className:`number`,regex:/\b\d+(?:\.\d+)?(?:px|rem|em|%|s|ms|vh|vw|deg)?\b/g}])}),Nq=sq({name:`dockerfile`,aliases:[`docker`],tokenize:Eq([{className:`comment`,regex:/^\s*#.*$/gm},{className:`keyword`,regex:/^\s*(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)\b/gim},{className:`string`,regex:/\b[A-Za-z0-9._/-]+:[A-Za-z0-9._-]+\b/g},{className:`variable`,regex:/\$\{?[A-Za-z_][A-Za-z0-9_]*\}?/g},{className:`command`,regex:/\b(?:bun|npm|npx|pnpm|yarn|node|apt|apt-get|apk)\b/g}])});function Pq(e,t,n=`html`){let r=[],i=[],a=0;for(;a<e.length;){if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4),n=t<0?e.length:t+3;r.push({start:a,end:n,className:`comment`}),a=n;continue}if(n===`ejs`&&e.startsWith(`<%`,a)){let t=e.indexOf(`%>`,a+2),n=t<0?e.length:t;i.push({start:a+2,end:n,lang:`js`}),a=t<0?e.length:t+2;continue}if(e[a]!==`<`){a++;continue}let t=e[a+1]===`/`,o=a+(t?2:1),s=/^[A-Za-z][\w:.-]*/.exec(e.slice(o));if(!s){a++;continue}let c=zq(e,o+s[0].length);if(c<0){a++;continue}let l=s[0].toLowerCase();if(r.push({start:o,end:o+s[0].length,className:`tag`}),t||Fq(e,o+s[0].length,c,r),!t&&(l===`script`||l===`style`)){let t=`</${l}`,n=e.toLowerCase().indexOf(t,c+1);if(n>=0){let t=Iq(l,e.slice(a,c+1));i.push({start:c+1,end:n,lang:t})}}a=c+1}n===`vue`&&Lq(e,`{{`,`}}`,`js`,i),n===`svelte`&&Rq(e,i);for(let n of i)n.start>=n.end||!t.hasLanguage(n.lang)||r.push(...Oq(t.tokenize(e.slice(n.start,n.end),n.lang),n.start));return r}function Fq(e,t,n,r){let i=e.slice(t,n),a=/\s([:@A-Za-z_][\w:.-]*)(?=\s*(?:=|\/?>))/g,o;for(;o=a.exec(i);){let e=o[0].indexOf(o[1]),n=t+o.index+e;r.push({start:n,end:n+o[1].length,className:`attr`})}let s=t;for(;s<n;){let t=e[s];if(t!==`"`&&t!==`'`){s++;continue}let i=Bq(e,s,t,n);r.push({start:s,end:i,className:`string`}),s=i}}function Iq(e,t){if(e===`style`)return`css`;let n=/\blang\s*=\s*["']?([\w-]+)/i.exec(t)?.[1];return n===`ts`||n===`typescript`?`ts`:`js`}function Lq(e,t,n,r,i){let a=0;for(;(a=e.indexOf(t,a))>=0;){let o=e.indexOf(n,a+t.length);if(o<0)return;i.push({start:a+t.length,end:o,lang:r}),a=o+n.length}}function Rq(e,t){let n=0;for(;n<e.length;){if(e[n]!==`{`||e[n+1]===`#`){n++;continue}let r=e.indexOf(`}`,n+1);if(r<0)return;t.push({start:n+1,end:r,lang:`js`}),n=r+1}}function zq(e,t){let n=t;for(;n<e.length;)if(e[n]===`"`||e[n]===`'`)n=Bq(e,n,e[n],e.length);else if(e[n]===`>`)return n;else n++;return-1}function Bq(e,t,n,r){let i=t+1;for(;i<r;)if(e[i]===`\\`)i+=2;else if(e[i]===n)return i+1;else i++;return r}var Vq=sq({name:`html`,aliases:[`htm`,`xml`,`angular-html`],tokenize:(e,t)=>Pq(e,t)}),Hq=[{className:`function`,regex:/@[A-Za-z_$][\w$]*/g},{className:`keyword`,regex:RegExp(`\\b(?:abstract|as|asserts|async|await|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|infer|instanceof|interface|is|keyof|let|module|namespace|new|of|override|package|private|protected|public|readonly|return|satisfies|set|static|super|switch|this|throw|try|type|typeof|using|var|while|with|yield)\\b`,`g`)},{className:`literal`,regex:/\b(?:false|null|true|undefined|NaN|Infinity)\b/g},{className:`number`,regex:/\b(?:0x[\da-f](?:_?[\da-f])*n?|0b[01](?:_?[01])*n?|0o[0-7](?:_?[0-7])*n?|\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:e[+-]?\d(?:_?\d)*)?n?)\b/gi},{className:`function`,regex:/\bfunction\s*\*?\s*([A-Za-z_$][\w$]*)/g,group:1},{className:`function`,regex:/(^|[^.A-Za-z0-9_$])([A-Za-z_$][\w$]*)\s*(?=\()/g,group:2},{className:`type`,regex:/\b(?:Array|Record|Promise|Readonly|Set|Map|WeakMap|WeakSet|string|number|boolean|bigint|symbol|object|unknown|never|void|any|[A-Z][A-Za-z0-9_$]*)\b/g},{className:`property`,regex:/(?:\.|\?\.)([A-Za-z_$][\w$]*)/g,group:1}];function Uq(e,t=!1,n=!1){let r=Wq(e,t,n),i=t?Jq(e,n):[];return Dq(e,Hq,[...r,...i])}function Wq(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i],o=e[i+1];if(a===`/`&&o===`/`){let t=nJ(e,i+2);r.push({start:i,end:t,className:`comment`}),i=t;continue}if(a===`/`&&o===`*`){let t=e.indexOf(`*/`,i+2),n=t<0?e.length:t+2;r.push({start:i,end:n,className:`comment`}),i=n;continue}if(a===`'`||a===`"`){let t=tJ(e,i,a);r.push({start:i,end:t,className:`string`}),i=t;continue}if(a==="`"){i=Gq(e,i,r,t,n);continue}if(a===`/`&&!(t&&e[i-1]===`<`)&&Qq(e,i)){let t=$q(e,i);if(t>i+1){r.push({start:i,end:t,className:`literal`}),i=t;continue}}i++}return r}function Gq(e,t,n,r,i){let a=t,o=t+1;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]==="`")return n.push({start:a,end:o+1,className:`string`}),o+1;if(e[o]===`$`&&e[o+1]===`{`){a<o&&n.push({start:a,end:o,className:`string`}),n.push({start:o,end:o+2,className:`operator`});let t=Kq(e,o+2),s=t<0?e.length:t,c=e.slice(o+2,s);if(n.push(...Oq(Uq(c,r,i),o+2)),t<0)return e.length;n.push({start:t,end:t+1,className:`operator`}),o=t+1,a=o;continue}o++}return a<e.length&&n.push({start:a,end:e.length,className:`string`}),e.length}function Kq(e,t){let n=1,r=t;for(;r<e.length;){let t=e[r],i=e[r+1];if(t===`'`||t===`"`){r=tJ(e,r,t);continue}if(t==="`"){r=qq(e,r);continue}if(t===`/`&&i===`/`){r=nJ(e,r+2);continue}if(t===`/`&&i===`*`){let t=e.indexOf(`*/`,r+2);r=t<0?e.length:t+2;continue}if(t===`{`&&n++,t===`}`&&--n===0)return r;r++}return-1}function qq(e,t){let n=t+1;for(;n<e.length;)if(e[n]===`\\`)n+=2;else if(e[n]==="`")return n+1;else if(e[n]===`$`&&e[n+1]===`{`){let t=Kq(e,n+2);n=t<0?e.length:t+1}else n++;return e.length}function Jq(e,t){let n=[],r=0,i=0,a=0;for(;r<e.length;){if(i&&(e[r]===`"`||e[r]===`'`||e[r]==="`")){r=e[r]==="`"?qq(e,r):tJ(e,r,e[r]);continue}if(i&&e[r]===`{`){a++,r++;continue}if(i&&e[r]===`}`){a=Math.max(0,a-1),r++;continue}if(e[r]!==`<`){r++;continue}if(e.startsWith(`</>`,r)){i=Math.max(0,i-1),r+=3;continue}if(e.startsWith(`<>`,r)&&(i>0||Xq(e,r,t))){i++,r+=2;continue}let o=e[r+1]===`/`,s=r+(o?2:1),c=/^[A-Za-z][\w:.-]*/.exec(e.slice(s));if(!c||!o&&!(i>0&&a===0)&&!Xq(e,r,t)){r++;continue}let l=eJ(e,s+c[0].length);if(l<0||Zq(e,r,l,o)){r++;continue}n.push({start:s,end:s+c[0].length,className:`tag`}),o||Yq(e,s+c[0].length,l,n);let u=/\/\s*$/.test(e.slice(s,l));o?i=Math.max(0,i-1):u||i++,r=l+1}return n}function Yq(e,t,n,r){let i=e.slice(t,n),a=/\s([:@A-Za-z_$][\w$:.-]*)(?=\s*(?:=|\/?>))/g,o;for(;o=a.exec(i);){let e=o[0].indexOf(o[1]),n=t+o.index+e;r.push({start:n,end:n+o[1].length,className:`attr`})}}function Xq(e,t,n){if(n&&/^\s*$/.test(e.slice(e.lastIndexOf(`
|
|
153
|
-
`,t-1)+1,t)))return!0;let r=e.slice(0,t).trimEnd();return!r||/\b(?:return|case|yield)$/.test(r)?!0:/(?:[=([{,:;!&|?]|>)$/.test(r)}function Zq(e,t,n,r){if(r)return!1;let i=e.slice(t+1,n),a=e.slice(n+1).trimStart();return/\s+extends\s+/.test(i)||a[0]===`(`&&!i.trimEnd().endsWith(`/`)}function Qq(e,t){let n=e.slice(0,t).trimEnd();return!n||/\b(?:case|delete|in|instanceof|of|return|throw|typeof|void|yield)$/.test(n)?!0:/[=([{,:;!&|?~+*%^<>-]$/.test(n)}function $q(e,t){let n=!1,r=t+1;for(;r<e.length&&e[r]!==`
|
|
154
|
-
`;)if(e[r]===`\\`)r+=2;else if(e[r]===`[`)n=!0,r++;else if(e[r]===`]`)n=!1,r++;else if(e[r]===`/`&&!n){for(r++;/[a-z]/i.test(e[r]||``);)r++;return r}else r++;return t+1}function eJ(e,t){let n=0,r=t;for(;r<e.length;){let t=e[r];if(t===`'`||t===`"`){r=tJ(e,r,t);continue}if(t===`{`)n++;else if(t===`}`)n=Math.max(0,n-1);else if(t===`>`&&n===0)return r;else if(t===`
|
|
155
|
-
`&&n===0)return-1;r++}return-1}function tJ(e,t,n){let r=t+1;for(;r<e.length;)if(e[r]===`\\`)r+=2;else if(e[r]===n)return r+1;else if(e[r]===`
|
|
156
|
-
`&&n!=="`")return r;else r++;return e.length}function nJ(e,t){let n=e.indexOf(`
|
|
157
|
-
`,t);return n<0?e.length:n}var rJ=sq({name:`js`,aliases:[`javascript`,`mjs`,`cjs`,`js-vue`],tokenize:e=>Uq(e)}),iJ=sq({name:`json`,aliases:[`jsonc`,`json5`],tokenize:Eq([{className:e=>e[0].startsWith(`//`)||e[0].startsWith(`/*`)?`comment`:e[1]?`property`:`string`,regex:/\/\/[^\n]*|\/\*[\s\S]*?\*\/|("(?:\\.|[^"\\])*")(?=\s*:)|"(?:\\.|[^"\\])*"/g},{className:`literal`,regex:/\b(?:false|null|true)\b/g},{className:`number`,regex:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/gi}])}),aJ=sq({name:`jsx`,tokenize:e=>Uq(e,!0)}),oJ=sq({name:`markdown`,aliases:[`md`],tokenize(e,t){return Dq(e,[{className:`heading`,regex:/^#{1,6}\s.*$/gm},{className:`heading`,regex:/^.+\n(?:=+|-+)\s*$/gm},{className:`code-inline`,regex:/`[^`\n]+`/g},{className:`link`,regex:/!?\[[^\]]+\]\([^)]+\)/g},{className:`meta`,regex:/^\s{0,3}(?:>|[-*+] |\d+\. )/gm}],sJ(e,t))}});function sJ(e,t){let n=[],r=/^( {0,3})(`{3,}|~{3,})\s*([^\n]*)$/gm,i;for(;i=r.exec(e);){let a=i[2],o=e.indexOf(`
|
|
158
|
-
`,i.index+i[0].length);if(o<0)break;let s=RegExp(`^ {0,3}${a[0]}{${a.length},}\\s*$`,`gm`);s.lastIndex=o+1;let c=s.exec(e),l=c?.index??e.length,u=i[3].trim().split(/\s+/)[0],d=u&&t.hasLanguage(u)?Oq(t.tokenize(e.slice(o+1,l),u),o+1):[];n.push({start:i.index,end:o,className:`meta`}),n.push(...cJ(o+1,l,d)),c&&n.push({start:c.index,end:c.index+c[0].length,className:`meta`}),r.lastIndex=c?c.index+c[0].length:e.length}return n}function cJ(e,t,n){let r=[],i=e;for(let e of[...n].sort((e,t)=>e.start-t.start))e.start>i&&r.push({start:i,end:e.start,className:`code-inline`}),r.push(e),i=e.end;return i<t&&r.push({start:i,end:t,className:`code-inline`}),r}var lJ=sq({name:`plaintext`,aliases:[`text`,`txt`,`-->`],tokenize:()=>[]}),uJ=sq({name:`python`,aliases:[`py`],tokenize(e){return Dq(e,[{className:e=>e[0].startsWith(`#`)?`comment`:`string`,regex:/#[^\n]*|(?:br|rb|fr|rf|[rubf])?(?:"""[\s\S]*?"""|'''[\s\S]*?'''|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*')/gi},{className:`keyword`,regex:/\b(?:and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b/g},{className:`literal`,regex:/\b(?:False|None|True|NotImplemented|Ellipsis)\b/g},{className:`function`,regex:/@[A-Za-z_][\w.]*/g},{className:`function`,regex:/\bdef\s+([A-Za-z_]\w*)/g,group:1},{className:`type`,regex:/\b(?:bool|bytes|dict|float|frozenset|int|list|object|set|str|tuple|type)\b/g},{className:`number`,regex:/\b(?:0x[\da-f_]+|0b[01_]+|0o[0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:e[+-]?\d[\d_]*)?j?)\b/gi}])}}),dJ=sq({name:`shell`,aliases:[`bash`,`sh`,`zsh`,`cmd`,`console`],tokenize(e){return Dq(e,[{collect:fJ},{className:`variable`,regex:/\$[A-Za-z_][A-Za-z0-9_]*|\b[A-Z_][A-Z0-9_]*(?==)/g},{className:`keyword`,regex:/\b(?:case|do|done|elif|else|esac|export|fi|for|function|if|in|select|then|time|until|while)\b/g},{className:`command`,regex:/(^|[\n;|&])\s*([A-Za-z0-9_./-]+)(?=\s|$)/g,group:2}])}});function fJ(e){let t=[];pJ(e,t);let n=0;for(;n<e.length;){if(hJ(n,t)){n=t.find(e=>e.start<=n&&e.end>n).end;continue}let r=e[n];if(r===`"`||r===`'`){let i=r,a=n+1;for(;a<e.length;)if(e[a]===`\\`&&i===`"`)a+=2;else if(e[a]===i){a++;break}else a++;t.push({start:n,end:a,className:`string`}),n=a;continue}if(r===`$`&&e[n+1]===`{`){let r=e.indexOf(`}`,n+2),i=r<0?e.length:r+1;t.push({start:n,end:i,className:`variable`}),n=i;continue}if(r===`#`&&(n===0||e[n-1]===`
|
|
159
|
-
`||/[\s;|&()]/.test(e[n-1]))){let r=e.indexOf(`
|
|
160
|
-
`,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i;continue}n++}return t}function pJ(e,t){let n=/<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1/g,r;for(;r=n.exec(e);){if(e[r.index-1]===`<`||mJ(e,r.index))continue;let n=e.indexOf(`
|
|
161
|
-
`,r.index+r[0].length);if(n<0)continue;let i=n+1,a=RegExp(`^\\t*${gJ(r[2])}\\s*$`,`m`).exec(e.slice(i));if(!a){t.push({start:i,end:e.length,className:`string`});continue}let o=i+a.index;o>i&&t.push({start:i,end:o,className:`string`});let s=i+a.index;t.push({start:s,end:s+a[0].length,className:`meta`})}}function mJ(e,t){let n=e.lastIndexOf(`
|
|
162
|
-
`,t-1)+1,r=``;for(let i=n;i<t;i++)e[i]===`\\`&&r!==`'`?i++:r&&e[i]===r?r=``:!r&&(e[i]===`"`||e[i]===`'`)&&(r=e[i]);return!!r}function hJ(e,t){return t.some(t=>t.start<=e&&t.end>e)}function gJ(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var _J=sq({name:`sql`,tokenize:Eq([{className:e=>e[0].startsWith(`--`)||e[0].startsWith(`/*`)?`comment`:`string`,regex:/--[^\n]*|\/\*[\s\S]*?\*\/|'(?:''|[^'])*'|"(?:""|[^"])*"/g},{className:`keyword`,regex:/\b(?:add|all|alter|and|as|asc|begin|between|by|case|check|column|commit|constraint|create|cross|database|default|delete|desc|distinct|drop|else|end|exists|foreign|from|full|group|having|index|inner|insert|into|join|key|left|like|limit|not|null|on|or|order|outer|primary|references|returning|right|rollback|select|set|table|then|union|unique|update|using|values|view|when|where|with)\b/gi},{className:`literal`,regex:/\b(?:false|null|true)\b/gi},{className:`number`,regex:/\b\d+(?:\.\d+)?\b/g},{className:`function`,regex:/\b[A-Za-z_][A-Za-z0-9_]*(?=\s*\()/g}])}),vJ=sq({name:`ts`,aliases:[`typescript`,`angular-ts`],tokenize:e=>Uq(e)}),yJ=sq({name:`tsx`,tokenize:e=>Uq(e,!0)}),bJ=sq({name:`yaml`,aliases:[`yml`],tokenize(e){let t=[...xJ(e),...SJ(e)];return Dq(e,[{className:`property`,regex:/^[ \t-]*([A-Za-z0-9_.-]+)(?=\s*:)/gm,group:1},{collect:CJ},{className:`literal`,regex:/\b(?:false|null|true|yes|no|on|off|~)\b/gi},{className:`number`,regex:/\b\d+(?:\.\d+)?\b/g}],t)}});function xJ(e){let t=[],n=/^(\s*)[\w.-]+:\s*[>|][+-]?\s*(?:#.*)?$/gm,r;for(;r=n.exec(e);){let n=e.indexOf(`
|
|
163
|
-
`,r.index+r[0].length);if(n<0)continue;let i=r[1].length,a=n+1;for(;a<e.length;){let t=e.indexOf(`
|
|
164
|
-
`,a),n=t<0?e.length:t,r=e.slice(a,n);if(r.trim()&&(r.match(/^\s*/)?.[0].length||0)<=i)break;a=t<0?e.length:t+1}a>n+1&&t.push({start:n+1,end:a,className:`string`})}return t}function SJ(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`"`||r===`'`){let i=r,a=n+1;for(;a<e.length&&e[a]!==`
|
|
165
|
-
`;)if(e[a]===`\\`&&i===`"`)a+=2;else if(e[a]===i){a++;break}else a++;t.push({start:n,end:a,className:`string`}),n=a;continue}if(r===`#`&&(n===0||e[n-1]===`
|
|
166
|
-
`||/\s/.test(e[n-1]))){let r=e.indexOf(`
|
|
167
|
-
`,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i;continue}n++}return t}function CJ(e){let t=[],n=/:\s*([^\n]*)/g,r;for(;r=n.exec(e);){let n=r[1],i=n.trimEnd();if(!i)continue;let a=r.index+r[0].indexOf(n),o=a+i.length,s=/\s+#/.exec(i);for(s&&(o=a+s.index);o>a&&/\s/.test(e[o-1]);)o--;o>a&&t.push({start:a,end:o,className:`string`})}return t}var wJ=/[ \t]*(?:(?:\/\/|#)[ \t]*\[!code[ \t]+(\+\+|--)\]|\/\*[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*\*\/|<!--[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*-->)[ \t]*$/;function TJ(e){let t=[];return{code:e.split(`
|
|
168
|
-
`).map((e,n)=>{let r=wJ.exec(e);if(!r)return e;let i=r[1]||r[2]||r[3];return t.push({className:i===`++`?`th-line--inserted`:`th-line--deleted`,lines:n+1}),e.slice(0,r.index)}).join(`
|
|
169
|
-
`),decorations:t}}function EJ(e){return(t,n=`plaintext`,r={})=>{let i=TJ(t);return uq(lq(e.tokenize(i.code,{lang:n}).tokens,{...r.lineNumbers===void 0?{}:{lineNumbers:r.lineNumbers},...i.decorations.length||r.highlightLines?.length?{decorations:[...i.decorations,...(r.highlightLines||[]).map(e=>({className:`th-line--highlighted`,lines:e}))]}:{}}))}}var DJ=cq({fallbackLanguage:`plaintext`,languages:[Mq,Nq,Vq,rJ,iJ,aJ,oJ,lJ,uJ,dJ,_J,vJ,yJ,bJ]}),OJ=EJ(DJ);function kJ(e,t){return DJ.highlightToHtml(e,t?{lang:t}:{})}var AJ=(0,J.forwardRef)(function({className:e,variant:t=`default`,...n},r){return(0,X.jsx)(`article`,{...n,className:$(`prose prose-caps`,t===`dropcap`&&`caps-prose-dropcap`,e),ref:r})});function jJ(e){return URL.parse(e)?.protocol??null}function MJ(e){if(e===``||e.startsWith(`//`))return!1;let t=jJ(e);return t===null||t===`http:`||t===`https:`||t===`mailto:`}function NJ(e){let t=jJ(e);return t===`http:`||t===`https:`}function PJ(e){if(e===``||e.startsWith(`//`))return!1;let t=jJ(e);return t===null||t===`http:`||t===`https:`}function FJ({children:e,className:t,components:n,frontmatter:r=!0,policy:i=`default`,typography:a=`prose`}){let o=(0,J.useMemo)(()=>Nz(e,{allowHtml:!1,frontmatter:r}),[e,r]),s=(0,J.useMemo)(()=>({...n,a(e){let t=e.href??``;if(i===`visitor`){let n=URL.parse(t);return n===null||!NJ(n.href)?(0,X.jsx)(`span`,{children:e.children}):(0,X.jsx)(`a`,{href:n.href,target:`_blank`,rel:`noopener noreferrer`,children:e.children})}if(!MJ(t))return(0,X.jsx)(X.Fragment,{children:e.children});let n=NJ(t);return(0,X.jsx)(`a`,{...e,href:t,rel:n?`noopener noreferrer`:e.rel,target:n?`_blank`:e.target})},img(e){if(i===`visitor`)return(0,X.jsx)(`span`,{className:`text-dim`,children:`Image removed`});let t=e.src??``;return PJ(t)?n?.img?(0,J.createElement)(n.img,e):(0,X.jsx)(`img`,{alt:e.alt??``,className:`max-w-full`,src:t}):(0,X.jsx)(X.Fragment,{children:e.alt??``})}}),[n,i]),c=(0,X.jsx)(GK,{allowHtml:!1,components:s,highlighter:OJ,children:o}),l=$(`min-w-0 break-words`,t);return a===`prose`?(0,X.jsx)(AJ,{className:l,children:c}):(0,X.jsx)(`div`,{className:l,children:c})}var IJ=(0,J.createContext)(`session`),LJ={blockquote({children:e}){return(0,X.jsx)(`blockquote`,{className:`text-dim my-2 border-l-2 border-primary pl-3 italic`,children:e})},pre({children:e,className:t,...n}){return(0,X.jsx)(`pre`,{...n,className:$(`whitespace-pre-wrap break-words`,t),children:e})},img({alt:e,src:t}){let n=t??``;return n.startsWith(`/`)?(0,X.jsxs)(`div`,{className:`my-2 px-3 py-2 font-mono text-[10px]`,style:{background:`var(--stipe-surface-selected)`,border:`1px solid var(--color-base-300)`},children:[(0,X.jsx)(`span`,{className:`text-dim`,children:e??`Generated image`}),(0,X.jsx)(`span`,{className:`text-dim mx-2`,children:`·`}),(0,X.jsx)(`span`,{style:{color:`var(--color-base-content)`},children:n})]}):(0,X.jsx)(`img`,{alt:e??`Image`,className:`my-2 max-w-full`,src:n,style:{maxHeight:400}})},strong({children:e}){return(0,X.jsx)(`strong`,{className:`font-semibold text-primary`,children:e})},table({children:e}){return(0,X.jsx)(`table`,{className:`my-2 w-full border-collapse text-xs`,children:e})},thead({children:e}){return(0,X.jsx)(`thead`,{style:{background:`var(--stipe-surface-selected)`},children:e})},th({children:e}){return(0,X.jsx)(`th`,{className:`border px-3 py-2 text-left font-semibold`,style:{borderColor:`var(--color-base-300)`},children:e})},td({children:e}){return(0,X.jsx)(`td`,{className:`border px-3 py-2`,style:{borderColor:`var(--color-base-300)`},children:e})},tr({children:e}){return(0,X.jsx)(`tr`,{children:e})},tbody({children:e}){return(0,X.jsx)(`tbody`,{children:e})}};function RJ({children:e,policy:t}){let n=(0,J.useContext)(IJ);return(0,X.jsx)(FJ,{className:`markdown-renderer`,components:LJ,frontmatter:!1,policy:(t??n)===`visitor`?`visitor`:`default`,typography:`inherit`,children:e})}var zJ=(0,J.memo)(function({thinking:e}){let[t,n]=(0,J.useState)(!1);return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{"aria-expanded":t,className:`flex h-8 w-full items-center gap-2 px-3 text-left text-[10px] uppercase tracking-wider transition-colors`,onClick:()=>{n(e=>!e)},style:{color:`var(--stipe-fg-muted)`,fontFamily:`var(--font-sans)`,fontStyle:`italic`},type:`button`,children:[`Thoughts`,(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`btn btn-circle btn-ghost btn-xs ml-auto text-dim`,style:{transform:t?`rotate(90deg)`:`rotate(0deg)`},children:(0,X.jsx)(qW,{size:12})})]}),t?(0,X.jsx)(`div`,{className:`max-w-[80ch] break-words px-3 pb-2 text-[11px]`,style:{color:`var(--stipe-fg-muted)`,fontFamily:`var(--font-sans)`,fontStyle:`italic`},children:(0,X.jsx)(RJ,{children:e})}):null]})});function BJ({children:e,isError:t,pending:n,speaker:r,thinking:i,markdownPolicy:a}){let o=(0,X.jsx)(RJ,{policy:a,children:e});if(r===`user`)return(0,X.jsx)(`div`,{className:`px-3 py-2 transition-opacity motion-reduce:transition-none ${n?`opacity-50`:``}`,"data-pending":n?`true`:void 0,"data-speaker":`user`,style:{background:`var(--stipe-surface)`,borderLeft:`3px solid var(--color-primary)`},children:(0,X.jsx)(`div`,{className:`message-body text-base-content`,children:o})});let s=e.trim().length>0;return!s&&!i?null:(0,X.jsxs)(`div`,{"data-speaker":`agent`,"data-pending":n?`true`:void 0,children:[i?(0,X.jsx)(zJ,{thinking:i}):null,s?(0,X.jsx)(`div`,{className:`px-3 py-2 ${t?`text-error`:`text-base-content`}`,children:o}):null]})}var VJ=Pb(`badge caps-badge`,{variants:{tone:{neutral:`badge-neutral`,primary:`badge-primary`,secondary:`badge-secondary`,accent:`badge-accent`,success:`badge-success`,info:`badge-info`,warning:`badge-warning`,error:`badge-error`},size:{sm:`badge-sm`,default:`badge-md`,lg:`badge-lg`},variant:{solid:``,quiet:`caps-badge-quiet`}},defaultVariants:{tone:`neutral`,size:`default`}}),HJ=(0,J.forwardRef)(function({className:e,size:t,tone:n,variant:r,...i},a){return(0,X.jsx)(`span`,{...i,className:$(VJ({size:t,tone:n,variant:r}),e),ref:a})}),UJ={add:`+`,context:` `,file:``,hunk:`@@`,remove:`-`};function WJ({lines:e,hiddenLines:t=0,className:n,...r}){return(0,X.jsxs)(`pre`,{...r,className:$(`caps-diff`,n),children:[e.map((e,t)=>(0,X.jsxs)(`span`,{className:`caps-diff-line`,"data-kind":e.kind,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-diff-marker`,children:UJ[e.kind]}),e.text,`
|
|
170
|
-
`]},`${String(t)}:${e.kind}`)),t>0?(0,X.jsxs)(`span`,{className:`caps-diff-line`,"data-kind":`more`,children:[`… `,String(t),` more lines`]}):null]})}function GJ({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(()=>t);return[i&&e!==void 0?e:a,J.useCallback(e=>{i||o(e)},[])]}function KJ(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=GJ({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=AV(a,!0,!0),u=CD(),[d,f]=J.useState(),p=d===null?void 0:d??u,m=xE(e=>{let t=!a,n=dB(pB,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return J.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var qJ=J.createContext(void 0);function JJ(){let e=J.useContext(qJ);if(e===void 0)throw Error(ME(15));return e}var YJ=`data-open`,XJ=`data-closed`,ZJ=CO,QJ=`data-panel-open`,$J={[YJ]:``},eY={[XJ]:``},tY={open(e){return e?{[QJ]:``}:null}},nY={open(e){return e?$J:eY},...DO},rY=J.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=xE(o),d=KJ({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=J.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=J.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=cD(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:nY});return(0,X.jsx)(qJ.Provider,{value:p,children:m})}),iY={...tY,...DO},aY=J.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=JJ(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=cB({disabled:c,native:u});return cD(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:iY})}),oY={height:void 0,width:void 0};function sY(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=J.useRef(null),f=J.useRef(null),[p,m]=J.useState(oY),h=J.useRef(oY),g=J.useRef(!1),_=J.useRef(s),v=J.useRef(!1),[y,b]=J.useState(!1),x=J.useRef(null),S=FE(t,d),C=OB(s),w=NV(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=xE((e,t=!0)=>{t&&(h.current=e),m(e)}),j=xE(()=>{x.current?.(),x.current=null}),M=xE(e=>{j(),x.current=()=>{x.current=null,e()}}),N=xE(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});hA(()=>{!y||u===`starting`||b(!1)},[y,u]),J.useEffect(()=>()=>{N(),j()},[N,j]),hA(()=>{s||(_.current=!1,v.current=!1);let e=d.current;if(!e)return;!s&&x.current&&j();let t=lY(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=cY(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(cY(e)),b(!0);return}if(t===`css-transition`){let t=fY(e);if(A(cY(e)),!n)return t;let r=dY(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(cY(e));let r=dY(e,`animation-name`,`none`);if(!n){r();return}let i=dY(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(t===`none`){A(oY,!1),c(!1);return}A(cY(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=cY(e);if(!(n.height>0||n.width>0)){c(!1);return}A(n),t===`css-animation`&&dY(e,`animation-name`,`none`)()},[a,s,j,A,c,M,D,u]),PV({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(oY,!1)}}),J.useEffect(()=>{if(s||!a||E!==`ending`)return;if(!d.current){c(!1),A(oY,!1);return}let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(oY,!1))}return t=MB.request(()=>{w(n,e.signal)}),()=>{MB.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),hA(()=>{let e=d.current;!e||!n||!T||e.setAttribute(`hidden`,`until-found`)},[T,n]),J.useEffect(function(){let e=d.current;if(!e)return;let t=kE.create(),n=-1,r=(r,i)=>{t.start(0,()=>{C.current||(n=MB.request(()=>{C.current||(r&&(g.current=!1),i&&e.setAttribute(ZJ,``),e.setAttribute(`hidden`,`until-found`))}))})},i=IA(e,`beforematch`,t=>{let n=dB(fB,t);if(o(!0,n),n.isCanceled){r(!1,!1);return}g.current=!0;let i=e.hasAttribute(ZJ);e.removeAttribute(ZJ),l(!0),r(!0,i)});return()=>{t.clear(),MB.cancel(n),i()}},[C,o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[ZJ]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function cY(e){return{height:e.scrollHeight,width:e.scrollWidth}}function lY(e,t){let n=PD(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&uY(n.animationDuration),i=uY(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function uY(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function dY(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function fY(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=MB.request(n);return()=>{MB.cancel(r),n()}}var pY=`--collapsible-panel-height`,mY=`--collapsible-panel-width`,hY=J.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=JJ(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;hA(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=sY({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=qE(s,k),j=cD(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[pY]:S===void 0?`auto`:`${S}px`,[mY]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:nY});return E?j:null}),gY=Pb(`caps-disclosure`,{variants:{tone:{neutral:``,error:`caps-disclosure-error`},size:{group:`caps-disclosure-group`,row:`caps-disclosure-row`}},defaultVariants:{tone:`neutral`,size:`group`}});function _Y({open:e,onOpenChange:t,summary:n,leading:r,trailing:i,children:a,tone:o,size:s,className:c}){return(0,X.jsxs)(rY,{className:$(gY({tone:o,size:s}),c),onOpenChange:t,open:e,children:[(0,X.jsxs)(aY,{className:`caps-disclosure-trigger`,children:[r===void 0?null:(0,X.jsx)(`span`,{className:`caps-disclosure-leading`,children:r}),(0,X.jsx)(`span`,{className:`caps-disclosure-summary`,children:n}),i===void 0?null:(0,X.jsx)(`span`,{className:`caps-disclosure-trailing`,children:i}),(0,X.jsx)(qW,{"aria-hidden":`true`,className:`caps-disclosure-chevron`,size:12})]}),(0,X.jsx)(hY,{className:`caps-disclosure-panel`,children:a})]})}var vY={coral:`var(--stipe-art-coral, #ff6558)`,blue:`var(--stipe-art-blue, #43a6f2)`,mint:`var(--stipe-art-mint, #63cfaa)`,grape:`var(--stipe-art-grape, #a66cc1)`,yellow:`var(--stipe-art-yellow, #ffd05d)`,cream:`var(--stipe-art-cream, #fff4de)`,ink:`var(--stipe-art-ink, #242c28)`,graphite:`var(--stipe-art-graphite, #49423f)`,inkcap:`var(--stipe-art-inkcap, #80499d)`},yY=`light-dark(var(--stipe-sketch-ink, #242c28), var(--stipe-art-cream, #fff4de))`,bY=`var(--color-base-100, light-dark(#fff4de, #242c28))`;function xY({transform:e,fill:t=yY}){return(0,X.jsx)(`path`,{transform:e,style:{fill:t},d:`M-1.264-9.479C-2.098-8.643-1.802-1.057-.907-.332.47.782 1.6-.446 1.618-3.075 1.623-3.888 1.691-5.398 1.77-6.429 1.979-9.202 1.596-10 .055-10-.588-10-.843-9.9-1.264-9.479Z`})}function SY(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(xY,{transform:`translate(25.4 19.8) rotate(-39) scale(.95 .76)`}),(0,X.jsx)(xY,{transform:`translate(32.1 17.8) scale(.96 .95)`}),(0,X.jsx)(xY,{transform:`translate(38.8 19.9) rotate(39) scale(.95 .77)`})]})}function CY(){return(0,X.jsxs)(`g`,{style:{fill:vY.blue},children:[(0,X.jsx)(`path`,{d:`M10.574 .604C9.804 1.375 9.867-.885 9.961 22.81 10.054 47.202 9.722 45.378 14.193 45.94 25.813 47.399 38.465 52.211 44.662 57.532 47.653 60.097 48.082 59.411 47.967 52.242L47.734 19.335C47.734 17.523 47.13 16.616 45.964 15.076 40.604 8.018 30.127 2.767 16.804 .462 13.045-.184 11.326-.148 10.574 .604Z`}),(0,X.jsx)(`path`,{d:`M81.571 .746C71.063 2.665 62.221 6.713 56.562 12.199 54.242 14.45 52 17.356 52.115 19.335L52.033 52.628C51.927 59.934 51.979 59.994 55.74 57.091 62.423 51.931 71.272 48.541 84.103 46.221 90.625 45.039 89.967 47.631 90.145 22.432 90.326-3.079 91.148-1 81.571 .746Z`}),(0,X.jsx)(`path`,{d:`M1.906 12.692C.1 13.42 .151 12.804 .151 33.825 .151 54.097 .163 54.302 1.447 55.498 2.71 56.674 3.384 56.81 7.937 56.816 20.943 56.834 30.647 58.293 38.776 61.45 45.964 64.242 46.435 61.924 39.526 57.773 32.296 53.429 26.656 51.544 14.943 49.553 5.958 48.027 6.535 49.414 6.408 29.003 6.32 14.74 6.263 13.103 5.816 12.764 5.254 12.335 2.9 12.293 1.906 12.692Z`}),(0,X.jsx)(`path`,{d:`M94.326 12.858C93.656 13.326 93.656 13.326 93.653 28.492 93.653 48.882 93.997 48.063 84.743 49.556 73.574 51.36 64.45 54.695 57.801 59.405 54.082 62.039 55.384 63.864 59.722 62.1 68.897 58.372 76.363 57.115 90.03 56.994 100.405 56.903 99.489 58.976 99.773 34.976 100.018 14.142 100.006 13.958 98.399 12.979 97.236 12.269 95.251 12.208 94.326 12.858Z`})]})}function wY(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:vY.cream},d:`M-8.572-25.123C-21.412-23.39-33.235-17.39-44.235-7.027-51.235-.433-51.251 .358-44.524 6.749-20.77 29.316 10.23 31.893 36.364 13.487 41.043 10.187 48.193 3.551 49.235 1.524 50.358-.642 49.471-2.102 43.738-7.497 29.257-21.128 9.968-27.631-8.572-25.123Z`}),(0,X.jsx)(`path`,{style:{fill:vY.ink},d:`M-6.225-16.807C-17.727-13.267-21.176 4.433-12.08 13.257-1.118 23.898 16.829 16.102 17.032 .604 17.209-12.412 6.219-20.642-6.225-16.807Z`})]})}function TY(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:vY.mint},d:`M540 342C520 340 497 355 477 374C450 399 440 421 456 444C465 458 480 462 492 464C503 466 500 477 494 486C487 500 508 496 522 478L530 468C557 468 578 464 591 451C601 442 599 429 585 427C572 425 556 432 547 418C538 403 550 390 568 385C579 382 589 380 584 368C576 352 557 341 540 342Z`}),(0,X.jsx)(`path`,{style:{fill:vY.coral},d:`M589 396C614 380 659 381 683 392C709 404 721 428 710 451C704 464 693 472 685 479C680 487 684 498 689 503C695 514 684 513 675 507C667 502 662 497 657 491C637 496 610 495 594 486C584 480 583 469 595 464C607 460 622 454 622 441C622 428 612 423 597 420C580 417 578 407 589 396Z`})]})}function EY({fill:e}){return(0,X.jsx)(`path`,{style:{fill:e},d:`M44.648 .288C26.645 1.615 13.263 8.266 5.942 19.529-4.299 35.277-.917 57.684 13.224 67.784 16.958 70.452 16.936 71.742 13.064 77.665 11.28 80.391 10.895 81.565 11.341 82.914 13.163 88.435 25.022 86.396 36.307 78.62L38.681 76.986 41.294 77.335C45.371 77.878 59.645 77.789 64.125 77.191 89.213 73.837 100.562 61.427 99.92 38.044 99.18 11.1 79.587-2.285 44.648 .288Z`})}function DY({onFigure:e=!1}){return(0,X.jsxs)(`g`,{style:{fill:e?bY:vY.ink},children:[(0,X.jsx)(`rect`,{x:`-15`,y:`-11`,width:`10`,height:`22`,rx:`5`}),(0,X.jsx)(`rect`,{x:`5`,y:`-11`,width:`10`,height:`22`,rx:`5`})]})}function OY(){return(0,X.jsx)(`path`,{style:{fill:vY.cream},d:`M18.125 .621C.039 1.574-2.575 4.791 2.264 20.133 17.454 68.284 77.345 69.396 96.119 21.875 100.749 10.154 100.318 4.348 94.605 1.513 91.981 .21 37.878-.421 18.125 .621Z`})}function kY(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:vY.yellow},d:`M31.42 5.279C29.108 5.983 28.068 6.993 25.817 10.732 24.033 13.687 24.027 13.762 25.58 14.265 30.375 15.821 36.711 20.506 39.938 24.885 42.077 27.788 41.835 27.806 45.281 24.463 48.633 21.213 49.164 20.185 48.982 17.325 48.812 14.643 48.174 13.872 42.68 9.741 36.737 5.273 34.439 4.361 31.42 5.279Z`}),(0,X.jsx)(`path`,{style:{fill:vY.yellow},d:`M22.538 16.207C22.093 16.652 19.732 20.231 13.309 30.196 10.737 34.188 10.723 33.911 13.589 35.351 16.461 36.798 19.778 39.28 21.825 41.523L22.6 42.37Q23.34 43.186 24.05 42.538L24.711 41.933C31.278 35.937 38.928 28.484 38.928 28.083 38.928 24.656 24.521 14.219 22.538 16.207Z`}),(0,X.jsx)(`path`,{style:{fill:vY.cream},d:`M8.89 38.053C8.203 39.566 6.598 44.473 6.598 45.056 6.598 45.137 6.887 45.125 7.236 45.036 9.655 44.404 13.526 47.475 13.526 50.027 13.526 51.132 13.361 51.164 16.187 49.49 21.421 46.387 21.966 45.665 20.575 43.659 19.002 41.387 14.975 38.238 11.909 36.881 9.799 35.949 9.854 35.926 8.89 38.053Z`}),(0,X.jsx)(`path`,{style:{fill:vY.graphite},d:`M6.598 45.056C5.732 46.866 5.155 49.464 6.309 50.907 8.041 53.505 10.928 52.639 13.526 50.907 13.526 48.021 9.978 44.404 7.236 45.036Z`})]})}function AY(){return(0,X.jsx)(`path`,{style:{fill:vY.coral},d:`M40.804 40.625C38.238 41.462 37.291 41.953 31.169 45.625 15.743 54.871 8.047 56.158 5.879 49.856 5.501 48.754 5.501 48.754 4.843 50.913 1.673 61.302 12.377 61.671 30.386 51.796 39.649 46.719 41.142 46.647 40.81 51.291 40.565 54.775 41.168 56.135 43.486 57.31 49.556 60.387 62.035 54.816 59.605 50.116 58.502 47.983 56.1 47.882 52.163 49.799 47.082 52.273 45.983 51.652 47.998 47.449 50.89 41.416 47.686 38.376 40.804 40.625Z`})}function jY({transform:e}){return(0,X.jsx)(`path`,{style:{fill:vY.mint},transform:e,d:`M0 0C3 -2 5 -5 5 -8 5 -10.5 3 -12 0 -12S-5 -10.5 -5 -8C-5 -5 -3 -2 0 0Z`})}function MY(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:yY},d:`M25.3 17.69C14.8 19.34 10.66 20.18 9.05 20.99 5.51 22.78 4.2 27.21 6.71 28.9 7.47 29.42 8.48 29.4 10.25 28.84 12.41 28.15 12.56 27.57 11.02 25.85 10 24.71 10.53 23.62 11.79 24.27 13.9 25.36 15.02 28.98 15.63 36.66 16.18 43.48 17.33 47.43 19.69 50.49 22.76 54.48 27.69 55.73 30.31 53.19 33 50.57 31.24 46.04 28.44 48.38 26.29 50.17 26.16 47.08 28.3 45.14 29.61 43.95 30.78 43.58 38.92 41.75 39.45 41.63 39.41 41.52 38.39 40.01 36.87 37.78 36.04 35.22 34.72 28.69 33.37 22 32.04 19.3 29.5 18.07 28.69 17.68 26.59 17.49 25.3 17.69M24.11 26.51C18.61 27.67 18.16 27.82 17.98 28.55 17.64 29.91 18.54 30.44 20.51 30.05 25.4 29.08 30.11 28.03 30.49 27.83 31.65 27.23 31 25.33 29.66 25.4 29.5 25.4 27 25.91 24.11 26.51M29.2 31.42C28.64 31.54 26.23 32.07 23.85 32.58 20.01 33.41 19.48 33.57 19.15 33.96 18.67 34.5 18.66 35.05 19.12 35.63 19.61 36.26 19.86 36.23 26.05 34.88 29.05 34.23 31.53 33.7 31.57 33.7 31.82 33.7 32.34 32.88 32.34 32.5 32.34 31.25 31.37 30.92 29.2 31.42M29.79 37.19C28.81 37.41 26.45 37.94 24.53 38.37 22.62 38.8 20.84 39.23 20.58 39.33 19.61 39.71 19.35 40.62 19.98 41.41 20.48 42.05 21 41.99 27.59 40.5 33.85 39.09 34.21 38.91 33.45 37.44 33.02 36.61 32.51 36.58 29.79 37.19M45.41 41.95C44.89 42.09 41.61 42.89 38.12 43.73 30.94 45.45 29.81 45.84 31.05 46.15 33.2 46.69 34.11 50.18 32.77 52.76 32.23 53.79 32.23 54.03 32.76 54.16 33.34 54.31 45.35 51.3 46.72 50.67 50.19 49.06 51.76 45.01 49.79 42.76 48.8 41.64 47.46 41.39 45.41 41.95`}),(0,X.jsx)(`path`,{style:{fill:vY.grape},d:`M48.21 10.15C47.92 10.41 47.5 11.27 46.96 12.74 45.52 16.61 45.24 16.99 43.01 18.15 39.18 20.15 39.05 20.99 42.28 22.73 45.37 24.39 45.68 24.79 47.12 28.95 48.3 32.32 49.28 32.2 50.65 28.52 52.23 24.25 52.26 24.22 55.2 22.56 57.53 21.24 57.79 21 57.79 20.16 57.79 19.49 57.55 19.31 55.01 18.06 52.16 16.66 52.2 16.72 50.31 11.56 49.7 9.89 49.03 9.44 48.21 10.15M32.59 13.92C31.78 14.73 32.28 15.89 33.58 16.22 35.07 16.6 36.19 17.1 37.17 17.84 38.42 18.77 39.23 18.86 39.79 18.15 39.99 17.9 40.15 17.53 40.15 17.32 40.15 15.29 33.99 12.52 32.59 13.92M42.48 34.38C40.96 35.96 40.65 36.88 41.39 37.57 42.2 38.33 43.36 37.74 44.55 35.95 45.2 34.97 45.22 34.35 44.62 33.88 43.89 33.31 43.41 33.42 42.48 34.38`}),(0,X.jsx)(`path`,{style:{fill:vY.yellow},d:`M40.75 25.96C39.69 27.07 38.11 30.69 38.11 31.98 38.11 32.66 38.55 33.19 39.12 33.19 39.8 33.19 40.24 32.73 40.58 31.66 40.95 30.46 41.65 29.09 42.42 28.01 43.77 26.14 42.29 24.32 40.75 25.96M54.85 27.67C54.71 27.81 54.47 28.32 54.31 28.82 53.67 30.76 53.19 31.37 51.67 32.13 50.25 32.85 50.34 33.36 52.04 34.21 53.25 34.82 53.57 35.23 54.24 37.01 54.98 38.98 55.47 39.08 56.03 37.37 56.7 35.32 57.08 34.81 58.64 33.87 60.18 32.95 60.14 32.65 58.38 31.78 57.02 31.11 56.68 30.66 56.02 28.65 55.69 27.64 55.25 27.27 54.85 27.67`})]})}function NY(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:yY},d:`M42.24 14.07C41.52 14.24 40.53 14.54 35.06 16.26 33.33 16.8 31.2 17.47 30.34 17.74 29.47 18.01 27.86 18.52 26.75 18.88 25.64 19.23 24.03 19.74 23.16 20.01 20.16 20.94 19.45 21.4 18.97 22.71 18.71 23.44 18.45 26.33 17.83 35.41 17.64 38.25 17.44 41.03 17.41 41.58 17.32 42.77 17.24 42.69 18.79 42.84L20.01 42.95 21.98 39.97C24.69 35.88 24.85 35.82 27.05 37.9 27.9 38.7 28.43 39.08 28.61 39.02 28.76 38.96 28.91 38.91 28.94 38.91 28.98 38.91 29.38 38.38 29.84 37.73 30.3 37.08 31.47 35.48 32.43 34.17 33.4 32.86 34.86 30.85 35.67 29.71 36.49 28.56 37.5 27.29 37.91 26.88 39.73 25.07 41.01 26.43 43.32 32.67 43.76 33.84 44.3 35.28 44.52 35.86 44.74 36.44 44.97 37.28 45.04 37.74 45.19 38.71 45.17 38.71 46.63 38.03 47.69 37.53 47.77 37.46 47.68 37.02 47.58 36.52 46.97 30.64 46.79 28.41 46.73 27.69 46.62 26.43 46.53 25.61 46.44 24.79 46.24 22.87 46.09 21.32 45.61 16.44 45.5 15.66 45.22 15.12 44.72 14.15 43.59 13.76 42.24 14.07M29.38 22.45C26.04 23.47 24.49 27.62 26.6 29.91 29.17 32.7 34.15 30.16 34.16 26.05 34.16 23.38 31.9 21.68 29.38 22.45M46.7 41.5C39.3 44.23 28.33 46.04 20.1 45.88L17.21 45.82 17.16 46.88C17.08 48.22 17.33 49.03 18.01 49.68 18.73 50.37 19.73 50.35 23.77 49.53 25.46 49.19 29.12 48.47 31.91 47.93 46.31 45.14 46.9 44.99 47.57 43.91 47.95 43.3 48.25 41.29 47.99 41.15 47.91 41.11 47.33 41.26 46.7 41.5`}),(0,X.jsx)(`path`,{style:{fill:vY.coral},d:`M29.72 22.45C25.84 23.34 24.28 28.36 27.25 30.42 29.34 31.88 32.91 30.43 33.83 27.75 34.92 24.55 32.75 21.76 29.72 22.45`}),(0,X.jsx)(`path`,{style:{fill:vY.mint},d:`M12.96 14.29C12.87 14.41 12.7 15.03 12.58 15.68 12.37 16.82 11.59 18.26 11.18 18.26 11.08 18.26 10.88 18.46 10.72 18.7 10.36 19.25 10.59 19.58 11.45 19.74 12.18 19.88 13.08 20.63 13.54 21.49 14.23 22.76 14.75 22.53 15.15 20.79 15.39 19.71 15.51 19.51 16.4 18.66 17.54 17.58 17.51 17.36 16.18 16.85 15.16 16.47 14.84 16.19 14.14 15.1 13.56 14.2 13.22 13.96 12.96 14.29M49.04 24.13C48.56 24.86 48.91 25.31 50.59 26.09 53.89 27.64 54.85 29.82 53.45 32.6 52.01 35.43 46.84 38.54 40.51 40.39 39.73 40.62 38.88 40.89 38.62 40.99 37.24 41.52 30.85 42.64 27.54 42.93 20.72 43.52 13.63 42.49 10.57 40.46 5.81 37.3 7.51 32.32 14.74 28.24 15.84 27.61 16.17 27.1 15.9 26.4 15.66 25.78 15.35 25.84 13.19 26.94 6 30.61 2.97 35.32 4.95 39.74 7.86 46.21 22.78 47.8 40.05 43.46 51.97 40.47 58.57 36.38 59.47 31.43 60.09 27.97 57.74 25.34 52.93 24.12 50.6 23.53 49.43 23.54 49.04 24.13`}),(0,X.jsx)(`path`,{style:{fill:vY.grape},d:`M34.82 8.91C33.48 10.04 34.21 12.14 35.94 12.14 37.29 12.14 38.18 10.99 37.77 9.77 37.36 8.53 35.81 8.08 34.82 8.91M53.15 43.16C53 43.28 52.74 43.86 52.57 44.45 52.18 45.78 51.76 46.32 50.64 46.93 49.52 47.53 49.45 47.89 50.33 48.34 51.34 48.85 52.24 49.95 52.56 51.04 53.13 53.01 53.6 53 54.21 50.99 54.61 49.69 55.13 48.93 55.91 48.54 57.17 47.91 57.23 47.51 56.15 46.96 55.23 46.49 54.67 45.76 54.23 44.44 53.8 43.15 53.54 42.84 53.15 43.16M24.18 53.18C22.45 53.9 22.87 56.59 24.71 56.59 26.79 56.59 27.2 53.67 25.2 53.09 24.89 53.01 24.51 53.04 24.18 53.18`}),(0,X.jsx)(`path`,{style:{fill:vY.yellow},d:`M51.76 11.04C51.21 12.77 50.56 13.61 49.24 14.34 48.6 14.69 48.72 15.07 49.59 15.48 50.54 15.93 51.11 16.69 51.62 18.22 52.06 19.57 52.26 19.54 52.79 18.08 53.29 16.69 53.87 15.91 54.86 15.31 55.76 14.77 55.77 14.48 54.92 14.02 53.91 13.46 53.5 12.99 52.89 11.66 52.23 10.21 52.06 10.12 51.76 11.04M11.06 48.22C10.99 48.35 10.71 48.88 10.46 49.41 9.95 50.48 9.45 50.99 8.59 51.33 7.89 51.61 7.85 52.1 8.52 52.37 9.51 52.79 10.3 53.85 10.89 55.58 11.09 56.18 11.48 55.88 11.87 54.84 12.24 53.87 13.33 52.56 13.79 52.56 14 52.56 14.5 52.06 14.5 51.85 14.5 51.77 14.19 51.54 13.81 51.34 12.98 50.92 12.36 50.14 11.93 48.99 11.6 48.09 11.31 47.83 11.06 48.22`})]})}function PY(){return(0,X.jsxs)(`g`,{transform:`translate(2 8) scale(.114) translate(-125 -122)`,children:[(0,X.jsx)(`path`,{style:{fill:vY.coral},d:`M278 155 482 123C517 117 527 135 530 167L542 309Q543 329 561 341L631 404Q649 419 646 444 645 465 623 472L407 521Q374 531 345 519L156 436Q115 418 128 375L221 191Q238 163 278 155Z`}),(0,X.jsx)(`path`,{style:{fill:vY.ink},d:`M317 183 461 161Q493 155 497 188L504 288Q508 320 478 326L318 356Q289 362 286 331L281 226Q278 194 317 183Z`}),(0,X.jsx)(`path`,{style:{fill:vY.cream},d:`M304 386 553 340Q562 337 570 346L631 404Q649 419 646 444Q645 448 629 452L411 483Q382 492 367 474Z`}),(0,X.jsxs)(`g`,{style:{fill:vY.cream},children:[(0,X.jsx)(`rect`,{x:`319`,y:`236`,width:`26`,height:`59`,rx:`13`}),(0,X.jsx)(`rect`,{x:`364`,y:`229`,width:`26`,height:`59`,rx:`13`})]}),(0,X.jsxs)(`g`,{style:{fill:vY.ink},transform:`rotate(-11 470 411)`,children:[(0,X.jsx)(`rect`,{x:`369`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`444`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`518`,y:`380`,width:`57`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`392`,y:`421`,width:`58`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`462`,y:`421`,width:`65`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`539`,y:`421`,width:`58`,height:`25`,rx:`13`})]})]})}function FY(){return(0,X.jsxs)(`g`,{transform:`translate(3 10) scale(.114) translate(-760 -140)`,children:[(0,X.jsx)(`path`,{style:{fill:vY.blue},d:`M1226 153C1257 153 1273 195 1267 231Q1263 265 1237 268L1176 270V215C1176 178 1195 153 1226 153Z`}),(0,X.jsx)(`path`,{style:{fill:vY.blue},d:`M824 376Q908 372 871 400C842 427 866 442 902 450L1113 480Q1188 479 1199 392C1207 447 1204 497 1163 511Q1134 521 1097 516C1055 510 991 507 957 507S869 511 826 512C781 513 758 483 760 441Q760 385 824 376Z`}),(0,X.jsx)(`path`,{style:{fill:vY.cream},d:`M824 376 857 184Q864 133 911 141C1039 169 1124 151 1226 153Q1179 159 1184 241L1199 377C1202 434 1174 482 1117 480L902 450C864 445 849 429 871 400Q908 372 824 376Z`}),(0,X.jsxs)(`g`,{style:{fill:vY.coral},children:[(0,X.jsx)(`path`,{d:`M982 198C1008 190 1030 197 1028 220L1023 265Q1020 295 1000 279C981 261 951 223 963 210Q970 202 982 198Z`}),(0,X.jsx)(`path`,{d:`M1063 220C1077 215 1100 237 1102 251Q1107 267 1084 282L1063 295Q1037 307 1040 278L1045 245Q1049 224 1063 220Z`}),(0,X.jsx)(`path`,{d:`M911 252C925 240 939 254 957 269L978 291Q995 311 961 316C938 318 907 316 898 308Q884 296 911 252Z`}),(0,X.jsx)(`path`,{d:`M1106 289Q1127 281 1134 304C1142 327 1146 352 1125 350Q1097 348 1073 335C1051 324 1072 311 1084 302Z`}),(0,X.jsx)(`path`,{d:`M927 338C946 334 972 334 985 343Q1004 353 984 384C970 408 957 418 940 403C922 389 896 356 913 345Z`}),(0,X.jsx)(`path`,{d:`M1010 375Q1025 363 1037 384C1049 407 1064 438 1044 442Q1025 448 1002 436C984 428 991 410 997 393Z`}),(0,X.jsx)(`path`,{d:`M1068 357C1084 359 1110 376 1120 389Q1130 402 1107 419C1090 432 1082 418 1073 401C1062 383 1043 355 1068 357Z`}),(0,X.jsx)(`path`,{d:`M1018 311C1037 312 1050 334 1034 343C1018 351 998 337 1005 320Q1009 311 1018 311Z`})]})]})}function IY(){return(0,X.jsxs)(`g`,{transform:`translate(2 7) scale(.11) translate(-1380 -96)`,children:[(0,X.jsx)(`path`,{style:{fill:vY.inkcap},d:`M1384 276C1394 238 1445 200 1497 158C1547 119 1604 97 1647 97C1690 97 1720 109 1745 138C1772 170 1791 184 1833 194C1870 201 1919 220 1922 257C1923 307 1891 339 1853 336C1801 335 1767 299 1701 294C1666 291 1620 294 1642 303Q1670 307 1675 333C1681 367 1697 389 1717 413C1735 434 1738 443 1719 464C1700 485 1692 502 1686 520Q1682 541 1653 541L1626 541Q1598 541 1594 519C1590 495 1578 474 1563 458C1545 440 1544 429 1559 410C1585 377 1608 337 1572 326C1554 320 1529 333 1506 340C1461 356 1428 357 1402 340Q1371 319 1384 276Z`}),(0,X.jsx)(`path`,{style:{fill:vY.cream},d:`M1634 362Q1641 346 1649 362C1660 390 1676 404 1705 424Q1721 435 1704 453C1685 475 1677 490 1671 513Q1670 526 1653 525L1626 525Q1611 525 1610 513C1606 492 1592 465 1575 449Q1562 437 1577 424C1604 404 1620 390 1634 362Z`}),(0,X.jsx)(`path`,{style:{fill:vY.inkcap},d:`M1634 456A18 18 0 1 1 1648 456V492Q1648 500 1641 500T1634 492Z`}),(0,X.jsx)(`path`,{style:{fill:vY.inkcap},d:`M1780 391Q1786 386 1793 396C1810 420 1828 444 1827 467C1826 508 1768 510 1753 480C1741 456 1762 413 1780 391Z`})]})}var{coral:LY,blue:RY,mint:zY,grape:BY,yellow:VY,cream:HY,ink:UY}=vY,WY={bonsai:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:zY,strokeWidth:`3.7`,strokeLinecap:`round`,d:`M35 27.5C36 25 35.5 22.5 34 21S31.5 17.5 31.5 14M36 27C40 26.8 43 26 45 24S47 20.5 47.5 18.5M30.5 31C32.5 26.5 30.5 24.6 26.5 24 22 23.5 18.5 21.6 16.8 18.5M29 37C26.5 34.5 25 33.7 21.5 33.2S15.5 32 13 31.6M36 39.5C38 38 40 37.5 42 36.5S47 34 51 32.2`}),(0,X.jsx)(`path`,{fill:zY,d:`M25.5 43.5C28 40.5 28 37 27.5 33 27.3 29.5 29.5 27 33.5 26.3L37.5 26V29.5C35 29.8 34.2 31.5 34.3 34 34.5 37.5 37 39.5 41 43.5Z`}),(0,X.jsx)(`circle`,{fill:RY,cx:`31.5`,cy:`10.7`,r:`4.8`}),(0,X.jsx)(`circle`,{fill:BY,cx:`16.6`,cy:`18.3`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:VY,cx:`47.9`,cy:`17.7`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:VY,cx:`12.8`,cy:`31.5`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:RY,cx:`50.9`,cy:`32.1`,r:`4.6`}),(0,X.jsx)(`path`,{fill:LY,d:`M16 46H47.5C47.5 54 44 58 38 58H25.5C19.5 58 16 54 16 46Z`}),(0,X.jsx)(`rect`,{fill:LY,x:`14`,y:`43`,width:`35.5`,height:`4.6`,rx:`2.3`})]}),computer:(0,X.jsx)(PY,{}),prints:(0,X.jsx)(FY,{}),inkcap:(0,X.jsx)(IY,{}),vishnu:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:LY},d:`M6 37C6 21 17.5 9 32 9s26 12 26 28c0 2.2-1.8 4-4 4H10c-2.2 0-4-1.8-4-4Z`}),(0,X.jsx)(`circle`,{style:{fill:HY},cx:`19`,cy:`25`,r:`4`}),(0,X.jsx)(`circle`,{style:{fill:HY},cx:`33`,cy:`19.5`,r:`4.8`}),(0,X.jsx)(`circle`,{style:{fill:HY},cx:`46`,cy:`28`,r:`3.4`}),(0,X.jsx)(`rect`,{style:{fill:RY},x:`13`,y:`39`,width:`38`,height:`18`,rx:`9`}),(0,X.jsx)(`rect`,{style:{fill:HY},x:`18.5`,y:`46.2`,width:`10`,height:`3.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{style:{fill:HY},x:`21.7`,y:`43`,width:`3.6`,height:`10`,rx:`1.8`}),(0,X.jsx)(`circle`,{style:{fill:VY},cx:`39`,cy:`50.5`,r:`2.7`}),(0,X.jsx)(`circle`,{style:{fill:HY},cx:`45`,cy:`45.5`,r:`2.7`})]}),generateText:(0,X.jsx)(MY,{}),generateMedia:(0,X.jsx)(NY,{}),buyApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`circle`,{fill:VY,cx:`32`,cy:`20`,r:`12`}),(0,X.jsx)(`circle`,{stroke:HY,strokeWidth:`4`,cx:`32`,cy:`20`,r:`6`}),(0,X.jsx)(xY,{fill:VY,transform:`translate(15.5 12) rotate(-60) scale(1.1 .85)`}),(0,X.jsx)(xY,{fill:VY,transform:`translate(48.5 12) rotate(60) scale(1.1 .85)`}),(0,X.jsx)(`path`,{fill:RY,d:`M10 35H54L50 53Q49 58 44 58H20Q15 58 14 53Z`}),(0,X.jsx)(`rect`,{fill:LY,x:`5`,y:`27`,width:`54`,height:`10`,rx:`5`}),(0,X.jsxs)(`g`,{fill:HY,children:[(0,X.jsx)(`rect`,{x:`20`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`29.5`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`39`,y:`41`,width:`5`,height:`11`,rx:`2.5`})]})]}),browseBazaar:(0,X.jsxs)(`g`,{transform:`rotate(-5 32 32)`,children:[(0,X.jsx)(`rect`,{fill:RY,x:`10`,y:`14`,width:`44`,height:`38`,rx:`6`}),(0,X.jsx)(`rect`,{fill:RY,x:`5`,y:`47`,width:`54`,height:`12`,rx:`6`}),(0,X.jsx)(`rect`,{fill:HY,x:`12`,y:`50.5`,width:`40`,height:`4.5`,rx:`2.25`}),(0,X.jsx)(`rect`,{fill:LY,x:`2`,y:`4`,width:`60`,height:`9`,rx:`4.5`}),(0,X.jsx)(`path`,{fill:LY,d:`M3 9H14.6V18A5.8 5.8 0 0 1 3 18Z`}),(0,X.jsx)(`path`,{fill:HY,d:`M14.6 9H26.2V18A5.8 5.8 0 0 1 14.6 18Z`}),(0,X.jsx)(`path`,{fill:LY,d:`M26.2 9H37.8V18A5.8 5.8 0 0 1 26.2 18Z`}),(0,X.jsx)(`path`,{fill:HY,d:`M37.8 9H49.4V18A5.8 5.8 0 0 1 37.8 18Z`}),(0,X.jsx)(`path`,{fill:LY,d:`M49.4 9H61V18A5.8 5.8 0 0 1 49.4 18Z`}),(0,X.jsx)(`g`,{transform:`translate(32 36.5) scale(.34)`,children:(0,X.jsx)(wY,{})})]}),agent:(0,X.jsxs)(`g`,{transform:`translate(32 33) scale(2.02) translate(-47.2 -41.8)`,children:[(0,X.jsx)(`path`,{fill:RY,d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,X.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,X.jsx)(DY,{})})]}),list:(0,X.jsxs)(`g`,{transform:`rotate(-7 32 32)`,children:[(0,X.jsx)(`path`,{style:{fill:RY},d:`M12 13Q6 13 6 19V50Q6 57 13 57H47Q53 57 53 50V20Q53 13 47 13Z`}),(0,X.jsx)(`path`,{style:{fill:HY},d:`M19 7H39Q42 7 44 9L55 20Q57 22 57 26V44Q57 50 51 50H19Q13 50 13 44V13Q13 7 19 7Z`}),(0,X.jsx)(`path`,{style:{fill:LY},d:`M39 7V18Q39 24 45 24H57Q57 22 55 20L44 9Q42 7 39 7Z`}),(0,X.jsxs)(`g`,{style:{fill:LY},children:[(0,X.jsx)(`circle`,{cx:`22`,cy:`21`,r:`3`}),(0,X.jsx)(`circle`,{cx:`22`,cy:`31`,r:`3`}),(0,X.jsx)(`circle`,{cx:`22`,cy:`41`,r:`3`})]}),(0,X.jsx)(`path`,{style:{stroke:RY},strokeWidth:`5`,strokeLinecap:`round`,d:`M31 21H32M31 31H46M31 41H42`})]}),chat:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`g`,{transform:`translate(3 11) scale(.22) translate(-449 -327)`,children:(0,X.jsx)(TY,{})}),(0,X.jsx)(xY,{transform:`translate(38.2 18) rotate(16) scale(.95 .6)`}),(0,X.jsx)(xY,{transform:`translate(44.4 20.5) rotate(47) scale(.95 .6)`})]}),read:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`g`,{transform:`translate(4 20.5) scale(.56)`,children:(0,X.jsx)(CY,{})}),(0,X.jsx)(`g`,{transform:`translate(32 38.6) scale(.3164)`,children:(0,X.jsx)(wY,{})}),(0,X.jsx)(SY,{})]}),readConversations:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(.9) translate(-32 -32)`,children:[(0,X.jsx)(`g`,{transform:`translate(4 7.88) scale(.56)`,children:(0,X.jsx)(EY,{fill:RY})}),(0,X.jsx)(`g`,{transform:`translate(32.2 30.3) scale(.352)`,children:(0,X.jsx)(wY,{})})]}),listAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.04) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:yY},d:`M32.059 10.146C23.878 10.646 18.949 14.844 18.925 21.331 18.912 24.856 20.167 27.259 22.274 27.74 24.437 28.233 26.097 29.061 27.481 30.337 28.275 31.068 28.328 31.096 29.352 31.306 31.161 31.677 31.653 32.094 32.115 33.651 32.392 34.582 32.557 34.868 32.915 35.041 33.919 35.523 35.864 33.733 36.539 31.706L36.775 30.997 38.008 30.681C42.663 29.489 45.29 26.142 45.468 21.176 45.734 13.784 40.673 9.62 32.059 10.146Z`}),(0,X.jsx)(`g`,{transform:`translate(32.4 21.2) scale(.39)`,children:(0,X.jsx)(DY,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:LY},d:`M14.375 27.586C8.014 28.591 4.363 32.396 4.355 38.027 4.347 43.93 8.071 47.469 15.239 48.368L16.828 48.568 17.873 49.568C19.854 51.464 22.469 52.496 23.691 51.864 24.384 51.506 24.431 51.044 23.924 49.606 23.337 47.943 23.479 47.492 24.749 46.977 32.756 43.73 32.643 31.899 24.573 28.49 22.238 27.504 17.535 27.087 14.375 27.586Z`}),(0,X.jsx)(`g`,{transform:`translate(17.6 37.7) scale(.38 .36)`,children:(0,X.jsx)(DY,{})}),(0,X.jsx)(`path`,{style:{fill:RY},d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,X.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,X.jsx)(DY,{})})]}),createAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:yY},d:`M20.436 24.499C13.35 25.216 7.504 28.799 5.442 33.687 3.114 39.208 4.438 45.791 8.593 49.358 10.446 50.949 10.34 50.831 10.34 51.301 10.34 51.796 10.106 52.294 9.281 53.558 7.191 56.76 12.108 56.905 16.701 53.777 17.517 53.221 17.715 53.135 18.015 53.201 20.013 53.639 25.739 53.051 28.595 52.113 35.47 49.857 39.129 44.162 37.83 37.738C37 31 33 26 26.717 24.428L24.075 24.413C22.623 24.405 20.985 24.444 20.436 24.499Z`}),(0,X.jsx)(`g`,{transform:`translate(21.9 40) scale(.46 .43)`,children:(0,X.jsx)(DY,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:zY},d:`M37.987 15.734C32.277 16.627 28.675 20.713 28.92 26.022 29.062 29.118 30.627 31.606 33.331 33.036 34.675 33.747 34.761 34.018 34.237 35.923 33.376 39.051 36.878 38.551 39.174 35.218 39.574 34.637 39.65 34.583 40.058 34.583 46.203 34.583 50.414 30.91 50.424 25.543 50.435 18.989 44.932 14.649 37.987 15.734Z`}),(0,X.jsx)(`g`,{transform:`translate(38.9 24.9) scale(.31)`,children:(0,X.jsx)(DY,{})}),(0,X.jsx)(xY,{fill:VY,transform:`translate(48.1 15.7) rotate(31) scale(1.25 .85)`}),(0,X.jsx)(xY,{fill:VY,transform:`translate(52.2 19.8) rotate(70) scale(1.25 .85)`})]}),sendPrompts:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`g`,{transform:`translate(4 13.2) scale(.412 .436)`,children:(0,X.jsx)(EY,{fill:LY})}),(0,X.jsx)(`g`,{transform:`translate(17.1 28.7) scale(.19)`,children:(0,X.jsx)(OY,{})}),(0,X.jsx)(xY,{fill:zY,transform:`translate(48.1 26.4) rotate(65) scale(1.7 1.28)`}),(0,X.jsx)(xY,{fill:zY,transform:`translate(48.4 33.8) rotate(110) scale(1.7 1.28)`})]}),write:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(kY,{}),(0,X.jsx)(AY,{})]}),run:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{style:{fill:RY},x:`6`,y:`9`,width:`52`,height:`43`,rx:`7`}),(0,X.jsx)(`path`,{style:{stroke:HY},strokeWidth:`5`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m17 22 9 8-9 8m17 0h12`})]}),connected:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,style:{stroke:RY},strokeWidth:`12`,strokeLinecap:`round`,d:`M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:LY},strokeWidth:`12`,strokeLinecap:`round`,d:`M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10`}),(0,X.jsx)(`path`,{style:{stroke:VY},strokeWidth:`4`,strokeLinecap:`round`,d:`m27 4 2 6m10-5-2 7m12 0-5 4`})]}),working:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{style:{fill:zY},cx:`23`,cy:`14`,rx:`13`,ry:`8`,transform:`rotate(-30 23 14)`}),(0,X.jsx)(`ellipse`,{style:{fill:VY},cx:`48`,cy:`36`,rx:`13`,ry:`8`,transform:`rotate(35 48 36)`}),(0,X.jsx)(`ellipse`,{style:{fill:BY},cx:`22`,cy:`48`,rx:`13`,ry:`8`,transform:`rotate(45 22 48)`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:yY},strokeWidth:`3`,strokeLinecap:`round`,d:`M42 8q13 2 13 13M43 55q-5 5-12 4M5 39q-5-9 1-17`})]}),complete:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:zY},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:UY},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m23 29 7 7 13-15`}),(0,X.jsx)(`path`,{style:{stroke:yY},strokeWidth:`3`,strokeLinecap:`round`,d:`m4 8 5 6m48-4 5-5M2 24l6 1`})]}),installApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`rect`,{style:{fill:RY},x:`9`,y:`26`,width:`46`,height:`32`,rx:`10`}),(0,X.jsx)(`rect`,{style:{fill:HY},x:`17`,y:`33`,width:`30`,height:`18`,rx:`5`}),(0,X.jsx)(`path`,{style:{fill:zY},d:`M22 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{fill:BY},d:`M34 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{stroke:LY},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M32 4v17m-8-7 8 8 8-8`})]}),restricted:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,style:{stroke:LY},strokeWidth:`9`,strokeLinecap:`round`,d:`M16 23V19q0-17 16-17t16 17v4`}),(0,X.jsx)(`rect`,{style:{fill:LY},x:`8`,y:`26`,width:`48`,height:`36`,rx:`9`}),(0,X.jsx)(`path`,{style:{fill:HY},d:`M32 34a7 7 0 0 0-4 13v7h8v-7a7 7 0 0 0-4-13Z`})]}),error:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:LY},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:HY},strokeWidth:`7`,strokeLinecap:`round`,d:`M32 18v15`}),(0,X.jsx)(`circle`,{style:{fill:HY},cx:`32`,cy:`45`,r:`4`})]}),trellis:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`g`,{fill:VY,children:[(0,X.jsx)(`rect`,{x:`17.25`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,X.jsx)(`rect`,{x:`42.95`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`18`,width:`3.2`,height:`26`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`15.75`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`28.85`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`42.55`,width:`34.4`,height:`3.1`,rx:`1.55`})]}),(0,X.jsx)(`path`,{fill:`none`,stroke:zY,strokeWidth:`3`,strokeLinecap:`round`,d:`M21.9 56.1C31.5 54.4 32.9 47 32.1 45.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:zY,strokeWidth:`3`,strokeLinecap:`round`,d:`M32 44.2C28.7 41.8 25.2 35.7 32 32.3 38.8 28 38.9 24 31.9 18.8 32.4 16.3 32.8 14.7 34.5 12.2`}),(0,X.jsx)(jY,{transform:`translate(32.1 14.1) rotate(45) scale(0.45 0.86)`}),(0,X.jsx)(jY,{transform:`translate(32.2 14.7) rotate(-60) scale(0.42 0.58)`}),(0,X.jsx)(jY,{transform:`translate(34.8 28.3) rotate(65) scale(0.38 0.8)`}),(0,X.jsx)(jY,{transform:`translate(28.2 33.1) rotate(-51) scale(0.5 0.57)`}),(0,X.jsx)(jY,{transform:`translate(28.6 53.3) rotate(-48) scale(0.47 0.6)`}),(0,X.jsx)(`circle`,{fill:LY,cx:`31.9`,cy:`18.8`,r:`4`}),(0,X.jsx)(`circle`,{fill:RY,cx:`32`,cy:`32.3`,r:`4`}),(0,X.jsx)(`circle`,{fill:BY,cx:`32`,cy:`44.2`,r:`4`})]}),games:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:RY,d:`M18.5 28.5H45.5C49.5 29.5 53 32 54 35 55 37.5 56.8 45.5 56.6 48 56.5 53 52.5 57.5 47 58H15C9.5 56.5 6.6 51 7.6 45.5 8.6 39.5 9.3 35 10.5 33 12 31 14.5 29.5 18.5 28.5Z`}),(0,X.jsx)(`ellipse`,{fill:HY,cx:`26.8`,cy:`37.9`,rx:`9.1`,ry:`5.6`}),(0,X.jsx)(`ellipse`,{fill:UY,cx:`27`,cy:`37.6`,rx:`4.7`,ry:`2.2`}),(0,X.jsx)(`path`,{fill:UY,d:`M23.1 26V35.4A4 4.2 0 0 0 31.1 35.4V26Z`}),(0,X.jsx)(`circle`,{fill:LY,cx:`27.1`,cy:`18.3`,r:`12.4`}),(0,X.jsx)(`circle`,{fill:HY,cx:`22.6`,cy:`14.3`,r:`3.05`}),(0,X.jsx)(`ellipse`,{fill:VY,cx:`45.1`,cy:`37.2`,rx:`5.6`,ry:`3.95`}),(0,X.jsx)(`ellipse`,{fill:HY,cx:`40.1`,cy:`46.6`,rx:`6.2`,ry:`4.4`})]}),oyster:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:BY,d:`M35.5 6C33.7 6.3 32.3 7.6 31.4 9.4 30.9 10.3 30.4 10.3 29.5 10 25.5 9 20.6 11.6 19.6 15.9 19.4 16.6 19 17 18 17.1 14.5 17.6 12 20.6 12.1 24.2 12.2 25.4 12 25.9 11.5 26.5 7.5 30 10.5 34.5 17.5 34.4 15.3 32.6 16 31 19 29 26 24 37 19.5 43.5 19 46 19 46 22 43 25.5 46.5 23.5 51.5 18.5 53.5 15 55 11 50 7 45 9 43.8 9.4 43.3 9.2 42.5 8 40.7 6.3 38 5.6 35.5 6Z`}),(0,X.jsx)(`circle`,{fill:HY,cx:`34.9`,cy:`41.9`,r:`11.3`}),(0,X.jsxs)(`g`,{fill:UY,children:[(0,X.jsx)(`rect`,{x:`29.9`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`}),(0,X.jsx)(`rect`,{x:`36.7`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`})]}),(0,X.jsx)(`path`,{fill:BY,d:`M49.5 39C47.9 39.3 46.5 40 46.1 41.6 45.8 43.2 45.5 43.5 44 43.5 38.5 43.5 35 48 39 49.5 40 50 39.5 50.5 38 51 35.5 52.5 32.5 52 30 51 29 50.5 28.5 50 29.5 50 33 47.5 30 43.5 24.5 43.5 23.3 43.5 22.9 43.3 22.5 43 20.5 40.5 19 40 17.5 39.5 13 39.5 13 44 17 47.5 18.3 48.4 18.6 48.7 19 49.5 20.5 53 23 55 26 55 26.8 55 27 55.3 27.5 56 31 58.5 36.5 58.5 40 56 40.8 55.2 41.2 55 42 55 45 55 47.5 53 49 49.5 49.6 48.5 50 48 50.5 47.5 56 43.5 55 38.5 49.5 39Z`}),(0,X.jsx)(`path`,{fill:`none`,stroke:VY,strokeWidth:`3`,strokeLinecap:`round`,d:`M46.6 31.8 49.2 27.8 M49.4 35.5 52.8 33.7 M21.5 32.5 22.9 33.5 M19.3 37.5 21.1 38.1`})]}),tourtois:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:HY,x:`11.07`,y:`35.73`,width:`26.8`,height:`9.7`,rx:`3.25`,transform:`rotate(-5 24.47 40.58)`}),(0,X.jsx)(`path`,{fill:VY,d:`M14.8 16C19 14.6 23 13.5 26.5 12.6 28.4 12.1 29.6 13.4 30.1 15.3L31.6 21 17.4 37.6C13.8 38.2 10.6 37.8 10.1 35.4L9.2 27.8C9.1 26.1 10.1 24.7 11.6 24.1 11.4 22.4 11.4 20.6 11.8 19.1 12.3 17.4 13.3 16.5 14.8 16Z`}),(0,X.jsx)(`path`,{fill:LY,d:`M14.0 24.1Q13.3 21.2 16.2 20.4L30.7 16.2Q33.6 15.4 34.6 18.2L36.0 22.7Q37.0 25.5 34.7 27.4L20.2 39.7Q17.9 41.6 17.2 38.7Z`}),(0,X.jsx)(`path`,{fill:RY,d:`M21 23.4 35.5 20.6C37.3 20.2 38.6 21 38.9 22.6L40 34.5C40.1 36.2 39.1 37.3 37.5 37.7 32.6 39.9 26 41 21 41 16 41 12.2 40.2 11 38.8 10.4 37.6 10.8 36.4 12.4 37L19.6 38.4 18.4 27C18.2 25.2 19.3 23.7 21 23.4Z`}),(0,X.jsx)(`path`,{fill:HY,d:`M22.8 29.6 34.8 26.9C36.2 26.6 37 27.3 37.2 28.6L37.9 33C38.1 34.2 37.5 35 36.3 35.3L24.3 37.8C23 38.1 22.3 37.5 22.1 36.3L21.3 31.6C21.1 30.6 21.7 29.8 22.8 29.6Z`}),(0,X.jsxs)(`g`,{fill:HY,children:[(0,X.jsx)(`circle`,{cx:`14.7`,cy:`18.45`,r:`1`}),(0,X.jsx)(`circle`,{cx:`17.6`,cy:`17.65`,r:`1`}),(0,X.jsx)(`circle`,{cx:`20.5`,cy:`16.85`,r:`1`}),(0,X.jsx)(`circle`,{cx:`17.9`,cy:`22.2`,r:`1`}),(0,X.jsx)(`circle`,{cx:`21`,cy:`21.5`,r:`1`}),(0,X.jsx)(`circle`,{cx:`24.1`,cy:`20.75`,r:`1`}),(0,X.jsx)(`circle`,{cx:`28.2`,cy:`25.3`,r:`1`})]}),(0,X.jsx)(`circle`,{fill:LY,cx:`21.7`,cy:`26.6`,r:`1`}),(0,X.jsx)(`circle`,{fill:VY,cx:`24.9`,cy:`25.9`,r:`1.05`}),(0,X.jsxs)(`g`,{fill:zY,children:[(0,X.jsx)(`ellipse`,{cx:`8.8`,cy:`36.6`,rx:`3.6`,ry:`1.9`,transform:`rotate(22 8.8 36.6)`}),(0,X.jsx)(`path`,{d:`M12 41C10 41.5 7.5 44.5 7 46.5 7 48 8.5 49.5 10.5 50 12.5 50.5 13.5 50 15 48 15.5 47 16.5 47.5 19 50 22 49.5 22 46.5 22 45.5 20.5 45.5 17 45 16.5 44.5 16.5 44 16.5 42 13.5 40.5 12 41Z`}),(0,X.jsx)(`path`,{d:`M40 33C39 38 36 42 34.5 41.5 32.5 40.5 29.5 42 28.5 44 26 49 27.5 51.5 32.5 51 36 51 37 50 36 46.5 36 45 37 44.5 38 44.5 38.5 45.5 40.5 49 43.5 50 46.5 47.5 47.5 46.5 46 43.5 44 42 43 41.5 43.5 40.5 44.5 39.5 46 38 47 37.5L47 33Z`})]}),(0,X.jsx)(`ellipse`,{fill:zY,cx:`46.4`,cy:`30.6`,rx:`8.1`,ry:`8.3`}),(0,X.jsxs)(`g`,{fill:UY,children:[(0,X.jsx)(`rect`,{x:`45.05`,y:`26.95`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 46.2 29.3)`}),(0,X.jsx)(`rect`,{x:`49.25`,y:`26.4`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 50.4 28.7)`})]}),(0,X.jsx)(`path`,{fill:LY,d:`M46.8 32.2H51C51 34.3 50 35.4 48.9 35.4S46.8 34.3 46.8 32.2Z`,transform:`rotate(-8 48.9 33.5)`}),(0,X.jsx)(`path`,{fill:`none`,stroke:VY,strokeWidth:`3`,strokeLinecap:`round`,d:`M50.9 17.7 50.5 19.7 M55.2 20.1 53.4 21.9 M56.5 24.5 55.7 24.7`})]}),allApps:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:LY,x:`7`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 18.6 18.6)`}),(0,X.jsx)(`rect`,{fill:RY,x:`33.9`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 45.5 18.6)`}),(0,X.jsx)(`rect`,{fill:zY,x:`7`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 18.6 45.5)`}),(0,X.jsx)(`rect`,{fill:VY,x:`33.9`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 45.5 45.5)`})]}),search:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:RY,strokeWidth:`6.5`,d:`M37 37.5 43 43.5`}),(0,X.jsx)(`path`,{fill:`none`,stroke:LY,strokeWidth:`12.6`,strokeLinecap:`round`,d:`M44.2 43.8 51.4 51.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:VY,strokeWidth:`3`,strokeLinecap:`round`,d:`M47.2 42.4 52.8 47.8`}),(0,X.jsx)(`ellipse`,{fill:RY,cx:`25.6`,cy:`24.6`,rx:`19.25`,ry:`18.6`}),(0,X.jsx)(`ellipse`,{fill:HY,cx:`25.2`,cy:`24.1`,rx:`14.2`,ry:`13.6`})]}),browser:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:LY,x:`5.9`,y:`6.15`,width:`52.2`,height:`51.7`,rx:`5.5`}),(0,X.jsx)(`path`,{fill:HY,d:`M10 16.5H29.4C30.3 16.1 31 14.4 31.8 12.5 32.5 10.9 33.2 10 34.5 10H52.2C53.4 10 54 10.7 54 12V16.5C55.2 16.5 56 17.1 56 18.3V52.4C56 53.7 55.1 54.6 53.8 54.6H10.2C8.9 54.6 8 53.7 8 52.4V18.2C8 17.1 8.7 16.5 10 16.5Z`}),(0,X.jsx)(`circle`,{fill:VY,cx:`12.2`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:RY,cx:`18.6`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:BY,cx:`25.1`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:zY,cx:`32`,cy:`34.9`,r:`14.5`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:HY,strokeWidth:`3`,children:[(0,X.jsx)(`ellipse`,{cx:`32`,cy:`34.9`,rx:`7.7`,ry:`13.3`}),(0,X.jsx)(`path`,{d:`M17.5 34.9H46.5`})]})]}),internet:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:`none`,stroke:VY,strokeWidth:`4.4`,cx:`32.2`,cy:`30.2`,rx:`25.6`,ry:`8.1`,transform:`rotate(-20.8 32.2 30.2)`}),(0,X.jsx)(`circle`,{fill:RY,cx:`32`,cy:`32`,r:`21.1`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:HY,strokeWidth:`3`,children:[(0,X.jsx)(`ellipse`,{cx:`32`,cy:`31.8`,rx:`12.2`,ry:`18.7`}),(0,X.jsx)(`path`,{d:`M32 13.1V50.5M15 20.4Q32 29 49 20.4M12.5 39Q32 44.6 51.5 39`})]}),(0,X.jsx)(`path`,{fill:`none`,stroke:VY,strokeWidth:`4.4`,d:`M6.6 30.2A25.6 8.1 0 0 0 57.8 30.2`,transform:`rotate(-20.8 32.2 30.2)`})]}),members:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`circle`,{fill:RY,cx:`41.9`,cy:`22.85`,r:`12.2`}),(0,X.jsx)(`path`,{fill:RY,d:`M36 34C33.8 34.8 32.2 35.8 31 37 37.5 39.5 40.5 43.5 40.5 49.5V53.5H54.5C57 53.5 58 51 58 47.5 58 40 55 35.5 49 34Z`}),(0,X.jsx)(`circle`,{fill:LY,cx:`22.95`,cy:`27.6`,r:`12.85`}),(0,X.jsx)(`path`,{fill:LY,d:`M15.5 38C10.5 39 7.5 42.5 6.5 47 5.5 50.5 6 53.5 8.5 53.5H38.5C42 52 40 43 36 40 34.5 39 32 38 31 38Z`}),(0,X.jsxs)(`g`,{fill:UY,children:[(0,X.jsx)(`circle`,{cx:`18.3`,cy:`28`,r:`1.6`}),(0,X.jsx)(`circle`,{cx:`27.9`,cy:`28`,r:`1.6`}),(0,X.jsx)(`circle`,{cx:`39.1`,cy:`23.05`,r:`1.55`}),(0,X.jsx)(`circle`,{cx:`47.25`,cy:`23.05`,r:`1.55`})]})]}),sell:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:VY,d:`M6.4 41.2V48.4C6.4 51.4 13.2 54 21.8 54S37.2 51.4 37.2 48.4V41.2C37.2 37.8 30.4 35 21.8 35S6.4 37.8 6.4 41.2Z`}),(0,X.jsx)(`ellipse`,{fill:HY,cx:`21.9`,cy:`40.8`,rx:`13.2`,ry:`3.6`}),(0,X.jsxs)(`g`,{transform:`rotate(-3 22.5 30) translate(0.5 0)`,children:[(0,X.jsx)(`path`,{fill:VY,d:`M7.5 26V34C7.5 37.3 14.2 40 22.5 40S37.5 37.3 37.5 34V26C37.5 22.7 30.8 20 22.5 20S7.5 22.7 7.5 26Z`}),(0,X.jsx)(`ellipse`,{fill:HY,cx:`23.7`,cy:`26.55`,rx:`13.05`,ry:`4.4`})]}),(0,X.jsxs)(`g`,{transform:`translate(46.3 40.3) rotate(-25)`,children:[(0,X.jsx)(`path`,{fill:LY,d:`M-8.5-10Q-8.5-12-7-13L-1.5-16.3Q0-17.2 1.5-16.3L7-13Q8.5-12 8.5-10V9Q8.5 12 5.5 12H-5.5Q-8.5 12-8.5 9Z`}),(0,X.jsx)(`circle`,{fill:HY,cx:`0`,cy:`-10.7`,r:`2.2`})]}),(0,X.jsx)(xY,{fill:VY,transform:`translate(38.2 18.6) scale(1.1 .86)`}),(0,X.jsx)(xY,{fill:VY,transform:`translate(42.8 21.2) rotate(45) scale(1.1 .85)`})]}),schedule:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:HY,x:`6`,y:`11`,width:`47.6`,height:`44`,rx:`6`}),(0,X.jsx)(`path`,{fill:LY,d:`M12 11H47.6Q53.6 11 53.6 17V21.5H6V17Q6 11 12 11Z`}),(0,X.jsxs)(`g`,{fill:HY,children:[(0,X.jsx)(`circle`,{cx:`16.1`,cy:`16.15`,r:`3.4`}),(0,X.jsx)(`circle`,{cx:`43.4`,cy:`16.15`,r:`3.4`})]}),(0,X.jsxs)(`g`,{fill:RY,children:[(0,X.jsx)(`rect`,{x:`13.6`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`40.9`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`})]}),(0,X.jsxs)(`g`,{fill:zY,children:[(0,X.jsx)(`rect`,{x:`11.1`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`11.1`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,X.jsxs)(`g`,{fill:BY,children:[(0,X.jsx)(`rect`,{x:`40.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`11.1`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,X.jsx)(`circle`,{fill:VY,cx:`45.5`,cy:`45.6`,r:`12.2`}),(0,X.jsx)(`path`,{fill:`none`,stroke:UY,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M45.1 39.3V46.2L51.3 49.8`}),(0,X.jsx)(`circle`,{fill:UY,cx:`45.1`,cy:`46.2`,r:`2.5`})]}),fungi:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:HY,cx:`33.5`,cy:`43.6`,rx:`18.6`,ry:`14.4`,transform:`rotate(-6 33.5 43.6)`}),(0,X.jsx)(`path`,{fill:LY,d:`M29.5 6.5C22 7.5 16 11 11 18.5 4 29 4.6 39.6 13.5 42.2 24 45 44 40.5 54 34.6 57.6 32.6 58.6 29.2 57.5 25 56.5 20 53 16 48.5 13 43.5 8 37 5.5 29.5 6.5Z`}),(0,X.jsxs)(`g`,{fill:HY,children:[(0,X.jsx)(`ellipse`,{cx:`29`,cy:`15.7`,rx:`8.7`,ry:`6.3`,transform:`rotate(-15.5 29 15.7)`}),(0,X.jsx)(`ellipse`,{cx:`50.8`,cy:`20.1`,rx:`6.5`,ry:`3.5`,transform:`rotate(51.6 50.8 20.1)`}),(0,X.jsx)(`ellipse`,{cx:`13`,cy:`26.8`,rx:`4.2`,ry:`3.3`,transform:`rotate(-54.5 13 26.8)`})]}),(0,X.jsxs)(`g`,{fill:UY,transform:`translate(26.6 46.6) scale(1.1) translate(-33.7 -38.5)`,children:[(0,X.jsx)(`rect`,{x:`31.85`,y:`35.9`,width:`3.75`,height:`5.25`,rx:`1.85`}),(0,X.jsx)(`path`,{d:`M 47.4 34.3 C 46 35 44.6 35.8 43.5 36.7 42.9 37.2 43.2 38.3 44 38.4 45.2 38.6 46.5 38.6 47.7 38.4 48.4 38.3 48.3 37.3 47.6 37.3 46.6 37.4 45.7 37.4 45 37.3 45.9 36.7 46.9 36.1 48 35.6 48.7 35.3 48.2 34 47.4 34.3 Z`}),(0,X.jsx)(`path`,{d:`M 37.4 41.1 C 38.6 44.3 42.6 44.3 43.6 40.5 43.7 40 43.1 39.8 42.9 40.3 41.9 42.8 39.1 42.9 38.3 40.7 38.1 40.2 37.3 40.5 37.4 41.1 Z`})]})]})};function GY({name:e,size:t}){return(0,X.jsx)(`svg`,{viewBox:`0 0 64 64`,width:t,height:t,fill:`none`,stroke:`none`,"aria-hidden":`true`,focusable:`false`,"data-sigil":e,children:WY[e]})}var KY=1e4;function qY({className:e,content:t,header:n,hideCopy:r,language:i,maxHeight:a=`320px`,style:o}){let[s,c]=(0,J.useState)(`idle`),l=async()=>{try{await navigator.clipboard.writeText(t),c(`copied`),setTimeout(()=>{c(`idle`)},1500)}catch(e){XP(`copy code to clipboard`,e),c(`failed`)}},u=i&&t.length<=KY?kJ(t,i):null,d={background:`var(--stipe-surface)`,border:`1px solid var(--color-base-300)`,color:`var(--color-base-content)`,...o};return(0,X.jsxs)(`div`,{className:`relative not-prose ${e??``}`,style:d,children:[n?(0,X.jsx)(`div`,{className:`text-dim px-2 pt-1.5 pb-1 text-[9px] uppercase tracking-wider`,children:n}):null,r?null:(0,X.jsx)(`button`,{"aria-label":`Copy to clipboard`,className:`btn btn-circle btn-ghost btn-xs text-dim absolute top-1 right-1 z-10 hover:text-base-content`,onClick:()=>{l()},type:`button`,children:s===`copied`?(0,X.jsx)(GW,{size:10}):(0,X.jsx)(JW,{size:10})}),r?null:(0,X.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:s===`failed`?`Copy to clipboard failed.`:null}),(0,X.jsx)(`div`,{className:`overflow-y-auto text-[10px]`,"data-scrollable":!0,style:{maxHeight:a===`0`?void 0:a,padding:`6px 4px`},children:u===null?(0,X.jsxs)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-base-content`,style:{margin:0},children:[t,t.length>KY?(0,X.jsx)(`span`,{className:`text-dim ml-2 italic`,children:`(syntax highlighting skipped for very long content)`}):null]}):(0,X.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u}})})]})}function JY(e,t,n){return n||e.length<=t?{shown:e,hidden:0}:{shown:e.slice(0,t),hidden:e.length-t}}function YY({hidden:e,onShowAll:t}){return e===0?null:(0,X.jsxs)(`button`,{className:`btn btn-ghost btn-xs text-dim`,onClick:t,type:`button`,children:[`Show `,String(e),` more lines`]})}var XY=`not-prose m-0 overflow-x-auto rounded-lg border border-base-300 bg-base-200 px-sm py-xs font-mono text-[10px] leading-relaxed`;function ZY({section:e,full:t,onShowAll:n}){switch(e.kind){case`diff`:{let{shown:r,hidden:i}=JY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{className:`not-prose`,children:[(0,X.jsx)(WJ,{hiddenLines:0,lines:r}),(0,X.jsx)(YY,{hidden:i,onShowAll:n})]})}case`excerpt`:{let{shown:r,hidden:i}=JY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:XY,"data-parakeet-section":`excerpt`,children:r.map((e,t)=>(0,X.jsxs)(`span`,{className:`block whitespace-pre`,children:[e.number===void 0?null:(0,X.jsx)(`span`,{className:`text-dim mr-sm inline-block w-8 select-none text-right`,children:String(e.number)}),e.text]},String(t)))}),(0,X.jsx)(YY,{hidden:i,onShowAll:n})]})}case`matches`:{let{shown:r,hidden:i}=JY(e.matches,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:XY,"data-parakeet-section":`matches`,children:r.map((e,t)=>(0,X.jsxs)(`span`,{className:`block whitespace-pre`,children:[e.location===``?null:(0,X.jsx)(`span`,{className:`text-info mr-sm`,children:e.location}),e.text]},String(t)))}),(0,X.jsx)(YY,{hidden:i,onShowAll:n})]})}case`command`:case`script`:{let{shown:r,hidden:i}=JY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:XY,"data-parakeet-section":e.kind,children:r.map((t,n)=>(0,X.jsxs)(`span`,{className:`block whitespace-pre`,children:[e.kind===`command`&&n===0?(0,X.jsx)(`span`,{className:`text-dim select-none`,children:`$ `}):null,t]},String(n)))}),(0,X.jsx)(YY,{hidden:i,onShowAll:n})]})}case`output`:{let{shown:r,hidden:i}=JY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:XY,"data-parakeet-section":`output`,children:r.map((e,t)=>(0,X.jsxs)(`span`,{className:e.stream===`stderr`?`block whitespace-pre text-error`:`block whitespace-pre`,"data-stream":e.stream,children:[e.stream===`stderr`?(0,X.jsx)(`span`,{className:`select-none`,children:`▍`}):null,e.text]},String(t)))}),(0,X.jsx)(YY,{hidden:i,onShowAll:n})]})}case`text`:{let{shown:r,hidden:i}=JY(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(qY,{className:`overflow-hidden rounded-lg`,content:r.join(`
|
|
171
|
-
`),header:e.label,...e.language===void 0?{}:{language:e.language}}),(0,X.jsx)(YY,{hidden:i,onShowAll:n})]})}}}function QY({call:e,tool:t,disclosure:n,onToggle:r}){let i=`${e.id}:full`,a=$F(n,i,!1),o=()=>{r(i,!1)};return(0,X.jsxs)(`div`,{className:`space-y-1.5 py-1.5 pr-2`,"data-parakeet-call-body":!0,children:[e.error===void 0?null:(0,X.jsx)(`p`,{className:`not-prose m-0 font-mono text-[11px] text-error`,role:`alert`,children:e.error}),e.sections.map((e,t)=>(0,X.jsx)(ZY,{full:a,onShowAll:o,section:e},`${e.kind}:${String(t)}`)),t?.result?.content.filter(e=>e.type===`image`).map((t,n)=>(0,X.jsx)(`img`,{alt:`Tool result`,className:`max-w-full`,src:`data:${t.mimeType};base64,${t.data}`,style:{maxHeight:400}},`${e.id}-image-${String(n)}`))]})}function $Y({call:e,tool:t,disclosureId:n,size:r,disclosure:i,onToggle:a,renderToolActions:o}){let s=QF(e),c=$F(i,n,s),l=e.status===`running`;return(0,X.jsxs)(`div`,{"data-parakeet-call":e.kind,"data-status":e.status,children:[(0,X.jsx)(_Y,{leading:(0,X.jsx)(GY,{name:QP[e.kind],size:16}),onOpenChange:()=>{a(n,s)},open:c,size:r,summary:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-base-content`,children:l?e.activeVerb:e.verb}),` `,(0,X.jsx)(`span`,{className:`font-mono`,children:e.label})]}),tone:e.status===`error`?`error`:`neutral`,trailing:(0,X.jsxs)(X.Fragment,{children:[e.exitCode===void 0?null:(0,X.jsxs)(HJ,{size:`sm`,tone:`error`,children:[`exit `,String(e.exitCode)]}),e.durationMs===void 0?null:(0,X.jsx)(`span`,{children:HF(e.durationMs)}),(0,X.jsx)(nK,{motion:l?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:ZP(e.status)})]}),children:(0,X.jsx)(QY,{call:e,disclosure:i,onToggle:a,tool:t})}),e.status===`completed`&&t?.result!==void 0?o?.(t):null]})}var eX=(0,J.memo)(function({group:e,disclosure:t,onToggle:n,renderToolActions:r}){let i=XF(e),a=$F(t,e.id,i),o=e.status===`running`,s=e.active,c=e.calls.length===1?e.calls[0]:void 0;return c===void 0?(0,X.jsxs)(`div`,{className:`px-1`,children:[(0,X.jsx)(_Y,{className:`[&>.caps-disclosure-panel]:hidden`,leading:(0,X.jsx)(GY,{name:`list`,size:16}),onOpenChange:()=>{n(e.id,i)},open:a,summary:o&&s!==void 0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-base-content`,children:s.activeVerb}),` `,(0,X.jsx)(`span`,{className:`font-mono`,children:s.label}),` ·`,` `,String(e.calls.length),` `,e.calls.length===1?`call`:`calls`]}):(0,X.jsxs)(`span`,{className:`text-base-content`,children:[e.summary,` · `,String(e.calls.length),` `,e.calls.length===1?`call`:`calls`]}),tone:e.status===`error`?`error`:`neutral`,trailing:(0,X.jsxs)(X.Fragment,{children:[e.failedCount>0?(0,X.jsxs)(`span`,{className:`text-error`,children:[String(e.failedCount),` failed`]}):null,e.durationMs===void 0?null:(0,X.jsx)(`span`,{children:HF(e.durationMs)}),(0,X.jsx)(nK,{motion:o?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:ZP(e.status)})]})}),ZF(e,a).map(i=>(0,X.jsx)($Y,{call:i,disclosure:t,disclosureId:i.id,onToggle:n,renderToolActions:r,size:`row`,tool:e.tools.find(e=>e.id===i.id)},i.id)),e.status===`completed`&&e.calls.length>3?(0,X.jsx)(`button`,{"aria-expanded":a,className:`btn btn-ghost btn-xs text-dim`,onClick:()=>{n(e.id,i)},type:`button`,children:a?`Show less`:`Show all ${String(e.calls.length)} calls`}):null]}):(0,X.jsx)(`div`,{className:`px-1`,children:(0,X.jsx)($Y,{call:c,disclosure:t,disclosureId:c.id,onToggle:n,renderToolActions:r,size:`row`,tool:e.tools[0]})})}),tX=()=>void 0,nX=(0,J.memo)(function({item:e,onDismissFailed:t,renderToolActions:n,renderAssistantAttachment:r,formatAssistantText:i,toolDisclosure:a=YF,onToggleTool:o=tX}){switch(e.kind){case`user_message`:{let n=e.requestId,r=n===void 0||t===void 0?null:(0,X.jsx)(`button`,{"aria-label":`Dismiss failed prompt`,className:`btn btn-ghost btn-xs`,onClick:()=>{t(n)},type:`button`,children:`Dismiss`});return(0,X.jsxs)(X.Fragment,{children:[e.author?(0,X.jsx)(`div`,{className:`px-3 text-xs text-dim`,"data-author":e.author.id,children:e.author.name}):null,(0,X.jsx)(BJ,{pending:e.status!==`confirmed`,speaker:`user`,children:e.text}),e.status===`failed`?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-xs text-error`,role:`alert`,children:[(0,X.jsx)(`span`,{children:`Your prompt didn’t make it through.`}),r]}):null]})}case`assistant_message`:return oP(e)?(0,X.jsxs)(X.Fragment,{children:[e.author?(0,X.jsx)(`div`,{className:`px-3 text-xs text-dim`,"data-author":e.author.id,children:e.author.name}):null,(0,X.jsx)(BJ,{isError:e.isError===!0,pending:e.pending,speaker:`agent`,...e.thinking?{thinking:e.thinking}:{},children:i?.(e.text)??e.text}),!e.pending&&!e.isError?r?.(e.text):null]}):null;case`tool_group`:return(0,X.jsx)(eX,{disclosure:a,group:e,onToggle:o,renderToolActions:n});case`compaction_divider`:return(0,X.jsx)(`div`,{className:`divider text-dim my-2 text-xs`,role:`separator`,children:e.tokensAfter===null?`compacted · the agent’s memory starts below`:`compacted ${QA(e.tokensBefore)} → ${QA(e.tokensAfter)}`});case`compaction_notice`:return(0,X.jsxs)(`div`,{className:`px-3 text-xs ${e.result===`failed`?`text-error`:`text-dim`}`,role:`status`,children:[`·`,` `,e.result===`failed`?`compaction failed`:`nothing to compact`,e.diagnostic===null?``:`: ${e.diagnostic}`]})}});function rX({disambiguateAuthors:e,visitor:t,composerActionVariant:n,empty:r,commands:i,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s,onLink:c,onOpen:l}){let u=(0,J.useRef)(null),[d]=(0,J.useState)(()=>Br()),f=nz({enabled:t===void 0,commands:i??d,origin:`browser`,keys:{newline:`Shift+Enter`},busy:aX()}),p=Qz(i??d),m=cL(),h=nL(),g=(0,J.useMemo)(()=>eB(m,h.commandAnchors),[m,h.commandAnchors]);return(0,X.jsxs)(`div`,{className:`parakeet flex h-full flex-col items-stretch`,"data-parakeet":`standalone`,"data-testid":`parakeet-view`,onClickCapture:e=>{let t=e.target instanceof Element?e.target.closest(`a[href]`):null;t instanceof HTMLAnchorElement&&c?.(t.href)&&e.preventDefault()},children:[(0,X.jsxs)(`div`,{className:`flex h-full w-full flex-col border-r border-base-300`,children:[(0,X.jsx)(sX,{disambiguateAuthors:t===void 0&&e===!0,clientActions:p,onOpen:l,focusAfterJump:u,empty:r,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s}),m.some(({value:e})=>e.panel.length>0)?(0,X.jsx)(`section`,{"aria-label":`Session extension controls`,className:`w-full shrink-0 border-t border-base-300 bg-base-100`,children:m.map(({entryId:e,value:t})=>{let n=t.panel.length===0?void 0:g.omitted.find(t=>t.entryId===e),r=t.panel.length===0?[]:g.unanchored.filter(t=>t.entryId===e).flatMap(({cell:e})=>e.rows.map(t=>({...t,id:`unanchored:${e.id}:${t.id}`})));return(0,X.jsx)(pK,{entryId:e,rows:[...t.panel,...n===void 0?[]:[{id:`omitted:${e}`,title:`${String(n.count)} earlier change${n.count===1?``:`s`} omitted`,tone:`muted`}],...r],actions:p,onOpen:l},e)})}):null,(0,X.jsx)(cX,{clientActions:p}),(0,X.jsx)(lX,{visitor:t,textareaRef:u,composerActionVariant:n,slash:f})]}),t===void 0?(0,X.jsx)(oX,{slash:f}):null]})}var iX=new Set([`cancelling`,`queued`,`retrying`,`sending`,`streaming`,`thinking`]);function aX(){return iX.has(sL().status)}function oX({slash:e}){let t=e.interactions.open;return(0,X.jsx)(OW,{open:t!==void 0,onOpenChange:t=>{t||e.store.close()},children:(0,X.jsx)(NW,{className:`w-[min(32rem,calc(100vw-2rem))] rounded-box bg-base-100 p-md shadow-lg`,keepMounted:!1,children:t===void 0?null:(0,X.jsx)(UK,{host:t.host,onClose:e.store.close,onRetry:()=>{e.store.close(),t.retry()}},t.key)})})}function sX({disambiguateAuthors:e,clientActions:t,onOpen:n,focusAfterJump:r,empty:i,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s}){let c=iL(),l=nL(),u=(0,J.useMemo)(()=>tj(e?[...l.settled,...l.tail].flatMap(e=>`author`in e&&e.author?[e.author]:[]):[]),[e,l.settled,l.tail]),d=eB(cL(),l.commandAnchors),[f,p]=(0,J.useState)(YF),m=(0,J.useCallback)((e,t)=>{p(n=>eI(n,e,t))},[]),h=sL(),g=(0,J.useRef)(null),_=(0,J.useRef)(void 0),v=l.settled.length+l.tail.length,y=(0,J.useCallback)(e=>e<l.settled.length?l.settled[e]:l.tail[e-l.settled.length],[l.settled,l.tail]),b=PG({anchorTo:`end`,count:v,estimateSize:()=>72,followOnAppend:`auto`,getItemKey:(0,J.useCallback)(e=>{let t=y(e);return t===void 0?e:t.kind===`user_message`&&t.requestId!==void 0?t.requestId:t.id},[y]),getScrollElement:()=>g.current,initialRect:{height:800,width:800},overscan:6,useFlushSync:!1}),x=b.getVirtualItems(),S=b.isAtEnd(),[C,w]=(0,J.useState)(0),T=v>0?y(v-1)?.id:void 0,E=(0,J.useRef)({count:v,lastItem:T});(0,J.useEffect)(()=>{let e=E.current;E.current={count:v,lastItem:T},S?w(0):e.lastItem!==void 0&&T!==e.lastItem&&w(t=>t+Math.max(1,v-e.count))},[S,v,T]);let D=(x[0]?.index??1/0)<3,{hasMoreHistory:O,hasNewerHistory:k,loadingOlderHistory:A,loadOlderHistory:j,loadNewerHistory:M}=l,N=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(!D){N.current=!1;return}O&&!A&&!N.current&&(N.current=!0,j())},[O,j,A,D]);let P=(0,J.useCallback)(()=>{w(0),_.current=void 0,l.jumpToLatest(),b.scrollToEnd({behavior:`smooth`})},[b,l]);return(0,X.jsxs)(`div`,{className:`prose relative min-h-0 flex-1`,children:[(0,X.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:lK(h.status,h.viewState)}),h.observation.status===`unavailable`?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-1 text-xs text-dim`,role:`status`,children:[(0,X.jsx)(`span`,{children:h.observation.reason}),(0,X.jsx)(`button`,{className:`underline`,onClick:()=>void h.reconnect(),type:`button`,children:`Reconnect`})]}):null,(0,X.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto`,"data-chat-scroller":!0,ref:g,onScroll:e=>{let t=e.currentTarget.scrollTop;_.current!==void 0&&t<_.current&&l.pinVisibleHistory(),_.current=t},onWheel:e=>{let t=g.current;t===null||A||(e.deltaY<0&&l.pinVisibleHistory(),e.deltaY<0&&t.scrollTop<=1&&O&&j(),e.deltaY>0&&t.scrollTop+t.clientHeight>=t.scrollHeight-1&&k&&M())},style:{overscrollBehavior:`contain`},children:v>0?(0,X.jsx)(`div`,{className:`relative w-full`,style:{height:`${String(b.getTotalSize())}px`},children:x.map(e=>{let r=y(e.index);return r===void 0?null:(0,X.jsxs)(`div`,{"data-index":e.index,"data-parakeet-entry":r.kind===`user_message`?`user`:r.kind,"data-parakeet-id":r.id,"data-status":r.kind===`assistant_message`?r.isError?`error`:void 0:r.kind===`compaction_divider`||r.kind===`compaction_notice`?void 0:r.status,"data-tone":r.kind===`assistant_message`&&r.isError?`error`:void 0,ref:b.measureElement,style:{left:0,position:`absolute`,top:0,transform:`translateY(${String(e.start)}px)`,width:`100%`},children:[(0,X.jsx)(nX,{item:`author`in r&&r.author&&u.has(r.author.id)?{...r,author:{...r.author,name:u.get(r.author.id)??r.author.name}}:r,onDismissFailed:c,onToggleTool:m,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s,toolDisclosure:f}),d.after.get(r.id)?.map(({entryId:e,cell:r})=>(0,X.jsx)(pK,{entryId:e,rows:r.rows,actions:t,onOpen:n},`${e}:${r.id}`))]},e.key)})}):i??(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center text-center`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-1 text-xs text-base-content`,children:`Ready`}),(0,X.jsx)(`p`,{className:`text-[10px] text-dim`,children:`What would you like to build?`})]})})}),v>0?(0,X.jsx)(uG,{direction:`forward`,unread:C,focusAfterJump:r,onJump:P,scrollerRef:g}):null]})}function cX({clientActions:e}){let{viewState:t}=sL(),n=cL(),r=t.kind===`idle`?n.find(({value:e})=>e.waiting!==null):void 0,i=t.kind===`queued`?t:null;return(0,X.jsxs)(X.Fragment,{children:[r?.value.waiting===void 0||r.value.waiting===null?null:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-xs`,children:[(0,X.jsx)(`span`,{children:r.value.waiting.summary}),(0,X.jsx)(lE,{size:`xs`,variant:`outline`,disabled:!e.enabled||e.state.get(r.value.waiting.cancel)?.pending===!0,onClick:()=>{r.value.waiting!==null&&e.execute(r.entryId,r.value.waiting.cancel,!0)},children:r.value.waiting.cancel.label})]}),(0,X.jsx)(WK,{waiting:i})]})}function lX({visitor:e,textareaRef:t,composerActionVariant:n,slash:r}){let i=rL(),a=sL(),o=cL(),s=nL();(0,J.useEffect)(()=>{i.failure!==void 0&&t.current?.focus()},[i.failure,t]);let c=(0,J.useCallback)(()=>{i.cancel()},[i.cancel]),l={statusChips:o.flatMap(({value:e})=>e.chips).sort((e,t)=>e.order-t.order).map(({row:e})=>e.title),actionVariant:n,draft:i.draft,failure:i.failure,failureCause:a.viewState.kind===`error`?a.viewState.cause:void 0,admissionError:i.admissionError,onAbort:c,onChange:i.setDraft,onRetry:i.retry,onSend:r.submit,slash:e===void 0?r:void 0,placeholder:e===void 0?void 0:`Ask ${e.agentName}…`,showFooter:e===void 0,status:a.status,viewState:a.viewState,textareaRef:t,model:s.model,usage:s.usage,context:a.context};return(0,X.jsx)(dK,{...l})}function uX({authorOf:e,disambiguateAuthors:t,visitor:n,markdownPolicy:r=`session`,composerActionVariant:i,empty:a,session:o,clients:s,renderToolActions:c,renderAssistantAttachment:l,formatAssistantText:u,commands:d,onLink:f,onOpen:p}){return(0,X.jsx)(IJ.Provider,{value:r,children:(0,X.jsx)(tL,{session:o,clients:s,authorOf:e,children:(0,X.jsx)(rX,{disambiguateAuthors:t,visitor:n,composerActionVariant:i,empty:a,renderToolActions:c,renderAssistantAttachment:l,formatAssistantText:u,commands:d,onLink:f,onOpen:p})})})}function dX(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619)>>>0;return t}var fX=[`primary`,`secondary`,`accent`,`info`,`success`,`warning`];function pX(e){return fX[dX(e)%fX.length]??`primary`}var mX=(0,J.forwardRef)(function({className:e,name:t,seed:n,size:r=`default`,subject:i=`actor`,variant:a=`initial`,...o},s){let c=Array.from(t.trim())[0]?.toLocaleUpperCase()??`?`;return(0,X.jsx)(`span`,{"aria-hidden":`true`,...o,className:$(`caps-monogram`,e),"data-subject":i===`actor`?void 0:i,"data-size":r==="default"?void 0:r,"data-tone":pX(n??t),ref:s,children:a===`specimen`?(0,X.jsx)(`svg`,{viewBox:`0 0 48 48`,width:`80%`,height:`80%`,fill:`none`,"aria-hidden":`true`,children:(0,X.jsxs)(`g`,{transform:`rotate(${String((n??t).split(``).reduce((e,t)=>e+(t.codePointAt(0)??0),0)%360)} 24 24)`,stroke:`currentColor`,strokeWidth:`1.5`,children:[Array.from({length:20},(e,t)=>(0,X.jsx)(`path`,{d:`M24 19 Q19 12 24 5`,transform:`rotate(${String(t*18)} 24 24)`},t)),(0,X.jsx)(`circle`,{cx:`24`,cy:`24`,r:`5`})]})}):c})}),hX=(0,J.createContext)(null),gX=(0,J.forwardRef)(function({service:e,src:t,activity:n,expression:r,appearance:i,renderStyle:a,paused:o=!1,onState:s,...c},l){let u=(0,J.useContext)(hX),d=e??u;if(!d)throw Error(`Sprite needs a configured SpriteProvider or service`);let f=(0,J.useRef)(null),p=(0,J.useRef)(null),m=(0,J.useRef)(s);return m.current=s,(0,J.useImperativeHandle)(l,()=>{if(!f.current)throw Error(`Sprite host is not mounted`);return f.current}),(0,J.useEffect)(()=>{if(!f.current)return;let e=d.mount(f.current),t=e.subscribe(e=>{f.current&&(f.current.dataset.spriteStatus=e.status),m.current?.(e)});return p.current=e,()=>{t(),e.dispose().catch(e=>{console.error(`Sprite cleanup failed`,e)}),p.current=null}},[d]),(0,J.useEffect)(()=>{let e=p.current;if(!e)return;let o={src:t};n!==void 0&&(o={...o,activity:n}),r!==void 0&&(o={...o,expression:r}),i!==void 0&&(o={...o,appearance:i}),a!==void 0&&(o={...o,renderStyle:a}),e.set(o)},[d,t,n,r,i,a]),(0,J.useEffect)(()=>{p.current?.pause(o)},[d,o]),(0,X.jsx)(`div`,{...c,ref:f})});function _X(e){return{src:{local:e.character},appearance:e.appearance,expression:e.expression,renderStyle:e.renderStyle}}function vX(e){for(let[t,n]of Object.entries({maxBytes:e.maxBytes,maxTotalBytes:e.maxTotalBytes,maxRequests:e.maxRequests}))if(!Number.isSafeInteger(n)||n<=0)throw Error(`Avatar ${t} must be a positive safe integer`);let t=new Set(e.allowedOrigins.map(e=>new URL(e).origin)),n=e.fetch??globalThis.fetch;return()=>{let r=0,i=0;return async(a,o,s=e.baseURL)=>{let c=new URL(a,s);if(![`http:`,`https:`].includes(c.protocol)||!t.has(c.origin)||c.username||c.password)throw Error(`Avatar asset is not admitted: ${c.origin}`);if(i+=1,i>e.maxRequests)throw Error(`Avatar asset request limit reached`);let l=await n(c.href,{signal:o,redirect:`error`});if(!l.ok)throw Error(`Avatar asset request failed: ${String(l.status)}`);let u=Number(l.headers.get(`content-length`));if(u>e.maxBytes||u>e.maxTotalBytes-r)throw await l.body?.cancel(),Error(`Avatar asset exceeds the byte limit`);let d=l.body?.getReader();if(!d)throw Error(`Avatar asset has no response body`);let f=[],p=0;try{for(;;){o.throwIfAborted();let t=await d.read();if(t.done)break;if(p+=t.value.byteLength,p>e.maxBytes)throw Error(`Avatar asset exceeds the byte limit`);if(t.value.byteLength>e.maxTotalBytes-r)throw Error(`Avatar selection exceeds the total byte limit`);r+=t.value.byteLength,f.push(t.value)}}catch(e){let t=await d.cancel().then(()=>({kind:`cancelled`}),e=>({kind:`failed`,error:e instanceof Error?e:Error(String(e))}));throw t.kind===`failed`?AggregateError([e,t.error],`Avatar asset read and cancellation failed`,{cause:e}):e}finally{d.releaseLock()}let m=new Uint8Array(p),h=0;for(let e of f)m.set(e,h),h+=e.byteLength;return{url:c.href,bytes:m,contentType:l.headers.get(`content-type`)??`application/octet-stream`}}}}var yX=(e,t)=>{let n=Dr.safeParse(e);return n.success?{kind:`local`,key:n.data.local}:{kind:`remote`,url:new URL(z().parse(e),t).href}},bX=e=>e instanceof Error?e:Error(String(e),{cause:e}),xX=e=>jn(e)?bX($n(e.cause)):Error(`Unexpected Sprite success`);function SX(e){let t=e.maxPixels??4194304;if(!Number.isSafeInteger(t)||t<=0)throw Error(`Sprite pixel limit must be a positive safe integer`);let n=e.assets??{baseURL:`https://sprite.invalid/`,allowedOrigins:[],maxBytes:1,maxTotalBytes:1,maxRequests:1},r=vX(n),a=new WeakSet,o=new WeakMap,s=e=>{let t=yX(e,n.baseURL);return t.kind===`remote`?t.url:`local:${t.key}`};return{mount(c){if(a.has(c))throw Error(`A Sprite already owns this target`);a.add(c);let l=tt(rr()),u=new Set,d={status:`empty`},f,p,m=0,h=!1,g,_,v,y=!1,b=!1,x=c.ownerDocument.defaultView?.matchMedia(`(prefers-reduced-motion: reduce)`),S=e=>{if(!(y&&e.status!==`destroyed`)){d=e;for(let t of u)try{t(e)}catch(e){console.error(`Sprite state observer failed`,e)}}},C=e=>{p?.controller.abort(),p?.holder.remove(),S({status:`error`,error:e}),E().catch(t=>{S({status:`error`,error:AggregateError([e,t],`Avatar failed and cleanup also failed`)})})},w=rg(c),T=()=>{let e=b||c.ownerDocument.hidden||x?.matches===!0;w.still(e);try{p?.native?.pause(e)}catch(e){C(bX(e))}};tt(Bn(l,ct(()=>{c.ownerDocument.removeEventListener(`visibilitychange`,T),x?.removeEventListener(`change`,T),w.dispose()}))),c.ownerDocument.addEventListener(`visibilitychange`,T),x?.addEventListener(`change`,T);let E=async()=>{if(_)return _;let e=p;if(!e)return;p=void 0,e.controller.abort(),e.holder.remove();let t=at(lr(e.scope,Ot)).then(e=>{if(jn(e))throw xX(e)});_=t;try{await t}finally{_===t&&(_=void 0)}},D=e=>{let t=e.native,n=e.document,r=f;if(!t||!n||!r||p!==e)return;let i=r.activity??`idle`,a=r.expression??t.expressions[0]??null,o,s;try{o=Or(n.controls,r.appearance),s=jh.parse(r.renderStyle??`plain`)}catch(e){let t=bX(e);d.status===`ready`?d.updateError?.message!==t.message&&S({...d,updateError:t}):C(t);return}let c={requestedActivity:i,requestedExpression:a,activity:t.activities.includes(i)?i:`idle`,expression:a!==null&&t.expressions.includes(a)?a:t.expressions[0]??null,appearance:o,renderStyle:s,fallback:!t.activities.includes(i)||a!==null&&!t.expressions.includes(a)},l=JSON.stringify([c.activity,c.expression,c.appearance]);if(w.set(s,e.holder),l!==e.appliedKey||d.status!==`ready`||d.presentation.renderStyle!==s||d.updateError!==void 0||d.presentation.requestedActivity!==i||d.presentation.requestedExpression!==a)try{l!==e.appliedKey&&t.set(c),e.appliedKey=l,T(),p===e&&S({status:`ready`,document:n,presentation:c})}catch(e){C(bX(e))}},O=async(a,o,s)=>{let l=r(),u=tt(rr()),d=new AbortController,f=c.ownerDocument.createElement(`div`);f.style.cssText=`width:100%;height:100%;position:relative`;let h={key:o,scope:u,controller:d,holder:f};p=h,tt(Bn(u,ct(()=>{f.remove()}))),c.append(f);let g=i(function*(){let r,o,s=n.baseURL,c=yX(a.src,n.baseURL);if(c.kind===`remote`){let t=yield*Le({try:()=>l(c.url,d.signal),catch:bX});s=t.url,r=Er.parse(JSON.parse(new TextDecoder().decode(t.bytes)));let n=e.renderers&&Object.hasOwn(e.renderers,r.renderer)?e.renderers[r.renderer]:void 0;if(!n)throw Error(`Renderer is not installed: ${r.renderer}`);o=(yield*Le({try:n,catch:bX})).default}else{let t=c.key,n=e.characters&&Object.hasOwn(e.characters,t)?e.characters[t]:void 0;if(!n)throw Error(`Character is not installed: ${t}`);let i=yield*Le({try:n,catch:bX});r=Er.parse(i.document),o=i.render}d.signal.throwIfAborted();let u=yield*o({target:f,document:r,signal:d.signal,maxPixels:t,reportError:e=>{p===h&&!d.signal.aborted&&C(e)},assetURL:e=>i(function*(){let t=yield*Le({try:()=>l(e,d.signal,s),catch:bX});return yield*rt(ct(()=>URL.createObjectURL(new Blob([t.bytes],{type:t.contentType}))),e=>ct(()=>{URL.revokeObjectURL(e)}))})});if(!u.activities.includes(`idle`))throw Error(`Character has no idle fallback`);return u.pause(!0),{native:u,document:r}}).pipe(Un(u)),_=await at(g,{signal:d.signal});if(!(y||s!==m||p!==h)){if(jn(_)){let e=xX(_);try{await E(),S({status:`error`,error:e})}catch(t){S({status:`error`,error:AggregateError([e,t],`Avatar load and cleanup failed`)})}return}h.native=_.value.native,h.document=_.value.document,D(h)}},k=async()=>{let e=e=>y||e!==m;for(;h&&!y;){h=!1;let t=m;if(await E(),e(t)||!f)continue;let n=await o.get(c);if(n?.kind===`failed`)throw n.error;e(t)||(S({status:`loading`}),await O(f,s(f.src),t))}},A=()=>{h=!0,p?.controller.abort(),p?.holder.remove(),!g&&(g=k().catch(e=>{S({status:`error`,error:bX(e)})}).finally(()=>{g=void 0,h&&!y&&A()}))};return{get state(){return d},subscribe(e){return u.add(e),()=>u.delete(e)},set(e){if(y)throw Error(`Sprite is destroyed`);f=e;let t=s(e.src);p?.key===t&&d.status===`ready`?D(p):(p?.key!==t||d.status===`error`)&&(m+=1,A())},pause(e){if(y)throw Error(`Sprite is destroyed`);b=e,T()},dispose(){return v||(y=!0,m+=1,a.delete(c),p?.controller.abort(),p?.holder.remove(),S({status:`destroyed`}),v=(async()=>{await g,await E();let e=await at(lr(l,Ot));if(jn(e))throw xX(e)})(),o.set(c,v.then(()=>({kind:`closed`}),e=>({kind:`failed`,error:bX(e)}))),v)}}}}}var CX=SX({characters:{mushroom:async()=>(await Ar(async()=>{let{default:e}=await import(`./mushroom-B9t9hgQE.js`);return{default:e}},__vite__mapDeps([6,7,2,8,1]))).default,cat:async()=>(await Ar(async()=>{let{default:e}=await import(`./cat-2dRm7fBw.js`);return{default:e}},__vite__mapDeps([9,7,2,8,1,10]))).default,burger:async()=>(await Ar(async()=>{let{default:e}=await import(`./burger-CoqBXzRV.js`);return{default:e}},__vite__mapDeps([11,7,2,8,1,10]))).default}}),wX=(0,J.memo)(function({activity:e=`idle`,avatar:t,className:n,name:r,size:i=24}){let[a,o]=(0,J.useState)(!1),s=(0,J.useMemo)(()=>_X(t),[t]);return(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`relative inline-block shrink-0 ${n??``}`,"data-agent-head":a?`ready`:`loading`,style:{height:i,width:i},children:[a?null:(0,X.jsx)(mX,{className:`absolute inset-0`,name:r,seed:r}),(0,X.jsx)(gX,{activity:e,appearance:s.appearance,className:`absolute inset-0`,expression:s.expression,onState:e=>{o(e.status===`ready`)},paused:e===`idle`,renderStyle:s.renderStyle,service:CX,src:s.src})]})}),TX=(0,J.memo)(function({avatar:e,className:t=`h-12 w-12 shrink-0`,service:n=CX,state:r}){let i=(0,J.useMemo)(()=>e?_X(e):void 0,[e]);return(0,X.jsx)(gX,{"aria-hidden":`true`,className:t,service:n,src:i?.src??{local:`mushroom`},...i?{appearance:i.appearance,renderStyle:i.renderStyle}:{},...r})}),EX={needs_you:`Waiting for you`,running:`Working`,errored:`Failed`,done:`Done`},DX={needs_you:0,errored_unseen:1,running:2,recent:3};function OX(e){return e===`running`||e===`needs_you`}function kX(e,t){return e!==void 0&&(t===void 0||e>t)}function AX(e,t){switch(e){case`needs_you`:return`needs_you`;case`running`:return`running`;case`errored`:return t?`errored_unseen`:`recent`;case`done`:return`recent`}}function jX(e,t){return DX[e.tier]-DX[t.tier]||(t.settledAt??t.createdAt)-(e.settledAt??e.createdAt)||e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId)}var MX=[`Needs you`,`Working`,`Ready`,`Finished`];function NX(e){return e.tier===`running`?`Working`:e.shelf===`active`?`Needs you`:e.ready?`Ready`:`Finished`}function PX(e){return{key:zX(e.agentId,e.sessionId),shelf:NX(e),attention:e.tier===`needs_you`||e.tier===`errored_unseen`?`${e.tier}:${String(e.settledAt??e.createdAt)}`:null}}function FX(e,t,n){let r=new Map(t.map(e=>[zX(e.agentId,e.sessionId),e]));if(e!==null&&n.held)return e;let i=[...t].sort((e,t)=>(t.settledAt??t.createdAt)-(e.settledAt??e.createdAt)||e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId)),a=new Map(e?.map(e=>[e.key,e])),o=i.map(PX).filter(e=>{let t=a.get(e.key);return t===void 0||e.key!==n.openKey&&e.attention!==null&&e.attention!==t.attention}),s=new Set(o.map(e=>e.key)),c=a.get(n.openKey??``),l=c===void 0?-1:(e??[]).filter(e=>e.shelf===c.shelf).findIndex(e=>e.key===c.key),u=MX.flatMap(t=>{let a;a=e===null||n.reorder?i.map(PX).filter(e=>e.shelf===t):[...o.filter(e=>e.shelf===t),...e.filter(e=>e.shelf===t&&!s.has(e.key)).flatMap(e=>{let t=r.get(e.key);return t===void 0?[]:[{...e,attention:PX(t).attention}]})];let u=c===void 0?void 0:r.get(c.key);return c!==void 0&&u!==void 0&&(a=a.filter(e=>e.key!==c.key),c.shelf===t&&a.splice(Math.min(l,a.length),0,{...c,attention:PX(u).attention})),a});return e!==null&&u.length===e.length&&u.every((t,n)=>t.key===e[n]?.key&&t.shelf===e[n]?.shelf&&t.attention===e[n]?.attention)?e:u}function IX(e){switch(e.kind){case`idle`:return`done`;case`waiting_for_you`:return`needs_you`;case`error`:return`errored`;default:return`running`}}function LX(e,t,n=null,r){let i=new Set(e.map(e=>e.agentId));return RX(t.filter(e=>!(`kind`in e)&&i.has(e.agentId)&&(n===null||e.agentId===n)),r)}function RX(e,t){let n=[],r=[];for(let i of e){if(`kind`in i)continue;if(i.state===`unavailable`){r.push({agentId:i.agentId,sessionId:i.sessionId});continue}let e=kX(i.settledAt,i.visitedAt),a=t?.agentId===i.agentId&&t.sessionId===i.sessionId?t.state:void 0,o=a?IX(a):i.state,s=a?a.kind===`idle`:o===`done`&&i.settledAt===void 0,c=AX(o,e);n.push({...i,state:o,ready:s,unseen:e,tier:c,shelf:c===`recent`?`settled`:`active`})}return n.sort(jX),{active:n.filter(e=>e.shelf===`active`),settled:n.filter(e=>e.shelf===`settled`),unavailable:r.sort((e,t)=>e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId))}}function zX(e,t){return`${e}\u0000${t}`}function BX(e){return e.name}function VX({children:e}){return(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:e})}function HX({open:e,agents:t,agentActivity:n,agentFilterId:r,websitesSelected:i,websitesVisible:a,canCreate:o,createOpen:s,onAll:c,onWebsites:l,onAgent:u,onCreate:d}){let[f,p]=(0,J.useState)(null),m=`grove-rail-cell relative size-12 rounded-field p-0`,h=r===null&&!(i&&a);return(0,X.jsxs)(`nav`,{id:`grove-agent-rail`,"aria-label":`Agents`,className:`grove-rail min-h-0 w-16 flex-none flex-col items-center gap-1 border-r border-base-300 py-2 ${e?`flex`:`flex min-[900px]:hidden`}`,children:[(0,X.jsx)(lE,{variant:`ghost`,"aria-label":`All Agents`,"aria-pressed":h,className:`${m} text-xs ${h?`bg-base-300`:``}`,onClick:c,children:(0,X.jsx)(VX,{children:`All`})}),a?(0,X.jsx)(lE,{variant:`ghost`,"aria-label":`Websites`,"aria-pressed":i,className:`${m} ${i?`bg-base-300`:``}`,onClick:l,children:(0,X.jsx)(VX,{children:(0,X.jsx)(GY,{name:`internet`,size:28})})}):null,(0,X.jsx)(XA,{className:`w-full flex-1`,style:{width:`100%`},children:(0,X.jsx)(`div`,{className:`flex flex-col items-center gap-1 py-1`,children:t.map(e=>(0,X.jsx)(lE,{variant:`ghost`,"aria-label":BX(e),title:BX(e),"aria-pressed":r===e.agentId&&!i,"data-agent-id":e.agentId,className:`${m} ${r===e.agentId&&!i?`bg-base-300`:``}`,onPointerEnter:()=>{p(e.agentId)},onPointerLeave:()=>{p(null)},onFocus:()=>{p(e.agentId)},onBlur:()=>{p(null)},onClick:()=>{u(e.agentId)},children:(0,X.jsx)(VX,{children:(0,X.jsx)(wX,{activity:n.get(e.agentId)??(f===e.agentId?`thinking`:`idle`),avatar:e.avatar,name:BX(e),size:32})})},e.agentId))})}),o?(0,X.jsx)(lE,{variant:`ghost`,"aria-label":`New Agent`,"aria-expanded":s,"aria-haspopup":`dialog`,className:`${m} mt-auto`,onClick:d,children:(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:(0,X.jsx)(eG,{size:20})})}):null]})}function UX({app:e}){let[t,n]=(0,J.useState)(null),r=Jo({queryKey:Cb.of(e,`team-inbox-notices`,t),enabled:e!==null&&(e.capabilities.has(Ng)||e.capabilities.has(Pg)),queryFn:async()=>{if(!e)throw Error(`No App connection`);let n=await Bg(e.capabilities);try{return await _b(n,t)}finally{await n.close()}}});return!r.isError&&!r.data?.items.length?null:(0,X.jsx)(`section`,{"aria-label":`Team notices`,className:`min-h-0 shrink-0`,children:(0,X.jsxs)(XA,{className:`max-h-52 border-b border-base-300`,children:[r.isError?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm`,children:`Team notices unavailable.`}):(0,X.jsx)(lS,{density:`compact`,className:`px-3 py-2`,children:r.data.items.map(e=>(0,X.jsx)(uS,{children:(0,X.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-[var(--spacing-xs)]`,children:[(0,X.jsx)(nK,{className:`col-span-2 grid grid-cols-subgrid`,size:`compact`,tone:`warning`,label:`kind`in e?`Seller closed`:`Installed App safety notice`}),(0,X.jsx)(`p`,{className:`m-0 col-start-2 text-sm [overflow-wrap:anywhere]`,children:`kind`in e?`${e.sellerName} closed. Your installation of ${e.displayName} continues; no new purchases are available.`:`${e.displayName} was removed. Fungi will disable it on your Team.`})]})},e.dispositionId))}),r.data?.next?(0,X.jsx)(lE,{variant:`ghost`,size:`sm`,onClick:()=>{n(r.data.next)},children:`Older notices`}):null,t===null?null:(0,X.jsx)(lE,{variant:`ghost`,size:`sm`,onClick:()=>{n(null)},children:`Newest notices`})]})})}var WX=`(min-width: 900px)`;function GX(e){let t=globalThis.matchMedia(WX);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}}function KX(){return globalThis.matchMedia(WX).matches}function qX(){return(0,J.useSyncExternalStore)(GX,KX,()=>!0)}function JX({open:e,onOpenChange:t,returnFocus:n,children:r}){let i=qX(),[a,o]=(0,J.useState)(null);return(0,X.jsxs)(OW,{open:i||e,modal:!i,disablePointerDismissal:i,onOpenChange:e=>{i||t(e)},children:[(0,X.jsx)(`div`,{ref:o,className:`contents`}),(0,X.jsxs)(AW,{container:a,keepMounted:!0,className:`contents`,children:[i?null:(0,X.jsx)(jW,{className:`grove-nav-scrim z-30 bg-base-200`}),(0,X.jsx)(MW,{id:`grove-nav`,role:i?`presentation`:`dialog`,"aria-label":i?void 0:`Agents and conversations`,initialFocus:!i&&void 0,finalFocus:!i&&n,className:`grove-nav min-h-0 flex-none rounded-none p-0 overflow-visible max-w-none max-h-none ${i?`static flex w-auto shadow-none`:`fixed inset-y-0 left-0 z-40 w-[min(22rem,88vw)] data-[open]:flex`}`,children:r})]})]})}var YX=W({path:q,entries:K(W({name:q,type:Gn([`file`,`directory`,`symlink`]),size:sn,modifiedAt:sn})),nextOffset:Sr(sn)}),XX=ph(`computer.list`,1,L(()=>mh({list:gh(hh(Ee().transform(e=>_n(YX)(e))))}))),ZX=Yt([W({state:Gn([`running`,`sleeping`,`starting`])}),W({state:G(`queued`),position:sn.pipe(H(Wn()),H(Nn(0)))})]),QX=W({enabled:Fn,effective:Fn,blockedBy:Sr(Gn([`team`,`global`]))}),$X=W({computerId:Tr,name:Tr,runtime:ZX,backends:K(W({id:Tr,kind:Gn([`platform-container`,`on-box-vm`,`local`]),status:Gn([`ready`,`queued`,`online`,`offline`]),queuePosition:Sr(sn.pipe(H(Wn()),H(Nn(0)))),hostId:Sr(q),hostLabel:Sr(q),folderLabel:Sr(q),detachable:Fn})),internet:QX});ph(`computer.instrument.read`,1,L(()=>mh({read:gh(hh(Ee().transform(e=>_n($X)(e))))}))),ph(`computer.instrument.control`,1,L(()=>mh({start:gh(hh(Ee().transform(e=>_n(ZX)(e)))),setInternetAccess:gh(hh(Ee().transform(e=>_n(QX)(e)))),detachLocal:gh(hh(Ee().transform(e=>_n(W({detached:Fn}))(e))))})));var eZ=W({ports:K(W({port:sn.pipe(H(Wn()),H(Ct({minimum:1,maximum:65535}))),previewUrl:Tr,openMode:Gn([`inline`,`external-only`]),expiresAt:sn.pipe(H(Wn()),H(Nn(0)))})).pipe(H(B(64)))}),tZ=Yt([eZ,W({error:G(`port_previews_not_configured`)})]),nZ=W({port:sn.annotate({message:`Use a port from 1 to 65535.`}).check(Wn({message:`Use a port from 1 to 65535.`}),Ct({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:Fn}),rZ=W({port:sn.pipe(H(Wn()),H(Ct({minimum:1,maximum:65535}))),removed:Fn});ph(`computer.ports`,2,L(()=>mh({list:gh(hh(Ee().transform(e=>_n(tZ)(e)))),expose:gh(hh(Ee().transform(e=>_n(nZ)(e)))),unexpose:gh(hh(Ee().transform(e=>_n(rZ)(e))))})));var iZ=Gn([`synced`,`pending`,`unknown`]),aZ=W({port:Sr(nZ.fields.port),id:Tr,command:Tr,cwd:Sr(q),startedAt:sn.pipe(H(Wn()),H(In(0))),state:Gn([`running`,`exited`,`uncertain`]),exitCode:Sr(sn.pipe(H(Wn()))),sync:iZ,endedAt:Sr(sn.pipe(H(Wn()),H(In(0))))}),oZ=W({processes:K(aZ)}),sZ=W({process:aZ,signalled:Fn});W({requestId:Tr.pipe(H(B(256))),command:Tr.pipe(H(B(16384))),cwd:Bt(q),port:Bt(nZ.fields.port)}),ph(`computer.processes`,1,L(()=>mh({start:gh(hh(Ee().transform(e=>_n(aZ)(e)))),list:gh(hh(Ee().transform(e=>_n(oZ)(e)))),kill:gh(hh(Ee().transform(e=>_n(sZ)(e))))}))),ph(`computer.readFile`,1,L(()=>mh({open:gh(mh({response:gh(v(Response)),close:_h}))}))),ph(`computer.writeFile`,3,L(()=>mh({open:gh(mh({write:_h,close:_h})),mkdir:_h,replace:gh(hh(Ee().transform(e=>_n(cZ)(e))))})));var cZ=Yt([W({kind:G(`replaced`),path:Tr,bytes:sn.pipe(H(Wn()),H(In(0)))}),W({kind:G(`conflict`)})]),lZ=W({computerName:Tr.pipe(H(B(256))),teamName:Tr.pipe(H(B(256))),modelDoor:Tr.pipe(H(B(256))),uptimeSeconds:sn.pipe(H(Wn()),H(In(0))),version:Tr.pipe(H(B(64)))});ph(`computer.terminal`,2,L(()=>mh({open:gh(mh({information:gh(hh(Ee().transform(e=>_n(lZ)(e)))),output:gh(v(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(v(Uint8Array).parse(e))}})))),input:gh(v(WritableStream)),resize:_h,close:_h}))})));function uZ({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function dZ(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var fZ=[],pZ=0,{link:mZ,unlink:hZ,propagate:gZ,checkDirty:_Z,shallowPropagate:vZ}=uZ({update(e){return e._update()},notify(e){fZ[bZ++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,wZ(e))}}),yZ=0,bZ=0,xZ,SZ=0;function CZ(e){try{++SZ,e()}finally{--SZ||TZ()}}function wZ(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=hZ(n,e)}function TZ(){if(!(SZ>0)){for(;yZ<bZ;){let e=fZ[yZ];fZ[yZ++]=void 0,e.notify()}yZ=0,bZ=0}}function EZ(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return xZ!==void 0&&mZ(i,xZ,pZ),i._snapshot},subscribe(e){let t=dZ(e),n={current:!1},r=DZ(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=xZ,o=t?.compare??Object.is;if(n)xZ=i,++pZ,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{xZ=a,n&&(i.flags&=-5),wZ(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&_Z(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&vZ(e)}}else e&32&&(i.flags=e&-33);return xZ!==void 0&&mZ(i,xZ,pZ),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(gZ(e),vZ(e),TZ())}},i}function DZ(e){let t=()=>{let t=xZ;xZ=n,++pZ,n.depsTail=void 0,n.flags=6;try{return e()}finally{xZ=t,n.flags&=-5,wZ(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&_Z(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,wZ(this)}};return t(),n}var OZ=class{constructor(e,t){this.atom=EZ(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(dZ(e))}},kZ=class{constructor(e){this.atom=EZ(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(dZ(e))}};function AZ(e,t){return typeof e==`function`?new kZ(e):t?new OZ(e,t):new OZ(e)}var jZ=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function MZ(e,t){return new jZ(e,t).maybeExecute}var NZ=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},PZ=new class extends NZ{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function FZ(e,t){return typeof e==`function`?e(t):e}function IZ(e,t){return WZ(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function LZ(e,t,n){let r=WZ(t);function i(e){if(!r.length)return FZ(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function RZ(e,t){let n=WZ(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var zZ=46,BZ=91,VZ=93,HZ=48,UZ=57;function WZ(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===BZ),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===zZ||s===BZ||s===VZ){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==HZ),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==VZ&&(a!==-1||s!==VZ)&&(a!==s||s!==zZ&&s!==BZ)&&n.push(``);r=o+1,i=!0}else(s<HZ||s>UZ)&&(i=!1);a=s}return n.length||n.push(``),n}function GZ(e){return!(Array.isArray(e)&&e.length===0)}function KZ(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function qZ(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var JZ=e=>!!e&&typeof e==`object`&&`fields`in e;function YZ(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!YZ(e[i],t[i]))return!1;return!0}var XZ=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},ZZ=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function QZ(e,t){return e==null?t:{...e,...t}}for(var $Z=256,eQ=[],tQ;$Z--;)eQ[$Z]=($Z+256).toString(16).substring(1);function nQ(){let e=0,t,n=``;if(!tQ||$Z+16>256){for(tQ=Array(256),e=256;e--;)tQ[e]=256*Math.random()|0;e=0,$Z=0}for(;e<16;e++)t=tQ[$Z+e],n+=e===6?eQ[t&15|64]:e===8?eQ[t&63|128]:eQ[t],e&1&&e>1&&e<11&&(n+=`-`);return $Z++,n}var rQ=MZ(e=>PZ.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function iQ(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=iQ(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,iQ(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(iQ(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=iQ(e[n]));return t}function aQ(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var oQ=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function sQ(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var cQ=(e,t)=>{let n=sQ(e,t);return{form:n,fields:n}},lQ={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:cQ(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:cQ(r.issues,e)}},uQ=e=>!!e&&`~standard`in e,dQ={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function fQ(e){function t(t){let n=e.getFieldMeta(t)??dQ;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>dQ;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function pQ(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var mQ=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{rQ(this)}),t=PZ.on(`request-form-state`,e=>{e.payload.id===this._formId&&PZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=PZ.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=PZ.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),PZ.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return PZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!YZ(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!YZ(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(CZ(()=>{this.baseStore.setState(()=>pQ(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=fQ(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}PZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=LZ(t,e.instance.name,e.instance.options.defaultValue))}),pQ({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return CZ(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return CZ(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=KZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||oQ}),r=!1,i={};return CZ(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=hQ(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=gQ(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??dQ,r=a?.[e],{newErrorValue:s,newSource:c}=XZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=dQ)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=gQ(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=gQ(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=qZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||oQ});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=gQ(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=hQ(r);s&&(i=i?{...i,...s}:s);let c=gQ(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??dQ,r=i?.[e],{newErrorValue:a,newSource:o}=XZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=dQ)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),CZ(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),PZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),PZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}CZ(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),CZ(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),PZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),PZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>IZ(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:FZ(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=dQ,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;CZ(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:LZ(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=RZ(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),fQ(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],QZ(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),fQ(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),QZ(r,{dontValidate:!0})),fQ(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),QZ(n,{dontValidate:!0})),fQ(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return LZ(LZ(e,`${t}`,i),`${n}`,r)},QZ(r,{dontValidate:!0})),fQ(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},QZ(r,{dontValidate:!0})),fQ(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],QZ(t,{dontValidate:!0})),fQ(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=IZ(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:dQ},values:i===void 0?t.values:LZ(t.values,e,i)}})},this.setErrorMap=e=>{CZ(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(JZ(t)){let{formError:e,fieldErrors:r}=hQ(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>lQ.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>lQ.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??nQ(),this._devtoolsSubmissionOverride=!1;let t=pQ({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!JZ(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=AZ(t);let n;this.fieldMetaDerived=AZ(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=IZ(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!GZ(u),f=!o.isDirty,p=YZ(l,this.getFieldInfo(a)?.instance?.options.defaultValue??IZ(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=AZ(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!aQ(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&aQ(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=AZ(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&JZ(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&YZ(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return uQ(e.validate)?lQ[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function hQ(e){return e?JZ(e)?{formError:hQ(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function gQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var _Q=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...dQ,isTouched:e.fieldMetaBase[this.name]?.isTouched??dQ.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??dQ.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??dQ.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(YZ(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,QZ(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,QZ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,QZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,QZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,QZ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,QZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,QZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,QZ(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=KZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||oQ}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=KZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||oQ});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;CZ(()=>{let e=(e,n)=>{let r=yQ(n.cause),a=n.validate?vQ(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=ZZ({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=yQ(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=qZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||oQ}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=qZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||oQ});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));CZ(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=yQ(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=vQ(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=ZZ({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),CZ(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>aQ(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[yQ(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[yQ(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>lQ.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>lQ.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)aQ(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=AZ(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...dQ,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!YZ(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return uQ(e.validate)?lQ[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function vQ(e){if(e)return e}function yQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function bQ(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function xQ(e){return{...dQ,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var SQ=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??bQ({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(YZ(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...dQ,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??bQ({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;wQ(t)&&(n=t.group,r=t.fields);let i=CQ(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:bQ({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,QZ(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof _Q&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&aQ(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=XZ({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=dQ)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=KZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||oQ}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=KZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||oQ});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;CZ(()=>{let t=(t,r)=>{let i=EQ(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&wQ(s)&&(c=s.group,l=s.fields);let u=CQ(c),d=n[i],{newErrorValue:f,newSource:p}=ZZ({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=EQ(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=qZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||oQ}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=qZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||oQ});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=EQ(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&wQ(o)&&(l=o.group,u=o.fields);let d=CQ(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=ZZ({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return CZ(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>aQ(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[EQ(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>aQ(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),CZ(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}CZ(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),CZ(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=AZ(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??xQ(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!YZ(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(uQ(e.validate)){let t=lQ[e.type](e.value,e.validate);return e.type===`validate`?TQ(t):t.then(TQ)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function CQ(e){if(e)return e}function wQ(e){return!!e&&typeof e==`object`&&`fields`in e}function TQ(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function EQ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function DQ(e,t){if(!t)return;let n=Object.assign({},e,{state:iQ(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return CZ(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}function OQ(e,t){return e===t}function kQ(e,t=e=>e,n){let r=n?.compare??OQ,i=(0,J.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,J.useCallback)(()=>e.get(),[e]);return(0,cH.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var AQ=typeof window<`u`?J.useLayoutEffect:J.useEffect;function jQ(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new _Q({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new _Q({...e}),i(a),n({form:e.form,name:e.name}));let o=kQ(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=kQ(a.store,e=>e.meta.isTouched),c=kQ(a.store,e=>e.meta.isBlurred),l=kQ(a.store,e=>e.meta.isDirty),u=kQ(a.store,e=>e.meta.errorMap),d=kQ(a.store,e=>e.meta.errorSourceMap),f=kQ(a.store,e=>e.meta.isValidating),p=(0,J.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return AQ(a.mount,[a]),AQ(()=>{a.update(e)}),p}var MQ=(({children:e,...t})=>{let n=jQ(t),r=(0,J.useMemo)(()=>FZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function NQ(){return(0,J.useState)(()=>nQ())[0]}var PQ=J,FQ=`18.3.1`.split(`.`)[0]===`17`?NQ:PQ.useId;function IQ(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new SQ({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new SQ({...e})),n({form:e.form,name:e.name}));let a=kQ(r.store,e=>e.value),o=kQ(r.store,e=>e.meta.isTouched),s=kQ(r.store,e=>e.meta.isBlurred),c=kQ(r.store,e=>e.meta.isDirty),l=kQ(r.store,e=>e.meta.errorMap),u=kQ(r.store,e=>e.meta.errorSourceMap),d=kQ(r.store,e=>e.meta.isValidating),f=kQ(r.store,e=>e.meta.isSubmitting),p=kQ(r.store,e=>e.meta.isSubmitted),m=kQ(r.store,e=>e.meta.submissionAttempts),h=kQ(r.store,e=>e.meta.isSubmitSuccessful),g=kQ(r.store,e=>e.meta.canSubmit),_=kQ(r.store,e=>e.meta.isValid),v=kQ(r.store,e=>e.meta.isFieldsValid),y=kQ(r.store,e=>e.meta.isFieldsValidating),b=kQ(r.store,e=>e.meta.isGroupValid),x=(0,J.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return AQ(r.mount,[r]),AQ(()=>{r.update(e)}),x}var LQ=(({children:e,...t})=>{let n=IQ(t),r=(0,J.useMemo)(()=>FZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function RQ({form:e,selector:t=e=>e,children:n}){let r=kQ(e.store,t);return(0,X.jsx)(X.Fragment,{children:FZ(n,r)})}function zQ(e){let t=FQ(),[n,r]=(0,J.useState)(e?.formId),[i,a]=(0,J.useState)(()=>new mQ({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new mQ({...e,formId:n})),r(n)}let o=(0,J.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,X.jsx)(MQ,{...e,form:i})},e.FormGroup=function(e){return(0,X.jsx)(LQ,{...e,form:i})},e.Subscribe=function(e){return(0,X.jsx)(RQ,{form:i,selector:e.selector,children:e.children})},e},[i]);AQ(i.mount,[]),AQ(()=>{i.update(e)});let s=(0,J.useRef)(!1);return AQ(()=>{s.current&&e?.transform&&DQ(i,e.transform)},[i,e?.transform]),AQ(()=>{s.current=!0}),o}var BQ=zt(q),VQ=zt(W({message:q}));function HQ(e){for(let t of e.errors){let e=$e(it(ne(VQ(t),e=>e.message),()=>BQ(t)));if(e!==void 0&&e.length>0)return e}}var UQ={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},WQ=(0,J.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,X.jsx)(lE,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:$(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,X.jsx)(`span`,{"aria-hidden":`true`,className:$(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,UQ[n]),children:t})})}),GQ={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},KQ=(0,J.forwardRef)(function({className:e,tone:t=`primary`,...n},r){return(0,X.jsx)(`progress`,{...n,"data-complete":n.value!==void 0&&Number(n.value)>=Number(n.max??1)?`true`:void 0,className:$(`progress caps-gooey-motion caps-gooey-progress w-full`,GQ[t],e),ref:r})});(0,J.forwardRef)(function({label:e,value:t,max:n,tone:r=`info`,className:i,...a},o){return(0,X.jsxs)(`div`,{...a,ref:o,className:$(`caps-game-meter`,i),children:[(0,X.jsxs)(`div`,{className:`caps-game-meter-readout`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsxs)(`span`,{className:`caps-game-meter-value`,children:[t,` / `,n]})]}),(0,X.jsx)(KQ,{"aria-label":e,value:t,max:n,tone:r})]})});function qQ({className:e,items:t,onCancel:n,onRemove:r,onRetry:i,rowClassName:a}){return t.length?(0,X.jsx)(`div`,{"aria-live":`polite`,className:`caps-upload-queue flex w-full min-w-0 flex-col gap-sm ${e??``}`,"data-upload-rows":!0,children:t.map(e=>(0,X.jsx)(XQ,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function JQ({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,X.jsx)(WQ,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,X.jsx)(tG,{}):(0,X.jsx)(iG,{}),onClick:()=>void n(t),type:`button`}):null}function YQ({item:e}){return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block min-w-0 truncate`,title:e.name,children:e.name}),(0,X.jsx)(`div`,{className:`caps-upload-details`,children:(0,X.jsxs)(`span`,{"aria-live":e.alert?`assertive`:void 0,className:`caps-upload-status min-w-0 break-words`,"data-upload-status":!0,role:e.alert?`alert`:void 0,children:[e.alert??e.statusLabel,` `,e.progressLabel]})})]})}function XQ({item:e,onCancel:t,onRemove:n,onRetry:r,rowClassName:i}){return(0,X.jsxs)(`div`,{className:`caps-upload-row grid w-full min-w-0 max-w-full grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-sm p-sm text-xs ${i??``}`,children:[e.preview.kind===`image`?(0,X.jsx)(`img`,{alt:``,className:`caps-upload-preview mask mask-squircle size-8 shrink-0 object-cover`,src:e.preview.url}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-upload-preview mask mask-squircle flex size-8 shrink-0 items-center justify-center bg-base-300`,children:(0,X.jsx)(ZW,{className:`size-4`})}),(0,X.jsx)(YQ,{item:e}),(0,X.jsx)(ZQ,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,X.jsx)(KQ,{"aria-label":`${e.name} progress`,className:`caps-upload-progress`,tone:e.alert?`error`:e.progress===100?`success`:`accent`,max:100,value:e.progress??(e.alert?0:void 0)})]})}function ZQ({actions:e,id:t,onCancel:n,onRemove:r,onRetry:i}){return(0,X.jsxs)(`div`,{className:`caps-upload-actions flex min-w-0 flex-wrap justify-end gap-xs`,children:[(0,X.jsx)(JQ,{action:e.retry,id:t,onAction:i,retry:!0}),(0,X.jsx)(JQ,{action:e.cancel,id:t,onAction:n}),(0,X.jsx)(JQ,{action:e.remove,id:t,onAction:r})]})}var QQ={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},$Q={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function e$({state:e}){let t=`caps-checkbox-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(e).current,i=(0,J.useRef)(e),a=qS();return(0,J.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=IS(n.current),c=WA(s,{ease:`inCubic`,duration:160}),l=HT(n.current,{d:{to:QQ[e],...o?HA:WA(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?HA:t?WA(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...WA(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:RS(s,120),...UA(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,X.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(qT,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(JT,{id:`${t}-shadow`}),(0,X.jsx)(YT,{id:`${t}-inset`}),(0,X.jsx)(ZT,{id:`${t}-goo`,values:$Q}),(0,X.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,X.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,X.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,X.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,X.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,X.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,X.jsx)(`path`,{ref:n,d:QQ[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,X.jsx)(`clipPath`,{id:`${t}-well`,children:(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,X.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,X.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,X.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,X.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,X.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var t$=(0,J.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,J.useRef)(null),[d,f]=(0,J.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,J.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,J.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,J.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,X.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,X.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:$(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,X.jsx)(e$,{state:m}):n]})}),n$=J.createContext(void 0);function r$(e){let t=J.useContext(n$);if(t===void 0&&!e)throw Error(ME(47));return t}var i$={...wH,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!wH.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&wH.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>wH.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},a$=class extends hH{constructor(e,t,n){let r=new YV;super(o$(e,r,t,n),s$(r),i$)}setOpen=(e,t)=>{let n=t.reason===mB,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=UV(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=HV(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),uL.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function o$(e,t,n,r=!1){let i={...vH(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function s$(e){return{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:J.createRef(),beforeTriggerFocusGuardRef:J.createRef(),beforeContentFocusGuardRef:J.createRef(),stickIfOpenTimeout:new kE,stickIfOpen:!0,triggerElements:e}}var c$=iH(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=u$(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),JV(u,d),GV(u);let{forceUnmount:m}=KV(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),J.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),J.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,dB(yB))}),[m,u]);let h=d||f||s!=null;return(0,X.jsxs)(n$.Provider,{value:u,children:[s&&(0,X.jsx)(zV,{handle:s,store:u}),h&&(0,X.jsx)(d$,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function l$(e){return r$(!0)?(0,X.jsx)(c$,{props:e}):(0,X.jsx)(mV,{children:(0,X.jsx)(c$,{props:e})})}function u$(e,t){let n=RV((e,n)=>new a$(t,e,n));return J.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function d$({store:e,modal:t}){let n=OV(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return qV(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function f$(e,t){function n(n,r,i){let a=n.currentTarget;uL.flushSync(()=>{e.setOpen(!1,dB(_B,n.nativeEvent,a))}),$k(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&eA(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var p$=aH(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=r$(!0),h=TH(s)??m;if(!h)throw Error(ME(74));let g=CD(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=J.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=WV(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=NH(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:VH(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=TV(v,{stickIfOpen:xE(()=>h.context.stickIfOpen)}),k=xW(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=cB({disabled:a,native:o}),N={open(e){return w?zO.open(e):RO.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=f$(h,x),ee=cD(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[QB]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),I=(0,X.jsx)(J.Fragment,{children:ee},g);return E?(0,X.jsxs)(J.Fragment,{children:[(0,X.jsx)(IB,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),I,(0,X.jsx)(IB,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):I}),m$=J.createContext(void 0);function h$(){let e=J.useContext(m$);if(e===void 0)throw Error(ME(45));return e}var g$=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return r$().useState(`mounted`)||n?(0,X.jsx)(m$.Provider,{value:n,children:(0,X.jsx)(aV,{ref:t,...r})}):null}),_$=J.createContext(void 0);function v$(){let e=J.useContext(_$);if(!e)throw Error(ME(46));return e}function y$(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=J.useState(null),d=J.useRef(null),f=dV(n),p=J.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=zU({...e,elements:{...p,...l&&{reference:l}}}),h=J.useCallback(e=>{let t=LD(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=J.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=J.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=J.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return hA(()=>{o&&(d.current=o)},[o]),hA(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),J.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var b$=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=dk(e,t)||{};if(l==null)return{};let d=kk(u),f={x:n,y:r},p=_k(i),m=hk(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=uk(D,k,O),j=!c.arrow&&pk(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),x$=(e,t)=>{let{name:n,fn:r}=b$(e);return{name:n,fn:r,options:[e,t]}},S$={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},C$={sideX:`left`,sideY:`top`},w$=`--available-width`,T$=`--available-height`,E$=`--anchor-width`,D$=`--anchor-height`,O$=`--transform-origin`,k$=w$,A$=T$;function j$(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function M$(e,t,n){let{rects:r,placement:i}=e;return{side:j$(t,fk(i),n),align:pk(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function N$(e){return P$(e,y$)}function P$(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=xE(O),A=O?k:n,j=OB(n),M=OB(g),N=bA()===`rtl`,[P,F]=J.useState(null);!g&&P!==null&&F(null);let ee=x===`placement`,I=P?fk(P):null,te=P&&ee?pk(P)||`center`:null,L=I||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],ne=te||o,re=ne===`center`?L:`${L}-${ne}`,ie=l;typeof ie==`number`?ie={top:ie,right:ie,bottom:ie,left:ie}:ie&&={top:ie.top||0,right:ie.right||0,bottom:ie.bottom||0,left:ie.left||0};let ae=+(i===`bottom`),oe=+(i===`top`),R=+(i===`right`),se=+(i===`left`),ce={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:ie},le=J.useRef(null),ue=OB(a),de=OB(s),fe=typeof a==`function`?0:a,pe=typeof s==`function`?0:s,me=[];p&&me.push(p),me.push(BU(e=>{let t=M$(e,i,N),n=typeof ue.current==`function`?ue.current(t):ue.current,r=typeof de.current==`function`?de.current(t):de.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[fe,pe,N,i]));let he=w===`none`&&C!==`shift`,ge=!he&&(u||E||C===`shift`),_e=C===`none`?null:UU({...ce,padding:{top:ie.top+1+ae,right:ie.right+1+se,bottom:ie.bottom+1+oe,left:ie.left+1+R},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),ve=he?null:VU({...ce,rootBoundary:D,mainAxis:w!==`none`,crossAxis:ge,limiter:u||E?void 0:HU(e=>{if(!le.current)return{};let{width:t,height:n}=le.current.getBoundingClientRect(),r=gk(fk(e.placement)),i=r===`y`?t:n,a=r===`y`?ie.left+ie.right:ie.top+ie.bottom;return{offset:i/2+a/2}})},[ce,u,E,D,ie,w]);C===`shift`||w===`shift`||ne===`center`?me.push(ve,_e):me.push(_e,ve),me.push(WU({...ce,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(k$,`${t}px`),i.setProperty(A$,`${n}px`);let a=PD(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(E$,`${u}px`),i.setProperty(D$,`${d}px`)}}),x$(e=>({element:le.current||Nk(e.elements.floating).createElement(`div`),padding:le.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=fk(r),u=pk(r),d=gk(l)===`y`,f=le.current,p=typeof a==`function`?a(M$(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return ge&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(O$,d?`${m} ${h}`:`${h} ${m}`),{}}},S$,b),hA(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ye=J.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:be,elements:xe,x:Se,y:Ce,middlewareData:we,update:Te,placement:Ee,context:De,isPositioned:Oe,floatingStyles:ke}=t({rootContext:h,open:m?g:void 0,placement:re,middleware:me,strategy:r,whileElementsMounted:m?void 0:(...e)=>DU(...e,ye),nodeId:y,externalTree:S}),{sideX:Ae,sideY:je}=we.adaptiveOrigin||C$,Me=Oe?r:`fixed`,Ne=J.useMemo(()=>{let e;return e=Oe?b?{position:Me,[Ae]:Se,[je]:Ce}:{...ke,position:Me}:{position:Me,top:0,left:0},e[k$]=`100vw`,e[A$]=`100vh`,Oe||(e.opacity=0),e},[b,Me,Ae,Se,je,Ce,ke,Oe]),Pe=J.useRef(null);hA(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(F$(t)?t.current:t)||null;n!==Pe.current&&(be.setPositionReference(n),Pe.current=n)},[g,be,A,j]),J.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&F$(e)&&e.current!==Pe.current&&(be.setPositionReference(e.current),Pe.current=e.current)},[g,be,A,j]),J.useEffect(()=>{if(m&&g&&xe.reference&&xe.floating)return DU(xe.reference,xe.floating,Te,ye)},[m,g,xe,Te,ye]);let Fe=fk(Ee),Ie=j$(i,Fe,N),Le=pk(Ee)||`center`,Re=!!we.hide?.referenceHidden;hA(()=>{x&&g&&Oe&&(Fe!==L||ee&&Le!==ne)&&F(Ee)},[x,ee,g,Oe,Ee,Fe,Le,L,ne]);let ze=J.useMemo(()=>({position:`absolute`,top:we.arrow?.y,left:we.arrow?.x}),[we.arrow]),Be=we.arrow?.centerOffset!==0;return J.useMemo(()=>({positionerStyles:Ne,arrowStyles:ze,arrowRef:le,arrowUncentered:Be,side:Ie,align:Le,physicalSide:Fe,anchorHidden:Re,refs:be,context:De,isPositioned:Oe,update:Te}),[Ne,ze,le,Be,Ie,Le,Fe,Re,be,De,Oe,Te])}function F$(e){return e!=null&&`current`in e}function I$(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=J.useRef(null),o=J.useRef(null),s=NV(r);hA(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),hA(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}function L$(e){return e===`starting`?ZB:EE}function R$(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),cD(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},L$(r),i],stateAttributesMapping:BO})}var z$=20;function B$(e,t,n,r){let[i,a]=J.useState(!1);hA(()=>{if(!e||!t||n==null){a(!1);return}let r=Nk(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-z$)},[e,t,n]),dW(e&&(!t||i),r)}var V$=J.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=$B,..._}=e,v=r$(),y=h$(),b=fV(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=N$({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});I$({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;B$(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=R$(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,X.jsxs)(_$.Provider,{value:j,children:[S&&M&&(0,X.jsx)($U,{inert:QU(!C),cutout:T}),(0,X.jsx)(pV,{id:b,children:P})]})}),H$=J.createContext(void 0);function U$(e){let t=J.useContext(H$);if(t===void 0&&!e)throw Error(ME(69));return t}var W$=J.createContext(void 0);function G$(){let[e,t]=J.useState(0),n=xE(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:J.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var K$=J.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=r$(),l=v$(),u=U$(!0)!=null,{context:d,hasClosePart:f}=G$(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);PV({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),jH(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?LV(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=cD(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...IV,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&qU.has(e.key)&&e.stopPropagation()}},L$(g),s],stateAttributesMapping:VO});return(0,X.jsx)(wV,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:RD(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,X.jsx)(W$.Provider,{value:d,children:M})})}),q$=(0,J.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,X.jsxs)(`button`,{...r,ref:i,type:n,className:$(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(KW,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function J$({defaultOpen:e,defaultValue:t,getKey:n,getSearchText:r,groupBy:i,id:a,isDisabled:o,items:s,onOpenChange:c,onCommit:l,multiple:u,controlledOpen:d,controlledKeys:f,trigger:p}){let m=`${a}-listbox`,[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(t),[x,S]=(0,J.useState)(e),C=f??(y===null?[]:[y]),w=p?d??x:!0,T=(0,J.useMemo)(()=>{let e=h.trim().toLowerCase();return e?s.filter(t=>r(t).toLowerCase().includes(e)):s},[r,s,h]),E=RK({getKey:n,isDisabled:o,items:T});(0,J.useEffect)(()=>{if(E.activeKey!==null)return;let e=E.enabledItems.find(e=>C.includes(n(e)))??E.enabledItems[0];e&&E.setActiveKey(n(e))},[E.activeKey,E.enabledItems,E.setActiveKey,n,C]);let D=e=>{v(!1),e||g(``),d===void 0&&S(e),c?.(e)},O=e=>`${m}-option-${encodeURIComponent(e)}`,k=e=>{let t=n(e);f===void 0&&b(t),l(e),p&&!u&&D(!1)},A=e=>{v(!0),g(e.target.value),E.setActiveKey(null)},j=e=>{if(RG(e))return;let t;switch(e.key){case`ArrowDown`:t=[1,void 0];break;case`ArrowUp`:t=[-1,void 0];break;case`End`:t=[1,`end`];break;case`Home`:t=[-1,`start`]}t?(v(!0),e.preventDefault(),E.move(t[0],t[1])):e.key===`Enter`&&E.activeItem&&(e.preventDefault(),k(E.activeItem))},M=(0,J.useMemo)(()=>{if(!i)return[{label:``,items:T}];let e=new Map;for(let t of T){let n=i(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e].map(([e,t])=>({label:e,items:t}))},[T,i]);return{keyboardNavigation:_,onPointerMove:()=>{v(!1)},activeKey:E.activeKey,activeItem:E.activeItem,groups:M,inputValue:h,listboxId:m,onInputChange:A,onInputKeyDown:j,optionId:O,open:w,commit:k,selectedKeys:C,setOpen:D}}function Y$(e){let{"aria-describedby":t,"aria-invalid":n,"aria-label":r,"aria-labelledby":i,"aria-required":a,activeTone:o=`neutral`,container:s,contentClassName:c,defaultOpen:l=!1,defaultValue:u=null,emptyMessage:d=`No matches`,getKey:f,getLabel:p,getSearchText:m=p,groupBy:h,id:g,inputProps:_,inputRef:v,isDisabled:y=()=>!1,items:b,onOpenChange:x,onValueChange:S,multiple:C,open:w,placeholder:T=`Search…`,renderItem:E,rootRef:D,trigger:O,triggerRef:k,value:A,...j}=e,M=e=>{let t=f(e);if(C){let e=A.includes(t)?A.filter(e=>e!==t):[...A,t];S?.(e,b.filter(t=>e.includes(f(t))))}else S?.(t,e)},N;C?N=A:A!==void 0&&(N=A===null?[]:[A]);let P=(0,J.useId)(),F=O?.props??_,ee=g??F?.id??P,I={id:ee,"aria-describedby":[t,F?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??F?.[`aria-invalid`],"aria-label":F?.[`aria-label`]??r,"aria-labelledby":F?.[`aria-labelledby`]??i,"aria-required":a??F?.[`aria-required`]},{keyboardNavigation:te,onPointerMove:L,activeItem:ne,activeKey:re,commit:ie,groups:ae,inputValue:oe,listboxId:R,onInputChange:se,onInputKeyDown:ce,open:le,optionId:ue,selectedKeys:de,setOpen:fe}=J$({defaultOpen:l,defaultValue:u,getKey:f,getSearchText:m,groupBy:h,id:ee,isDisabled:y,items:b,onOpenChange:x,onCommit:M,multiple:C??!1,controlledOpen:w,controlledKeys:N,trigger:O});EW(()=>{O&&fe(!1)});let pe=TW(`popover`),me=s===void 0?pe:s,he=IK(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),ge=(0,X.jsx)(MK,{..._,...O?{}:I,"aria-activedescendant":ne?ue(f(ne)):void 0,"aria-autocomplete":`list`,"aria-controls":R,"aria-expanded":!0,className:$(`input-sm`,_?.className),id:O?_?.id??`${ee}-input`:ee,onChange:e=>{_?.onChange?.(e),se(e)},onKeyDown:e=>{_?.onKeyDown?.(e),e.defaultPrevented||ce(e)},placeholder:_?.placeholder??T,ref:v,role:`combobox`,value:oe}),_e=(0,X.jsx)(`div`,{id:R,ref:he,className:`caps-combobox-list`,"data-navigation":te?`keyboard`:`pointer`,onPointerMove:L,role:`listbox`,"aria-multiselectable":C??void 0,children:ae.every(e=>e.items.length===0)?(0,X.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:d}):ae.map(e=>(0,X.jsxs)(`div`,{"aria-label":e.label||void 0,role:e.label?`group`:void 0,children:[e.label?(0,X.jsx)(`div`,{className:`px-md pb-xs pt-sm text-xs text-base-content uppercase tracking-wider`,children:e.label}):null,e.items.map(e=>{let t=f(e),n=y(e),r=re===t,i={active:r,disabled:n,selected:de.includes(t)};return(0,X.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&te,disabled:n,id:ue(t),onClick:()=>{ie(e)},onMouseDown:e=>{e.preventDefault()},role:`option`,tabIndex:-1,type:`button`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-combobox-check`,children:i.selected?(0,X.jsx)(GW,{}):null}),E?.(e,r,i)??p(e)]},t)})]},e.label))});return O?(0,X.jsx)(`div`,{...j,className:$(j.className),ref:D,children:(0,X.jsxs)(l$,{modal:!0,onOpenChange:fe,open:le,children:[(0,X.jsx)(p$,{...I,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),me===null?null:(0,X.jsx)(g$,{container:me,children:(0,X.jsx)(V$,{align:`start`,side:`bottom`,sideOffset:4,children:(0,X.jsxs)(K$,{"data-active-tone":o,className:$(`min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none caps-combobox-panel caps-combobox-popup`,c),children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:ge}),_e]})})})]})}):(0,X.jsx)(`div`,{...j,className:$(j.className),ref:D,children:(0,X.jsxs)(`div`,{className:$(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:ge}),_e]})})}function X$({icon:e,caption:t}){return(0,X.jsxs)(`span`,{className:`caps-icon-choice-mark`,"aria-hidden":`true`,children:[(0,X.jsx)(`span`,{className:`caps-icon-choice-art`,children:e}),t?(0,X.jsx)(`span`,{className:`caps-icon-choice-caption`,children:t}):null,(0,X.jsx)(`span`,{className:`caps-icon-choice-lamp`})]})}var Z$=(0,J.forwardRef)(function({label:e,icon:t,caption:n,appearance:r,className:i,...a},o){return(0,X.jsx)(`label`,{className:`caps-icon-choice`,"data-appearance":r===`compact`?r:void 0,children:(0,X.jsx)(t$,{...a,appearance:r??`default`,"aria-label":e,className:$(`caps-icon-choice-input`,i),indicator:(0,X.jsx)(X$,{icon:t,caption:n}),ref:o})})});function Q$({checked:e}){let t=`caps-radio-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(e).current,i=(0,J.useRef)(e),a=(0,J.useRef)(null),o=LS(a),{reduced:s}=o;return(0,J.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=WA(o,{ease:`outCubic`,duration:75}),c=e?UA(o,{bounce:.65,duration:300}):WA(o,{ease:`inCubic`,duration:100}),l=HT(n.current,t?{rx:r,ry:r,cy:6,duration:0}:{rx:[{to:e?3.5:4.15,...a},{to:r,...c}],ry:[{to:e?4.5:3.85,...a},{to:r,...c}],cy:[{to:e?5.85:6.1,...a},{to:6,...c}]});return()=>{l.cancel()}},[e,s,o]),(0,X.jsxs)(`svg`,{ref:a,className:`caps-radio-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(qT,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(JT,{id:`${t}-shadow`}),(0,X.jsx)(YT,{id:`${t}-inset`}),(0,X.jsx)(`clipPath`,{id:`${t}-well`,children:(0,X.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})})]}),(0,X.jsx)(`circle`,{className:`caps-radio-track`,cx:`6`,cy:`6`,r:`5.5`,filter:`url(#${t}-inset)`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,X.jsx)(`ellipse`,{ref:n,cx:`6`,cy:`6`,rx:r?4:0,ry:r?4:0,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var $$=(0,J.createContext)(null),e1=(0,J.forwardRef)(function({children:e,className:t,defaultValue:n,disabled:r=!1,name:i,onValueChange:a,orientation:o=`vertical`,value:s,...c},l){let u=(0,J.useId)(),d=(0,J.useRef)(null);(0,J.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,J.useState)(n),h=s??p;return(0,J.useEffect)(()=>{let e=d.current?.form;if(!e||s!==void 0)return;let t=e=>{queueMicrotask(()=>{e.defaultPrevented||m(n)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[s,n,c.form]),(0,X.jsx)($$.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,X.jsx)(`fieldset`,{...c,className:$(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),t1=(0,J.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,J.useContext)($$);if(!s)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);let c=s.value===i,l=e=>{n?.(e),e.target.checked&&s.onValueChange?.(i)};return(0,X.jsxs)(`span`,{className:`caps-radio`,"data-checked":c,"data-custom-indicator":t!==void 0||void 0,children:[(0,X.jsx)(`input`,{...a,"aria-checked":c,checked:c,className:$(`caps-radio-input`,e),disabled:s.disabled||a.disabled,name:s.name,onChange:l,onClick:r,ref:o,type:`radio`,value:i}),t===void 0?(0,X.jsx)(Q$,{checked:c}):t]})}),n1=(0,J.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,J.useContext)($$),s=(0,J.useId)(),c=t??s,l=o?.value===i.value,u=o?.disabled===!0||i.disabled===!0;return(0,X.jsxs)(`label`,{className:`caps-choice-card`,"data-checked":l,"data-disabled":u||void 0,htmlFor:c,children:[(0,X.jsx)(t1,{...i,"aria-describedby":e?`${c}-description`:void 0,"aria-labelledby":`${c}-title`,id:c,ref:a}),(0,X.jsxs)(`span`,{className:`caps-choice-card-copy`,children:[(0,X.jsx)(`span`,{className:`caps-choice-card-title`,id:`${c}-title`,children:r}),e?(0,X.jsx)(`span`,{className:`caps-choice-card-description`,id:`${c}-description`,children:e}):null]}),n?(0,X.jsx)(`span`,{className:`caps-choice-card-meta`,children:n}):null]})}),r1=(0,J.forwardRef)(function({label:e,icon:t,caption:n,className:r,...i},a){return(0,X.jsx)(`label`,{className:`caps-icon-choice`,children:(0,X.jsx)(t1,{...i,"aria-label":e,className:$(`caps-icon-choice-input`,r),indicator:(0,X.jsx)(X$,{icon:t,caption:n}),ref:a})})}),i1=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,X.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:$(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,X.jsx)(KW,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function a1({checked:e}){let t=`caps-switch-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(null),i=(0,J.useRef)(e).current,a=(0,J.useRef)(e),o=qS();return(0,J.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=IS(n.current),c=UA(s,{bounce:.25,duration:440}),l=WA(s,{ease:`inOutSine`,duration:100}),u=HT(n.current,t?{x:2,y:2,width:i,height:8,duration:0}:{x:[{to:e?2.5:1.5,...l},{to:2,...c}],y:[{to:1.5,...l},{to:2,...c}],height:[{to:9,...l},{to:8,...c}],width:[{to:e?7:16.5,...l},{to:i,...c}]}),d=HT(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,X.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(qT,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(JT,{id:`${t}-shadow`}),(0,X.jsx)(YT,{id:`${t}-inset`}),(0,X.jsx)(`clipPath`,{id:`${t}-track`,children:(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,X.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,X.jsx)(`rect`,{ref:n,x:`2`,y:`2`,width:i?16:8,height:`8`,rx:`4`,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var o1=(0,J.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,J.useRef)(null),[c,l]=(0,J.useState)(n),u=t??c;return(0,J.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,J.useEffect)(()=>{let e=s.current?.form;if(!e||t!==void 0)return;let r=e=>{queueMicrotask(()=>{!e.defaultPrevented&&s.current&&l(n)})};return e.addEventListener(`reset`,r),()=>{e.removeEventListener(`reset`,r)}},[t,n,a.form]),(0,X.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,X.jsx)(`input`,{...a,checked:u,className:$(`caps-switch-input`,e),onChange:e=>{t===void 0&&l(e.target.checked),r?.(e),i?.(e.target.checked)},ref:s,role:`switch`,type:`checkbox`}),(0,X.jsx)(a1,{checked:u})]})}),s1=zt(q),c1=zt(Fn),l1=zt(Sr(vr)),u1=zt(K(q)),d1=K(Tn(File)),f1=zt(d1),p1=Yt([q,vr,Fn,Mn,Tt,K(q),d1]),m1=zt(p1),h1=e=>E(s1(e.state.value),()=>``),g1=e=>E(c1(e.state.value),()=>!1),_1=e=>E(l1(e.state.value),()=>null),v1=e=>E(u1(e.state.value),()=>[]),y1=e=>E(f1(e.state.value),()=>[]),b1=e=>E(m1(e.state.value),()=>null);function x1({field:e,spec:t,locked:n,...r}){let[i,a]=(0,J.useState)(!1);return(0,X.jsxs)(hK,{children:[(0,X.jsx)(MK,{...r,name:t.name,disabled:n,type:i?`text`:`password`,autoComplete:`off`,spellCheck:!1,className:`caps-field-secret`,placeholder:t.placeholder,readOnly:t.readOnly,value:h1(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,X.jsx)(lE,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,X.jsx)(YW,{"aria-hidden":`true`}):(0,X.jsx)(XW,{"aria-hidden":`true`})})]})}var S1={text:`text`,email:`email`,url:`url`,tel:`tel`};function C1({spec:e,field:t,locked:n,...r}){let i=y1(t),a=n||e.readOnly===!0,o=(0,J.useRef)(null);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(JS,{asChild:!0,children:(0,X.jsx)(`input`,{...r,ref:o,type:`file`,tabIndex:-1,required:r.required===!0&&i.length===0,name:e.name,accept:e.accept,multiple:e.multiple,disabled:a,onBlur:t.handleBlur,onChange:e=>{t.handleChange(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,X.jsx)(lE,{type:`button`,variant:`outline`,"aria-label":`Choose files for ${e.label}`,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],disabled:a,onBlur:t.handleBlur,onClick:()=>{o.current?.click()},children:`Choose files`}),(0,X.jsx)(qQ,{items:i.map((e,t)=>({id:String(t),name:e.name,preview:{kind:`file`},progress:0,progressLabel:`${String(e.size)} bytes`,statusLabel:`Selected`,actions:a?{}:{remove:{label:`Remove`,accessibleLabel:`Remove ${e.name}`}}})),onRemove:e=>{t.handleChange(i.filter((t,n)=>String(n)!==e))},onCancel:()=>void 0,onRetry:()=>void 0})]})}function w1({spec:e,field:t,locked:n,...r}){let i=e=>{t.handleChange(e)},a={...r,name:e.name,disabled:n,onBlur:t.handleBlur};switch(e.kind){case`text`:case`email`:case`url`:case`tel`:return(0,X.jsx)(MK,{...a,type:S1[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:h1(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,X.jsx)(rK,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:h1(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,X.jsx)(x1,{...r,field:t,spec:e,locked:n});case`money`:return(0,X.jsxs)(hK,{children:[(0,X.jsx)(gK,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,X.jsx)(MK,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:h1(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,X.jsx)(MK,{...a,type:`date`,readOnly:e.readOnly,value:h1(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,X.jsx)(jK,{...a,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},...e.unit===void 0?{}:{unit:e.unit},...e.wrap===void 0?{}:{wrap:e.wrap},disabled:n||e.readOnly===!0,decrementLabel:`Decrease ${e.label}`,incrementLabel:`Increase ${e.label}`,value:_1(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,X.jsxs)(i1,{...a,value:h1(t),onChange:e=>{i(e.currentTarget.value)},children:[e.placeholder===void 0?null:(0,X.jsx)(`option`,{value:``,disabled:!0,children:e.placeholder}),e.options.map(e=>(0,X.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]});case`combobox`:return(0,X.jsx)(Y$,{id:r.id??e.name,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],"aria-required":r[`aria-required`],items:e.options,getKey:e=>e.value,getLabel:e=>e.label,isDisabled:t=>t.disabled||n||e.readOnly===!0,value:h1(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,X.jsx)(q$,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===h1(t))?.label??e.placeholder??`Choose…`}),inputProps:{"aria-label":`Search ${e.label}`,disabled:n||e.readOnly===!0},onValueChange:e=>{i(e??``),t.handleBlur()}});case`file`:return(0,X.jsx)(C1,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,X.jsx)(t$,{...a,disabled:n||e.readOnly===!0,checked:g1(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,X.jsx)(o1,{...a,disabled:n||e.readOnly===!0,checked:g1(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var T1=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function E1({spec:e,field:t,locked:n,error:r}){let i=n||e.readOnly===!0,a=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=v1(t),o=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,X.jsx)(wK,{legend:a,description:e.help,disabled:i,error:r??null,children:e.kind===`icon-checkboxes`?(0,X.jsx)(`div`,{className:`caps-field-icon-choices`,children:e.options.map(r=>(0,X.jsx)(Z$,{name:e.name,value:r.value,label:r.label,...r.caption===void 0?{}:{caption:r.caption},icon:r.icon,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{o(r.value,e.currentTarget.checked)}},r.value))}):e.options.map(r=>(0,X.jsx)(EK,{label:r.label,description:r.description,orientation:`inline`,children:(0,X.jsx)(t$,{name:e.name,value:r.value,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{o(r.value,e.currentTarget.checked)}})},r.value))})}let o=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,X.jsx)(wK,{legend:a,description:e.help,disabled:i,error:r??null,children:(0,X.jsx)(e1,{name:e.name,"aria-label":a,value:h1(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||o?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,X.jsx)(r1,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):o?(0,X.jsx)(n1,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,X.jsx)(EK,{label:t.label,orientation:`inline`,children:(0,X.jsx)(t1,{value:t.value,disabled:t.disabled})},t.value))})})}function D1({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:b1(t),onChange:e=>{t.handleChange(e)},onBlur:t.handleBlur,error:r,disabled:n,id:a.id??e.name,"aria-describedby":a[`aria-describedby`],"aria-invalid":r!==void 0})}function O1({form:e,spec:t,locked:n}){let r=jQ({form:e,name:t.name}),i=kQ(e.store,e=>e.submissionAttempts>0),a=r.state.meta.isBlurred||i?HQ(r.state.meta):void 0;if(t.render===void 0&&T1.has(t.kind))return(0,X.jsx)(E1,{spec:t,field:r,locked:n,error:a});let o=t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,X.jsx)(EK,{label:t.label,description:t.help,icon:t.icon,orientation:o,error:a,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,X.jsx)(w1,{spec:t,field:r,locked:n}):(0,X.jsx)(D1,{spec:t,field:r,locked:n,error:a,render:t.render})})}var k1=zt(kt(q,p1));function A1({form:e,spec:t,locked:n}){let r=t.when;return kQ(e.store,e=>r===void 0||r(E(k1(e.values),()=>({}))))?(0,X.jsx)(O1,{form:e,spec:t,locked:n}):null}function j1({form:e,section:t,locked:n}){let r=t.fields.map(t=>(0,X.jsx)(A1,{form:e,spec:t,locked:n},t.name));return t.title===void 0?r:(0,X.jsx)(CK,{title:t.title,description:t.description,children:r})}function M1({model:e,names:t,disabled:n=!1}){let r=e.form;return t===void 0?e.description.sections.map(e=>(0,X.jsx)(j1,{form:r,section:e,locked:n},e.id??``)):t.map(t=>{let i=e.description.fields.find(e=>e.name===t);return i===void 0?null:(0,X.jsx)(A1,{form:r,spec:i,locked:n},t)})}var N1=class{annotation;constructor(e){this.annotation=e}},P1=class{sections;constructor(e){this.sections=e}},F1=`caps/form`,I1=0;function L1(e){I1+=1;let t={[`${F1}:${String(I1)}`]:new N1(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}q.annotate(L1({kind:`secret`})).pipe(tn(`Secret`));var R1=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function z1(e){return Object.values(e??{}).reduce((e,t)=>t instanceof N1?{...e,...t.annotation}:e,{})}function B1(e){return e.reduce((e,t)=>({...e,...z1(t)}),{})}function V1(e){let t=e?.[F1];return t instanceof P1?t.sections:{}}var H1=zt(q);function U1(e){if(xn(e))return r(H1(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!hr(e))return null;let t=[];for(let n of e.types){if(Rn(n))continue;let e=U1(n);if(e===null)return null;t.push(...e)}return t}function W1(e){if(xt(e))return{type:`string`,literals:[]};if(Cn(e))return{type:`number`,nullable:!1};if(dr(e))return{type:`boolean`};let t=U1(e);if(t!==null)return{type:`string`,literals:t};if(Gt(e)){let[t]=e.rest;if(t===void 0)return null;if(xt(t))return{type:`strings`,literals:[]};let n=U1(t);return n===null?null:{type:`strings`,literals:n}}if(hr(e)){let t=e.types.filter(e=>!Rn(e)&&!vn(e)),n=e.types.some(e=>vn(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=W1(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function G1(e){let t=e.ast;if(!nn(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=On(e.type),r=B1([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:W1(n);if(i===null)throw Error(`Schema field "${t}" has no form control. Annotate it with field({ render }) or a kind.`);return{name:t,valueType:i,optional:e.type.context?.isOptional===!0,annotation:r,title:qn(e.type),description:fr(e.type)}}),sections:V1(ar(t))}}function K1(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof g)n=!0,t=t.unwrap();else if(t instanceof A)r=!0,t=t.unwrap();else if(t instanceof Ue)t=t.unwrap();else if(t instanceof x)t=t.in;else return{node:t,optional:n,nullable:r}}function q1(e){if(e instanceof bt){let t=e.options.map(e=>q1(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof o?e.options:e instanceof Ve?[...e.values]:null;if(t===null)return null;let n=t.map(e=>H1(e));return n.every(fe)?n.map(e=>e.value):null}function J1(e){let{node:t,nullable:n}=K1(e);if(t instanceof D)return{type:`string`,literals:[]};if(t instanceof M)return{type:`number`,nullable:n};if(t instanceof P)return{type:`boolean`};let r=q1(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof d){let e=K1(t.element).node;if(e instanceof D)return{type:`strings`,literals:[]};let n=q1(e);return n===null?null:{type:`strings`,literals:n}}return null}function Y1(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof g||e instanceof A||e instanceof Ue?e.unwrap():e instanceof x?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>pt.get(e))}function X1(e){return Y1(e).reduce((e,t)=>({...e,...t}),{})}function Z1(e){return Object.entries(e.shape)}function Q1(e){let t=K1(e).node;if(!(t instanceof I))throw Error(`A schema form needs a z.object.`);return{fields:Z1(t).map(([e,t])=>{let n=B1(Y1(t)),r=n.kind===`file`?{type:`files`}:J1(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=X1(t);return{name:e,valueType:r,optional:K1(t).optional,annotation:n,title:i.title,description:i.description}}),sections:V1(X1(e))}}function $1(e,t){let n=t.options??{};return(e.length>0?e:Object.keys(n)).map(e=>{let t=n[e],r=t===void 0?{}:t instanceof Object?t:{label:t};return{value:e,label:r.label??R1(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function e0(e,t){let n=t.some(e=>e.icon!==void 0);switch(e.type){case`boolean`:return`switch`;case`number`:return`number`;case`strings`:return n?`icon-checkboxes`:`checkboxes`;case`files`:return`file`;case`string`:return t.length===0?`text`:t.length>12?`combobox`:n?`icon-radio`:t.some(e=>e.description!==void 0||e.meta!==void 0)||t.length<=3?`radio`:`select`}}function t0(e,t){switch(e.type){case`boolean`:return!1;case`number`:return e.nullable?null:0;case`strings`:case`files`:return[];case`string`:return t[0]?.value??``}}function n0(e){let t=e instanceof ie?Q1(e):G1(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=$1(e.valueType.type===`string`||e.valueType.type===`strings`?e.valueType.literals:[],e.annotation),a=r.help??e.description;return{...r,name:e.name,label:r.label??e.title??R1(e.name),help:a,kind:n??e0(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=t0(e.valueType,i.options))});let i=e=>e.order??e.index,a=e=>e.section!==void 0&&Object.hasOwn(t.sections,e.section)?e.section:null,o=e=>n.filter(t=>a(t)===e).sort((e,t)=>i(e)-i(t)),s=Object.entries(t.sections).map(([e,t])=>({id:e,title:t.title,description:t.description,fields:o(e)}));return{fields:n,sections:[{id:null,title:void 0,description:void 0,fields:o(null)},...s].filter(e=>e.fields.length>0),defaults:r}}function r0(e){let t=e instanceof ie?e:Lt(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>i0(e)):i0(n)}}}}function i0(e){return e.issues===void 0?e:{issues:e.issues.map(e=>e.path===void 0?e:{...e,path:e.path.slice(0,1)})}}var a0=`onServer`;function o0(e){return e.state.meta.errorMap.onServer!==void 0}function s0(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[a0]:void 0}}))}function c0(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[a0]:n}}))}function l0(e){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(e.defaultValues),[s,c]=(0,J.useState)(null);YZ(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,J.useMemo)(()=>n0(l),[l]),d=(0,J.useMemo)(()=>r0(l),[l]),f=zQ({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),o0(e)&&s0(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await r0(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o=await e.onSubmit(a.value,t)??{kind:`saved`};if(o.kind===`refused`){n(o.error??null);let e=r;for(let[t,n]of Object.entries(o.fields??{}))n!==void 0&&n.length>0&&c0(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function u0(e){return{dirty:kQ(e.form.store,e=>!e.isDefaultValue),submitting:kQ(e.form.store,e=>e.isSubmitting),canSubmit:kQ(e.form.store,e=>e.canSubmit)}}function d0({model:e,submitLabel:t=`Save changes`,discardLabel:n,allowClean:r,footer:i,children:a,disabled:o=!1,...s}){let{submitting:c}=u0(e);return(0,X.jsxs)(xK,{...s,busy:c,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit()},children:[a??(0,X.jsx)(M1,{model:e,disabled:o}),i===void 0?(0,X.jsx)(m0,{model:e,label:t,...n===void 0?{}:{discardLabel:n},...r===void 0?{}:{allowClean:r}}):i]})}function f0({schema:e,defaultValues:t,onSubmit:n,...r}){let i=l0({schema:e,defaultValues:t,onSubmit:n});return(0,X.jsx)(d0,{...r,model:i})}function p0(e){return`model`in e?(0,X.jsx)(d0,{...e}):(0,X.jsx)(f0,{...e})}function m0({model:e,label:t,discardLabel:n,allowClean:r=!1,dirtyLabel:i=`Unsaved changes`,buttonProps:a,...o}){let{dirty:s,submitting:c,canSubmit:l}=u0(e),u=c?null:e.saved&&!s?(0,X.jsx)(nK,{tone:`success`,size:`compact`,label:e.saved}):s?(0,X.jsx)(nK,{tone:`neutral`,size:`compact`,label:i}):null;return(0,X.jsxs)(bK,{...o,error:e.error,status:u,children:[n&&s?(0,X.jsx)(lE,{type:`button`,variant:`ghost`,disabled:c,onClick:e.discard,children:n}):null,(0,X.jsx)(lE,{...a,type:`submit`,loading:c,disabled:c||!l||!s&&!r,children:t})]})}var h0=e=>e,g0=(e,t)=>{let n=e[t];if(!n)throw Error(`Missing burger path: ${t}`);return n},_0={apiVersion:1,name:`burger`,palette:{bottomBun:`#e9c46a`,bunSpot:`#d4a373`,cheese:`#f4d03f`,dead:`#636e72`,deadTongue:`#b2bec3`,eye:`#2d3436`,lettuce:`#7cb342`,mouth:`#2d3436`,patty:`#5d4037`,tomato:`#e74c3c`,topBun:`#f4a261`,blush:`#feaae4`,tongue:`#f98284`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.cylinder({parent:r,name:`bottom-bun`,backface:t(`bottomBun`),color:t(`bottomBun`),diameter:34,frontFace:t(`bunSpot`),length:6,rotate:{x:Math.PI/2},stroke:!1,translate:{y:8}}),e.cylinder({parent:r,name:`patty`,color:t(`patty`),diameter:36,frontFace:t(`patty`),length:4,rotate:{x:Math.PI/2},stroke:!1,translate:{y:3}}),e.cylinder({parent:r,name:`tomato`,color:t(`tomato`),diameter:34,frontFace:t(`tomato`),length:2,rotate:{x:Math.PI/2},stroke:!1,translate:{y:-2}});let i=e.hemisphere({parent:r,name:`top-bun`,backface:t(`bunSpot`),color:t(`topBun`),diameter:38,rotate:{x:Math.PI/2},stroke:!1,translate:{y:-3}});for(let[n,r]of[{x:-8,y:-6,z:14},{x:6,y:-8,z:13},{x:0,y:-10,z:12},{x:10,y:-4,z:13},{x:-5,y:-2,z:15},{x:4,y:-12,z:11}].entries())e.path({parent:i,name:`seed.${String(n+1)}`,path:[{x:0,y:0}],color:t(`bunSpot`),stroke:1.2,translate:r});let a=e.group({parent:r,name:`face`,translate:{y:-5,z:16}}),o=Pr(e,t,a,{blushMode:`medium-alias`,hideMouth:!0}),s=e.group({parent:r,name:`burger.mouth`,translate:{y:1,z:10}}),c=h0({angry:[{x:-13,y:2},{x:13,y:2},{x:13,y:5},{bezier:[{x:7,y:4},{x:0,y:5},{x:-7,y:4}]},{x:-13,y:5}],happy:[{x:-12,y:0},{bezier:[{x:-6,y:3},{x:0,y:5},{x:6,y:3}]},{x:12,y:0},{x:13,y:2},{bezier:[{x:7,y:5},{x:0,y:7},{x:-7,y:5}]},{x:-13,y:2}],open:[{x:-10,y:0},{bezier:[{x:-10,y:5},{x:-5,y:8},{x:0,y:8}]},{bezier:[{x:5,y:8},{x:10,y:5},{x:10,y:0}]},{x:10,y:1},{bezier:[{x:5,y:6},{x:-5,y:6},{x:-10,y:1}]}],pout:[{x:-8,y:2},{bezier:[{x:0,y:5},{x:8,y:2},{x:8,y:4}]},{x:0,y:6},{x:-8,y:4}],sad:[{x:-12,y:3},{bezier:[{x:-6,y:0},{x:0,y:-1},{x:6,y:0}]},{x:12,y:3},{x:13,y:5},{bezier:[{x:7,y:2},{x:0,y:1},{x:-7,y:2}]},{x:-13,y:5}],small:[{x:-6,y:1},{x:6,y:1},{x:7,y:3},{x:0,y:2},{x:-7,y:3}],surprised:[],worried:[{x:-11,y:1},{bezier:[{x:-6,y:3},{x:-3,y:1},{x:0,y:2}]},{bezier:[{x:3,y:1},{x:6,y:3},{x:11,y:1}]},{x:12,y:3},{x:0,y:4},{x:-12,y:3}],dead:[{x:-12,y:1},{x:12,y:1},{x:13,y:4},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:4}],normal:[{x:-12,y:1},{x:12,y:1},{x:13,y:4},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:4}]}),l=h0({angry:[{x:-13,y:0},{x:13,y:0},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:2},{x:-7,y:1}]},{x:-13,y:2}],happy:[{x:-12,y:2},{bezier:[{x:-6,y:0},{x:0,y:-1},{x:6,y:0}]},{x:12,y:2},{x:13,y:3},{bezier:[{x:7,y:1},{x:0,y:0},{x:-7,y:1}]},{x:-13,y:3}],open:[{x:-10,y:2},{bezier:[{x:-10,y:-3},{x:-5,y:-6},{x:0,y:-6}]},{bezier:[{x:5,y:-6},{x:10,y:-3},{x:10,y:2}]},{x:10,y:1},{bezier:[{x:5,y:-4},{x:-5,y:-4},{x:-10,y:1}]}],pout:[{x:-8,y:0},{bezier:[{x:-4,y:-1},{x:0,y:0},{x:4,y:-1}]},{x:8,y:0},{x:9,y:1},{x:0,y:1},{x:-9,y:1}],sad:[{x:-12,y:0},{bezier:[{x:-6,y:2},{x:0,y:3},{x:6,y:2}]},{x:12,y:0},{x:13,y:1},{bezier:[{x:7,y:3},{x:0,y:4},{x:-7,y:3}]},{x:-13,y:1}],small:[{x:-6,y:0},{bezier:[{x:-3,y:1},{x:0,y:0},{x:3,y:1}]},{x:6,y:0},{x:7,y:1},{x:0,y:1},{x:-7,y:1}],surprised:[{x:-13,y:2},{bezier:[{x:-7,y:-2},{x:0,y:-3},{x:7,y:-2}]},{x:13,y:2},{x:14,y:3},{bezier:[{x:8,y:0},{x:0,y:-1},{x:-8,y:0}]},{x:-14,y:3}],worried:[{x:-11,y:1},{bezier:[{x:-6,y:0},{x:-3,y:1},{x:0,y:0}]},{bezier:[{x:3,y:2},{x:6,y:0},{x:11,y:1}]},{x:12,y:2},{bezier:[{x:7,y:1},{x:0,y:1},{x:-7,y:1}]},{x:-12,y:2}],dead:[{x:-12,y:1},{bezier:[{x:-6,y:0},{x:0,y:-.5},{x:6,y:0}]},{x:12,y:1},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:.5},{x:-7,y:1}]},{x:-13,y:2}],normal:[{x:-12,y:1},{bezier:[{x:-6,y:0},{x:0,y:-.5},{x:6,y:0}]},{x:12,y:1},{x:13,y:2},{bezier:[{x:7,y:1},{x:0,y:.5},{x:-7,y:1}]},{x:-13,y:2}]}),u={};for(let n of[`normal`,`happy`,`sad`,`angry`,`surprised`,`dead`,`small`,`worried`,`pout`,`open`]){let r=e.group({parent:s,name:`burger.mouth.${n}`}),i={y:n===`open`?2:n===`small`?.5:1.5,z:+(n===`pout`)};n===`surprised`?e.ellipse({parent:r,name:`cheese.${n}`,color:t(`cheese`),fill:!0,height:8,stroke:2,translate:{y:2,z:0},width:6}):e.path({parent:r,name:`cheese.${n}`,color:t(`cheese`),fill:!0,path:g0(c,n),stroke:2,translate:i});let a={y:n===`open`?1:n===`surprised`?-1:-.5,z:n===`pout`?2:1};e.path({parent:r,name:`lettuce.${n}`,color:t(`lettuce`),fill:!0,path:g0(l,n),stroke:1.5,translate:a}),u[n]=r}return{root:n,variants:{eyes:o.eyes,mouth:u,blush:o.blush}}},expressions:Nr,activities:Fr,defaultPresentation:{activity:`idle`,expression:`normal`}},v0=(e,t)=>{let n=e[t];if(!n)throw Error(`Missing cat face node: ${t}`);return n},y0=e=>e,b0={apiVersion:1,name:`cat`,palette:{body:`#ffe6c6`,eye:`#28282e`,mouth:`#28282e`,blush:`#feaae4`,dead:`#6c5671`,deadTongue:`#d9c8bf`,tongue:`#f98284`,stripes:`#dea38b`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.path({parent:r,name:`body.sphere`,path:[{x:0,y:0}],color:t(`body`),stroke:32});for(let n of[-1,1])e.path({parent:r,name:`ear.${n<0?`left`:`right`}`,color:t(`body`),fill:!0,path:[{x:-6,y:0},{x:6,y:0},{x:0,y:-10}],rotate:{z:.6*n},stroke:3,translate:{x:9*n,y:-10}});let i=e.group({parent:r,name:`face`,translate:{z:20}}),a=Pr(e,t,i,{hideMouth:!0}),o=e.group({parent:i,name:`cat.mouth`,translate:{y:6,z:2}}),s=(n,r,i)=>e.path({parent:o,name:`cat.mouth.${n}`,closed:!1,color:t(`mouth`),path:r,stroke:i}),c=y0({normal:s(`normal`,[{x:-2,y:-1},{x:0,y:0},{x:2,y:-1}],1.5),sad:s(`sad`,[{x:-2.5,y:2},{bezier:[{x:0,y:0},{x:2.5,y:2},{x:2.5,y:2}]}],1.5),angry:s(`angry`,[{x:-3,y:1},{x:3,y:1}],2),small:s(`small`,[{x:-1.5,y:0},{x:1.5,y:0}],1),worried:s(`worried`,[{x:-2,y:1},{bezier:[{x:-.5,y:.5},{x:.5,y:.5},{x:2,y:1}]}],1)}),l=e.group({parent:o,name:`cat.mouth.happy`,translate:{y:1}});e.path({parent:l,closed:!1,color:t(`mouth`),path:[{x:-2.5,y:1},{bezier:[{x:0,y:3},{x:2.5,y:1},{x:2.5,y:1}]}],stroke:1.5}),e.ellipse({parent:l,width:2,height:1.5,stroke:0,fill:!0,color:t(`tongue`),translate:{y:2}}),c.happy=l,c.surprised=e.ellipse({parent:o,name:`cat.mouth.surprised`,width:2.5,height:3,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}});let u=e.group({parent:o,name:`cat.mouth.dead`,translate:{y:3}});e.ellipse({parent:u,width:2.5,height:1.5,stroke:1.5,fill:!0,color:t(`dead`)}),e.ellipse({parent:u,width:1.2,height:.8,stroke:0,fill:!0,color:t(`deadTongue`),translate:{y:.5}}),c.dead=u,c.pout=e.ellipse({parent:o,name:`cat.mouth.pout`,width:2,height:2.5,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}}),c.open=e.ellipse({parent:o,name:`cat.mouth.open`,width:4,height:5,stroke:1.5,fill:!0,color:t(`mouth`),translate:{y:1}});let d=e.group({parent:i,name:`whiskers`,translate:{y:5,z:2}});for(let n of[-1,1]){let r=n*12;for(let[i,a]of[-2,0,2].entries())e.path({parent:d,name:`whisker.${n<0?`left`:`right`}.${String(i)}`,closed:!1,color:t(`eye`),path:[{x:0,y:a},{x:n*8,y:a+(i-1)*1.5}],stroke:.8,translate:{x:r,y:a*.5}})}let f={normal:v0(c,`normal`),happy:c.happy,sad:v0(c,`sad`),angry:v0(c,`angry`),surprised:c.surprised,dead:c.dead,small:v0(c,`small`),worried:v0(c,`worried`),pout:c.pout,open:c.open};return{root:n,variants:{eyes:a.eyes,mouth:f,blush:a.blush}}},expressions:Nr,activities:{...Fr,listening:{motion:{target:`root`,rotate:{x:-.2},durationMs:300,repeat:`yoyo`},mouseInfluence:.3},thinking:{motion:{target:`root`,rotate:{z:.1},durationMs:800,repeat:`yoyo`},mouseInfluence:0}},defaultPresentation:{activity:`idle`,expression:`normal`}},x0={apiVersion:1,name:`mushroom`,palette:{body:`#fff7e4`,cap:`#f98284`,capSpot:`#ffe6c6`,eye:`#28282e`,mouth:`#28282e`,blush:`#feaae4`,dead:`#6c5671`,deadTongue:`#d9c8bf`,tongue:`#f98284`,sweat:`#accce4`,white:`#ffffff`},build({scene:e,color:t}){let n=e.group({name:`root`}),r=e.group({parent:n,name:`body`,updateSort:!0});e.hemisphere({parent:r,name:`body.hemisphere`,backface:t(`cap`),color:t(`body`),diameter:32,rotate:{x:3*Math.PI/2},stroke:!1,translate:{y:2}});let i=e.hemisphere({parent:r,name:`cap.hemisphere`,backface:t(`capSpot`),color:t(`cap`),diameter:42,rotate:{x:Math.PI/2},stroke:!1,translate:{y:2}});e.path({parent:i,name:`cap.spot.front`,path:[{x:0,y:0}],color:t(`capSpot`),stroke:12,translate:{x:-8,y:8,z:12}}),e.path({parent:i,name:`cap.spot.top`,path:[{x:0,y:0}],color:t(`capSpot`),stroke:18,translate:{x:8,y:-4,z:13}});let a=e.group({parent:r,name:`face`,translate:{y:7,z:8}}),o=Pr(e,t,a,{blushMode:`medium-alias`});return{root:n,variants:{eyes:o.eyes,mouth:o.mouth,blush:o.blush}}},expressions:Nr,activities:{...Fr,error:{geometry:{eyes:`dead`,mouth:`dead`},motion:{target:`root`,rotate:{x:.9},durationMs:600,repeat:`none`},mouseInfluence:.1}},defaultPresentation:{activity:`idle`,expression:`sleepy`}},S0={mushroom:[`cap`,`capSpot`],cat:[`body`,`stripes`],burger:[`topBun`,`bottomBun`]},C0={mushroom:x0,cat:b0,burger:_0};function w0(e){let t=jr(Mr(C0[e])),n=kr.parse(t.data);return{controls:t.controls,expressions:Object.keys(n.expressions),identitySlots:S0[e]}}var T0=new Map;function E0(e){let t=T0.get(e);return t||(t=w0(e),T0.set(e,t)),t}var D0=Object.freeze({get mushroom(){return E0(`mushroom`)},get cat(){return E0(`cat`)},get burger(){return E0(`burger`)}}),O0={mushroom:`Shiitake`,cat:`Cat`,burger:`Burger`},k0=[[`Rose`,`#f98284`,`#ffe6c6`],[`Peach`,`#f6a55c`,`#ffe9c9`],[`Gold`,`#f2d06b`,`#fff6d1`],[`Leaf`,`#9bd47a`,`#e6f8d8`],[`Mint`,`#5fc7b4`,`#d9f6ef`],[`Sky`,`#6aaee8`,`#dcefff`],[`Lilac`,`#9b8cf0`,`#ebe6ff`],[`Plum`,`#e58bd6`,`#fbe2f6`]];function A0(e,t){if(t===e.character)return e;let n=D0[e.character].identitySlots,r=D0[t].identitySlots,i=Object.fromEntries(r.flatMap((t,r)=>{let i=n[r];return Object.hasOwn(e.appearance,i)?[[t,e.appearance[i]]]:[]}));return{...e,character:t,appearance:i,expression:`normal`}}function j0({value:e,disabled:t=!1,onChange:n}){let r=(0,J.useId)(),i=D0[e.character].identitySlots,a=k0.find(([,t,n])=>i.every((r,i)=>e.appearance[r]===(i===0?t:n)))?.[0]??``;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(e1,{"aria-label":`Character`,className:`grid grid-cols-3 gap-sm`,disabled:t,orientation:`horizontal`,value:e.character,onValueChange:t=>{n(A0(e,cg.shape.character.parse(t)))},children:ig.map(t=>(0,X.jsx)(n1,{id:`${r}-${t}`,value:t,title:O0[t],description:(0,X.jsx)(wX,{avatar:A0(e,t),name:O0[t],size:40})},t))}),(0,X.jsx)(e1,{"aria-label":`Colour`,className:`flex flex-wrap gap-xs`,disabled:t,orientation:`horizontal`,value:a,onValueChange:t=>{let r=k0.find(([e])=>e===t);r&&n({...e,appearance:{...e.appearance,...Object.fromEntries(i.map((e,t)=>[e,r[t===0?1:2]]))}})},children:k0.map(([e,t])=>(0,X.jsx)(`label`,{title:e,className:`grid size-9 cursor-pointer place-items-center rounded-full border border-base-300`,style:{backgroundColor:t},children:(0,X.jsx)(t1,{value:e,"aria-label":e})},e))})]})}var M0=Nt.check(jt(1,{message:`Give your Agent a name.`}),B(256,{message:`Use at most 256 characters.`})),N0=zt(M0),P0=gg.annotate(L1({label:`Computer`,kind:`select`,options:{new:`New Computer`,none:`No Computer`}})),F0=Jn({family:`grove-agent-create-request`,version:1,kinds:{request:{prefix:`request`}}});function I0({create:e,canChooseComputer:t,inputRef:n,error:r,onCancel:i}){let a=(0,J.useRef)(null),[o,s]=(0,J.useState)(()=>fg(F0.request.generate())),c=l0({schema:(0,J.useMemo)(()=>W({name:M0.annotate(L1({label:`Name`,render:e=>(0,X.jsx)(MK,{ref:n,id:e.id,name:e.name,"aria-label":`New Agent name`,"aria-required":`true`,"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],placeholder:`Name your Agent`,maxLength:256,disabled:e.disabled,value:e.value,onBlur:e.onBlur,onChange:t=>{e.onChange(t.currentTarget.value)}})})),computer:P0}),[n]),defaultValues:{name:``,computer:gg.make(`new`)},onSubmit:async({name:n,computer:r})=>{let i=t?r:void 0,s=a.current;if(s?.name!==n||s.computer!==i||s.avatar!==o){let e={name:n,requestId:F0.request.generate(),avatar:o};s=i===void 0?e:{...e,computer:i}}return a.current=s,await e(s)?(a.current=null,{kind:`saved`,values:{name:``,computer:gg.make(`new`)}}):{kind:`refused`}}}),{submitting:l,canSubmit:u,dirty:d}=u0(c);return(0,X.jsxs)(p0,{model:c,"aria-label":`Create Agent`,footer:(0,X.jsxs)(bK,{divider:!1,error:r,children:[(0,X.jsx)(lE,{type:`button`,variant:`ghost`,disabled:l,onClick:i,children:`Cancel`}),(0,X.jsx)(lE,{type:`submit`,className:`shrink-0 disabled:-outline-offset-1`,variant:`primary`,loading:l,disabled:l||!u||!d,children:`Create Agent`})]}),onSubmitCapture:e=>{w(N0(c.form.state.values.name))&&e.currentTarget.querySelector(`input[name="name"]`)?.focus()},onChange:()=>{let e=c.form.state.values;(e.name.trim()!==a.current?.name||t&&e.computer!==a.current.computer)&&(a.current=null)},children:[(0,X.jsx)(M1,{model:c,names:t?[`name`,`computer`]:[`name`]}),(0,X.jsxs)(`fieldset`,{className:`flex flex-col gap-xs`,children:[(0,X.jsx)(`legend`,{className:`caps-label mb-xs text-sm font-semibold text-base-content`,children:`Avatar`}),(0,X.jsx)(j0,{value:o,disabled:l,onChange:e=>{s(e),a.current=null}})]})]})}function L0({open:e,pending:t,error:n,canChooseComputer:r,create:i,onClose:a,returnFocus:o}){let s=(0,J.useRef)(null);return(0,X.jsx)(OW,{open:e,onOpenChange:e=>{!e&&!t&&a()},children:(0,X.jsxs)(NW,{className:`flex flex-col gap-lg`,initialFocus:s,finalFocus:o,keepMounted:!1,children:[(0,X.jsxs)(FW,{children:[(0,X.jsx)(IW,{children:`New Agent`}),(0,X.jsx)(LW,{children:`Agents chat, write and make little games with you.`})]}),(0,X.jsx)(I0,{create:i,canChooseComputer:r,inputRef:s,error:n,onCancel:a})]})})}function R0({open:e,agents:t,defaultAgentId:n,start:r,pending:i,onClose:a,onNewAgent:o,returnFocus:s}){let c=l0({schema:(0,J.useMemo)(()=>W({agentId:q.check(U(e=>t.some(t=>t.agentId===e)||`Choose an Agent.`)).annotate(L1({label:`Agent`,kind:`select`,options:Object.fromEntries(t.map(e=>[e.agentId,BX(e)]))}))}),[t]),defaultValues:{agentId:n??``},onSubmit:async({agentId:e})=>{let t=await r(e);if(t)return{kind:`refused`,error:t}}}),{submitting:l,canSubmit:u}=u0(c);return(0,X.jsx)(OW,{open:e,onOpenChange:e=>{!e&&!i&&!c.form.state.isSubmitting&&a()},children:(0,X.jsxs)(NW,{className:`flex flex-col gap-lg`,keepMounted:!1,finalFocus:s,children:[(0,X.jsxs)(FW,{children:[(0,X.jsx)(IW,{children:`New conversation`}),(0,X.jsx)(LW,{children:`Choose who to talk with.`})]}),t.length===0?(0,X.jsxs)(`div`,{className:`grid gap-sm`,children:[(0,X.jsx)(`p`,{children:`No Agent has conversation access yet.`}),o?(0,X.jsx)(lE,{onClick:o,children:`New Agent`}):null,(0,X.jsx)(lE,{variant:`ghost`,onClick:a,children:`Cancel`})]}):(0,X.jsx)(p0,{model:c,"aria-label":`New conversation`,footer:(0,X.jsxs)(bK,{divider:!1,error:c.error,children:[(0,X.jsx)(lE,{type:`button`,variant:`ghost`,disabled:l||i,onClick:a,children:`Cancel`}),(0,X.jsx)(lE,{type:`submit`,loading:l||i,disabled:!u||l||i,children:`Start`})]})})]})})}var z0=J.useLayoutEffect;function B0(e,t,n){J.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function V0(e){let t=J.useRef(null);return J.useImperativeHandle(e,()=>t.current,[]),t}function H0(e){return e[e.length-1]}function U0(e){return typeof e==`function`}function W0(e,t){return U0(e)?e(t):e}var G0=Object.prototype.hasOwnProperty,K0=Object.prototype.propertyIsEnumerable;function q0(e){for(let t in e)if(G0.call(e,t))return!0;return!1}var J0=()=>Object.create(null),Y0=(e,t)=>X0(e,t,J0);function X0(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=e2(e)&&e2(i);if(!a&&!(Q0(e)&&Q0(i)))return i;let o=a?e:Z0(e);if(!o)return i;let s=a?i:Z0(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:G0.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=X0(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function Z0(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!K0.call(e,r))return!1;t.push(r)}return t}function Q0(e){if(!$0(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!$0(n)||!n.hasOwnProperty(`isPrototypeOf`))}function $0(e){return Object.prototype.toString.call(e)===`[object Object]`}function e2(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function t2(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!t2(e[r],t[r],n))return!1;return!0}if(Q0(e)&&Q0(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!t2(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!t2(e[o],t[o],n)))return!1;return i===a}return!1}var n2=/[\x00-\x1f\x7f"<>`{}]/g;function r2(e){return e.replace(n2,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function i2(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return r2(t)}var a2=[`http:`,`https:`,`mailto:`,`tel:`];function o2(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function s2(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=i2(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=i2(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function c2(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function l2(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function u2(){throw Error(`Invariant failed`)}function d2(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var f2=4,p2=5;function m2(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function h2(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=m2(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function g2(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=h2(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=v2(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c),m=t?p?t:t.toLowerCase():void 0,h=c?p?c:c.toLowerCase():void 0,g=f===1?i.dynamic:f===3?i.optional:i.wildcard,_=f!==2&&!d&&g?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===m&&e.suffix===h);if(_)n=_;else{let e=y2(f,r,p,m,h);n=e,e.parent=i,e.depth=a;let t;t=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],t.push(e),t.length===2&&o?.push(t)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=v2(r);e.kind=p2,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=v2(r);e.kind=f2,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)g2(e,t,r,c,i,a,o,s)}function _2(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function v2(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function y2(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function b2(e,t){let n=v2(`/`),r=new Uint16Array(6),i=[];for(let t of e)g2(!1,r,t,1,n,0,i);for(let e of i)e.sort(_2);t.masksTree=n,t.flatCache=d2(1e3)}function x2(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=E2(e,t.masksTree);return t.flatCache.set(e,r),r}function S2(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=v2(`/`),g2(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),E2(r,o,n)}function C2(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=E2(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=O2(a.route)),t.matchCache.set(r,a),a}function w2(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function T2(e,t=!1,n){let r=v2(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;g2(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&u2(),o[e.id]=e,c!==0&&e.path){let t=w2(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(_2);return{processedTree:{segmentTree:r,singleCache:d2(1e3),matchCache:d2(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function E2(e,t,n=!1){let r=e.split(`/`),i=A2(e,r,t,n);if(!i)return null;let[a]=D2(e,r,i);return{route:i.node.route,rawParams:a}}function D2(e,t,n){let r=k2(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===f2)break;if(u.kind===p2){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function O2(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function k2(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function A2(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!H0(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!P2(l,n))continue;if(i.parse){if(!N2(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==f2&&P2(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===f2||i.kind===2)&&P2(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(N2(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&M2(f,o))return n;P2(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(_||!(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)))){if(a){if(_)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+j2(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+j2(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+j2(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+j2(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function j2(e,t){return 2**(e-t-1)}function M2(e,t){return e===2**(t-1)-1}function N2(e,t,n){let r,i;try{[r,i]=D2(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function P2(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===f2)>(e.node.kind===f2)||t.node.kind===f2==(e.node.kind===f2)&&t.node.depth>e.node.depth)))}function F2(e){return I2(e.filter(e=>e!==void 0).join(`/`))}function I2(e){return e.replace(/\/{2,}/g,`/`)}function L2(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function R2(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function z2(e){return R2(L2(e))}function B2(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function V2(e,t,n){return B2(e,n)===B2(t,n)}function H2({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t===`.`,a=t.startsWith(`/`),o;if(r){o=a?t:i?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(i)s=e.split(`/`);else if(a)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&H0(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.length>1?s.pop():s=[``]:r===`.`||s.push(r)}}s.length>1&&(H0(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=I2(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function U2(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function W2(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>K2(e,n)).join(`/`):K2(r,n):r}function G2({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=h2(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=W2(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=W2(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=W2(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function K2(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function q2(e){return e?.isNotFound===!0}function J2(){try{return sessionStorage}catch{return}}var Y2=`tsr-scroll-restoration-v1_3`,X2=J2();function Z2(){try{return JSON.parse(X2?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Q2(){try{X2?.setItem(Y2,JSON.stringify($2))}catch{}}var $2=Z2(),e4=`data-scroll-restoration-id`,t4=e=>e.state.__TSR_key||e.href;function n4(e){let t=e.getAttribute(e4);if(t)return`[${e4}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var r4=!1,i4=`window`;function a4(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function o4(e){let t=new Set;for(let n of e){if(n===i4)continue;let e=a4(n);e&&t.add(e)}return t}function s4(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||t4,a=new Set,o=e=>{let t=$2[e]||={};for(let e of a)e===document?t[i4]={scrollX,scrollY}:e.isConnected&&(t[n4(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,r4=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{r4||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Q2()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=$2[d];if(e){let t=$2[u];for(let n in e){if(n===i4){if(s)continue}else{let e=a4(n);if(!e||s&&o&&(l??=o4(o),l.has(e)))continue}t||=$2[u]={},t[n]??=e[n]}}}r4=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=o4(o));let t=e&&i&&c,s=r.restoring?$2[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===i4){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=a4(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{r4=!1}}))}function c4(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function l4(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function u4(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=l4(r):Array.isArray(t)?t.push(l4(r)):n[e]=[t,l4(r)]}return n}var d4=/^(?:\s|["[{\d-]|fa|nu|tr)/,f4=m4(JSON.parse),p4=h4(JSON.stringify,JSON.parse);function m4(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=u4(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function h4(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!d4.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=c4(e,r);return t?`?${t}`:``}}var g4=`__root__`;function _4(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function v4(e){return e instanceof Response&&!!e.options}function y4(e){return{input:({url:t})=>{for(let n of e)t=x4(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=S4(e[n],t);return t}}}function b4(e){let t=z2(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=F2([`/`,t,e.pathname]),e)}}function x4(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function S4(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function C4(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{l2(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var w4=`__TSR_index`,T4=`popstate`,E4=`beforeunload`;function D4(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=M4(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[w4];i=O4(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[w4];i=O4(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[w4]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function O4(e,t){t||={};let n=N4();return{...t,key:n,__TSR_key:n,[w4]:e}}function k4(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>M4(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=N4();t.history.replaceState({[w4]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=M4(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[w4]-l.state[w4],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=D4({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(E4,x,{capture:!0}),t.removeEventListener(T4,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(E4,x,{capture:!0}),t.addEventListener(T4,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function A4(e={initialEntries:[`/`]}){let t=e.initialEntries,n=e.initialIndex?Math.min(Math.max(e.initialIndex,0),t.length-1):t.length-1,r=t.map((e,t)=>O4(t,void 0)),i=()=>M4(t[n],r[n]),a=[];return D4({getLocation:i,getLength:()=>t.length,pushState:(e,i)=>{n<t.length-1&&(t.splice(n+1),r.splice(n+1)),r.push(i),t.push(e),n=Math.max(t.length-1,0)},replaceState:(e,i)=>{r[n]=i,t[n]=e},back:()=>{n=Math.max(n-1,0)},forward:()=>{n=Math.min(n+1,t.length-1)},go:e=>{n=Math.min(Math.max(n+e,0),t.length-1)},createHref:e=>e,getBlockers:()=>a,setBlockers:e=>a=e})}function j4(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function M4(e,t){let n=j4(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=N4();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[w4]:0,key:a,__TSR_key:a}}}function N4(){return(Math.random()+1).toString(36).substring(7)}function P4(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function F4(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function I4({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function L4(e,t,n,r){for(let i of t){if(r?.()===!1)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r?.()===!1)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var R4=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=U2(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:k4()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=d2(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=C4(this.latestLocation,e),s4(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=z2(a);t&&t!==`/`&&e.push(b4({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:y4(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=T2(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&b2(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:s2(e).path,external:!1,searchStr:o,search:Y0(t?.search,i),hash:s2(r.slice(1)).path,state:X0(t?.state,a)}}let o=new URL(i,this.origin),s=x4(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:s2(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:Y0(t?.search,c),hash:s2(s.hash.slice(1)).path,state:X0(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>H2({base:e,to:t.includes(`//`)?I2(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=C2(R2(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=t.to?`${t.to}`:void 0,o=r[2],s=Object.assign(Object.create(null),r[3]),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=W4(t.params,s),d=this.routesByPath[R2(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let[e,t,n]=this.getMatchedRoutes(l);f=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&q0(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:s2(G2({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,V4(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=H4(m,t,f,e._includeValidateSearch),m=Y0(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?W0(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?W0(t.state,n.state):{};v=X0(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=S4(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=c2(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=x2(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=W4(s,n);r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=R2(this.latestLocation.href)===R2(n.href)&&t2(I4(n.state),I4(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,_redirects:a,href:o,...s}={})=>{if(o){let t=this.history.location.state.__TSR_index,n=M4(o,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);s.to=x4(this.rewrite,r).pathname,s.search=this.options.parseSearch(n.search),s.hash=n.hash.slice(1)}let c=this.buildLocation({...s,_includeValidateSearch:!0});a&&(c._redirects=a),this._pendingLocation=c;let l=this.commitLocation({...c,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===c&&(this._pendingLocation=void 0)}),l},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(o2(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await I3(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(F4(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&P4(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=(e.options._builtLocation??this.buildLocation(e.options)).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&o2(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=J4,this.preloadRoute=e=>L3(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=S2(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!t2(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?t2(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??p4,parseSearch:e.parseSearch??f4,protocolAllowlist:e.protocolAllowlist??a2}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=O2(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:R2(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?U4(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=V4(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof z4||(r=new z4(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let{interpolatedPath:g,usedParams:_}=G2({path:i.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),v=i.id+g+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(_,d);let x;if(!b)try{G4(i,d)}catch(e){if(x=q2(e)||v4(e)?e:new B4(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:Y0(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=P4(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:g,updatedAt:Date.now(),search:y?Y0(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?X0(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?Y0(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=H0(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=H0(a),c={...e.search};for(let e of a)try{Object.assign(c,V4(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=Object.assign(Object.create(null),o);for(let t of a)try{G4(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},z4=class extends Error{},B4=class extends Error{};function V4(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new z4(`Async validation not supported`);if(n.issues)throw new z4(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function H4(e,t,n,r){let i=[];for(let e of n){let t=e.options;`search`in t?t.search?.middlewares&&i.push(...t.search.middlewares):(t.preSearchFilters||t.postSearchFilters)&&i.push(({search:e,next:n})=>{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;n&&i.push(({search:e,next:t,meta:i})=>{let a=t(e);if(r)try{let e=V4(n,a);if(i&&e)for(let t in e)t in a||(i.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=W0(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function U4(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return g4}function W4(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,W0(e,t))}function G4(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function K4(e,t){return e.options[t]?.preload?.()}function q4(e,t){let n=K4(e,`component`),r=K4(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function J4(e,t,n){let r=()=>t===!1?void 0:t?K4(e,t):q4(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function Y4(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var X4=0,Z4=1,Q4=2,$4=3,e3=4;function t3(e){return typeof e[0]==`number`}function n3(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function r3(e,t){return e.routesById[t.routeId]}function i3(e,t,n){return v4(e)?[$4,e]:q2(e)?(e.routeId||=n,[Q4,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[Z4,e]:[X4,e])}function a3(e,t){let n=i3(t,!0,e.id);if(n[0]!==Z4)return n;try{e.options.onError?.(n[1])}catch(t){n=i3(t,!0,e.id)}return n}function o3(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[e3]):a3(e,t)}function s3(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function c3(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[4];for(let t=n[7]??0;t<r;t++){let r=s[t],i=r3(e,r);r.abortController=n[0];let u=s[t-1]?.context??e.options.context??{},d={params:r.params,location:o,navigate:s3(e,o),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:i.id},f=u;try{let e=r._ctx;!e&&i.options.context&&(e=r._ctx=i.options.context({...d,deps:r.loaderDeps,context:u})||{}),f={...u,...e},r.context=f}catch(a){return u3(e,r),[t,o3(i,a,n)]}if(c.aborted||!n[2]())return n[0].abort(),[t,[e3]];let p=r.paramsError??r.searchError;if(p!==void 0)return u3(e,r),[t,o3(i,p,n)];let m=i.options.beforeLoad;if(!m)continue;let h={...d,search:r.search,context:f,...e.options.additionalContext},g=r.status;g===`success`&&t>=a&&(r.status=`pending`),n[8]?.();try{p3(e,r,`beforeLoad`,n[0]);let a=await n3(m(h),c);if(!n[2]())return n[0].abort(),[t,[e3]];let o=i3(a,!1,i.id);if(o[0]!==X4)return u3(e,r),[t,o];r.context={...f,...a}}catch(a){return u3(e,r),[t,o3(i,a,n)]}finally{g===`success`&&r.status===`pending`&&(r.status=`success`),p3(e,r,!1,n[0])}}i()}function l3(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function u3(e,t){let n=t._flight;t._flight=void 0,l3(e,t,n)?.abort()}function d3(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=l3(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function f3(e){for(let t of e){let e=t._flight;e&&e[2]++}}function p3(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function m3(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:s3(e,s),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function h3(e,t,n,r,i,a,o,s){let c=s.signal;if(c.aborted)return[e3];if(!i)return[X4,void 0];let l=n._flight;p3(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(m3(e,t,n,r,s,a,o))).then(e=>i3(e,!1,r.id),e=>i3(e,!0,r.id)).then(t=>(t[0]!==X4&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Z4&&l[2]?a3(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],await n3(l[0],c)}catch(t){if(t!==c)throw t;return u3(e,n),[e3]}finally{p3(e,n,!1,s)}}function g3(e,t,n){t[0]===X4?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==$4&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function _3(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&u3(e,r)}function v3(e,t){return t[0]===Z4||t[0]===Q4?{...e,status:t[0]===Z4?`error`:`notFound`,error:t[1],_flight:void 0}:e}function y3(e,t,n,r,i,a,o){let s=t[1][n],c=r3(e,s),l=!!a[4],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(m3(e,t,s,c,a[0],i,l))),a[2]()||(a[0].abort(),p=[e3])),!p){if(s.status!==`success`)f=!0;else{let t=a[4]||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[6]||s.cause===`enter`||a[3].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(t){s.invalid=!0,u3(e,s),p=o3(c,t,a)}let m=c.options.loader,h=typeof m==`function`?m:m?.handler,g=(!l||c.options.preload!==!1)&&m?e._flights?.get(s.id):void 0;g===s._flight||p?g=void 0:g&&!f&&!l&&d===void 0?f=!0:f||(g=void 0);let _=!!(m&&f&&s.status===`success`&&!l&&!a[5]&&((typeof m==`function`?void 0:m?.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),v=f&&(!l||c.options.preload!==!1),y=v&&!_&&(s.status!==`success`||!!m),b=c.lazyFn&&c._lazy!==!0?a[8]:void 0;if(v&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),g&&g[2]++,y){let t=s._flight;s._flight=g,l3(e,s,t)?.abort(),s.status===`success`&&n>=o&&(s.status=`pending`),a[8]?.()}v||(s.isFetching=!1);let x=(p?Promise.resolve(p):y?h3(e,t,s,c,h,i,l,a[0]):Promise.resolve([X4,s.loaderData])).then(t=>(y&&(g3(s,t,l),t[0]===X4&&(m&&!a[0].signal.aborted&&_3(e,s,u),s.status=`pending`)),t)),S=n3(Promise.resolve().then(()=>J4(c,void 0,b)),a[0].signal).then(()=>void 0,e=>[n,o3(c,e,a)]).then(e=>x.then(t=>(y&&!e&&t[0]===X4&&s.status===`pending`&&a[2]()&&(s.status=`success`,a[8]?.()),e)));if(r.push([n,x,S]),!_)return x.then(e=>v3(s,e));let C={...s,status:`pending`,preload:!1,_flight:g};s.invalid=!1,s.isFetching=`loader`;let w=h3(e,t,C,c,h,i,!1,a[0]).then(e=>(s.isFetching=!1,g3(C,e,!1),e));return(t[2]??=[]).push([n,w,S,C]),w.then(e=>v3(C,e))}async function b3(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=r3(e,t[n]),a=J4(i,!1);if(a)try{await n3(a,r)}catch(e){if(e===r)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function x3(e,t){t[2]&&=(d3(e,t[2].map(e=>e[3])),void 0)}async function S3(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=$4)throw[a,t];!i&&t[0]!==X4&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===$4)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}async function C3(e,t,n,r,i,a,o){let s=t[1],c=await a,l=!1,u=s.findIndex(e=>e._notFound),d=t=>t[1][0]===Q4?b3(e,s,t,r.signal):t[0],f=u<0?s.length:u;if((c?.[1][0]??0)>=$4)f=0;else if(c){f=c[2]??=await d(c);for(let e of n){if(e[0]>=f)break;let t=await e[1];if(t[0]!==X4&&t[0]<$4&&!(`loaderData`in s[e[0]])){c=[e[0],t],f=c[2]=await d(c);break}}}for(let e of n){if(e[0]>=f)break;let t=await e[2];if(t){c=t;break}}if((c?.[1][0]??0)>=$4){let n=c[1];if(n[0]!==$4||n[1].options.reloadDocument||i<20)return x3(e,t),n;l=!0,c=[0,[Z4,Error(`Too many redirects`)]]}let p=c?c[2]??await d(c):u;if(p>=0){let i=c?.[1],a=i?.[0],u=s[p],d=i?.[1],f=()=>{i&&(u._notFound=void 0,a===Z4?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};f();let m=r3(e,u);try{await n3(i?Promise.resolve().then(()=>J4(m,a===Z4?`errorComponent`:`notFoundComponent`)):Promise.all([J4(m),J4(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal)return x3(e,t),[e3]}i?l&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),x3(e,t),d3(e,s),f()):(u.status=`success`,o?.())}return t}async function w3(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=r3(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await n3(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function T3(e,t,n,r){let i=[t,n],a=e.stores.matches.get(),o=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&o>=0){let t=await b3(e,i[1],void 0,r[0].signal,o);t!==o&&(n[o]._notFound=void 0,n[t]._notFound=!0),o=t}let s=o<0?n.length:o+1,c=0;for(;c<s&&c!==o;){let e=n[c],t=r[3][c],i=a[c];if(t?.id!==e.id||t.status!==`success`||t._notFound||e.preload||i?.id!==e.id||i.status!==`success`||i._notFound)break;c++}let l=[],u=r[7]??0,d=u?Promise.resolve(i[1][u-1]):void 0,f=()=>{for(let t=u;t<s&&!r[0].signal.aborted;t++)d=y3(e,i,t,l,d,r,c)},p=await c3(e,i,r,s,f,c);if(p&&(r[5]=!0,s=p[0],p[1][0]===Q4?(p[2]=await b3(e,i[1],p,r[0].signal),s=Math.min(s,p[2]+1)):p[1][0]>=$4&&(s=0),f()),r[2]()&&!r[4]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let m;try{let t=C3(e,i,l,r[0],r[1],S3(l,p,i[2]),r[8]);i[2]?.length&&(i[3]=S3(i[2],void 0,void 0,t.then(e=>t3(e)?0:Y4(e[1]).length,()=>0))),m=await t}catch(t){throw x3(e,i),t}return t3(m)?m:w3(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function E3(e,t){if(e._tx!==t)return;let n=e._pending,r=!1,i=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===i?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));let a=t[3],o=e.stores.matches.get(),s=-1,c,l,u,d=!1;for(let t=0;t<a.length;t++){let n=a[t],r=n.status===`success`;if(d=o[t]?.id===n.id&&o[t]?.status===`pending`,r&&!d)continue;let i=r3(e,n);if(c=r&&d||n.invalid?0:i.options.pendingMs??e.options.defaultPendingMs,u=i.options.pendingComponent??e.options.defaultPendingComponent,!u||typeof c!=`number`||c===1/0)return;s=t,l=i.options.pendingMinMs??e.options.defaultPendingMinMs??0;break}if(s<0)return;let f=a[s].id;if((!n||n[1]!==s||i!==f)&&(clearTimeout(n?.[3]),e._pending=n=[t,s,d?Date.now()+l:t[4]+c,void 0,d?Promise.resolve(!0):void 0,u]),n[4]&&!r&&n[5]===u)return;if(n[5]=u,!n[4]){clearTimeout(n[3]);let r=n[2]-Date.now();if(r>0){n[3]=setTimeout(()=>E3(e,t),r);return}n[2]=0}let p=a.map(e=>({...e,_flight:void 0}));p[s].status=`pending`;let m=e.startTransition(()=>e.stores.setMatches(p),p).then(t=>(t&&e._pending===n&&n[4]===m&&!n[2]&&(n[2]=Date.now()+l),t));n[4]=m}function D3(e,t){let n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function O3(e,t){e._committed=t,e.stores.setMatches(t)}function k3(e,t){d3(e,t[1]),x3(e,t)}function A3(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=Y4(n).length,s=new Map,c=Date.now();for(let t of[...i,...a.values()]){if(t.status!==`success`||n.some((e,n)=>e.id===t.id&&(n<o||e.status===`success`)))continue;let r=r3(e,t);!r.options.loader||c-t.updatedAt>=(t.preload?r.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:r.options.gcTime??e.options.defaultGcTime??3e5)||s.set(t.id,a.get(t.id)===t?t:{...t,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=s,O3(e,n),d3(e,[...a.values(),...i],[...n,...s.values()]),L4(e,i,n,()=>e._tx===t)}async function j3(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function M3(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function N3(e,t){D3(e,t),t[0].abort(),d3(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set(`idle`),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function P3(e,t,n,r,i){let a=n.map(e=>({...e}));f3(a);for(let t of r)u3(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await C3(e,o,r,t[0],t[1],i)}catch(t){throw d3(e,a),t}if(t3(s)){d3(e,a),s[0]===$4&&e._tx===t&&e._committed===n&&await M3(e,t,s[1]);return}let c=await w3(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){d3(e,c[1]);return}for(let t of c[1]){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),u3(e,n))}O3(e,c[1]),d3(e,n,c[1])}async function F3(e,t,n,r,i,a){let o=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,i,n,a,r],s=await T3(e,t[2],t[3],o);if(t3(s)){s[0]===$4&&e._tx===t?(D3(e,t),d3(e,t[3]),t[3]=[],e._tx===t&&await M3(e,t,s[1])):N3(e,t);return}let c=e._pending;if(c?.[0]===t&&(clearTimeout(c[3]),c[4])){let n=t[0].signal,r=!1;try{r=await n3(c[4],n)}catch(e){if(e!==n)throw e}if(r&&e._pending===c&&c[0]===t){let e=c[2]-Date.now();if(e>0){try{await n3(new Promise(t=>{c[3]=setTimeout(t,e)}),n)}catch{}clearTimeout(c[3])}}}if(e._tx!==t){D3(e,t),k3(e,s);return}let l=t[2],u=F4(l,e.stores.resolvedLocation.get()),d=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){k3(e,s);return}let n=await e.startTransition(()=>{D3(e,t),A3(e,t,s[1],a),e._tx===t&&(e.emit({type:`onLoad`,...u}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...u}))},s[1]);if(e._tx!==t){x3(e,s);return}d?.length&&P3(e,t,s[1],d,s[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(l),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...u}),n&&e._tx===t&&e.emit({type:`onRendered`,...u})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function I3(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),u.signal.aborted){await j3(e,n);return}let f=F4(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await j3(e,n);return}let p=i.href===a.href,m,h=u;try{m=e.matchRoutes(a,{_controller:u}),f3(m)}catch(t){if(u.abort(),!v4(t)){await j3(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...t.options,replace:!0,ignoreBlocker:!0}),await j3(e,n);return}let g=l?c[1](m):void 0;if(g?h=l:l?.abort(),u.signal.aborted){d3(e,m),await j3(e,n);return}e._preflight=void 0;let _=[h,s,a,m,Date.now(),Promise.resolve().then(()=>F3(e,_,p,()=>E3(e,_),t?.sync,g)).catch(()=>{e._tx===_&&N3(e,_)})];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&p3(e,t,!1)}n[0].abort(),d3(e,n[3],_[3],!0)}if(e._tx!==_){d3(e,_[3]),_[3]=[],await j3(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),!r&&!m.some(e=>e._notFound)&&E3(e,_);try{await _[5]}finally{await j3(e,_)}}async function L3(e,t,n=0){if(n>20)return;let r=t._builtLocation??e.buildLocation(t),i=e._committed,a=new AbortController,o;try{o=e.matchRoutes(r,{_controller:a}),f3(o)}catch(e){a.abort(),q2(e)||console.error(e);return}(e._preloads??=new Map).set(a,o);let s;try{let t;try{t=await T3(e,r,o,[a,n,()=>!0,i,!0])}finally{s=e._preloads.delete(a),d3(e,o),a.abort()}if(!t3(t))return t[1];if(s&&t[0]===$4&&!t[1].options.reloadDocument)return L3(e,{...t[1].options,_fromLocation:r},n+1)}catch(e){q2(e)||console.error(e)}}var R3=`Error preloading route! ☝️`,z3=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=g4:this.parentRoute||u2();let r=n?g4:t?.path;r&&r!==`/`&&(r=L2(r));let i=t?.id||r,a=n?g4:F2([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=F2([`/`,a]));let o=a===`__root__`?`/`:F2([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=R2(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>_4({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},B3=class extends z3{constructor(e){super(e)}};function V3(e){return(0,X.jsx)(H3,{...e})}var H3=class extends J.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?J.createElement(this.props.errorComponent??U3,{error:e,reset:this.reset}):this.props.children}};function U3({error:e}){let[t,n]=J.useState(!1);return(0,X.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,X.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,X.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,X.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,X.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,X.jsx)(`div`,{children:(0,X.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,X.jsx)(`code`,{children:e.message}):null})}):null]})}function W3({children:e,fallback:t=null}){return(0,X.jsx)(J.Fragment,{children:G3()?e:t})}function G3(){return J.useSyncExternalStore(K3,()=>!0,()=>!1)}function K3(){return()=>{}}var q3=J.createContext(null);function J3(e){return J.useContext(q3)}var Y3=J.createContext(void 0),X3=J.createContext(void 0),Z3=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(Z3||{});function Q3({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function $3(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var e6=[],t6=0,{link:n6,unlink:r6,propagate:i6,checkDirty:a6,shallowPropagate:o6}=Q3({update(e){return e._update()},notify(e){e6[c6++]=e,e.flags&=~Z3.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Z3.Mutable|Z3.Dirty,f6(e))}}),s6=0,c6=0,l6,u6=0;function d6(e){try{++u6,e()}finally{--u6||p6()}}function f6(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=r6(n,e)}function p6(){if(!(u6>0)){for(;s6<c6;){let e=e6[s6];e6[s6++]=void 0,e.notify()}s6=0,c6=0}}function m6(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?Z3.None:Z3.Mutable,get(){return l6!==void 0&&n6(i,l6,t6),i._snapshot},subscribe(e){let t=$3(e),n={current:!1},r=h6(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=l6,o=t?.compare??Object.is;if(n)l6=i,++t6,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=Z3.Mutable|Z3.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{l6=a,n&&(i.flags&=~Z3.RecursedCheck),f6(i)}}};return n?(i.flags=Z3.Mutable|Z3.Dirty,i.get=function(){let e=i.flags;if(e&Z3.Dirty||e&Z3.Pending&&a6(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&o6(e)}}else e&Z3.Pending&&(i.flags=e&~Z3.Pending);return l6!==void 0&&n6(i,l6,t6),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(i6(e),o6(e),p6())}},i}function h6(e){let t=()=>{let t=l6;l6=n,++t6,n.depsTail=void 0,n.flags=Z3.Watching|Z3.RecursedCheck;try{return e()}finally{l6=t,n.flags&=~Z3.RecursedCheck,f6(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Z3.Watching|Z3.RecursedCheck,notify(){let e=this.flags;e&Z3.Dirty||e&Z3.Pending&&a6(this.deps,this)?t():this.flags=Z3.Watching},stop(){this.flags=Z3.None,this.depsTail=void 0,f6(this)}};return t(),n}var g6=t((e=>{var t=Lr();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),_6=t(((e,t)=>{t.exports=g6()})),v6=t((e=>{var t=Lr(),n=_6();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),y6=t(((e,t)=>{t.exports=v6()}))();function b6(e,t){return e===t}function x6(e,t,n=b6){let r=(0,J.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,J.useCallback)(()=>e?.get(),[e]);return(0,y6.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var S6={};function C6(e,t){let n=J.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=X0(n.current,i):i}}function w6(e){let t=J3(),n=J.useContext(e.from?X3:Y3),r=e.from??n,i=t.stores.getMatchStore(r),a=C6(e,t),o=x6(i,e=>e?a(e):S6);if(o!==S6)return o;(e.shouldThrow??!0)&&u2()}function T6(e){return w6({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function E6(e){let{select:t,...n}=e;return w6({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function D6(e){return w6({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function O6(e){return w6({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function k6(e){let t=J3();return J.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function A6(e){return w6({...e,select:t=>e.select?e.select(t.context):t.context})}function j6(e){let t=J.useRef(e);return t2(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function M6(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function N6(e,t,n){if(e?.external)return o2(e.href,n)?void 0:e.href;if(!W6(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),o2(t,n)?void 0:t}catch{}}function P6(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!V2(e.pathname,t.pathname,r))return!1}else{let n=B2(e.pathname,r),i=B2(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!t2(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function F6(e,t){let n=J3(),r=V0(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:ee,...I}=e,te=G3(),L=j6(e.search),ne=j6(e.params),re=j6(o),ie=J.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,L,ne,e.state,e.mask,e.unsafeRelative]),ae=J.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...ie}),r=U6(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=N6(r,s,n.protocolAllowlist);return[r?.href,i,P6(e,t,re,n.basepath,te,i!==void 0)]},[re,v,te,ie,n,s]),[oe,R,se]=x6(n.stores.location,ae,M6),ce=se?W0(i,{})??L6:I6,le=se?I6:W0(a,{})??I6,ue=[b,ce.className,le.className].filter(Boolean).join(` `),de=(y||ce.style||le.style)&&{...y,...ce.style,...le.style},fe=J.useRef(!1),pe=e.reloadDocument||R||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,he=J.useCallback(()=>{n.preloadRoute(ie).catch(e=>{console.warn(e),console.warn(R3)})},[n,ie]),ge=J.useCallback(e=>{if(!e){V6(r);return}if(!(e.isIntersecting??pe===`intent`)){e.isIntersecting===!1&&V6(r);return}if(!me){he();return}B6.has(r)||B6.set(r,setTimeout(()=>{B6.delete(r),he()},me))},[he,r,pe,me]);B0(r,ge,pe!==`viewport`),J.useEffect(()=>{fe.current||pe===`render`&&(he(),fe.current=!0)},[he,pe]);let _e=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!K6(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...ie,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(R)return{...I,ref:r,href:R,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ve=()=>{pe===`intent`&&he()},ye=()=>{pe===`intent`&&V6(r)};return{...I,...ce,...le,href:oe,ref:r,onClick:H6([x,_e]),onBlur:H6([S,ye]),onFocus:H6([C,ge]),onMouseEnter:H6([w,ge]),onMouseLeave:H6([T,ye]),onTouchStart:H6([E,ve]),disabled:!!v,target:_,...de&&{style:de},...ue&&{className:ue},...v&&R6,...se&&z6}}var I6={},L6={className:`active`},R6={role:`link`,"aria-disabled":!0},z6={"data-status":`active`,"aria-current":`page`},B6=new WeakMap,V6=e=>{clearTimeout(B6.get(e)),B6.delete(e)},H6=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function U6(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function W6(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var G6=J.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=F6(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return J.createElement(`a`,t,o)}return J.createElement(n,a,o)});function K6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var q6=class extends z3{constructor(e){super(e),this.useMatch=e=>w6({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>A6({...e,from:this.id}),this.useSearch=e=>O6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>D6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>E6({...e,from:this.id}),this.useLoaderData=e=>T6({...e,from:this.id}),this.useNavigate=()=>k6({from:this.fullPath}),this.Link=J.forwardRef((e,t)=>(0,X.jsx)(G6,{ref:t,from:this.fullPath,...e}))}};function J6(e){return new q6(e)}var Y6=class extends B3{constructor(e){super(e),this.useMatch=e=>w6({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>A6({...e,from:this.id}),this.useSearch=e=>O6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>D6({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>E6({...e,from:this.id}),this.useLoaderData=e=>T6({...e,from:this.id}),this.useNavigate=()=>k6({from:this.fullPath}),this.Link=J.forwardRef((e,t)=>(0,X.jsx)(G6,{ref:t,from:this.fullPath,...e}))}};function X6(e){return new Y6(e)}function Z6(e){let t=J3(),n=`not-found-${x6(t.stores.location,e=>e.pathname)}-${x6(t.stores.status,e=>e)}`;return(0,X.jsx)(V3,{getResetKey:()=>n,onCatch:(t,n)=>{if(q2(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(q2(t))return e.fallback?.(t);throw t},children:e.children})}function Q6(){return(0,X.jsx)(`p`,{children:`Not Found`})}function $6(e){return(0,X.jsx)(X.Fragment,{children:e.children})}function e8(e,t,n){return t.options.notFoundComponent?(0,X.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,X.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,X.jsx)(Q6,{})}function t8(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,X.jsx)(n,{}):null}var n8=(e,t)=>e[0]===t[0]&&e[1]===t[1],r8=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,i8=J.memo(function({routeId:e}){let t=J3();return(0,X.jsx)(a8,{router:t,match:x6(t.stores.getMatchStore(e),e=>e)})});function a8({router:e,match:t}){let n=e.routesById[t.routeId],r=t8(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=r8(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?J.Suspense:$6,l=i?V3:$6,u=o?Z6:$6;return(0,X.jsxs)(n.isRoot?n.options.shellComponent??$6:$6,{children:[(0,X.jsx)(Y3.Provider,{value:t.routeId,children:(0,X.jsx)(c,{fallback:r,children:(0,X.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(q2(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,X.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return J.createElement(o,e)},children:s?(0,X.jsx)(W3,{fallback:r,children:(0,X.jsx)(o8,{match:t})}):(0,X.jsx)(o8,{match:t})})})})}),null]})}var o8=J.memo(function({match:e}){let t=J3(),n=e.routeId,r=t.routesById[n],i=J.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=J.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,X.jsx)(e,{},i):(0,X.jsx)(s8,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!r8(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return t8(t,r)}if(e.status===`notFound`)return e8(t,r,e.error);if(e.status===`error`)throw e.error;return a}),s8=J.memo(function(){let e=J3(),t=J.useContext(Y3),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=x6(a,e=>[!!e._notFound,e.error],n8),i=x6(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return e8(e,e.routesById[t],r);if(!i)return null;let a=(0,X.jsx)(i8,{routeId:i});return t===`__root__`?(0,X.jsx)(J.Suspense,{fallback:t8(e),children:a}):a});function c8(e,t){let n=e[1];e.length=0,n?.(t)}function l8({t:e}){let t=J3(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise((a,o)=>{c8(n,!1),n.push(i,a),e(t),J.startTransition(()=>{try{r()}catch(e){n[1]===a&&(n.length=0),o(e)}})}),z0(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(R2(r.publicHref)!==R2(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...F4(a,a)})}):t._tx||t.load().catch(console.error),e},[t,t.history]),null}function u8(){let e=J3(),t=e.routesById[g4],n=t8(e,t),r=e.ssr?$6:J.Suspense,i=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(l8,{t:J.useState()[1]}),(0,X.jsx)(r,{fallback:n,children:(0,X.jsx)(d8,{})})]});return e.options.InnerWrap?(0,X.jsx)(e.options.InnerWrap,{children:i}):i}function d8(){let e=J3(),t=e._rendered,n=x6(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;z0(()=>{t[0]===n&&c8(t,!0)},[t,n]);let a=i?(0,X.jsx)(i8,{routeId:i}):null;return(0,X.jsx)(Y3.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,X.jsx)(V3,{getResetKey:()=>r,onCatch:void 0,children:a})})}var f8=e=>({createMutableStore:m6,createReadonlyStore:m6,batch:d6}),p8=e=>new m8(e),m8=class extends R4{constructor(e){super(e,f8)}};function h8({router:e,children:t,...n}){q0(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,X.jsx)(q3.Provider,{value:e,children:t});return e.options.Wrap?(0,X.jsx)(e.options.Wrap,{children:r}):r}function g8({router:e,...t}){return(0,X.jsx)(h8,{router:e,...t,children:(0,X.jsx)(u8,{})})}function _8(e){let t=J3({warn:e?.router===void 0}),n=e?.router||t;return x6(n.stores.__store,C6(e,n))}function v8(){return x6(J3().stores.location,e=>e.state.__TSR_index!==0)}var y8=(0,J.createContext)(null),b8=y8.Provider,x8=X6({validateSearch:et({agent:z().min(1).optional()}),component:()=>null}),S8=J6({getParentRoute:()=>x8,path:`/`}),C8=J6({getParentRoute:()=>x8,path:`/sessions/$agentId/$sessionId`,params:{parse:e=>et({agentId:z().min(1),sessionId:z().min(1)}).parse(e)}});function w8(){return p8({routeTree:x8.addChildren([S8,C8]),history:A4(),InnerWrap:({children:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,J.useContext)(y8),e]}),defaultPendingMs:0,defaultPendingMinMs:0})}function T8(e,t){let n=_8({router:e,select:e=>e.location.search}),r=w6({from:C8.id,shouldThrow:!1});ah(t,{canGoBack:v8(),onBack:()=>e.history.canGoBack()?(e.history.back(),!0):!1});let i=(0,J.useCallback)(t=>{e.navigate({to:`.`,search:{agent:t??void 0},replace:!0})},[e]),a=(0,J.useCallback)((t,n)=>{e.navigate({to:`/sessions/$agentId/$sessionId`,params:{agentId:t,sessionId:n},search:!0})},[e]);return{agentFilterId:n.agent??null,setFilter:i,selection:r?.params,open:a}}var E8=Nt.check(jt(1,{message:`Give your Agent a name.`}),B(256,{message:`Use at most 256 characters.`}));function D8({agentId:e,name:t,rename:n}){let[r,i]=(0,J.useState)(!1),a=l0({schema:(0,J.useMemo)(()=>W({name:E8.annotate(L1({label:`Agent name`,render:e=>(0,X.jsx)(MK,{id:e.id,name:e.name,"aria-label":`Agent name`,"aria-invalid":e[`aria-invalid`],"aria-describedby":e[`aria-describedby`],autoFocus:!0,maxLength:256,disabled:e.disabled,value:e.value,onBlur:e.onBlur,onChange:t=>{e.onChange(t.currentTarget.value)}})}))}),[]),defaultValues:{name:t},onSubmit:async({name:r})=>r===t||await n(e,r)?(i(!1),{kind:`saved`,values:{name:r}}):{kind:`refused`}}),{submitting:o,canSubmit:s}=u0(a);return r?(0,X.jsxs)(p0,{model:a,"aria-label":`Rename Agent`,footer:null,className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(M1,{model:a,names:[`name`]})}),(0,X.jsx)(lE,{type:`submit`,size:`sm`,loading:o,disabled:o||!s,children:`Save`}),(0,X.jsx)(WQ,{"aria-label":`Cancel rename`,type:`button`,icon:(0,X.jsx)(iG,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!1)}})]}):(0,X.jsx)(WQ,{"aria-label":`Rename Agent`,icon:(0,X.jsx)($W,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!0)}})}function O8({status:e,approving:t,onApprove:n}){return e?.status===`pending`?(0,X.jsx)(lE,{variant:`outline`,size:`sm`,className:`flex-none`,loading:t,disabled:t,onClick:n,children:`Allow App tools`}):null}function k8(e){return[{id:`new-conversation`,title:`New conversation`,category:`Conversation`,description:`Start a new conversation with this Agent`,projections:{slash:{aliases:[`new`],order:20},palette:{}},handler:()=>{e().newConversation()}},{id:`permissions`,title:`App permissions`,category:`Conversation`,description:`Review what Grove may access`,projections:{slash:{aliases:[`permissions`],order:21},palette:{}},handler:()=>{e().openPermissions()}}]}function A8(e,t){let n=(0,J.useRef)(e);n.current=e;let r=(0,J.useMemo)(()=>k8(()=>n.current),[]),i=(0,J.useMemo)(()=>Br(),[]);return(0,J.useEffect)(()=>{let e=i.contribute({sourceId:`grove`,namespace:`grove`,commands:r});return()=>{e.dispose()}},[r,i]),(0,J.useEffect)(()=>t?ua(t,r):void 0,[r,t]),i}function j8(e){let t=ya(),n=e?.capabilities.has(Ng)===!0||e?.capabilities.has(Pg)===!0,r=Db(n?e:null),i=e&&!n?{...r,status:`live`}:r,a=Cb.of(e,`agents`),o=Jo({...Eb(e,Sg,a,e=>e.list()),enabled:e?.capabilities.has(Sg)===!0}),s=new Set(o.data?.map(e=>e.agentId)),c=o.isSuccess?JSON.stringify([...new Set(i.items.filter(e=>!(`kind`in e)).map(e=>e.agentId))].filter(e=>!s.has(e)).sort()):`[]`,{refetch:l}=o;return(0,J.useEffect)(()=>{c!==`[]`&&i.items.length>0&&l()},[c,i.items,l]),{directory:o,inbox:i,createAgent:Zo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return Fg(e.capabilities,t)},onMutate:()=>({directoryKey:a}),onSuccess:(e,n,r)=>{t.setQueryData(r.directoryKey,(t=[])=>t.some(t=>t.agentId===e.agentId)?t:[...t,e])}}),renameAgent:Zo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return Eg(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}}),setAgentAvatar:Zo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return kg(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}})}}function M8(e,t){let n=ya(),r=e?.capabilities.has(Mg)===!0,i=Cb.of(e,`agent-tool-policy`,t??`none`);return{canRead:r,status:Jo({...Eb(e,Mg,i,e=>t===null?Promise.resolve(null):e.status({agentId:t})),enabled:r&&t!==null}),approve:Zo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return e.capabilities.require(Mg).approve({agentId:t.agentId,level:`write`,expectedRevision:t.expectedRevision})},onSuccess:e=>{`error`in e||n.setQueryData(i,e)}})}}function N8({agentId:e,name:t,avatar:n,setAvatar:r}){let[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(!1),c=(0,X.jsx)(wX,{avatar:n,name:t,size:24});return r===void 0?(0,X.jsx)(`span`,{className:`flex-none`,children:c}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(lE,{variant:`ghost`,size:`sm`,"aria-label":`Change avatar`,className:`flex-none p-0`,onClick:()=>{a(n)},children:c}),(0,X.jsx)(OW,{open:i!==null,onOpenChange:e=>{!e&&!o&&a(null)},children:(0,X.jsxs)(NW,{className:`flex flex-col gap-lg`,keepMounted:!1,children:[(0,X.jsxs)(FW,{children:[(0,X.jsxs)(IW,{children:[t,`'s avatar`]}),(0,X.jsxs)(LW,{children:[`Every conversation with `,t,` shows this look.`]})]}),i===null?null:(0,X.jsx)(j0,{value:i,disabled:o,onChange:a}),(0,X.jsxs)(PW,{children:[(0,X.jsx)(lE,{type:`button`,variant:`ghost`,disabled:o,onClick:()=>{a(null)},children:`Cancel`}),(0,X.jsx)(lE,{type:`button`,variant:`primary`,loading:o,disabled:o||i===null,onClick:()=>{i!==null&&(s(!0),r(e,i).then(e=>{s(!1),e&&a(null)}))},children:`Save`})]})]})})]})}var P8=(0,J.forwardRef)(function({className:e,orientation:t,variant:n=`grip`,value:r,min:i,max:a,onValueChange:o,onKeyDown:s,...c},l){return(0,X.jsx)(`div`,{...c,ref:l,className:$(`caps-resize-handle`,e),"data-resize-variant":n,role:`separator`,"aria-orientation":t,"aria-valuemin":Math.round(i),"aria-valuemax":Math.round(a),"aria-valuenow":Math.round(r),tabIndex:c.tabIndex??0,onKeyDown:e=>{if(s?.(e),e.defaultPrevented)return;if(e.key===`Home`||e.key===`End`){e.preventDefault(),o(e.key===`Home`?i:a);return}let n=t===`horizontal`?e.key===`ArrowUp`?-32:e.key===`ArrowDown`?32:null:e.key===`ArrowLeft`?-32:e.key===`ArrowRight`?32:null;n!==null&&(e.preventDefault(),o(Math.min(a,Math.max(i,r+n))))},children:(0,X.jsx)(`span`,{className:`caps-resize-grip`,"aria-hidden":`true`})})});SN({frames:new Map,order:[],tiles:[],minima:new Map,participating:new Set,mainSize:void 0,zoomed:null,gesture:null,restore:new Map});function F8(e,t=!0,n){let r=(0,J.useRef)(e);r.current=e;let i=(0,J.useRef)(null);return(0,J.useEffect)(()=>(t||i.current?.release(!0),()=>i.current?.release(!0)),[t]),(0,J.useEffect)(()=>{let e=()=>{i.current?.release(!0)};return n?.addEventListener(`abort`,e),()=>{n?.removeEventListener(`abort`,e)}},[n]),{onPointerDown:e=>{if(!t||n?.aborted||i.current||e.pointerType===`mouse`&&e.button!==0)return;let{currentTarget:a,pointerId:o}=e;if(a.setPointerCapture(o),!r.current.begin(e)){a.releasePointerCapture(o);return}let s=r.current.end,c=()=>{l(!0)},l=e=>{a.removeEventListener(`lostpointercapture`,c),i.current=null,s(e),a.hasPointerCapture(o)&&a.releasePointerCapture(o)};i.current={id:o,element:a,x:e.clientX,y:e.clientY,release:l},a.addEventListener(`lostpointercapture`,c)},onPointerMove:e=>{let t=i.current;t?.id===e.pointerId&&(r.current.move(e.clientX-t.x,e.clientY-t.y,e),t.x=e.clientX,t.y=e.clientY)},onPointerUp:e=>{i.current?.id===e.pointerId&&i.current.release(!1)},onPointerCancel:e=>{i.current?.id===e.pointerId&&i.current.release(!0)}}}(0,J.createContext)(null);var I8=(0,J.createContext)(null);(0,J.forwardRef)(function({layer:e,style:t,children:n,...r},i){let a=(0,J.useContext)(I8),o=a?.update,s=a?.roots.get(`dialog`),[c,l]=(0,J.useState)(!1);(0,J.useEffect)(()=>{if(!s)return;let e=()=>{l(Array.from(s.querySelectorAll(`*`)).some(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0}))};e();let t=new MutationObserver(e);return t.observe(s,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[s]);let u=(0,J.useRef)(null);(0,J.useImperativeHandle)(i,()=>u.current);let d=(0,J.useCallback)(t=>{u.current=t,o?.(e,t)},[o,e]);return(0,J.createElement)(`div`,{...r,ref:d,onFocusCapture:t=>{e===`windows`&&t.target instanceof Node&&t.currentTarget.contains(t.target)&&a?.dismiss?.(),r.onFocusCapture?.(t)},"data-maosaico-layer":e,inert:e===`windows`&&c?``:void 0,style:{position:`relative`,...t,isolation:`isolate`,zIndex:`var(--stipe-layer-${e})`}},n)});var L8={min:224,max:480,initial:320},R8={agentRailOpen:!0,listRailOpen:!0,listWidth:L8.initial},z8=`fungi.grove.layout.v1`,B8=zt(bn(W({agentRailOpen:Fn,listRailOpen:Fn,listWidth:sn.pipe(H(mr()))})));function V8(e){return Math.round(Math.min(L8.max,Math.max(L8.min,e)))}function H8(e){try{let t=e?.getItem(z8);if(t==null)return R8;let n=B8(t);return fe(n)?{...n.value,listWidth:V8(n.value.listWidth)}:R8}catch(e){return console.warn(`Grove could not read its saved rail layout`,e),R8}}function U8(e,t){try{e?.setItem(z8,JSON.stringify(t))}catch(e){console.warn(`Grove could not save its rail layout`,e)}}function W8(){try{return globalThis.localStorage}catch(e){console.warn(`Grove rail layout storage is unavailable`,e);return}}function G8(){let[e,t]=(0,J.useState)(()=>H8(W8()));return(0,J.useEffect)(()=>{U8(W8(),e)},[e]),[e,t]}var K8={2:`h2`,3:`h3`,4:`h4`};function q8(e,t){let{reduced:n}=t,r=e&&!n,i=RS(t,600),[a,o]=(0,J.useState)(r);return(0,J.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var J8=(0,J.forwardRef)(function({actions:e,className:t,description:n,headingLevel:r=2,suggestions:i,thinking:a=!1,title:o,visual:s,renderVisual:c,variant:l=`plain`,...u},d){let f=(0,J.useId)(),p=(0,J.useRef)(null),m=LS(p),h=q8(l===`speech`,m)&&!a,g=K8[r],_=c?c({speaking:h,thinking:a}):s,v=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{ref:p,className:`empty-state-title`,id:u[`aria-labelledby`]?void 0:f,children:o}),(0,X.jsx)(`p`,{children:n}),i&&i.length>0?(0,X.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:i.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(lE,{size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},e.label))}):null,e?(0,X.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,X.jsxs)(`section`,{...u,"aria-labelledby":u[`aria-labelledby`]??f,className:$(`empty-state`,l!==`plain`&&`empty-state-${l}`,t),ref:d,children:[_?(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:_}):null,l===`speech`?(0,X.jsx)(`div`,{className:`empty-state-bubble`,children:v}):v]})});function Y8({description:e,icon:t,label:n,density:r=`regular`,appearance:i=`plain`,iconSize:a=`default`,size:o,trailing:s,...c}){return(0,X.jsxs)(lE,{...c,className:$(`caps-action-row`,i===`card`&&`caps-action-row-card`,r===`compact`?`h-auto min-h-10 w-full justify-start gap-xs px-xs py-2xs text-left`:`h-auto min-h-14 w-full justify-start gap-sm px-sm py-xs text-left`,c.className),size:o??(r===`compact`?`default`:`lg`),variant:c.variant??`ghost`,children:[t?(0,X.jsx)(`span`,{className:r===`compact`?`grid ${a===`lg`?`size-8`:`size-7`} shrink-0 place-items-center [&_:is(svg,.caps-monogram)]:size-5`:`grid ${a===`lg`?`size-12`:`size-10`} shrink-0 place-items-center [&_:is(svg,.caps-monogram)]:size-7`,children:t}):null,(0,X.jsxs)(`span`,{className:`caps-action-row-copy`,children:[(0,X.jsx)(`span`,{className:`caps-action-row-label max-w-full truncate`,children:n}),e?(0,X.jsx)(`span`,{className:`caps-action-row-description max-w-full truncate`,children:e}):null]}),s?(0,X.jsx)(`span`,{className:`caps-action-row-trailing`,children:s}):null]})}function X8(e,t,n,r,i){let a=[];r&&a.push({kind:`hint`,key:`loading`,loading:!0});let o=0,s=[...e.active,...e.settled],c=new Map(s.map(e=>[zX(e.agentId,e.sessionId),e]));for(let e of[`Needs you`,`Working`,`Ready`,`Finished`]){let n=t.filter(t=>t.shelf===e).flatMap(e=>{let t=c.get(e.key);return t===void 0?[]:[t]});if(n.length!==0){a.push({kind:`heading`,key:e,title:e,gap:o++>0});for(let t of n)a.push({kind:`session`,key:zX(t.agentId,t.sessionId),shelf:e,session:t})}}if(e.unavailable.length>0){a.push({kind:`heading`,key:`Unavailable`,title:`Unavailable`,gap:o>0});for(let t of e.unavailable)a.push({kind:`unavailable`,key:zX(t.agentId,t.sessionId),session:t})}if(n.length>0){a.push({kind:`heading`,key:`Websites`,title:`Websites`,gap:a.length>0});for(let e of n)a.push({kind:`website`,key:`website:${e.bindingId}:${e.conversation.sessionId}`,website:e})}return a.length===0&&!i&&a.push({kind:`hint`,key:`empty`,loading:!1}),a}function Z8({viewport:e,view:t,agents:n,loading:r,failed:i,pendingSelection:a,selectedAgentId:o,selectedSessionId:s,onSelect:c,onDelete:l,deleting:u,websites:d,selectedWebsite:f,onSelectWebsite:p}){let m=o!==null&&s!==null?zX(o,s):null,[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),y=h||_,[b,x]=(0,J.useState)(0),[S,C]=(0,J.useState)({placements:null,openKey:m,reopened:b}),w=(0,J.useMemo)(()=>FX(S.placements,[...t.active,...t.settled],{openKey:S.openKey===m?m:null,held:y,reorder:S.openKey!==m||S.reopened!==b}),[S,t,m,y,b]);(0,J.useEffect)(()=>{!y&&(S.placements!==w||S.openKey!==m||S.reopened!==b)&&C({placements:w,openKey:m,reopened:b})},[y,S,w,m,b]),(0,J.useEffect)(()=>{let t=e.current;if(t===null)return;let n=t.clientWidth>0&&t.clientHeight>0,r=`ResizeObserver`in globalThis?new ResizeObserver(([e])=>{let t=e.contentRect.width>0&&e.contentRect.height>0;t&&!n&&x(e=>e+1),n=t}):void 0;r?.observe(t);let i=()=>{document.visibilityState===`visible`&&x(e=>e+1)};return document.addEventListener(`visibilitychange`,i),()=>{r?.disconnect(),document.removeEventListener(`visibilitychange`,i)}},[e]);let T=(0,J.useMemo)(()=>X8(t,w,d,r,i),[t,w,d,r,i]),E=(0,J.useCallback)(e=>T[e]?.key??e,[T]),D=PG({count:T.length,getScrollElement:()=>e.current,getItemKey:E,estimateSize:e=>T[e]?.kind===`heading`?24:44,measureElement:(e,t,n)=>{let r=EG(e,t,n);return r>0?r:EG(e,void 0,n)||n.options.estimateSize(n.indexFromElement(e))},initialRect:{width:320,height:800},overscan:5,useFlushSync:!1});return(0,X.jsx)(`div`,{className:`inbox-list px-1 py-1`,onPointerEnter:()=>{g(!0)},onPointerLeave:()=>{g(!1)},onFocusCapture:()=>{v(!0)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||v(!1)},children:(0,X.jsx)(`div`,{style:{height:D.getTotalSize(),position:`relative`,width:`100%`},children:D.getVirtualItems().map(e=>{let t=T[e.index],r=t.kind===`session`||t.kind===`unavailable`?t.session:null,i=r?n.get(r.agentId):void 0;return(0,X.jsx)(`div`,{"data-index":e.index,ref:D.measureElement,"data-inbox-shelf":t.kind===`session`?t.shelf:t.kind===`unavailable`?`Unavailable`:void 0,className:t.kind===`heading`?`inbox-shelf`:void 0,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${String(e.start)}px)`,paddingTop:t.kind===`heading`&&t.gap?4:0},children:t.kind===`heading`?(0,X.jsx)(dS,{style:{paddingBottom:0},children:t.title}):t.kind===`hint`?(0,X.jsx)(`p`,{className:t.loading?`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`:`m-0 px-2 py-3 text-xs text-(--stipe-fg-muted)`,role:t.loading?`status`:void 0,children:t.loading?`Loading conversations…`:`No conversations yet.`}):t.kind===`website`?(0,X.jsx)(Y8,{appearance:`plain`,density:`compact`,className:`inbox-row${f?.bindingId===t.website.bindingId&&f.conversation.sessionId===t.website.conversation.sessionId?` is-selected bg-base-300`:``}`,"data-testid":`inbox-website-row`,label:t.website.conversation.label||`Website visitor`,description:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(GY,{name:`internet`,size:14}),t.website.siteLabel]}),trailing:t.website.conversation.held?(0,X.jsx)(`span`,{className:`text-xs`,children:t.website.conversation.heldByYou?`You're replying`:`With a teammate`}):t.website.conversation.needsYou?(0,X.jsx)(nK,{size:`compact`,tone:`accent`,title:t.website.conversation.needsYou.reason}):null,onClick:()=>{p(t.website)},variant:`ghost`}):t.kind===`unavailable`?i?(0,X.jsx)($8,{agent:i,row:t.session}):null:i?(0,X.jsx)(Q8,{agent:i,session:t.session,attention:t.session.unseen,pending:a?.agentId===t.session.agentId&&a.sessionId===t.session.sessionId,selected:o===t.session.agentId&&s===t.session.sessionId,onDelete:l&&i.sessionOperations.includes(`agent.manage`)?()=>{l(t.session.agentId,t.session.sessionId)}:void 0,deleting:u?.agentId===t.session.agentId&&u.sessionId===t.session.sessionId,onSelect:()=>{c(t.session.agentId,t.session.sessionId)}}):null},e.key)})})})}function Q8({agent:e,session:t,attention:n,pending:r,selected:i,onSelect:a,onDelete:o,deleting:s}){let c=OX(t.state),l=t.state===`errored`,u=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r||c||l?(0,X.jsx)(`span`,{className:`sr-only`,children:r?`Opening`:EX[t.state]}):null,r||c?(0,X.jsx)(nK,{size:`compact`,title:r?`Opening`:EX[t.state],motion:t.state===`running`||r?`pulse`:`none`,tone:r?`neutral`:t.state===`needs_you`?`accent`:`info`}):l?(0,X.jsx)(nK,{size:`compact`,title:EX.errored,glyph:`bang`,tone:`error`}):n?(0,X.jsx)(nK,{size:`compact`,title:`Finished since your last visit`,tone:`neutral`}):null,(0,X.jsx)(`time`,{className:`inbox-row-age min-w-[3ch] text-right text-[0.6875rem] tabular-nums text-(--stipe-fg-muted)`,dateTime:new Date(t.lastActivityAt).toISOString(),children:e5(t.lastActivityAt)})]});return(0,X.jsxs)(`div`,{className:`relative group`,children:[(0,X.jsx)(Y8,{"aria-current":i?`page`:void 0,"aria-label":`${t.title||`Untitled session`} — ${BX(e)}${n?` — Finished since your last visit`:``}${t.ready?` — Ready`:c||l?` — ${EX[t.state]}`:``}`,"aria-busy":r||void 0,appearance:`plain`,className:`inbox-row${o?` pr-9`:``}${i?` is-selected bg-base-300`:``}`,"data-attention":n?`true`:`false`,"data-pending":r?`true`:`false`,"data-session-id":t.sessionId,"data-status":t.state,"data-testid":`inbox-session-row`,density:`compact`,description:BX(e),label:t.title||`Untitled session`,onClick:a,trailing:u,variant:`ghost`}),o?(0,X.jsx)(WQ,{"aria-label":`Delete conversation ${t.title||`Untitled session`}`,title:`Delete conversation`,icon:(0,X.jsx)(rG,{}),iconSize:`sm`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 max-[899px]:opacity-100`,disabled:c||s,onClick:o}):null]})}function $8({agent:e,row:t}){return(0,X.jsxs)(`div`,{className:`inbox-row is-unavailable flex min-h-11 w-full items-center gap-2 rounded-field border-0 px-2 py-1 text-left text-base-content`,"data-session-id":t.sessionId,"data-testid":`inbox-unavailable-row`,role:`group`,children:[(0,X.jsxs)(`span`,{className:`inbox-row-copy flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:`Conversation unavailable`}),(0,X.jsxs)(`small`,{className:`truncate text-xs text-(--stipe-fg-muted)`,children:[BX(e),` `,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` This saved conversation could not be read.`]})]}),(0,X.jsx)(nK,{className:`inbox-row-status`,glyph:`bang`,tone:`error`,title:`This saved conversation could not be read`})]})}function e5(e){let t=Math.max(0,Date.now()-e);return t<6e4?`now`:t<36e5?`${String(Math.floor(t/6e4))}m`:t<864e5?`${String(Math.floor(t/36e5))}h`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}var t5=z().min(1).max(256),n5=Je().int().nonnegative();de(`state`,[Xe({state:n(`agent`),version:n5}),Xe({state:n(`requested`),version:n5,reason:z().max(4e3),at:Je().int().nonnegative()}),Xe({state:n(`person`),version:n5,memberId:t5,memberName:z().min(1).max(128),since:Je().int().nonnegative()})]);var r5=Xe({bindingId:t5,agentId:t5,origins:T(z().min(1).max(2048)).min(1).max(16),lifecycle:c([`active`,`suspended`])}),i5=Xe({sessionId:t5,label:z().max(4096),lastEventAt:Je().int().nonnegative(),needsYou:Xe({at:Je().int().nonnegative(),reason:z().max(4e3)}).nullable(),held:C(),heldByYou:C(),heldByName:z().min(1).max(128).nullable(),holdVersion:Je().int().nonnegative()}),a5=Xe({bindingId:t5}).extend({sessionId:t5});a5.extend({requestId:z().min(1).max(128),text:z().trim().min(1).max(4e3)});var o5=Xe({expectedVersion:n5,confirm:C()});a5.extend(o5.shape),a5.extend({expectedVersion:n5});var s5=Xe({websites:T(r5).max(1e3)}),c5=Xe({conversations:T(i5).max(100)});Xe({conversation:i5});var l5=Xe({status:n(`sent`)}),u5=ph(`channels.read`,1,L(()=>mh({list:gh(hh(s5)),conversations:gh(hh(c5))}))),d5=ph(`channels.personal.manage`,1,L(()=>mh({hold:gh(hh(i5)),release:gh(hh(i5)),dismiss:gh(hh(i5)),reply:gh(hh(l5))})));function f5(e,t){let n=!1,r=async()=>{try{return await t.read()}catch(e){if(!(e instanceof Xt)||e.boundary!==`runtime`||e.cause!==`unavailable`)throw e;if(await new Promise(e=>setTimeout(e,150)),n)throw Error(`Conversation opening cancelled`,{cause:e});return t.read()}},i,a=new Promise((e,t)=>{i=()=>{t(Error(`Conversation opening cancelled`))}});return{ready:Promise.race([r(),a]).then(r=>{if(n)throw Error(`Conversation opening cancelled`);xI(e,t,r)}),close:()=>{n=!0,i()}}}function p5(e){return class{#e;constructor(t){this.#e=new c_(t,{fetch:(t,n)=>e(t,n)})}get readyState(){return this.#e.readyState}addEventListener(e,t,n){this.#e.addEventListener(e,t,n)}close(){this.#e.close()}}}function m5(e){let{connection:t,queryClient:n,services:r}=e,i=null,a=null,o=null,s=!1,c=(e,t)=>e?.agentId===t.agentId&&e.sessionId===t.sessionId,l=e=>!s&&i===e,u=(u,d,f=!1,p=!0)=>{if(s)return;let m={agentId:u,sessionId:d};if(c(i,m)||(i?.close(),i=null,e.onPending(null),e.onError(null),c(a,m)))return;let h=null,g=!1,_={...m,close:()=>{g||(g=!0,h?.())}};i=_,e.onPending(m),(async()=>{try{let s=await r.openAgent(t.capabilities,{agentId:u});if(!l(_)){await s.close();return}let c=r.createClient({baseUrl:s.baseUrl,eventSource:p5(s.fetch),fetch:s.fetch}),f=c.session(d),m=f5(n,f);if(h=()=>{m.close(),Promise.allSettled([c.close(),s.close()])},await m.ready,p&&e.reportsSelection!==!1&&await t.ui.reportAgentSessionSelection({agentId:u,sessionId:d}),!l(_))return;let g={agentId:u,sessionId:d,session:f},v=o;i=null,a=g,o=_.close,e.onConversation(g),e.onPending(null),v?.()}catch(t){console.error(`Chat Session opening failed`,t),_.close(),l(_)&&(i=null,e.onPending(null),e.onError(f?`That Session could not be opened. ${a?`The current conversation remains open.`:`Choose another Session from the list.`}`:`Could not open this Session${t instanceof Error?`: ${t.message}`:``}. ${a?`The previous conversation remains open.`:`Try opening it again.`}`))}})()},d=()=>{if(s)return;let n=i!==null||a!==null;i?.close(),i=null,o?.(),o=null,a=null,e.onPending(null),e.onConversation(null),e.onError(null),!(!n||e.reportsSelection===!1)&&t.ui.reportAgentSessionSelection(null).catch(e=>{console.error(`Chat Session selection could not be reported`,e)})};return{select:u,clear:d,close:()=>{d(),s=!0}}}function h5(e,t){async function n(e){if(e.type!==`prompt`||(e.images?.length??0)>0)throw new Y(`Website conversations support text replies only`,{code:`COMMAND_NOT_DECLARED`,retryable:!1});if(!t.canReply())throw new Y(`Use Take over to reply to this visitor`,{code:`CAPABILITY_DENIED`,retryable:!1});return await t.reply({bindingId:t.bindingId,sessionId:t.sessionId,requestId:e.requestId,text:e.text}),{status:`recorded`}}return{address:e.address,read:t=>e.read(t),watch:t=>e.watch(t),extension:()=>({call:()=>Promise.reject(new Y(`Website Session controls are unavailable`,{code:`COMMAND_NOT_DECLARED`,retryable:!1}))}),command:n}}function g5(e,t){(0,J.useSyncExternalStore)(t=>e?.capabilities.subscribe(t)??(()=>void 0),()=>e?.capabilities.version??0);let n=ya(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=e?.capabilities.has(u5)===!0,u=e?.capabilities.has(d5)===!0,d=Jo({...Eb(e,u5,Cb.of(e,`websites`),e=>e.list()),enabled:l}),f=l?d.data?.websites??[]:[],p=Ko({queries:f.map(t=>({...Eb(e,u5,Cb.of(e,`website-conversations`,t.bindingId),e=>e.conversations({bindingId:t.bindingId})),enabled:l}))}),m=f.flatMap((e,t)=>(p[t]?.data?.conversations??[]).map(t=>({bindingId:e.bindingId,agentId:e.agentId,siteLabel:e.origins.map(e=>new URL(e).host).join(`, `),conversation:t}))).sort((e,t)=>t.conversation.lastEventAt-e.conversation.lastEventAt),h=m.find(e=>e.bindingId===r?.bindingId&&e.conversation.sessionId===r.sessionId),g=(0,J.useMemo)(()=>e===null?null:m5({connection:e,queryClient:n,services:t,onPending:()=>void 0,onConversation:o,onError:c}),[e,n,t]);(0,J.useEffect)(()=>()=>{g?.close()},[g]),(0,J.useEffect)(()=>{l||g?.clear()},[l,g]);let _=Zo({mutationFn:t=>{if(e===null)throw Error(`No App connection`);let n=e.capabilities.require(d5);return t.kind===`hold`?n.hold({bindingId:t.bindingId,sessionId:t.sessionId,expectedVersion:t.expectedVersion,confirm:t.confirm}):n.release({bindingId:t.bindingId,sessionId:t.sessionId,expectedVersion:t.expectedVersion,confirm:t.confirm})},onSuccess:(t,r)=>{n.setQueryData(Cb.of(e,`website-conversations`,r.bindingId),e=>e===void 0?void 0:{conversations:e.conversations.map(e=>e.sessionId===t.sessionId?t:e)})}}),v=h?.bindingId,y=h?.conversation.sessionId,b=h?.conversation.heldByYou===!0,x=(0,J.useMemo)(()=>a===null||v===void 0||y===void 0||e===null?null:h5(a.session,{bindingId:v,sessionId:y,canReply:()=>b&&e.capabilities.has(d5),reply:t=>e.capabilities.require(d5).reply(t)}),[e,a,v,y,b]),S=(0,J.useCallback)(()=>{g?.clear(),i(null),o(null),_.reset()},[g,_.reset]);return{canRead:l,canManage:u,rows:m,selected:h,session:x,action:_,openingError:s,loading:l&&(d.isPending||p.some(e=>e.isPending)),failed:l&&(d.isError||p.some(e=>e.isError)),clear:S,select:e=>{l&&(h?.bindingId!==e.bindingId||h.conversation.sessionId!==e.conversation.sessionId||a===null)&&(i({bindingId:e.bindingId,sessionId:e.conversation.sessionId}),o(null),_.reset(),g?.select(e.agentId,e.conversation.sessionId))}}}function _5({inbox:e}){let{selected:t,session:n,action:r,canManage:i,openingError:a}=e,[o,s]=(0,J.useState)(null);if((0,J.useEffect)(()=>{s(null)},[t?.bindingId,t?.conversation.sessionId,i]),t===void 0)return null;let c=t.conversation;return(0,X.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":`Website conversation`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-base-300 p-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 text-sm`,children:c.heldByYou?`You're replying. The Agent is paused.`:c.held?`${c.heldByName??`A teammate`} is replying.`:`The Agent is replying. Take over to answer as yourself.`}),i?(0,X.jsx)(lE,{size:`sm`,disabled:r.isPending,onClick:()=>{let e={bindingId:t.bindingId,sessionId:c.sessionId};c.heldByYou?r.mutate({kind:`release`,...e,expectedVersion:c.holdVersion,confirm:!1}):c.held?s({...e,version:c.holdVersion,name:c.heldByName??`A teammate`}):r.mutate({kind:`hold`,...e,expectedVersion:c.holdVersion,confirm:!1})},children:c.heldByYou?`Hand back to Agent`:`Take over`}):null]}),(0,X.jsx)(OW,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,X.jsxs)(NW,{children:[(0,X.jsxs)(FW,{children:[(0,X.jsxs)(IW,{children:[o?.name,` is replying — take over?`]}),(0,X.jsx)(LW,{children:`You will reply as yourself. Their replies stop until they take over again.`})]}),(0,X.jsxs)(PW,{children:[(0,X.jsx)(RW,{render:(0,X.jsx)(lE,{variant:`outline`}),children:`Cancel`}),(0,X.jsx)(lE,{disabled:r.isPending||!i,onClick:()=>{o!==null&&(r.mutate({kind:`hold`,bindingId:o.bindingId,sessionId:o.sessionId,expectedVersion:o.version,confirm:!0}),s(null))},children:`Take over`})]})]})}),i?null:(0,X.jsx)(`p`,{className:`p-3 text-sm`,children:`Allow takeover in Grove's App permissions to reply. Your Team permissions still apply.`}),r.isError?(0,X.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:`This conversation changed or website access was removed. Refresh and try again.`}):null,a?(0,X.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:a}):null,n?(0,X.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(uX,{authorOf:dh,disambiguateAuthors:!0,session:n,markdownPolicy:`visitor`,composerActionVariant:`outline`},`${t.bindingId}:${c.sessionId}`)}):null]})}var v5=(0,J.lazy)(async()=>({default:(await Ar(()=>import(`./parakeet-conversation-w0nznEs9.js`),__vite__mapDeps([12,1,2,3,4,5,13]))).ParakeetConversation})),y5={openAgent:Rg,createClient:fM},b5=[`agent.list`,`agent.manage`,`agent.read`,`agent.send`],x5=[`agent.read`,`agent.send`,`agent.manage`],S5=Jn({family:`grove-session-create-request`,version:1,kinds:{request:{prefix:`request`}}});async function C5(e,t,n,r){let i=await n.openAgent(e.capabilities,{agentId:t}),a=n.createClient({baseUrl:i.baseUrl,eventSource:p5(i.fetch),fetch:i.fetch});try{return await r(a)}finally{Promise.allSettled([a.close(),i.close()])}}function w5({open:e,renderConversation:t,connection:n,commands:r,composeDraft:i,onPrefilled:a,onForked:o,onOpen:s,label:c=`Conversation`}){let l=e.session;return(0,J.useEffect)(()=>{let e=GR(r,l,{sourceId:`grove-session`,namespace:`session`,sessionResumeAvailable:!1,forkAvailable:!0,onForked:o});return()=>{e.dispose()}},[r,l,o]),(0,X.jsx)(`section`,{className:`inbox-conversation min-h-0 min-w-0 flex-1`,"data-inbox-conversation":!0,"aria-label":c,children:t?t(e,i,s):(0,X.jsx)(J.Suspense,{fallback:(0,X.jsx)(`p`,{className:`p-3 text-sm text-(--stipe-fg-muted)`,role:`status`,children:`Opening conversation…`}),children:(0,X.jsx)(v5,{session:l,connection:n,commands:r,prefill:i,onPrefilled:a,onOpen:s})})})}function T5(e){return rh(e.connection),(0,X.jsx)(E5,{...e},JSON.stringify(Cb.of(e.connection)))}function E5(e){let t=(0,J.useMemo)(w8,[e.connection]);return(0,X.jsx)(b8,{value:(0,X.jsx)(D5,{...e,router:t}),children:(0,X.jsx)(g8,{router:t})})}function D5({router:e,connection:t,services:n=y5}){let{agentFilterId:r,setFilter:i,selection:a,open:o}=T8(e,t?.window.navigation),s=ya(),c=g5(t,n),{directory:l,inbox:u,createAgent:d,renameAgent:f,setAgentAvatar:p}=j8(t),m=l.data??[],h=l.isPending&&(t?.capabilities.has(Sg)??!0),g=l.error?.message??null,_=d.isPending,v=Zo({mutationFn:e=>{if(!t)throw Error(`No App connection`);return C5(t,e.agentId,n,t=>t.createSession(e.requestId))}}),y=Zo({mutationFn:e=>{if(!t)throw Error(`No App connection`);return C5(t,e.agentId,n,t=>t.deleteSession(e.sessionId))},onSuccess:(t,n)=>{a?.agentId===n.agentId&&a.sessionId===n.sessionId&&(_e?.clear(),e.navigate({to:`/`,search:!0,replace:!0})),u.refresh()}}),b=v.isPending?v.variables.agentId:null,[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(!1),D=C?.agentId??null,O=C?.sessionId??null,[k,A]=(0,J.useState)(null),j=(0,J.useRef)(null),[M,N]=G8(),{agentRailOpen:P,listRailOpen:F,listWidth:ee}=M,I=e=>{N(t=>({...t,agentRailOpen:e(t.agentRailOpen)}))},te=e=>{N(t=>({...t,listRailOpen:e(t.listRailOpen)}))},L=e=>{N(t=>({...t,listWidth:V8(e(t.listWidth))}))},ne=F8({begin:()=>!0,move:e=>{L(t=>t+e)},end:()=>void 0}),[re,ie]=(0,J.useState)(!1),ae=qX(),oe=(0,J.useRef)(null),[R,se]=(0,J.useState)(null),ce=d.error?.message??null,le=d.data,ue=(0,J.useRef)(null),[de,fe]=(0,J.useState)(null),[pe,me]=(0,J.useState)(null),he=rh(t)?.openRequest??null,ge=(0,J.useRef)(null),_e=(0,J.useMemo)(()=>t===null?null:m5({connection:t,queryClient:s,services:n,onPending:S,onConversation:w,onError:fe}),[t,s,n]);(0,J.useEffect)(()=>{if(_e!==null)return()=>{ue.current=null,_e.close()}},[_e]);let[ve,ye]=(0,J.useState)(null),be=(0,J.useMemo)(()=>Br(),[]),xe=(0,J.useMemo)(()=>t===null?null:m5({connection:t,queryClient:s,services:n,onPending:()=>void 0,onConversation:ye,onError:fe,reportsSelection:!1}),[t,s,n]);(0,J.useEffect)(()=>xe===null?void 0:()=>{xe.close()},[xe]);let Se=(0,J.useCallback)(e=>{let t=t=>e.params.find(e=>e.key===t)?.value,n=t(`agent`),r=t(`session`);n!==void 0&&r!==void 0&&xe?.select(n,r,!1,!1)},[xe]),Ce=(0,J.useRef)(null),we=(0,J.useCallback)((e,t,n=!1,r=!0)=>{_e!==null&&(v.isError&&v.reset(),c.clear(),E(!1),Ce.current={agentId:e,sessionId:t},_e.select(e,t,n,r),o(e,t))},[_e,o,c.clear,v.isError,v.reset]),Te=a?.agentId,Ee=a?.sessionId;(0,J.useEffect)(()=>{let e=Ce.current;Ce.current=null,Te===void 0||Ee===void 0?_e?.clear():(e?.agentId!==Te||e.sessionId!==Ee)&&_e?.select(Te,Ee)},[_e,Te,Ee]);let De=(0,J.useCallback)(e=>{C&&(we(C.agentId,e,!1,!1),u.refresh())},[C,we,u.refresh]);(0,J.useEffect)(()=>{if(!t||he===null){he===null&&(ge.current=null);return}if(he.kind!==`navigate`||ge.current===he.requestId)return;let e=he.params.find(e=>e.key===`agent`)?.value,n=he.params.find(e=>e.key===`session`)?.value;!e||!n||(ge.current=he.requestId,i(e),we(e,n,!0))},[t,he,we,i]);let Oe=(0,J.useCallback)(async e=>{if(!t||_||!t.capabilities.has(Cg))return!1;try{let t=await d.mutateAsync(e);return i(t.agentId),se(t.agentId),A(null),!0}catch{return!1}},[t,_,d.mutateAsync,i]),ke=(0,J.useCallback)(async e=>{if(!t||b!==null)return`Conversation creation is unavailable.`;fe(null);let n=ue.current?.agentId===e?ue.current:{agentId:e,requestId:S5.request.generate()};ue.current=n;try{let t=await v.mutateAsync(n);we(e,t,!1,!1),u.refresh(),A(null),ie(!1),ue.current===n&&(ue.current=null);return}catch(e){return console.error(`Grove conversation creation failed`,e),e instanceof Error?e.message:`Couldn't start the conversation.`}},[t,we,b,v.mutateAsync,u.refresh]);(0,J.useEffect)(()=>{if(!(!t||he?.kind!==`compose`)&&ge.current!==he.requestId&&!(!C&&h)&&(ge.current=he.requestId,me({requestId:he.requestId,text:he.text}),!C)){let e=t.capabilities.has(Pg)?m.find(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)):void 0;e?ke(e.agentId):A(`agent`)}},[m,t,h,C,he,ke]);let Ae=A8({newConversation:()=>{C&&ke(C.agentId)},openPermissions:()=>{t?.ui.requestAppPermissions({}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})}},t?.commands),je=new Set(c.rows.map(e=>`${e.agentId}:${e.conversation.sessionId}`)),Me=u.items.filter(e=>!(`kind`in e)).filter(e=>!je.has(`${e.agentId}:${e.sessionId}`)),Ne=Ko({queries:(C?[C.session]:[]).map(e=>({...bI(e),enabled:!1}))}).at(0)?.data?.snapshot,Pe=(0,J.useMemo)(()=>C&&Ne?{agentId:C.agentId,sessionId:C.sessionId,state:VN(Ne)}:void 0,[C,Ne]),Fe=(0,J.useMemo)(()=>LX(m,T&&c.canRead?[]:Me,r,Pe),[r,m,Me,T,c.canRead,Pe]),Ie=(0,J.useMemo)(()=>{let e=new Map;for(let t of Me)`state`in t&&(t.state===`needs_you`?e.set(t.agentId,`speaking`):t.state===`running`&&!e.has(t.agentId)&&e.set(t.agentId,`thinking`));return e},[Me]),Le=(0,J.useMemo)(()=>new Map(m.map(e=>[e.agentId,e])),[m]),Re=(0,J.useRef)(null),ze=Me.find(e=>e.agentId===D&&e.sessionId===O),Be=ze!==void 0&&ze.state!==`unavailable`,Ve=ze!==void 0&&ze.state!==`unavailable`?ze.settledAt:void 0;(0,J.useEffect)(()=>{!Be||D===null||O===null||u.visit(D,O).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},[Be,Ve,D,O,u.visit]);let He=u.status===`loading`,Ue=u.status===`error`,We=t?.capabilities.has(Cg)??!1,Ge=t?.capabilities.has(Pg)??!1,Ke=m.filter(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)),qe=Ke.find(e=>e.agentId===(R??r))??Ke.at(0),Je=Ge&&qe!==void 0,Ye=()=>{t?.ui.requestAppPermissions({agents:b5}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},Xe=le&&(!le.sessionOperations.includes(`agent.read`)||!le.sessionOperations.includes(`agent.send`)||!le.sessionOperations.includes(`agent.manage`))?`Agent created. Allow Grove to read, send messages and manage its sessions to start a conversation.`:pe&&!C&&!Je&&d.isIdle?`Choose an Agent to compose your game idea.`:null,Ze=(0,J.useMemo)(()=>LX(m,Me,null,Pe),[m,Me,Pe]),Qe=(e,t)=>{ie(!1),we(e,t)},$e=()=>{oe.current=document.activeElement instanceof HTMLElement?document.activeElement:null,ie(!0)};ih(t,ae?[{kind:`button`,id:`agents`,text:`Agents`,expanded:P,title:P?`Hide Agents`:`Show Agents`},{kind:`button`,id:`conversations`,text:`Conversations`,expanded:F,title:F?`Hide conversations`:`Show conversations`}]:[{kind:`button`,id:`agents`,text:`Agents and conversations`,opens:`dialog`,expanded:re}],e=>{if(k!==null)return!1;if(ae&&e.itemId===`agents`)I(e=>!e);else if(ae&&e.itemId===`conversations`)te(e=>!e);else if(!ae&&e.itemId===`agents`)re?ie(!1):$e();else return!1;return!0});let et=e=>{i(e),se(e);let t=[...Ze.active,...Ze.settled].filter(t=>t.agentId===e).sort((e,t)=>t.lastActivityAt-e.lastActivityAt).at(0);t&&Qe(e,t.sessionId)},tt={"--grove-list-width":`${String(ee)}px`},nt=C?Le.get(C.agentId):void 0,z=ve?Le.get(ve.agentId):void 0,rt=t?.capabilities.has(Tg)??!1,it=t?.capabilities.has(Og)??!1,at=M8(t,nt?.agentId??null),ot=ze!==void 0&&ze.state!==`unavailable`?ze.title||`Untitled conversation`:`Conversation`,st=r===null?void 0:Le.get(r),ct=Fe.active.length+Fe.settled.length,lt=(0,J.useCallback)(async(e,n)=>{if(!t)return!1;try{return await f.mutateAsync({agentId:e,name:n}),!0}catch{return!1}},[t,f.mutateAsync]),ut=(0,J.useCallback)(async(e,n)=>{if(!t)return!1;try{return await p.mutateAsync({agentId:e,avatar:n}),!0}catch{return!1}},[t,p.mutateAsync]),dt=(0,J.useCallback)(()=>{let e=at.status.data;!nt||e==null||at.approve.mutate({agentId:nt.agentId,expectedRevision:e.revision})},[nt,at.status.data,at.approve]),ft=(0,J.useCallback)(e=>{!t||_||b!==null||e===`agent`&&!We||(k===null&&(j.current=re?oe.current:document.activeElement instanceof HTMLElement?document.activeElement:null),ie(!1),e===`session`&&se(nt?.agentId??r??Ke.at(0)?.agentId??null),A(e))},[t,_,b,We,k,re,nt?.agentId,r,Ke]);(0,J.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||!e.ctrlKey||e.altKey||e.metaKey||e.key.toLowerCase()!==`n`||!t||e.shiftKey&&!We||(e.preventDefault(),ft(e.shiftKey?`agent`:`session`))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[t,We,ft]);let pt=v.isError?v.variables:null,mt=pt&&k!==`session`?(0,X.jsx)(cS,{className:C||c.selected?`inbox-error m-2`:`inbox-empty m-auto max-w-[28rem]`,tone:`error`,title:`Couldn't start the conversation.`,action:(0,X.jsx)(lE,{variant:`outline`,onClick:()=>void ke(pt.agentId),children:`Retry`})}):null;return(0,X.jsxs)(`main`,{className:`inbox-app grove-shell relative flex h-dvh min-h-0 bg-base-200 font-sans text-base-content`,"data-inbox-app":!0,"data-conversation":!!C||c.selected!==void 0,children:[t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(L0,{open:k===`agent`,pending:_,error:ce,canChooseComputer:t.capabilities.has(XX),create:Oe,onClose:()=>{A(null)},returnFocus:j}),k===`session`?(0,X.jsx)(R0,{open:!0,agents:Ge?Ke:[],defaultAgentId:qe?.agentId??null,start:ke,pending:b!==null,onClose:()=>{A(null)},onNewAgent:We?()=>{A(`agent`)}:void 0,returnFocus:j}):null]}):null,(0,X.jsxs)(JX,{open:re,onOpenChange:ie,returnFocus:oe,children:[(0,X.jsx)(HX,{open:P,agents:m,agentActivity:Ie,agentFilterId:r,websitesSelected:T,websitesVisible:c.canRead,canCreate:t!==null&&We,createOpen:k===`agent`,onAll:()=>{i(null),E(!1)},onWebsites:()=>{i(null),E(!0)},onAgent:e=>{E(!1),et(e)},onCreate:()=>{ft(`agent`)}}),(0,X.jsxs)(`aside`,{id:`grove-list-rail`,className:`inbox-sidebar group relative min-h-0 min-w-0 flex-1 flex-col border-r border-base-300 min-[900px]:w-[var(--grove-list-width)] min-[900px]:flex-none ${F?`flex`:`flex min-[900px]:hidden`}`,style:tt,"aria-label":`Conversations`,children:[ae?(0,X.jsx)(P8,{"aria-label":`Conversation list width`,"aria-controls":`grove-list-rail`,className:`absolute right-0 top-1/2 z-10 translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100`,orientation:`vertical`,variant:`notch`,value:ee,min:L8.min,max:L8.max,onValueChange:e=>{L(()=>e)},onDoubleClick:()=>{L(()=>L8.initial)},...ne}):null,(0,X.jsxs)(`header`,{className:`inbox-header flex h-10 flex-none items-center gap-1 border-b border-base-300 pl-3 pr-1`,children:[(0,X.jsx)(dS,{className:`min-w-0 flex-1 truncate`,children:T&&c.canRead?`Websites`:st?BX(st):`All Agents`}),t&&(Je||We)?(0,X.jsx)(WQ,{"aria-label":`New conversation`,"aria-haspopup":`dialog`,icon:(0,X.jsx)(nG,{}),iconSize:`sm`,size:`sm`,onClick:()=>{ft(`session`)}}):null]}),Xe?(0,X.jsx)(cS,{tone:`info`,title:Xe,action:(0,X.jsx)(lE,{variant:`ghost`,onClick:()=>{t?.ui.requestAppPermissions({agents:x5}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},children:`Allow conversation access`})}):null,t&&m.length>0&&!Je&&!We?(0,X.jsxs)(`section`,{className:`inbox-create inbox-access flex flex-col items-start gap-3 border-b border-base-300 py-2`,"aria-labelledby":`inbox-agent-access-title`,children:[(0,X.jsx)(hS,{level:2,id:`inbox-agent-access-title`,className:`inbox-access-title m-0`,children:`Let Grove manage your Agents`}),(0,X.jsx)(`p`,{children:`Grove creates Agents and carries their conversations. Your Team decides what it may do.`}),(0,X.jsx)(lE,{size:`sm`,onClick:Ye,children:`Allow Agent access`})]}):null,y.error?(0,X.jsx)(cS,{tone:`error`,title:y.error.message}):null,g?(0,X.jsx)(cS,{className:`inbox-error`,tone:`error`,title:g,action:(0,X.jsx)(lE,{variant:`ghost`,size:`sm`,onClick:()=>{l.refetch()},children:`Try again`})}):null,Ue?(0,X.jsx)(cS,{className:`inbox-error`,tone:`error`,title:`Conversations are unavailable.`,action:(0,X.jsx)(lE,{variant:`ghost`,size:`sm`,onClick:()=>{u.refresh()},children:`Retry conversations`})}):null,(0,X.jsx)(XA,{ref:Re,className:`inbox-surface min-h-0 flex-1`,"aria-label":`Conversations`,children:t?h?(0,X.jsx)(`p`,{className:`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`,role:`status`,children:`Loading Agents…`}):(0,X.jsx)(Z8,{viewport:Re,view:Fe,agents:Le,loading:He||c.loading,failed:!!g||Ue||c.failed,pendingSelection:x,selectedAgentId:D,selectedSessionId:O,onSelect:Qe,onDelete:Ge?(e,t)=>{y.mutate({agentId:e,sessionId:t})}:void 0,deleting:y.isPending?y.variables:null,websites:c.rows.filter(e=>r===null||e.agentId===r),selectedWebsite:c.selected,onSelectWebsite:e=>{_e?.clear(),ie(!1),c.select(e)}}):(0,X.jsx)(`p`,{className:`inbox-empty m-0 px-2 py-3 text-sm text-(--stipe-fg-muted)`,children:`Connect to the host to browse Agents.`})},r)]})]}),(0,X.jsxs)(`section`,{className:`inbox-conversation-shell flex min-h-0 min-w-0 flex-1 flex-col`,"aria-label":`Conversation`,children:[(0,X.jsxs)(`header`,{className:`grove-head flex h-10 flex-none items-center gap-2 border-b border-base-300 px-2 text-xs`,children:[ae||!c.selected&&!nt?null:(0,X.jsx)(lE,{variant:`outline`,size:`sm`,"aria-haspopup":`dialog`,"aria-controls":`grove-nav`,"aria-expanded":re,onClick:$e,children:`Agents and conversations`}),c.selected?(0,X.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,X.jsx)(GY,{name:`internet`,size:14}),(0,X.jsx)(dS,{className:`min-w-0 truncate`,children:c.selected.siteLabel}),(0,X.jsx)(qW,{"aria-hidden":`true`,size:12}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:c.selected.conversation.label||`Website visitor`})]}):nt?(0,X.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,X.jsx)(N8,{agentId:nt.agentId,name:BX(nt),avatar:nt.avatar,...it?{setAvatar:ut}:{}},`avatar-${nt.agentId}`),(0,X.jsx)(dS,{className:`flex-none`,children:BX(nt)}),rt?(0,X.jsx)(D8,{agentId:nt.agentId,name:nt.name,rename:lt},nt.agentId):null,at.canRead?(0,X.jsx)(O8,{status:at.status.data,approving:at.approve.isPending,onApprove:dt}):null,(0,X.jsx)(qW,{"aria-hidden":`true`,className:`flex-none text-(--stipe-fg-muted)`,size:12}),(0,X.jsx)(`span`,{className:`min-w-0 truncate text-(--stipe-fg-muted)`,children:ot})]}):null]}),(0,X.jsx)(UX,{app:t}),de?(0,X.jsx)(cS,{className:`inbox-error m-2`,tone:`error`,title:de}):null,C||c.selected?mt:null,c.selected?(0,X.jsx)(_5,{inbox:c}):C?(0,X.jsx)(w5,{open:C,connection:t,commands:Ae,renderConversation:n.renderConversation,composeDraft:pe,onPrefilled:()=>{me(null)},onForked:De,onOpen:Se}):!t||h?null:m.length===0&&!g?(0,X.jsx)(J8,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`speech`,thinking:_,renderVisual:({speaking:e,thinking:t})=>(0,X.jsx)(TX,{className:`h-full w-full`,state:{activity:t?`thinking`:e?`speaking`:`idle`,expression:`normal`}}),title:We?`No one's here yet.`:`Welcome to Grove`,description:We?`Agents chat, write and make little games with you. Name someone?`:`Let Grove find your Agents, create new ones, and open conversations. Your Team controls this access.`,actions:We?(0,X.jsx)(lE,{onClick:()=>{ft(`agent`)},children:`Name your first Agent`}):(0,X.jsx)(lE,{onClick:Ye,children:`Allow Agent access`})}):mt??(0,X.jsx)(J8,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`panel`,title:ct>0?`Pick up a conversation`:qe?`Say hello to ${BX(qe)}`:`No conversations yet`,description:ct>0?`Choose one from the list, or ask for something new. A tiny game is a good start.`:`Ask for anything. Try: “Make me a tiny game where a mushroom catches raindrops.”`,actions:(0,X.jsxs)(X.Fragment,{children:[ae||ct===0?null:(0,X.jsx)(lE,{variant:`outline`,"aria-haspopup":`dialog`,"aria-controls":`grove-nav`,"aria-expanded":re,onClick:$e,children:`Agents and conversations`}),Je?(0,X.jsx)(lE,{variant:`outline`,loading:b===qe.agentId,disabled:b!==null,onClick:()=>void ke(qe.agentId),children:ct>0?`Ask ${BX(qe)} something`:`Start a conversation`}):null]})})]}),ve===null?null:(0,X.jsxs)(`section`,{className:`inbox-conversation-shell flex min-h-0 min-w-0 flex-1 flex-col border-l border-base-300`,"aria-label":`Beside conversation`,"data-inbox-beside":!0,children:[(0,X.jsxs)(`header`,{className:`grove-head flex h-10 flex-none items-center gap-2 border-b border-base-300 px-2 text-xs`,children:[(0,X.jsx)(dS,{className:`min-w-0 flex-1 truncate`,children:z===void 0?ve.agentId:BX(z)}),(0,X.jsx)(WQ,{"aria-label":`Close beside conversation`,icon:(0,X.jsx)(iG,{}),iconSize:`sm`,size:`sm`,onClick:()=>{xe?.clear()}})]}),(0,X.jsx)(w5,{open:ve,connection:t,commands:be,renderConversation:n.renderConversation,composeDraft:null,onPrefilled:()=>void 0,onForked:e=>{xe?.select(ve.agentId,e,!1,!1)},onOpen:Se,label:`Beside conversation`})]})]})}var O5=document.getElementById(`inbox-root`);if(!O5)throw Error(`Inbox root is missing`);eh(O5,{name:`Grove`,queryClient:Tb()},({app:e})=>(0,J.createElement)(T5,{connection:e}));export{dh as $,lw as A,MC as B,uT as C,jw as D,Rw as E,FC as F,eC as G,tC as H,LC as I,gS as J,JS as K,zC as L,RC as M,BC as N,Tw as O,IC as P,Cb as Q,fw as R,lT as S,Vw as T,sC as U,kC as V,TC as W,mS as X,_S as Y,$ as Z,DM as _,MK as a,DT as b,JW as c,rR as d,Jo as et,dL as f,NM as g,hP as h,HJ as i,pw as j,hw as k,GW as l,rL as m,_0 as n,Lr as nt,hK as o,tL as p,pS as q,rX as r,mK as s,b0 as t,_a as tt,pR as u,lE as v,iT as w,fT as x,VT as y,uw as z};
|