@fungi.computer/grove 0.0.1 → 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.
Files changed (72) hide show
  1. package/README.md +18 -9
  2. package/dist/assets/Effect-BY0T-p9d.js +76 -0
  3. package/dist/assets/abort-signals-joV34wzR.js +1 -0
  4. package/dist/assets/anthropic-messages-BPUe3sjP.js +19 -0
  5. package/dist/assets/azure-openai-responses-qVCjcy57.js +1 -0
  6. package/dist/assets/base-face-Dc6wvM5e.js +1 -0
  7. package/dist/assets/burger-CJ8nsj7v.js +1 -0
  8. package/dist/assets/cat-DCYVOD6V.js +1 -0
  9. package/dist/assets/classifier-shared-DtTbFkSF.js +1 -0
  10. package/dist/assets/cloudflare-workers-ai-system-one-C4GWBDtR.js +1 -0
  11. package/dist/assets/compat-Dluy1HPa.js +2 -0
  12. package/dist/assets/{diagnostics-CmW2yJSB.js → diagnostics-CxvqSC4Q.js} +1 -1
  13. package/dist/assets/document-DjWTbvB5.js +1 -0
  14. package/dist/assets/error-BTdmRKoB.js +1 -0
  15. package/dist/assets/extension-hook-Ce1QNicQ.js +721 -0
  16. package/dist/assets/extensions-D55BOb_a.js +1 -0
  17. package/dist/assets/{google-generative-ai-DP-8xZvz.js → google-generative-ai-D4EEWKtU.js} +1 -1
  18. package/dist/assets/{google-shared-Cs5udoZV.js → google-shared-CvUYw8Za.js} +3 -3
  19. package/dist/assets/{google-vertex-BJiAIGUd.js → google-vertex-MtdrRNuD.js} +1 -1
  20. package/dist/assets/index--Y1OC0IE.js +171 -0
  21. package/dist/assets/index-BmdZJzrt.css +1 -0
  22. package/dist/assets/{json-parse-nqKewMRF.js → json-parse-M7s0500m.js} +2 -2
  23. package/dist/assets/mistral-conversations-CI9T5Sz9.js +4 -0
  24. package/dist/assets/models-BM_0GHMS.js +1 -0
  25. package/dist/assets/mushroom-CstiBfYI.js +1 -0
  26. package/dist/assets/{node.browser-CwSOSQcL.js → node.browser-DL9pz-ZD.js} +1 -1
  27. package/dist/assets/node.browser-HQ5SKBOf.js +1 -0
  28. package/dist/assets/openai-codex-responses-C1JF2nxc.js +9 -0
  29. package/dist/assets/openai-completions-DJRWblh-.js +5 -0
  30. package/dist/assets/openai-decisions-CRn788gD.js +2 -0
  31. package/dist/assets/openai-responses-DT9fG-Eg.js +1 -0
  32. package/dist/assets/openai-responses-shared-BDR0j8d9.js +10 -0
  33. package/dist/assets/{openrouter-images-DwousKhc.js → openrouter-images-BqwSYNGm.js} +1 -1
  34. package/dist/assets/parakeet-conversation-DFuwoFfN.js +4 -0
  35. package/dist/assets/{pi-messages-CfXPQ4jp.js → pi-messages-0BariYjJ.js} +1 -1
  36. package/dist/assets/preload-helper-DY31Aviq.js +8 -0
  37. package/dist/assets/{provider-retry-CSlu6hjs.js → provider-retry-RVfYd5Vz.js} +1 -1
  38. package/dist/assets/renderer-l9sYXW5N.js +1 -0
  39. package/dist/assets/runtime-core-BHRx5Fxu.js +2 -0
  40. package/dist/assets/system-one-shared-DywxmMny.js +1 -0
  41. package/dist/assets/transform-messages-ByuM-ZZe.js +1 -0
  42. package/dist/assets/typesafe-system-one-D7tQu98S.js +1 -0
  43. package/dist/index.html +7 -5
  44. package/package.json +40 -17
  45. package/dist/assets/Effect-BEduymlz.js +0 -76
  46. package/dist/assets/anthropic-messages-Bnv5qjAJ.js +0 -41
  47. package/dist/assets/azure-openai-responses-QZaJy-8U.js +0 -1
  48. package/dist/assets/base-face-CJPKiwfc.js +0 -1
  49. package/dist/assets/burger-DMbWZ2jd.js +0 -1
  50. package/dist/assets/cat-UfLh6DHG.js +0 -1
  51. package/dist/assets/cloudflare-workers-ai-system-one-Bq-3_D9p.js +0 -1
  52. package/dist/assets/compat-CvJ9Wfru.js +0 -2
  53. package/dist/assets/error-CJ3RHG07.js +0 -1
  54. package/dist/assets/extension-hook-DvcdepgP.js +0 -560
  55. package/dist/assets/extensions-1Fd4Wd8r.js +0 -1
  56. package/dist/assets/index-DBHVAvuX.css +0 -1
  57. package/dist/assets/index-hJphFjkO.js +0 -171
  58. package/dist/assets/mistral-conversations-mRYg3mWw.js +0 -4
  59. package/dist/assets/models-CcNnosqL.js +0 -1
  60. package/dist/assets/mushroom-BBaCYNmw.js +0 -1
  61. package/dist/assets/node.browser-DFtqp6Hr.js +0 -1
  62. package/dist/assets/openai-codex-responses-BMz-j1hp.js +0 -9
  63. package/dist/assets/openai-completions-BxBCgHHI.js +0 -5
  64. package/dist/assets/openai-responses-cvwOEFWg.js +0 -1
  65. package/dist/assets/openai-responses-shared-DzD8B6NI.js +0 -10
  66. package/dist/assets/parakeet-conversation-C3pQoKx-.js +0 -3
  67. package/dist/assets/preload-helper-mbhLTglw.js +0 -8
  68. package/dist/assets/renderer-BdjuCi44.js +0 -1
  69. package/dist/assets/runtime-core-CvcjUkf6.js +0 -2
  70. package/dist/assets/system-one-shared-CGF8IYMZ.js +0 -1
  71. package/dist/assets/transform-messages-CrQEqmfx.js +0 -1
  72. 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-CvcjUkf6.js","assets/rolldown-runtime-hePW80VL.js","assets/Effect-BEduymlz.js","assets/extension-hook-DvcdepgP.js","assets/preload-helper-mbhLTglw.js","assets/extensions-1Fd4Wd8r.js","assets/mushroom-BBaCYNmw.js","assets/renderer-BdjuCi44.js","assets/cat-UfLh6DHG.js","assets/base-face-CJPKiwfc.js","assets/burger-DMbWZ2jd.js","assets/parakeet-conversation-C3pQoKx-.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,Ii as b,J as x,Ji as S,Jn as C,Ki as w,Kn as T,La 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,Qn as ne,Ra as re,Ri as ie,Sa as ae,T as oe,Ta as se,Ui as L,Vi as ce,Vn as le,Xi as ue,Xn as de,Yi as fe,Z as pe,Zi as me,_ as he,_a as ge,_t as _e,a as ve,aa as ye,ai as be,ba as xe,bi as Se,ct as Ce,d as we,da as Te,dt as Ee,ea as De,er as Oe,fa as ke,g as Ae,ga as je,gt as Me,h as Ne,ha as Pe,hi as Fe,ht as Ie,ia as Le,it as Re,ja as ze,ji as Be,ka as Ve,ki as He,l as Ue,lt as We,m as Ge,ma as Ke,na as qe,nr as Je,oa as Ye,pa as Xe,q as Ze,qn as Qe,ra as $e,rt as et,s as tt,sa as R,t as nt,tr as rt,tt as it,ua as at,ui as ot,ut as st,va as ct,vt as lt,w as ut,wa as dt,xa as ft,xi as pt,y as mt,ya as ht,yt as gt,z as _t,za as vt,zi as yt}from"./Effect-BEduymlz.js";import{$i as bt,$n as xt,$r as St,An as Ct,Ar as wt,Bn as Tt,Br as Et,Ca as Dt,Ci as z,Cr as Ot,Da as kt,Di as At,Dn as jt,Dr as Mt,En as Nt,Fi as B,Fr as V,Gi as Pt,Hi as Ft,Hn as It,Hr as Lt,Ii as H,In as Rt,Ir as zt,Jn as Bt,Jr as Vt,Ki as Ht,Kn as Ut,Li as Wt,Lr as Gt,Mr as U,Nn as Kt,Nr as qt,Oa as Jt,Or as Yt,Pi as Xt,Pn as Zt,Pr as Qt,Qi as $t,Qn as en,Qr as tn,Rn as nn,Sr as rn,Ta as an,Tr as W,Ui as on,Un as sn,Ur as cn,Ut as ln,V as un,Vn as dn,Vr as fn,Wi as pn,Wn as mn,Wr as hn,Xi as gn,Xn as _n,Xr as vn,Yi as yn,Zi as bn,Zn as xn,Zr as Sn,_a as Cn,_r as wn,aa as Tn,an as En,ar as Dn,ba as On,br as kn,ci as An,cn as jn,cr as Mn,di as Nn,dr as Pn,ea as Fn,er as In,fa as Ln,fr as Rn,ga as zn,ha as Bn,hi as Vn,hr as Hn,i as Un,ia as Wn,ir as Gn,ja as Kn,ji as qn,jn as Jn,jr as Yn,ka as Xn,kn as Zn,kr as Qn,ln as $n,ma as er,mr as G,n as tr,na as nr,nr as rr,oa as ir,on as ar,or as K,pa as or,pr as sr,qi as cr,qn as lr,ra as ur,rr as dr,si as fr,ta as pr,tr as mr,ua as hr,ur as gr,va as _r,wn as vr,wr as q,xa as yr,xr as br,ya as xr,yi as Sr,yr as Cr}from"./extension-hook-DvcdepgP.js";import{t as wr}from"./preload-helper-mbhLTglw.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 Tr=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`})),Er=t(((e,t)=>{t.exports=Tr()})),J=e(Er(),1),Dr=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},Or=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function kr(){let e=!1,t=si,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=si,s(),o.clear())},contribute:t=>{if(Lr(t),e)throw new Or;Rr(t,n),zr(t,n);let r=Symbol(`whistle-contribution`);Ir(t)||(n=[...n,{contribution:Br(t),generation:r}],i=!0,s());let a=!0;return ai(o=>{if(!a||e)return;let c={...t,commands:o};Lr(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Rr(c,u),zr(c,u);let d=Br(c);if(Ir(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=Fr(r,n);if(o===void 0)return{status:`missing`};let s;try{let e=li(o);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;i.interaction===void 0&&n!==void 0&&Ar.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=di(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 si;let a=n.flatMap(e=>e.contribution.commands.map(li));return(i||a.some((e,t)=>!ui(e,r[t])))&&(t=fi(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var Ar=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),jr=16,Mr=32,Nr=64,Pr=256;function Fr(e,t){for(let n of t)for(let t of n.contribution.commands)if(`${n.contribution.namespace}:${t.id}`===e)return t}function Ir(e){return e.commands.length===0}function Lr(e){ri(e.sourceId,`source ID`),ri(e.namespace,`namespace`,!0),e.scope!==void 0&&ri(e.scope,`scope`);for(let t of e.commands)Qr(t)}function Rr(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&oi(`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)&&oi(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&oi(`Slash alias is already registered`),r.add(e)}}function zr(e,t){t.length>=Nr&&oi(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>Pr&&oi(`Live command capacity exceeded`)}function Br(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(Vr)};return e.scope===void 0?t:{...t,scope:e.scope}}function Vr(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=Hr(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Kr(e.projections)),t}function Hr(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=Ur(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=Ur(e.outputSchema)),e.presentation!==void 0&&(t.presentation=Gr(e.presentation)),Object.freeze(t)}function Ur(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Wr(t)])))}function Wr(e){return Array.isArray(e)?Object.freeze(e.map(Wr)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Wr(t)]))):e}function Gr(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:Ur(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:Wr(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Kr(e){let t={};return e.bindings!==void 0&&(t.bindings=qr(e.bindings)),e.agent!==void 0&&(t.agent=Jr(e.agent)),e.help!==void 0&&(t.help=Yr(e.help.order)),e.menu!==void 0&&(t.menu=Yr(e.menu.order)),e.palette!==void 0&&(t.palette=Yr(e.palette.order)),e.slash!==void 0&&(t.slash=Xr(e.slash)),t}function qr(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Jr(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Yr(e){let t={};return e!==void 0&&(t.order=e),t}function Xr(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.arguments!==void 0&&(t.arguments=Zr(e.arguments)),t}function Zr(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:Ur(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:Ur(e.text.arguments)})),Object.freeze(t)}function Qr(e){ri(e.id,`command ID`,!0),ri(e.title,`title`),ri(e.category,`category`),$r(e.action),ei(e.projections)}function $r(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)ri(t.label,`choice label`),t.description!==void 0&&ri(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&ri(e.presentation.submitLabel,`submit label`);return;case`confirmation`:ri(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&ri(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&ri(e.presentation.cancelLabel,`cancellation label`)}}function ei(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&ii(t.order);if(e.bindings!==void 0&&ni(e.bindings.values,`binding`),e.slash!==void 0){ni(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&oi(`slash alias must not contain whitespace`);ti(e.slash.arguments)}e.agent?.keybind!==void 0&&ri(e.agent.keybind,`agent keybind`)}}function ti(e){if(e===void 0)return;ri(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&oi(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])ri(n.word,`argument word`),/\s/u.test(n.word)&&oi(`argument word must not contain whitespace`),t.has(n.word)&&oi(`argument word is repeated`),t.add(n.word),n.description!==void 0&&ri(n.description,`argument word description`);t.size>Mr&&oi(`argument word count exceeds 32`),e.text!==void 0&&(ri(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&ri(e.text.requestIdField,`request id field`))}function ni(e,t){e.length>jr&&oi(`${t} count exceeds 16`);for(let n of e)ri(n,t)}function ri(e,t,n=!1){e.trim().length===0&&oi(`${t} must not be blank`),n&&e.includes(`:`)&&oi(`${t} must not contain a colon`)}function ii(e){e!==void 0&&!Number.isSafeInteger(e)&&oi(`order must be a safe integer`)}function ai(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function oi(e){throw Error(e)}var si=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),ci=Object.freeze({status:`available`});function li(e){let t=e.availability?.()??ci;return t.status===`available`?ci:Object.freeze({status:`unavailable`,reason:t.reason})}function ui(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function di(e){if(e instanceof Dr){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:Wr(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function fi(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++]??ci;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...yi(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...yi(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...yi(e,l,u.slash.order,d),alias:t};i.push(u.slash.arguments===void 0?n:{...n,arguments:u.slash.arguments})}u?.help!==void 0&&a.push({...yi(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...yi(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(xi(e,l,u.agent,d))}}return gi(n),_i(i),hi(r),hi(a),hi(o),hi(s),Object.freeze({bindings:vi(n),palette:vi(r),slash:vi(i),help:vi(a),menu:vi(o),agent:vi(s)})}var pi=new TextEncoder;function mi(e,t){let n=pi.encode(e),r=pi.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 hi(e){e.sort((e,t)=>e.order-t.order||mi(e.commandId,t.commandId))}function gi(e){e.sort((e,t)=>e.order-t.order||mi(e.commandId,t.commandId)||mi(e.binding,t.binding))}function _i(e){e.sort((e,t)=>e.order-t.order||mi(e.commandId,t.commandId)||mi(e.alias,t.alias))}function vi(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function yi(e,t,n,r){let i=bi(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function bi(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 xi(e,t,n,r){let i=yi(e,t,n.order,r),a=i.action===void 0?i:{...i,action:Si(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function Si(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var Ci=me(),wi=ue(`status`,[$e({status:n(`available`)}).strict(),$e({status:n(`unavailable`),reason:R()}).strict()]),Ti=Ci,Ei=ye(R(),Ti),Di=e=>Ti.parse(e),Oi=e=>Ei.parse(e),ki=$e({code:R().min(1).max(160),message:R().min(1).max(512),details:Ti.optional()}).strict(),Ai=e=>ki.parse(e),ji=Ei,Mi=R().refine(e=>e.trim().length>0),Ni=wi,Pi=at([$e({type:n(`action`)}).strict(),$e({type:n(`custom`),data:Ei}).strict(),$e({type:n(`choice`),options:w($e({value:Ti,label:Mi,description:Mi.optional()}))}).strict(),$e({type:n(`form`),submitLabel:Mi.optional()}).strict(),$e({type:n(`confirmation`),message:Mi,confirmLabel:Mi.optional(),cancelLabel:Mi.optional()}).strict()]),Fi=$e({inputSchema:ji.optional(),outputSchema:ji.optional(),presentation:Pi.optional()}).strict(),Ii=qe().int().refine(e=>Number.isSafeInteger(e)),Li=$e({hint:Mi.pipe(R().max(120)),words:w($e({word:R().regex(/^\S{1,64}$/u),description:Mi.pipe(R().max(512)).optional(),arguments:Ei}).strict()).max(32).optional(),text:$e({field:Mi.pipe(R().max(120)),arguments:Ei,requestIdField:Mi.pipe(R().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`),Ri=$e({order:Ii.optional()}).strict(),zi=$e({bindings:$e({order:Ii.optional(),values:w(Mi).max(16)}).strict().optional(),agent:$e({keybind:Mi.optional(),order:Ii.optional()}).strict().optional(),help:Ri.optional(),menu:Ri.optional(),palette:Ri.optional(),slash:$e({aliases:w(Mi).max(16),order:Ii.optional(),arguments:Li.optional()}).strict().optional()}).strict(),Bi=$e({id:Mi.refine(e=>!e.includes(`:`)),title:Mi,category:Mi,description:Mi.optional(),projections:zi.optional(),action:Fi.optional(),availability:Ni.optional()}).strict(),Vi=e=>Bi.parse(e),Hi=$e({inputSchema:ji.optional(),outputSchema:ji.optional()}).strict(),Ui=$e({commandId:R(),sourceId:R(),scope:R().optional(),title:R(),category:R(),description:R().optional(),order:qe(),availability:wi,action:Hi.optional(),keybind:R().optional()}).strict();w(Ui);var Wi=8192,Gi=Mi.pipe(R().max(Wi)),Ki=ke({protocol:/^https?$/u}),qi=ue(`type`,[$e({type:n(`choice`),message:Gi,collapsedGroup:Gi.optional(),options:w($e({value:Gi,label:Gi,description:Gi.optional(),group:Gi.optional()}).strict()).min(1).max(256)}).strict(),$e({type:n(`text`),message:Gi,placeholder:Gi.optional(),secret:S().optional()}).strict(),$e({type:n(`confirmation`),message:Gi,confirmLabel:Gi.optional(),cancelLabel:Gi.optional()}).strict()]),Ji=ue(`type`,[$e({type:n(`info`),message:Gi,links:w($e({url:Ki,label:Gi.optional()}).strict()).max(16).optional()}).strict(),$e({type:n(`progress`),message:Gi}).strict(),$e({type:n(`handoff`),url:Ki,code:Gi.optional(),message:Gi.optional()}).strict(),$e({type:n(`success`),message:Gi}).strict()]),Yi=e=>qi.parse(e),Xi=e=>Ji.parse(e),Zi={confirmation:e=>(qi.options[2].parse(e),S()),text:e=>(qi.options[1].parse(e),R().max(Wi)),choice:e=>{let t=qi.options[0].parse(e);return R().refine(e=>t.options.some(t=>t.value===e))}};function Qi(e){let t=Zi[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}function $i(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:Di(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 ea=`data-theme`;function ta(e){return e||(globalThis.document?.documentElement??null)}function na(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function ra(e,t){let n=na(e),r=ta(t);r&&r.setAttribute(ea,n)}function ia(e){return ta(e)?.getAttribute(ea)??null}var aa=t((e=>{var t=Er(),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})),oa=t(((e,t)=>{t.exports=aa()})),X=oa(),sa=J.createContext(void 0),ca=e=>{let t=J.useContext(sa);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},la=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,X.jsx)(sa.Provider,{value:e,children:t})),ua={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},da=new class{#e=ua;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 fa(e){setTimeout(e,0)}var pa=typeof window>`u`||`Deno`in globalThis;function ma(){}function ha(e,t){return typeof e==`function`?e(t):e}function ga(e){return typeof e==`number`&&e>=0&&e!==1/0}function _a(e,t){return Math.max(e+(t||0)-Date.now(),0)}function va(e,t){return typeof e==`function`?e(t):e}function ya(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==xa(o,t.options))return!1}else if(!Ca(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 ba(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Sa(t.options.mutationKey)!==Sa(a))return!1}else if(!Ca(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function xa(e,t){return(t?.queryKeyHashFn||Sa)(e)}function Sa(e){return JSON.stringify(e,(e,t)=>Oa(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ca(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(!Ca(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Ca(e[r],t[r]))return!1;return!0}return!1}var wa=Object.prototype.hasOwnProperty;function Ta(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Da(e)&&Da(t);if(!r&&!(Oa(e)&&Oa(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:wa.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ta(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ea(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 Da(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Oa(e){if(!ka(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ka(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ka(e){return Object.prototype.toString.call(e)===`[object Object]`}function Aa(e){return new Promise(t=>{da.setTimeout(t,e)})}function ja(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ta(e,t)}function Ma(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Na(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pa=Symbol();function Fa(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Pa?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ia(e,t){return typeof e==`function`?e(...t):!!e}function La(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 Ra=()=>pa,za=()=>Ra(),Ba=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(){}},Va=new class extends Ba{#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`}},Ha=fa;function Ua(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ha,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 Wa=Ua(),Ga=new class extends Ba{#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 Ka(e){return Math.min(1e3*2**e,3e4)}function qa(e){return(e??`online`)!==`online`||Ga.isOnline()}var Ja=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ya(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ma);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Ja(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Va.isFocused()&&(e.networkMode===`always`||Ga.isOnline())&&e.canRun(),p=()=>qa(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??(za()?0:3),a=e.retryDelay??Ka,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),Aa(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 Xa=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ga(this.gcTime)&&(this.#e=da.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(za()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(da.clearTimeout(this.#e),this.#e=void 0)}};function Za(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=>{La(e,()=>t.signal,()=>n=!0)},u=Fa(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?Na:Ma;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?$a:Qa,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:Qa(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 Qa(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 $a(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function eo(e,t){return t?Qa(e,t)!=null:!1}function to(e,t){return!t||!e.getPreviousPageParam?!1:$a(e,t)!=null}var no=class extends Xa{#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=ao(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=ao(this.options);e.data!==void 0&&(this.setState(io(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ja(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(ma).catch(ma):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=>va(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pa||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>va(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:!_a(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=Fa(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`?Za(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=Ya({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ja&&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 Ja){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,...ro(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...io(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),Wa.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function ro(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qa(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function io(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ao(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 oo=class extends Ba{#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),co(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return lo(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return lo(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 va(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&&!Ea(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&uo(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||va(this.options.enabled,this.#t)!==va(t.enabled,this.#t)||va(this.options.staleTime,this.#t)!==va(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||va(this.options.enabled,this.#t)!==va(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 Ea(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(ma)),t}#h(e){return!za()&&va(this.options.enabled,this.#t)!==!1&&ga(e)}#g(){this.#b();let e=va(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=_a(this.#r.dataUpdatedAt,e)+1;this.#u=da.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=da.setInterval(()=>{(this.options.refetchIntervalInBackground||Va.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(da.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(da.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&&co(e,t),o=i&&uo(e,n,t,r);(a||o)&&(l={...l,...ro(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=ja(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=ja(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:fo(e,t),refetch:this.refetch,isEnabled:va(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),Ea(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)})})();Wa.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 so(e,t){return va(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||va(t.retryOnMount,e)!==!1)}function co(e,t){return so(e,t)||e.state.data!==void 0&&lo(e,t,t.refetchOnMount)}function lo(e,t,n){if(va(t.enabled,e)!==!1&&va(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&fo(e,t)}return!1}function uo(e,t,n,r){return(e!==t||va(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&fo(e,n)}function fo(e,t){return va(t.enabled,e)!==!1&&e.isStaleByTime(va(t.staleTime,e))}var po=class extends oo{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:eo(t,n.data),hasPreviousPage:to(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},mo=class extends Xa{#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||ho(),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=Ya({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),Wa.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ho(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var go=class extends Ba{#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 mo({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=_o(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=_o(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=_o(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=_o(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Wa.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=>ba(t,e))}findAll(e={}){return this.getAll().filter(t=>ba(e,t))}notify(e){Wa.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Wa.batch(()=>Promise.all(e.map(e=>e.continue().catch(ma))))}};function _o(e){return e.options.scope?.id}var vo=class extends Ba{#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),Ea(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Sa(t.mutationKey)!==Sa(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??ho();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){Wa.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 yo(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var bo=class extends Ba{#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,Wa.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||!Ea(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(yo(e,n).forEach(e=>{e.destroy()}),yo(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=Ta(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 oo(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)&&Wa.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},xo=class extends Ba{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??xa(r,t),a=this.get(i);return a||(a=new no({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(){Wa.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=>ya(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ya(e,t)):t}notify(e){Wa.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Wa.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Wa.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},So=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new xo,this.#t=e.mutationCache||new go,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Va.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ga.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(va(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=ha(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Wa.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;Wa.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Wa.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=Wa.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ma).catch(ma)}invalidateQueries(e,t={}){return Wa.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=Wa.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(ma)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ma)}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(va(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(va(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ma).catch(ma)}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(ma).catch(ma)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ga.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(Sa(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ca(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Sa(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ca(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||=xa(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===Pa&&(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 Co({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Ma(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(La({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 wo=J.createContext(!1),To=()=>J.useContext(wo);wo.Provider;function Eo(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Do=J.createContext(Eo()),Oo=()=>J.useContext(Do),ko=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ia(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Ao=e=>{J.useEffect(()=>{e.clearReset()},[e])},jo=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ia(n,[e.error,r])),Mo=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))}},No=(e,t)=>e?.suspense&&t.isPending,Po=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Fo({queries:e,...t},n){let r=ca(n),i=To(),a=Oo(),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=>{Mo(e);let t=r.getQueryCache().get(e.queryHash);ko(e,a,t)}),Ao(a);let[c]=J.useState(()=>new bo(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;J.useSyncExternalStore(J.useCallback(e=>f?c.subscribe(Wa.batchCalls(e)):ma,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),J.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>No(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&No(n,e)?Po(n,new oo(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&jo({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 Io(e,t,n){let r=To(),i=Oo(),a=ca(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Mo(o),ko(o,i,s),Ao(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(Wa.batchCalls(e)):ma;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),J.useEffect(()=>{l.setOptions(o)},[o,l]),No(o,u))throw Po(o,l,i);if(jo({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Lo(e,t){return Io(e,oo,t)}function Ro(e){return e}function zo(e){return e}function Bo(e,t){let n=ca(t),[r]=J.useState(()=>new vo(n,e));J.useEffect(()=>{r.setOptions(e)},[r,e]);let i=J.useSyncExternalStore(J.useCallback(e=>r.subscribe(Wa.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=J.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(ma)},[r]);if(i.error&&Ia(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Vo=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}}}})),Ho=t(((e,t)=>{t.exports=Vo()})),Uo=t((e=>{var t=Er(),n=Ho();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 ne(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 re=!1;function ie(e,t){if(!e||re)return``;re=!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{re=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ne(e):``}function ae(e){switch(e.tag){case 5:return ne(e.type);case 16:return ne(`Lazy`);case 13:return ne(`Suspense`);case 19:return ne(`SuspenseList`);case 0:case 2:case 15:return e=ie(e.type,!1),e;case 11:return e=ie(e.type.render,!1),e;case 1:return e=ie(e.type,!0),e;default:return``}}function oe(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?oe(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function se(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 oe(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 L(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ce(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function le(e){var t=ce(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 ue(e){e._valueTracker||=le(e)}function de(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ce(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function fe(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 pe(e,t){var n=t.checked;return I({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function me(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=L(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 he(e,t){t=t.checked,t!=null&&b(e,`checked`,t,!1)}function ge(e,t){he(e,t);var n=L(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`)?ve(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&ve(e,t.type,L(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _e(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 ve(e,t,n){(t!==`number`||fe(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ye=Array.isArray;function be(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=``+L(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 xe(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return I({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Se(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(ye(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:L(n)}}function Ce(e,t){var n=L(t.value),r=L(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 we(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function Te(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 Ee(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?Te(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var De,Oe=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(De||=document.createElement(`div`),De.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ae={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},je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ae).forEach(function(e){je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ae[t]=Ae[e]})});function Me(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ae.hasOwnProperty(e)&&Ae[e]?(``+t).trim():t+`px`}function Ne(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Me(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Pe=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 Fe(e,t){if(t){if(Pe[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 Ie(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 Le=null;function Re(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ze=null,Be=null,Ve=null;function He(e){if(e=Ni(e)){if(typeof ze!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Fi(t),ze(e.stateNode,e.type,t))}}function Ue(e){Be?Ve?Ve.push(e):Ve=[e]:Be=e}function We(){if(Be){var e=Be,t=Ve;if(Ve=Be=null,He(e),t)for(e=0;e<t.length;e++)He(t[e])}}function Ge(e,t){return e(t)}function Ke(){}var qe=!1;function Je(e,t,n){if(qe)return e(t,n);qe=!0;try{return Ge(e,t,n)}finally{qe=!1,(Be!==null||Ve!==null)&&(Ke(),We())}}function Ye(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 Xe=!1;if(c)try{var Ze={};Object.defineProperty(Ze,"passive",{get:function(){Xe=!0}}),window.addEventListener(`test`,Ze,Ze),window.removeEventListener(`test`,Ze,Ze)}catch{Xe=!1}function Qe(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 $e=!1,et=null,tt=!1,R=null,nt={onError:function(e){$e=!0,et=e}};function rt(e,t,n,r,i,a,o,s,c){$e=!1,et=null,Qe.apply(nt,arguments)}function it(e,t,n,i,a,o,s,c,l){if(rt.apply(this,arguments),$e){if($e){var u=et;$e=!1,et=null}else throw Error(r(198));tt||(tt=!0,R=u)}}function at(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 ot(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 st(e){if(at(e)!==e)throw Error(r(188))}function ct(e){var t=e.alternate;if(!t){if(t=at(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 st(a),e;if(o===i)return st(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 lt(e){return e=ct(e),e===null?null:ut(e)}function ut(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ut(e);if(t!==null)return t;e=e.sibling}return null}var dt=n.unstable_scheduleCallback,ft=n.unstable_cancelCallback,pt=n.unstable_shouldYield,mt=n.unstable_requestPaint,ht=n.unstable_now,gt=n.unstable_getCurrentPriorityLevel,_t=n.unstable_ImmediatePriority,vt=n.unstable_UserBlockingPriority,yt=n.unstable_NormalPriority,bt=n.unstable_LowPriority,xt=n.unstable_IdlePriority,St=null,Ct=null;function wt(e){if(Ct&&typeof Ct.onCommitFiberRoot==`function`)try{Ct.onCommitFiberRoot(St,e,void 0,(e.current.flags&128)==128)}catch{}}var Tt=Math.clz32?Math.clz32:z,Et=Math.log,Dt=Math.LN2;function z(e){return e>>>=0,e===0?32:31-(Et(e)/Dt|0)|0}var Ot=64,kt=4194304;function At(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 jt(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=At(a))):r=At(s)}else o=n&~i,o===0?a!==0&&(r=At(a)):r=At(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-Tt(t),i=1<<n,r|=e[n],t&=~i;return r}function Mt(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 Nt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Tt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Mt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function B(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function V(){var e=Ot;return Ot<<=1,!(Ot&4194240)&&(Ot=64),e}function Pt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ft(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function It(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-Tt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Lt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Tt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var H=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=[],U=null,Kt=null,qt=null,Jt=new Map,Yt=new Map,Xt=[],Zt=`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 Qt(e,t){switch(e){case`focusin`:case`focusout`:U=null;break;case`dragenter`:case`dragleave`:Kt=null;break;case`mouseover`:case`mouseout`:qt=null;break;case`pointerover`:case`pointerout`:Jt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Yt.delete(t.pointerId)}}function $t(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 U=$t(U,e,t,n,r,i),!0;case`dragenter`:return Kt=$t(Kt,e,t,n,r,i),!0;case`mouseover`:return qt=$t(qt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Jt.set(a,$t(Jt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Yt.set(a,$t(Yt.get(a)||null,e,t,n,r,i)),!0}return!1}function tn(e){var t=Mi(e.target);if(t!==null){var n=at(t);if(n!==null){if(t=n.tag,t===13){if(t=ot(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);Le=r,n.target.dispatchEvent(r),Le=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,U!==null&&nn(U)&&(U=null),Kt!==null&&nn(Kt)&&(Kt=null),qt!==null&&nn(qt)&&(qt=null),Jt.forEach(rn),Yt.forEach(rn)}function W(e,t){e.blockedOn===t&&(e.blockedOn=null,Wt||(Wt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,an)))}function on(e){function t(t){return W(t,e)}if(0<Gt.length){W(Gt[0],e);for(var n=1;n<Gt.length;n++){var r=Gt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(U!==null&&W(U,e),Kt!==null&&W(Kt,e),qt!==null&&W(qt,e),Jt.forEach(t),Yt.forEach(t),n=0;n<Xt.length;n++)r=Xt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Xt.length&&(n=Xt[0],n.blockedOn===null);)tn(n),n.blockedOn===null&&Xt.shift()}var sn=x.ReactCurrentBatchConfig,cn=!0;function ln(e,t,n,r){var i=H,a=sn.transition;sn.transition=null;try{H=1,dn(e,t,n,r)}finally{H=i,sn.transition=a}}function un(e,t,n,r){var i=H,a=sn.transition;sn.transition=null;try{H=4,dn(e,t,n,r)}finally{H=i,sn.transition=a}}function dn(e,t,n,r){if(cn){var i=pn(e,t,n,r);if(i===null)ii(e,t,r,fn,n),Qt(e,r);else if(en(i,e,t,n,r))r.stopPropagation();else if(Qt(e,r),t&4&&-1<Zt.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=Re(r),e=Mi(e),e!==null){if(t=at(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ot(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(gt()){case _t:return 1;case vt:return 4;case yt:case bt:return 16;case xt: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 G(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var tr=!1;function nr(e,t){switch(e){case`compositionend`:return G(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 rr(e,t){if(tr)return e===`compositionend`||!Jn&&er(e,t)?(e=vn(),_n=gn=hn=null,tr=!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 K(e,t,n,r){Ue(r),t=oi(t,`onChange`),0<t.length&&(n=new wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function cr(e){Qr(e,0)}function lr(e){if(de(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(){or&&(or.detachEvent(`onpropertychange`,gr),sr=or=null)}function gr(e){if(e.propertyName===`value`&&lr(sr)){var t=[];K(t,sr,e,Re(e)),Je(cr,t)}}function _r(e,t,n){e===`focusin`?(hr(),or=t,sr=n,or.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(sr)}function q(e,t){if(e===`click`)return lr(t)}function yr(e,t){if(e===`input`||e===`change`)return lr(t)}function br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var xr=typeof Object.is==`function`?Object.is:br;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 J(){for(var e=window,t=fe();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=fe(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=J(),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!==fe(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`)},Lr={},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(Lr[e])return Lr[e];if(!Ir[e])return e;var t=Ir[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rr)return Lr[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,it(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(tt)throw e=R,tt=!1,R=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,!Xe||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}Je(function(){var r=a,i=Re(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=Ye(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!==Le&&(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=at(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=yr;else{g=vr;var _=_r}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=q);if(g&&=g(e,r)){K(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&ve(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 tr?er(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(Zn&&n.locale!==`ko`&&(tr||y!==`onCompositionStart`?y===`onCompositionEnd`&&tr&&(v=vn()):(hn=i,gn=`value`in hn?hn.value:hn.textContent,tr=!0)),_=oi(r,y),0<_.length&&(y=new In(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=G(n),v!==null&&(y.data=v)))),(v=Xn?nr(e,n):rr(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=Ye(e,n),a!=null&&r.unshift(ai(e,a,i)),a=Ye(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=Ye(n,a),c!=null&&o.unshift(ai(n,c,s))):i||(c=Ye(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),on(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);on(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,se(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,Y=!1;function ea(e){Qi===null?Qi=[e]:Qi.push(e)}function ta(e){$i=!0,ea(e)}function na(){if(!Y&&Qi!==null){Y=!0;var e=0,t=H;try{var n=Qi;for(H=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)),dt(_t,na),t}finally{H=t,Y=!1}}return null}var ra=[],ia=0,aa=null,oa=0,X=[],sa=0,ca=null,la=1,ua=``;function da(e,t){ra[ia++]=oa,ra[ia++]=aa,aa=e,oa=t}function fa(e,t,n){X[sa++]=la,X[sa++]=ua,X[sa++]=ca,ca=e;var r=la;e=ua;var i=32-Tt(r)-1;r&=~(1<<i),n+=1;var a=32-Tt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,la=1<<32-Tt(t)+i|n<<i|r,ua=a+e}else la=1<<a|n<<i|r,ua=e}function pa(e){e.return!==null&&(da(e,1),fa(e,1,0))}function ma(e){for(;e===aa;)aa=ra[--ia],ra[ia]=null,oa=ra[--ia],ra[ia]=null;for(;e===ca;)ca=X[--sa],X[sa]=null,ua=X[--sa],X[sa]=null,la=X[--sa],X[sa]=null}var ha=null,ga=null,_a=!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,ha=e,ga=Ci(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,ha=e,ga=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ca===null?null:{id:la,overflow:ua},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Jl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ha=e,ga=null,!0);default:return!1}}function xa(e){return!!(e.mode&1)&&!(e.flags&128)}function Sa(e){if(_a){var t=ga;if(t){var n=t;if(!ba(e,t)){if(xa(e))throw Error(r(418));t=Ci(n.nextSibling);var i=ha;t&&ba(e,t)?ya(i,n):(e.flags=e.flags&-4097|2,_a=!1,ha=e)}}else{if(xa(e))throw Error(r(418));e.flags=e.flags&-4097|2,_a=!1,ha=e}}}function Ca(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ha=e}function wa(e){if(e!==ha)return!1;if(!_a)return Ca(e),_a=!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&&=ga){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){ga=Ci(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}ga=null}}else ga=ha?Ci(e.stateNode.nextSibling):null;return!0}function Ta(){for(var e=ga;e;)e=Ci(e.nextSibling)}function Ea(){ga=ha=null,_a=!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(ye(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(ye(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(ye(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),_a&&da(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 _a&&da(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)}),_a&&da(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),_a&&da(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 _a&&da(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)}),_a&&da(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(ye(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,Lt(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:Ee(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ee(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=Ee(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,Xo(Bo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||So!==null&&So.memoizedState.tag&1){if(n.flags|=2048,Go(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)&&Uo(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Uo(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xr(e,n)}catch{return!0}}function Uo(e){var t=qa(e,1);t!==null&&gl(t,e,1,-1)}function Wo(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 Go(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 Ko(){return Mo().memoizedState}function qo(e,t,n,r){var i=jo();bo.flags|=e,i.memoizedState=Go(1|t,n,void 0,r===void 0?null:r)}function Jo(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=Go(t,n,a,r);return}}bo.flags|=e,i.memoizedState=Go(1|t,n,a,r)}function Yo(e,t){return qo(8390656,8,e,t)}function Xo(e,t){return Jo(2048,8,e,t)}function Zo(e,t){return Jo(4,2,e,t)}function Qo(e,t){return Jo(4,4,e,t)}function $o(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]),Jo(4,4,$o.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=V(),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=H;H=n!==0&&4>n?n:4,e(!0);var r=vo.transition;vo.transition={};try{e(!1),t()}finally{H=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,Lt(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:Yo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),qo(4194308,4,$o.bind(null,t,e),n)},useLayoutEffect:function(e,t){return qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return qo(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:Wo,useDebugValue:ts,useDeferredValue:function(e){return jo().memoizedState=e},useTransition:function(){var e=Wo(!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(_a){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,Yo(Bo.bind(null,i,o,e),[e]),i.flags|=2048,Go(9,zo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=jo(),t=Uc.identifierPrefix;if(_a){var n=ua,r=la;n=(r&~(1<<32-Tt(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:Xo,useImperativeHandle:es,useInsertionEffect:Zo,useLayoutEffect:Qo,useMemo:rs,useReducer:Po,useRef:Ko,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:Xo,useImperativeHandle:es,useInsertionEffect:Zo,useLayoutEffect:Qo,useMemo:rs,useReducer:Fo,useRef:Ko,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)?at(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+=ae(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)):(_a&&n&&pa(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)):(_a&&r&&pa(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,ga=Ci(a.nextSibling),ha=t,_a=!0,va=null,e!==null&&(X[sa++]=la,X[sa++]=ua,X[sa++]=ca,la=e.id,ua=e.overflow,ca=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=pe(e,i),r=pe(e,r),o=[];break;case`select`:i=I({},i,{value:void 0}),r=I({},r,{value:void 0}),o=[];break;case`textarea`:i=xe(e,i),r=xe(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=pi)}Fe(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(!_a)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(ma(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`:me(i,s),$r(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},$r(`invalid`,i);break;case`textarea`:Se(i,s),$r(`invalid`,i)}for(var c in Fe(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`:ue(i),_e(i,s,!0);break;case`textarea`:ue(i),we(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=Te(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=Ie(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`:me(e,i),o=pe(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`:Se(e,i),o=xe(e,i),$r(`invalid`,e);break;default:o=i}for(s in Fe(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ne(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Oe(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&ke(e,u):typeof u==`number`&&ke(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`:ue(e),_e(e,i,!1);break;case`textarea`:ue(e),we(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+L(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&be(e,!!i.multiple,i.defaultValue,!0):be(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=ha,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(_a&&ga!==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&&ht()>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&&!_a)return sc(t),null}else 2*ht()-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=ht(),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(ma(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=cn,e=J(),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},cn=!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(Ct&&typeof Ct.onCommitFiberUnmount==`function`)try{Ct.onCommitFiberUnmount(St,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),on(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{ke(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&&he(a,o),Ie(c,s);var u=Ie(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ne(a,f):d===`dangerouslySetInnerHTML`?Oe(a,f):d===`children`?ke(a,f):b(a,d,f,u)}switch(c){case`input`:ge(a,o);break;case`textarea`:Ce(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?be(a,!!o.multiple,o.multiple?[]:``,!1):be(a,!!o.multiple,o.defaultValue,!0)):be(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{on(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=ht())),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=Me(`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&&(ke(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&&on(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?ht():fl===-1?fl=ht():fl}function hl(e){return e.mode&1?Hc&2&&Gc!==0?Gc&-Gc:Oa.transition===null?(e=H,e===0?(e=window.event,e=e===void 0?16:mn(e.type),e):e):(pl===0&&(pl=V()),pl):1}function gl(e,t,n,i){if(50<ul)throw ul=0,dl=null,Error(r(185));Ft(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=ht()+500,$i&&na()))}function _l(e,t){var n=e.callbackNode;Nt(e,t);var r=jt(e,e===Uc?Gc:0);if(r===0)n!==null&&ft(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ft(n),t===1)e.tag===0?ta(Cl.bind(null,e)):ea(Cl.bind(null,e)),bi(function(){!(Hc&6)&&na()}),n=null;else{switch(Rt(r)){case 1:n=_t;break;case 4:n=vt;break;case 16:n=yt;break;case 536870912:n=xt;break;default:n=yt}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=jt(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=ht()+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=B(e),a!==0&&(i=a,t=yl(e,a))),t===1)throw n=Yc,Dl(e,0),Sl(e,i),_l(e,ht()),n;if(t===6)Sl(e,i);else{if(a=e.current.alternate,!(i&30)&&!xl(a)&&(t=jl(e,i),t===2&&(o=B(e),o!==0&&(i=o,t=yl(e,o))),t===1))throw n=Yc,Dl(e,0),Sl(e,i),_l(e,ht()),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-ht(),10<t)){if(jt(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-Tt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ht()-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,ht()),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-Tt(t),r=1<<n;e[n]=-1,t&=~r}}function Cl(e){if(Hc&6)throw Error(r(327));Rl();var t=jt(e,0);if(!(t&1))return _l(e,ht()),null;var n=jl(e,t);if(e.tag!==0&&n===2){var i=B(e);i!==0&&(t=i,n=yl(e,i))}if(n===1)throw n=Yc,Dl(e,0),Sl(e,t),_l(e,ht()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Il(e,el,rl),_l(e,ht()),null}function wl(e,t){var n=Hc;Hc|=1;try{return e(t)}finally{Hc=n,Hc===0&&(nl=ht()+500,$i&&na())}}function Tl(e){cl!==null&&cl.tag===0&&!(Hc&6)&&Rl();var t=Hc;Hc|=1;var n=Vc.transition,r=H;try{if(Vc.transition=null,H=1,e)return e()}finally{H=r,Vc.transition=n,Hc=t,!(Hc&6)&&na()}}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(ma(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(_a&&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&&!pt();)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=H,i=Vc.transition;try{Vc.transition=null,H=1,Ll(e,t,n,r)}finally{Vc.transition=i,H=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(It(e,o),e===Uc&&(Wc=Uc=null,Gc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||sl||(sl=!0,Kl(yt,function(){return Rl(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Vc.transition,Vc.transition=null;var s=H;H=1;var c=Hc;Hc|=4,Bc.current=null,gc(e,n),jc(n,e),Or(hi),cn=!!mi,hi=mi=null,e.current=n,Nc(n,e,a),mt(),Hc=c,H=s,Vc.transition=o}else e.current=n;if(sl&&(sl=!1,cl=e,ll=a),o=e.pendingLanes,o===0&&(ol=null),wt(n.stateNode,i),_l(e,ht()),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,na(),null}function Rl(){if(cl!==null){var e=Rt(ll),t=Vc.transition,n=H;try{if(Vc.transition=null,H=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,na(),Ct&&typeof Ct.onPostCommitFiberRoot==`function`)try{Ct.onPostCommitFiberRoot(St,e)}catch{}i=!0}return i}finally{H=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&&(Ft(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&&(Ft(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>ht()-tl?Dl(e,0):Qc|=n),_l(e,t)}function Hl(e,t){t===0&&(e.mode&1?(t=kt,kt<<=1,!(kt&130023424)&&(kt=4194304)):t=1);var n=ml();e=qa(e,t),e!==null&&(Ft(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,_a&&t.flags&1048576&&fa(t,oa,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,_a&&o&&pa(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(ga=Ci(t.stateNode.containerInfo.firstChild),ha=t,_a=!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 dt(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=Pt(0),this.expirationTimes=Pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(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(at(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,Ft(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<Xt.length&&t!==0&&t<Xt[n].priority;n++);Xt.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=At(t.pendingLanes);n!==0&&(Lt(t,n|1),_l(t,ht()),!(Hc&6)&&(nl=ht()+500,na()))}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 H},Ut=function(e,t){var n=H;try{return H=e,t()}finally{H=n}},ze=function(e,t,n){switch(t){case`input`:if(ge(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));de(i),ge(i,a)}}}break;case`textarea`:Ce(e,n);break;case`select`:t=n.value,t!=null&&be(e,!!n.multiple,t,!1)}},Ge=wl,Ke=Tl;var xu={usingClientEntryPoint:!1,Events:[Ni,Pi,Fi,Ue,We,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=lt(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{St=wu.inject(Cu),Ct=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=lt(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`})),Wo=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=Uo()})),Go=t((e=>{var t=Wo();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function Ko(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),Kn(t))}var qo=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 Jo=globalThis[qo],Yo=Jo?Jo.RpcTarget:class{},Xo=async function(){}.constructor,Zo=typeof Buffer<`u`?Buffer.prototype:void 0;function Qo(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 Xo.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case Zo: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 us.prototype:return`stub`;case ds.prototype:return`rpc-promise`;default:if(Jo){if(t==Jo.RpcStub.prototype||e instanceof Jo.ServiceStub)return`rpc-target`;if(t==Jo.RpcPromise.prototype||t==Jo.RpcProperty.prototype)return`rpc-thenable`}return e instanceof Yo?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function $o(){throw Error(`RPC map() implementation was not loaded.`)}var es={applyMap:$o,sendMap:$o};function ts(){throw Error(`Stream implementation was not loaded.`)}var ns={createWritableStreamHook:ts,createWritableStreamFromHook:ts,createReadableStreamHook:ts},rs=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}}},is=class extends rs{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)}}},as=new is(Error(`Attempted to use RPC stub after it has been disposed.`)),os=(e,t,n)=>e.call(t,n);function ss(e,t){let n=os;os=e;try{return t()}finally{os=n}}var cs=Symbol(`realStub`),ls={apply(e,t,n){let r=e.raw;return new ds(os(r.hook,r.pathIfPromise||[],vs.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===cs)return r;if(t in ds.prototype)return r[t];if(typeof t==`string`)return new ds(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=as}},has(e,t){let n=e.raw;return t===cs?!0:t in ds.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.`)}},us=class e extends Yo{constructor(e,t){if(super(),!(e instanceof rs)){let n=e;if(e=n instanceof Yo||n instanceof Function?Cs.create(n,void 0):new xs(vs.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,ls)}hook;pathIfPromise;dup(){let t=this[cs];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[cs].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[cs];return es.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},ds=class extends us{constructor(e,t){if(e instanceof rs)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=Qo(e);if(n===`rpc-promise`){let t=gs(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=as,super(e,[])}}else if(n===`rpc-thenable`)super(Cs.create(e,void 0),[]);else{let t=new ws(Promise.resolve(e).then(e=>new xs(vs.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return _s(this).then(...arguments)}catch(e){return _s(this).catch(...arguments)}finally(e){return _s(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function fs(e){let{hook:t,pathIfPromise:n}=e[cs];return n&&n.length>0?t.get(n):t}function ps(e){let{hook:t,pathIfPromise:n}=e[cs];return n?t.get(n):t.dup()}function ms(e){let{hook:t,pathIfPromise:n}=e[cs];if(!(n&&n.length>0))return t}function hs(e){return e[cs].hook}function gs(e){return e[cs]}async function _s(e){let{hook:t,pathIfPromise:n}=e[cs];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var vs=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 Cs.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=Cs.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 ns.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=ns.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 ns.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=ns.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(Qo(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?ps(t):fs(t),t instanceof ds){let e=new ds(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new us(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):Cs.create(n,t),this.hooks.push(r),new us(r)}case`rpc-thenable`:{let o=e,s;return s=a?new ds(a.getHookForRpcTarget(o,t,i),[]):new ds(Cs.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):ns.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):ns.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 ds)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=ms(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 ds?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(Qo(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=ms(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)):Ss(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=ns.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=ns.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>hs(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(Qo(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`:hs(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function ys(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(Qo(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}=gs(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 ds){let{hook:t,pathIfPromise:n}=gs(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var bs=class extends rs{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=ys(t,void 0,e,r)}catch(e){return t.dispose(),new is(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new ws(t.deliverCall(n.value,n.parent).then(e=>new xs(e))):(t.dispose(),new is(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=ys(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):es.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new is(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=ys(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new xs(vs.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new is(e)}}},xs=class e extends bs{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(vs.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 us&&this.payload.value.onRpcBroken(e)}};function Ss(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var Cs=class e extends bs{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=>vs.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&Ss(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},ws=class e extends rs{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)}},Ts={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},Es=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,Ds=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function Os(e){return Ds.includes(e)}var ks={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},As={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},js=new Map;for(let e of Object.keys(As))js.set(As[e],e);function Ms(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 Ns=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 Ps(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var Fs={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},Is=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=Ns,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(Qo(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=js.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=ks[t];!Es&&i&&(n=n.slice(),Ms(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=ns.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=ns.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}=gs(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 Ts}};function Ls(e,t){return new ds(new ws(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new xs(vs.fromAppReturn(r))})),[])}function Rs(e,t){return new ds(new ws(Ps(e,t).then(e=>new xs(vs.fromAppReturn(e)))),[])}var zs=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=vs.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(!Os(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=ks[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(!Es&&r!==void 0&&Ms(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=Fs[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=Ls(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=Rs(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 ds(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new ds(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 ds(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 ds(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 us(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=ns.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=ns.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}},Bs=16,Vs=8,Hs=16,Us=64;function Ws(e){return 2+e.length*3}function Gs(e,t,n=0){if(n>=Us)return Vs;switch(typeof e){case`string`:return Ws(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 Hs+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return Hs+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return Vs;if(t.add(e),e instanceof Array){let r=Bs;for(let i of e)r+=Vs+Gs(i,t,n+1);return r}if(e instanceof Error){let r=Bs+Ws(e.name)+Ws(e.message)+Ws(e.stack??``);for(let i of Object.keys(e))r+=Vs+Ws(i)+Gs(e[i],t,n+1);return r}let r=Bs;for(let i of Object.keys(e))r+=Vs+Ws(i)+Gs(e[i],t,n+1);return r}default:return 16}}var Ks=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 is(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)}},qs=class e extends rs{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)}},Js=class extends qs{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},Ys=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={...Ts,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new Ks(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new Js(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 us){let{hook:n,pathIfPromise:r}=gs(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=Is.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,Is.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,Is.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 qs&&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 Ks(this,e,!1),this.imports[e]=t),new qs(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new is(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new Ks(this,e,!0);return this.imports[e]=t,new qs(!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 Ks(this,n,!1);this.imports.push(r);let i=new qs(!1,r),a=ns.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=Is.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 Ks(this,this.imports.length,!1);return this.imports.push(i),new qs(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=Is.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=Gs(a));let s=this.imports.length,c=new Ks(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 Ks(this,this.imports.length,!1);return this.imports.push(a),new qs(!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`,Is.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 xs(new zs(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 xs(new zs(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=ns.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 xs(new zs(this,this.encodingLevel).evaluate(n[2])));else{let e=new zs(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new is(e.value))}}else n[0]==`resolve`&&new zs(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 zs(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}},Xs=class{#e;#t;constructor(e,t,n={}){let r;r=t?new xs(vs.fromAppReturn(t)):new is(Error(`This connection has no main object.`)),this.#e=new Ys(e,r,n),this.#t=new us(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function Zs(e,t,n){return new Xs(new Qs(e),t,n).getRemoteMain()}var Qs=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))}},$s,ec=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=$s?{parent:$s,captures:[],subject:$s.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},$s=this}unregister(){$s=this.context.parent}makeInput(){return new nc(this,0)}makeOutput(e){let t;try{t=Is.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 nc(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=Is.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 nc(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new nc(this,this.instructions.length)}capture(e){if(e instanceof nc&&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){}};es.sendMap=(e,t,n)=>{let r=new ec(e,t),i;try{i=vs.fromAppReturn(ss(r.pushCall.bind(r),()=>n(new ds(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new ds(r.makeOutput(i),[])};function tc(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var nc=class extends rs{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($s)return $s.pushGet(this,e);tc()}call(e,t){t.dispose(),tc()}map(e,t,n){for(let e of t)e.dispose();tc()}pull(){tc()}ignoreUnhandledRejections(){}onBroken(e){tc()}},rc=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 zs(this).evaluateCopy(t);if(e.value instanceof us){let t=ms(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new xs(e))}return new zs(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 Ts}};function ic(e,t,n,r,i){let a=new rc(r,new xs(vs.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}es.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof ds)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(ic(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=vs.fromArray(t)}else a=e==null?vs.fromAppReturn(e):ic(e,t,n,r,i);return new xs(a)}finally{for(let e of r)e.dispose()}};var ac=class e extends rs{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 ws((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new xs(e)))}catch(e){return t.dispose(),new is(e)}}map(e,t,n){for(let e of t)e.dispose();return new is(Error(`Cannot use map() on a WritableStream`))}get(e){return new is(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){}},oc=262144,sc=1073741824,cc=65536,lc=2,uc=1.25,dc=.9,fc=3,Z=class{now;window=oc;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?lc:uc,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*dc):Math.max(s,this.window),this.window=Math.max(Math.min(s,sc),cc),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*uc?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=fc&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function pc(e){let t,n=!1,r=new Z(()=>performance.now()),i,a,o=()=>{n||(n=!0,e.dispose())};return new WritableStream({write(n,s){if(t!==void 0)throw t;let c=vs.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`],vs.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`],vs.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var mc=class e extends rs{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 is(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new is(Error(`Cannot use map() on a ReadableStream`))}get(e){return new is(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){}};ns.createWritableStreamHook=ac.create,ns.createWritableStreamFromHook=pc,ns.createReadableStreamHook=mc.create;var hc=us,gc=Yo,_c=Zs;function vc(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 yc(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}function bc(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function xc(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function Sc(e){return{name:xc(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function Cc(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function wc(e,t){let n=Cc(Sc(e));return{stroke:n,display:t?.display??Mc(n),match:t?.match??Oc(n),tokenName:t?.tokenName?bc(t.tokenName):void 0}}function Tc(e){return{stroke:Cc(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function Ec(e){return e.map(e=>Tc(e))}function Dc(e){return`match`in e?e.match:`stroke`in e?Oc(e.stroke):Oc(e)}function Oc(e){return`key:${Nc(Sc(e))}`}function kc(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function Ac(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:Mc(e.stroke):Mc(Sc(e))}function jc(e,t){return e.map(e=>Ac(e,t)).join(t?.separator??``)}function Mc(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 Nc(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var Pc=Symbol(`keymap-extension-context`);function Fc(e){return e.isDestroyed?null:e.getFocusedTarget()}function Ic(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 Lc(e,t){let n=new Set;return Ic(e,t,e=>{n.add(e)}),n}function Rc(e,t,n){let r=[],i=Lc(t,n),a=Array.isArray(e)?e:zc(e);for(let e of a)Bc(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 Bc(e,t,n,r=Lc(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function Vc(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 Hc(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?Vc(e)>=i.min:n}function Uc(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&Vc(e)<n.max)return!0}return Hc(e,t,n)&&e.index+1<e.binding.sequence.length}function Wc(e,t){return e.index===e.binding.sequence.length-1&&Hc(e,t,!1)}function Gc(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 Kc(e,t){let n=Gc(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=Gc(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=Gc(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function qc(e,t){let n=[];for(let r of e){if(!Hc(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 Jc(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 Yc(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 Xc(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 Jc({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 Zc(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&Vc(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return Jc(e,e.index,r,t.value??n.name)}}return Hc(e,r,!1)?Xc(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return Xc(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function Qc(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=Xc(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=Yc(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function $c(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 el(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function tl(){let e=el();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 nl(){let e=el(),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 rl(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function il(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(!rl(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 al(e){let t=il(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function ol(e){return{...e,sequence:Ec(e.sequence)}}function sl(e,t){let n=tl();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=cl(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 cl(e){return e.map(t=>({sequence:Ec(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:ol(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&ll(e,t)),hasContinuations:e.some(e=>e.event===`press`&&ul(t,e))}))}function ll(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function ul(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function dl(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function fl(){return{plain:dl(),bindings:dl(),metadata:dl(),bindingsAndMetadata:dl()}}function pl(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 ml(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function hl(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function gl(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 _l(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 vl(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=Ac(i.stroke)),c&&(o=void 0),n.push(wc(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function yl(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function bl(e,t,n,r,i,a,o={}){let s=fl(),c=-1,l=[],u=()=>yl(t).getFocusedTarget(),d=()=>Fc(t),f=t=>{let n=e.pending;gl(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),L(),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)&&Uc(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?vl(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=_l(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=pl(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&yl(t);let o=u(),s=ml(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,hl(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=Rc(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>Bc(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?Ac(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?oe(c,s,r):t.set(e,ae(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=ie(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=ie(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(qc(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=ne(e,t,i,a,o);if(!c)return;let l=n.get(s);l?oe(l,c,i):n.set(s,ae(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=se(o,t,n,r,i);e&&a.push(e)}return a},ne=(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=ie(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=re(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}},re=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?Ac(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},ie=(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}},ae=(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}),oe=(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)}},se=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:Cc(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},L=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?vl(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:vl,collectMatchingBindings:E,collectActiveBindings:A}}var xl=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),Sl=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),Cl=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function wl(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 Tl(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 El(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function Dl(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),El(n,e.command.name,i)}return{entries:t,chainsByName:n}}function Ol(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),El(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 kl(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=Rc(e.sortedLayers,t,r)),Ol(e.activeLayersCache,n,!0)}function Al(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 jl(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 Ml(e){let t=`field ${e.fieldName}`;return{require(n,r){Al(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);jl(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function Nl(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Pl(e,t){return e instanceof Error&&e.message?e.message:t}function Fl(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function Il(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=>Il(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!Nl(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?Il(i,t):i;return r?Object.freeze(a):a}return e}var Ll=[`name`],Rl=Object.freeze({}),zl=new WeakMap;function Bl(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=>Hl({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=>le(e).map(e=>Vl(e.commandState)),S=e=>{let t=ce(e),n=le(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:Vl(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&&ue(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:(de(n,ce(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=_e(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=_e(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=ae(ie(t));return g.set(t,n??null),n},E=(e,t)=>ae(M(t).chainsByName.get(e)),D=(e,t)=>_e(e,null,{mode:`registered`,execution:t}),O=(e,t,n)=>_e(e,t,{mode:`active`,execution:n}),k=(e,t)=>ne(e,t)?.command,A=e=>re(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(!Bc(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=kl(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=Dl(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:oe(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:oe(e.command,t,`active`)?.attrs},I=(e,n)=>{if(n?.some(t=>t.command.name===e)||N().chainsByName.has(e))return`resolved`;let r=_e(e,Fc(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())})}}),ne=(e,t)=>{let n=M(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:oe(e,t,`active`)},re=e=>ie(e)?.[0],ie=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},ae=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},oe=(e,t,n)=>_e(e,t,{mode:n}).resolved,se=()=>N().entries,L=()=>{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},ce=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:Fc(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:M(r)}},le=(e,t=ce(e))=>{let r;return r=t.visibility===`registered`?se():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],ql({entries:r,query:e,getCommand:e=>Vl(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},ue=(e,t,n)=>{fe(n,n=>{pe(e,t,n)})},de=(e,t)=>{if(t.visibility===`registered`){let t=L();for(let[n,r]of e){let e=N().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(he(i,e))}return}fe(t,n=>{me(e,n,t)})},fe=(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)}},pe=(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(he(n,r.commandAttrs))}},me=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(he(t,ge(t,n)))},he=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),ge=(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)},_e=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=Ul(t,e.commandResolvers.values(),()=>be(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=ye(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=ve(c.command.name,r,a)??Kl(c.command);e&&(s.resolved={...c,attrs:e})}return s},ve=(e,t,n)=>n===`registered`?re(e)?.commandState.attrs:M(t).reachableByName.get(e)?.commandState.attrs,ye=(e,t,n)=>n===`registered`?re(e):M(t).reachableByName.get(e),be=(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 Vl(e){return e.command}function Hl(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=Tl(r.name),s=Wl(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,Ml({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,Pl(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function Ul(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:Gl(t,o.getExecutionFields())}}return{hadError:i}}function Wl(e){let t={};for(let[n,r]of Object.entries(e))!xl.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?Rl:t}function Gl(e,t){return{command:e,input:t.input,payload:t.payload}}function Kl(e){let t=Wl(e);return t===Rl?void 0:t}function ql(e){let t=e.query?.namespace,n=Jl(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=Ll;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(Xl(u,t)&&Yl(u,r,i)&&!(c&&!c.has(u.command.name))&&Zl(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 Jl(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function Yl(e,t,n){if(!t)return!0;for(let r of n)if(Ql(e,r,t))return!0;return!1}function Xl(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?au(n.namespace,t):!1}function Zl(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!nu(e,r,i,n))return!1;return!0}function Ql(e,t,n){return $l(e,t)?.includes(n)===!0}function $l(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=eu(a);return n.set(t,o),o}function eu(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=eu(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 tu(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function nu(e,t,n,r){return typeof n==`function`?ru(e,t,n,r):iu(e,t,n)}function ru(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,tu(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,tu(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,tu(n,o[t],l(),r.onFilterError))?!0:!c&&tu(n,void 0,l(),r.onFilterError)}function iu(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&au(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&au(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&au(a[t],n)}function au(e,t){return Array.isArray(t)?t.some(t=>ou(e,t)):ou(e,t)}function ou(e,t){return Array.isArray(e)?e.some(e=>ou(e,t)):Object.is(e,t)}function su(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(Fl(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(cu(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=wl(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`&&(lu(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 lu(n,i),!0;return!1}}}function cu(e){return typeof e==`object`&&!!e&&`ok`in e}function lu(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var uu=Object.freeze({}),du=[],fu=[];function pu(e){if(Object.keys(e).length!==0)return Il(e,{freeze:!0})}function mu(e,t,n,r){let i=t=>bu(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:uu,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=yu(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:uu,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)=>jc(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=_u(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,Pl(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?yu(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=vu(x,m)}catch(e){t.emitError(`binding-parse-error`,e,Pl(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`||Sl.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,Ml({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?pu(u):void 0,m=wl(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:ol(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):du,matchers:d.length>0?d:fu,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`&&!_&&gu(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,Pl(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>wc(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:Ec(r)}];let l={...n,sequence:Ec(r)},u=[],d=!0,f=o??uu;for(let n of s)try{n(l,{layer:f,parseKey:t=>bu(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(ol(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 hu(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 gu(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&hu(n.sequence,t.sequence)||t.command!==void 0&&hu(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 _u(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??uu,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 vu(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 yu(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??uu,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:bc,createMatch:kc,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 bu(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=yu(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function xu(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function Su(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(xu(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 Cu=Symbol(`keymap-disambiguation-decision`),wu=Symbol(`keymap-deferred-disambiguation-decision`);function Tu(e,t){return{[Cu]:!0,action:e,handler:t}}function Eu(e){return{[wu]:!0,action:e}}function Du(e){return!!e&&typeof e==`object`&&e[Cu]===!0}function Ou(e){return!!e&&typeof e==`object`&&e[wu]===!0}function ku(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 Au(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 ju(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...wc({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 Mu(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 Nu(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&&he()}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:Ec(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:Ec(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?Ec(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||he();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=ne(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=xe(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=Se(a,r,e,t);if(o=A(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function ne(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=xe(e);if(n)return re(n,i,e,t);let a=r.getActiveLayers(t),o=M();for(let n of i){let r=ae(a,[n],e,t);if(o=A(o,r),r.handled)return o}return o}function re(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=Zc(r,n,i,e.patterns,Ce,we);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,Yc(t,n)),1/0),u=c.filter(e=>Yc(e,n)===l);if(u.length===0||!u.some(e=>Oe(e,a,o))){let e=O(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return ie(u,0,!1,i,a)}function ie(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=ye(t,i,n);if(u.length>0){if(s)continue;let e=be(t,n);return L(t,i,u,e,a,o,s)||P(`sequence-advance`,u,o,a)}if(!Wc(n,e.patterns))continue;let d=be(t,n);for(let e of d)l.add(e);let f=ke(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 ae(e,t,n,r){return oe(e,0,t,n,r)}function oe(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=Te(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>Uc(t,e.patterns,!1)).length>0){let n=u.filter(t=>Wc(t,e.patterns)),i=ve(t,s,r,a,o);return se(t,s,r,i,n,a,o)||P(`sequence-start`,i,o,a)}let d=ke(n,u.filter(t=>Wc(t,e.patterns)),a,o);if(l=A(l,d.outcome),d.handled&&d.stop)return l}return l}function se(e,t,n,i,a,o,s){return ce({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=ke(i,a,o,s);return c.stop?c.outcome:A(c.outcome,oe(e,t+1,n,o,s))}})}function L(e,t,n,i,a,o,s){return ce({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=ke(n,i,a,o);return c.stop?c.outcome:A(c.outcome,ie(e,t+1,s||c.handled,a,o))}})}function ce(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=ue({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?le(g,a,l,f,p,i,h):(_e(h()),f())}function le(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 de(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 ue(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=Ec(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:Cc(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:Ec(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:()=>Tu(`run-exact`),continueSequence:()=>Tu(`continue-sequence`),clear:()=>Tu(`clear`),defer:e=>Tu(`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(Fl(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!Du(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function de(e,t,n,r,i){he();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{fe(o,t,n,r)})}function fe(e,n,r,i){if(!ge(e))return;let a={signal:e.controller.signal,sequence:Ec(i),focused:r,sleep:t=>ku(t,e.controller.signal),runExact:()=>Eu(`run-exact`),continueSequence:()=>Eu(`continue-sequence`),clear:()=>Eu(`clear`)},o;try{o=n(a)}catch(n){ge(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),me(e));return}if(Fl(o)){o.then(t=>{pe(e,t)}).catch(n=>{ge(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),me(e))});return}pe(e,o)}function pe(e,n){if(ge(e)){if(n!==void 0&&!Ou(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),me(e);return}me(e),e.apply(n)}}function me(e){ge(e)&&(d=null)}function he(){let e=d;e&&(d=null,e.controller.abort())}function ge(e){return d===e}function _e(e){let n=jc(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 ve(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 Te(n,r,a,o,l))Uc(t,e.patterns,!1)&&c.push(t)}return c}function ye(t,n,r){return t.filter((t,i)=>i>=n&&Uc(t,e.patterns,!1)&&Fu(t.parts,r.parts))}function be(t,n){return t.filter(t=>t.layer===n.layer&&Wc(t,e.patterns)&&Fu(t.parts,n.parts))}function xe(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return Pu(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 Se(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 Ce(n,r){return Au(e.patterns,t,n,r)}function we(t,n,r){return ju(e.patterns,t,n,r)}function Te(e,t,n,r,i){let a=Qc(e,t,n,Ce,we);return a.some(e=>Oe(e,r,i))?a:[]}function Ee(n){return Mu(e.patterns,t,n)}function De(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function Oe(e,t,n){return De(e.binding,t,n)}function ke(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,Ee(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 Pu(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 Fu(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 Iu=()=>{};function Lu(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 Ru(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=bc(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,Pl(e,`Failed to register keymap token`)),Iu}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),Iu;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,Pl(e,`Failed to register keymap token "${a}"`)),Iu}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,Pl(e,`Failed to register keymap token "${a}"`)),Iu}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,Pl(e,`Failed to unregister keymap token "${a}"`))}}}function Bu(e,t,n,r){let i,a;try{i=bc(r.name);let e=Lu(i,`min`,r.min,1),t=Lu(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:kc(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,Pl(e,`Failed to register keymap sequence pattern`)),Iu}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),Iu):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function Vu(e,t,n,r){return Ru(r,{kind:n,reservedFields:n===`layer`?Cl:n===`binding`?Sl:xl,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var Hu=()=>{};function Uu(e,t){return t.priority-e.priority||t.order-e.order}function Wu(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 Gu(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 Ku(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`),Hu;let o,s,c,p,m,v,y;try{y=l(n),o=u(al(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,Pl(e,`Failed to register keymap layer`)),Hu}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 Hu;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:Kc(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(Uu),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=>il(e)});t&&(i=al(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(Cl.has(c)||l===void 0)continue;o[c]=Il(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,Ml({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?Il(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=Kc(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,Pl(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=Wu(t),r=Gu(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,Pl(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var qu=1e3;function Ju(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>=qu){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:qu},`[Keymap] Possible infinite state listener feedback loop detected after ${qu} 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 Yu(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 Xu=Object.freeze({});function Zu(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:tl(),bindingExpanders:tl(),bindingParsers:tl(),bindingTransformers:tl(),bindingFields:new Map,commandTransformers:tl(),commandFields:new Map,eventMatchResolvers:tl(),disambiguationResolvers:tl(),keyHooks:nl(),keyAfterHooks:nl(),rawHooks:nl(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:tl(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:Xu,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function Qu(e){return Dc(e)}var $u=class{#e=Zu();#t=!1;#n=new Map;#r=[];#i=$c(()=>{});#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=$c((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=Ju(this.#e,this.#i,this.#a),this.#l=Su(this.#e,this.#o),this.#u=Bl(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=bl(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=Yu(this.#e,this.#o,this.#s),this.#d=su(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=mu(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=sl(this.#o,this.#u),this.#m=Ku(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=Nu(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()}))}[Pc](){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?Qu(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 Vu(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 Bu(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 Vu(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return Vu(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)))}},ed=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(`.`)),td=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),nd=id(ed),rd=id(td);function id(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 ad(e){return e>=65&&e<=90?e+32:e}function od(e){return e>=48&&e<=57}function sd(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(ad(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function cd(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(ad(r));if(i){for(let e of i)if(sd(t,e,n))return e}}function ld(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function ud(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 dd(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function fd(e,t){let n=cd(nd,e,t);if(n)return n;if(ad(e.charCodeAt(t))!==102||!od(e.charCodeAt(t+1)))return;let r=od(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function pd(e,t){return cd(rd,e,t)}function md(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=pd(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=fd(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 hd=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[ud(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:[ud(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[ld(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:[ud(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=md(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=fd(t,n);return s?{parts:[dd(s,e)],nextIndex:n+s.length}:{parts:[ud(a,e)],nextIndex:n+1}},gd=(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 _d(e){return e.appendBindingParser(e=>hd(e))}function vd(e){return e.appendEventMatchResolver((e,t)=>gd(e,t))}function yd(e){let t=_d(e),n=vd(e);return()=>{n(),t()}}var bd=Symbol(`keymap:mod-bindings`),xd=/(^|[+,\s])mod(?=\s*\+)/i,Sd=/(^|[+,\s])mod(?=\s*\+)/gi;function Cd(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function wd(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function Td(e){return e.acquireResource(bd,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!xd.test(t))return;let r=Cd(e.getHostMetadata());return[{key:t.replace(Sd,(e,t)=>`${t}${r}`),displays:n??wd(t)}]}))}var Ed=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 Dd(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 Od(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=Dd(t);return n===`unknown`?Dd(e?.platform??e?.userAgent):n}function kd(){let e=Od();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function Ad(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function jd(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||!Ad(t.name)?[t]:[t,{...t,shift:!1}]}var Md=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 Nd(){return globalThis.MutationObserver}function Pd(e){return Ed.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function Fd(e){if(!e)return new Md(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Md(Pd(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Id=class{metadata=kd();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(Fd(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(Fd(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 Fd()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=Nd();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 Ld(e){return new Id(e)}var Rd=(e,t)=>jd(e).map(e=>t.resolveKey(e)),zd=`fungi.app.ready`,Bd=`fungi.app.connect`,Vd=[`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`],Hd=e=>q.pipe(V(At(1)),V(z(e))),Ud=e=>B(Hd(e)),Wd=rn.pipe(V(Vn()),V(Xt(Number.isSafeInteger,{message:`Expected a safe integer`}))),Gd=Wd.pipe(V(Nn(0))),Kd=Wd.pipe(V(An(0))),qd=W({appId:Hd(160),releaseId:Hd(160),surfaceId:Hd(160)}),Jd=W({editing:Mn,surface:U([Hd(160),kn])}),Yd=U([W({kind:G(`compose`),requestId:Hd(160),text:Hd(2e3)}),W({kind:G(`navigate`),requestId:Hd(160),params:K(W({key:Hd(64),value:Hd(4096)})).pipe(V(z(16)))})]),Xd=W({computerId:U([Hd(256),kn]),teamHasComputers:B(br(Mn)),computerAccessGranted:B(Mn),focus:Jd,openRequest:U([kn,Yd]),visibility:Hn([`visible`,`hidden`])}),Zd=Hn([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),Qd=W({altKey:Mn,ctrlKey:Mn,id:Hd(160),key:Hd(64),metaKey:Mn,shiftKey:Mn}),$d=W({action:B(qt),availability:B(qt),category:Hd(160),description:Ud(512),id:Hd(160),projections:B(qt),title:Hd(160)}),ef=W({arguments:B(qt),commandId:Hd(321),origin:Hn([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:Hd(160)}),tf=U([W({result:B(qt),status:G(`handled`)}),W({error:qt,status:G(`failed`)})]),nf=e=>Hd(e).pipe(V(Xt(e=>{for(let t=0;t<e.length;t+=1)if(vc(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),rf={id:Hd(64),text:nf(80),end:H(Mn)},af=H(rn.pipe(V(Vn()),V(St({minimum:0,maximum:9999})))),of=K(U([W({...rf,kind:G(`text`),tone:H(Hn([`neutral`,`success`,`warning`,`error`]))}),W({...rf,kind:G(`button`),icon:H(Hn([`folder`,`ports`,`processes`,`access`])),count:af,title:H(nf(1024)),disabled:H(Mn),opens:H(G(`dialog`)),expanded:H(Mn)}),W({...rf,kind:G(`toggle`),pressed:Mn}),W({...rf,kind:G(`menu`),count:af,title:H(nf(1024)),options:K(W({id:Hd(64),text:nf(80),checked:H(Mn),disabled:H(Mn)})).pipe(V(z(16)),V(Xt(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(V(z(6)),V(Xt(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),sf=W({computerId:Hd(256),path:Hd(1024)}),cf=Hd(80).pipe(V(Xt(e=>e.trim()===e,{message:`Expected a trimmed title`}))),lf=W({contractVersion:G(1),canGoBack:Mn,title:B(cf)}),uf=W({canGoBack:Mn,title:B(q)}),df=br(W({agentId:Hd(256),sessionId:Hd(256)})),ff=W({agents:B(K(Hn([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(V(z(4)))),computers:B(K(Hn([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(V(z(4))))}),pf=Hn([`granted`,`declined`,`customize`]),mf=W({message:Hd(512),tone:B(Hn([`info`,`success`,`warning`,`error`]))}),hf=W({code:Hn(Vd),message:Hd(512),retryable:Mn}),gf=W({protocolVersion:G(2),type:G(zd)}),_f=W({epoch:Hd(160),protocolVersion:G(2),type:G(Bd)}),vf=W({epoch:Hd(160),protocolVersion:G(2)}),yf={[Symbol.dispose]:B(qt)},bf=U([W({...yf,ok:G(!0),value:qt}),W({...yf,error:hf,ok:G(!1)})]);function xf(e,t,n=`PROTOCOL`){return Se(cn(e,{onExcessProperty:`error`}),le({onFailure:e=>{throw new Y(`The peer sent malformed protocol data`,{cause:e,code:n,retryable:!1})},onSuccess:t}))}function Sf(e){return Object.freeze(e)}function Cf(e,t){let n=e.arguments===void 0?void 0:Di(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),Sf(r)}var wf=xf($d,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}),Sf(sp(()=>Vi(t)))},`INVALID_ARGUMENT`),Tf=xf(Hd(321),e=>e),Ef=xf(ef,e=>{let t=e.arguments===void 0?void 0:Di(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),Sf(n)}),Df=xf(U([wt,qt]),e=>e===void 0?void 0:Di(e)),Of=xf(_f,e=>Sf(e));xf(vf,e=>Sf(e));var kf=xf(Xd,e=>{let t={computerId:e.computerId,focus:Sf({...e.focus}),openRequest:e.openRequest===null?null:Sf({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),Sf(t)}),Af=xf(hf,e=>Sf({...e})),jf=xf(Jd,e=>Sf({...e}),`INVALID_ARGUMENT`),Mf=xf(qd,e=>Sf({...e})),Nf=xf(Zd,e=>e),Pf=xf(of,e=>Sf(e.map(e=>e.kind===`menu`?Sf({...e,options:Sf(e.options.map(e=>Sf(e)))}):Sf(e))),`INVALID_ARGUMENT`),Ff=xf(W({itemId:Hd(64),optionId:H(Hd(64)),anchor:H(W({start:rn.pipe(V(St({minimum:0,maximum:1e5}))),width:rn.pipe(V(St({minimum:0,maximum:1e5})))}))}),e=>Sf(e.anchor===void 0?{...e}:{...e,anchor:Sf({...e.anchor})}),`INVALID_ARGUMENT`),If=xf(sf,e=>Sf({...e}),`INVALID_ARGUMENT`);xf(lf,e=>Sf(e.title===void 0?{canGoBack:e.canGoBack}:{canGoBack:e.canGoBack,title:e.title}),`INVALID_ARGUMENT`);var Lf=xf(uf,e=>{let t=e.title?.trim();return Rf(t===void 0||t.length===0?{contractVersion:1,canGoBack:e.canGoBack}:{contractVersion:1,canGoBack:e.canGoBack,title:t})},`INVALID_ARGUMENT`),Rf=xf(lf,e=>Sf({...e}),`INVALID_ARGUMENT`),zf=xf(df,e=>e===null?null:Sf({...e}),`INVALID_ARGUMENT`),Bf=xf(ff,e=>Sf({agents:Sf([...new Set(e.agents??[])]),computers:Sf([...new Set(e.computers??[])])}),`INVALID_ARGUMENT`);xf(gf,e=>Sf(e));var Vf=xf(Hd(512),e=>e),Hf=xf(mf,e=>Sf({...e}),`INVALID_ARGUMENT`);xf(W({id:Hd(160),repeat:Mn}),e=>Sf(e));var Uf=xf(K(Qd).pipe(V(z(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 Sf(e.map(e=>Sf({...e})))});function Wf(e){return xf(W({value:qt,version:Gd}),t=>Sf({value:e(t.value),version:t.version}))}var Gf=Wf(kf),Kf=xf(W({capabilities:K(qt).pipe(V(z(128))),context:qt}),e=>Sf({capabilities:Sf(e.capabilities.map(e=>Qf(e))),context:Gf(e.context)})),qf=Wf(Nf),Jf=Wf(Uf),Yf=Wf(Vf),Xf=Se(qf,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new Y(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return Sf({value:e.value,version:e.version})});function Zf(e){return xf(W({handle:qt,id:Hd(160),version:Kd}),t=>{if(!(t.handle instanceof hc)&&!(e&&t.handle instanceof gc))throw new Y(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return Sf({handle:t.handle,id:t.id,version:t.version})})}var Qf=Zf(!1),$f=Zf(!0);function ep(e){let t=e?$f:Qf;return xf(W({capabilities:K(qt).pipe(V(z(128))),context:qt,identity:qt,lifecycle:qt,reservedChords:qt,theme:qt}),e=>Sf({capabilities:Sf(e.capabilities.map(e=>t(e))),context:Gf(e.context),identity:Mf(e.identity),lifecycle:Xf(e.lifecycle),reservedChords:Jf(e.reservedChords),theme:Yf(e.theme)}))}var tp=ep(!1);ep(!0);function np(e){return xf(bf,t=>t.ok?Sf({ok:!0,value:e(t.value)}):Sf({ok:!1,error:Af(t.error)}))}var rp=np(tp),ip=np(xf(W({commandId:Hd(321)}),e=>Sf(e)));np(xf(tf,e=>{if(e.status===`failed`)return Sf({status:`failed`,error:sp(()=>Ai(e.error))});let t=e.result===void 0?void 0:Di(e.result);return Sf(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var ap=np(xf(wt,()=>void 0)),op=np(xf(pf,e=>e));np(xf(Mn,e=>e)),np(xf(Mn,e=>e));function sp(e){try{return e()}catch(e){throw new Y(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var cp=U([W({kind:G(`saveFile`),name:Hd(255).pipe(V(qn(/^[^\p{Cc}/\\]+$/u))),mime:Hd(255),bytes:Qn}),W({kind:G(`copyText`),text:q})]);function lp(e){let t=cn(cp,{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 up=np(xf(U([W({kind:G(`saved`)}),W({kind:G(`copied`)}),W({kind:G(`refused`),reason:Hn([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>Sf(e)));function dp(e){return e instanceof Y?{code:e.code,message:pp(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function fp(e){try{let t=Af(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 pp(e){return e.trim().slice(0,512)||`Host operation failed`}var mp=e=>({ok:!0,value:e}),hp=e=>({error:dp(e),ok:!1});async function gp(e,t){let n,r=new Set;try{return n=await e,_p(t(n))}catch(e){throw vp(e)&&yp(e,r),e instanceof Y?e:new Y(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&vp(n)&&yp(n,r)}}function _p(e){if(e.ok)return e.value;throw fp(e.error)}function vp(e){return ot(e)&&Symbol.dispose in e&&be(e[Symbol.dispose])}function yp(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function bp(){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 xp(e){let t=Uf(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=Uf(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function Sp(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Ld(r),a=new $u(i);yd(a),Td(a),a.prependEventMatchResolver(Rd);let o=wp(e.onBroken),s=Op(a,e.chords,e.remote,o),c=Cp(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=()=>Tp(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:Ep(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=Ep(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=Op(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 Cp(e,t,n,r,i){return()=>{if(!n())return;let a=Tp(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function wp(e){return t=>{try{gp(t(),ap).catch(t=>{Ko(`browser-bridge.host-call`,t),e(t)})}catch(t){Ko(`browser-bridge.host-call`,t),e(t)}}}function Tp(e,t){let n=e.activeElement;return jf({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function Ep(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||Dp(e.key)&&n())return!1;e.run()}})),priority:500})}function Dp(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function Op(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:Pd(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 kp(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=Mp(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=jp(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 Ap)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of Ap)e.window.removeEventListener(t,n)}}var Ap=[`mousedown`,`mouseup`,`auxclick`];function jp(e){return e===3?`back`:e===4?`forward`:null}function Mp(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:Np(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 Np(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function Pp(){return!Fe(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function Fp(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 Ip(e){let t=new Map,n=Fp(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=Qf(n),r=Bp(e.id,e.version);if(t.has(r))throw Rp(e.handle),new Y(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())Rp(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)Rp(t)},o=e=>{if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=Bp(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 Lp=Te().transform(e=>{let t=v(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=hn(W({[Symbol.dispose]:B(Sn(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function Rp(e){try{let t=Lp.parse(e);if(t===void 0||zp.has(t.owner))return;zp.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}var zp=new WeakSet;function Bp(e,t){return`${e}@${String(t)}`}var Vp=class extends gc{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(Tf(e))?.abort(),Promise.resolve(mp(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=Ef(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=Df(await this.#t(Cf(t,n.signal)));return mp(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof Dr)try{return mp({status:`failed`,error:Ai({code:e.code,message:e.message,details:e.details})})}catch(e){return hp(e)}return hp(e)}}[Symbol.dispose](){this.dispose()}};function Hp(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 Up(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:Hp(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{gp(e(),ap).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:Gp(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 Wp(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 Gp(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!be(s))throw new Y(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=wf(o),l=new Vp(s),u=Wp(n,c,s,l);try{let t=await Kp(e,c,u.target);r()&&await qp(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 Kp(e,t,n){return gp(e.registerCommand(t,n),ip)}async function qp(e,t,n){throw n.dispose(),await gp(e.unregisterCommand(t),ap),new Y(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var Jp=zt(e=>e instanceof hc),Yp=class extends gc{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw om();let t=e===void 0?void 0:Af(e);return setTimeout(()=>this.#t.disconnect?.(t??um()),0),Promise.resolve(mp(void 0))}catch(e){return Promise.resolve(hp(e))}}async requestClose(){try{if(this.#e)throw om();return mp(await(this.#t.beforeClose?.()??!0))}catch(e){return hp(e)}}async requestBack(){try{if(this.#e)throw om();return mp(await(this.#t.back?.()??!1))}catch(e){return hp(e)}}async activateStatus(e){try{if(this.#e)throw om();let t=Ff(e);return yc(this.#t.statusItems,t)?mp(await(this.#t.statusAction?.(t)??!1)):mp(!1)}catch(e){return hp(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?hp(om()):this.#n(e,`context`,kf,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw om();let n=Kf(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(mp(void 0));for(let e of n.capabilities)t.push({...e,handle:hn(Jp)(e.handle).dup()});if(!this.#t.capabilities)throw om();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(mp(void 0))}catch(e){for(let e of t)Rp(e.handle);return Promise.resolve(hp(e))}}updateLifecycle(e){try{if(this.#e)throw om();let t=Wf(Nf)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(mp(void 0));if(!dm(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(mp(void 0))}catch(e){return Promise.resolve(hp(e))}}async updateReservedChords(e){return this.#e?hp(om()):this.#n(e,`chords`,Uf,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?hp(om()):this.#n(e,`theme`,Vf,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=Wf(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(mp(void 0))}catch(e){return Promise.resolve(hp(e))}}};async function Xp(e){let t=em(),n=new Yp(t),r=_c(e.port,n),i,a=$p(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=_p(rp(o));if(!e.isActive())throw Qp();let c=tm({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 pm(t,e,n,r,i)}}function Zp(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 Qp(){return new Y(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function $p(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{Ko(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new Y(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function em(){return{statusItems:[],bindings:bp(),chords:xp([]),context:Fp({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:Fp(`connecting`),theme:Fp(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function tm(e){let t=Mf(e.bootstrap.identity),n=fm(e.bootstrap);Zp(e.state,n);let r=Ip(e.bootstrap.capabilities);return e.state.capabilities=r,rm(e,t,r)}function nm(e,t,n){return Sp({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 rm(e,t,n){let r=!1,i=t=>{r||(r=!0,cm([()=>{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.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{Rp(e.bootstrapOwner)},()=>{Rp(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=Up(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=am(e.remote,a,e.state),c=im(e.state,e.remote,a),l=nm(e,t,i),u=kp({window:e.options.window,mac:Pp(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{Ko(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{sm(i)}),lm({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 im(e,t,n){let r=Object.freeze({async publish(r){n();let i=Lf(r);e.canGoBack=i.canGoBack,await gp(t.reportNavigation(i),ap)},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 am(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await gp(e.requestComputerChoice(),ap)},async requestBrowserAction(n){t();let r=lp(n);return r.kind===`refused`?r:await gp(e.requestBrowserAction(r),up)},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 gp(e.requestAppPermissions(Bf(n)),op)},async openDesktopSettings(){t(),await gp(e.openDesktopSettings(),ap)},async openTeamBilling(){t(),await gp(e.openTeamBilling(),ap)},async openNavigation(n){t(),await gp(e.openNavigation(If(n)),ap)},async reportStatus(r){t();let i=Pf(r);n.statusItems=i,await gp(e.reportStatus(i),ap)},async reportAgentSessionSelection(n){t(),await gp(e.reportAgentSessionSelection(zf(n)),ap)},async showToast(n){t(),await gp(e.showToast(Hf(n)),ap)}})}function om(){return new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function sm(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function cm(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function lm(e){return Object.freeze(e)}function um(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function dm(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function fm(e){let t=Wf(kf)(e.context),n=Wf(Vf)(e.theme),r=Wf(Nf)(e.lifecycle),i=Wf(Uf)(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 pm(e,t,n,r,i){throw cm([()=>{n[Symbol.dispose]()},()=>{i&&Rp(i)},()=>{Rp(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 mm=!1,hm=class{options;#e;#t;#n;#r=!1;#i;#a;constructor(e){this.options=e,this.#t=bm(e.expectedHostOrigin),this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#t;if(!e)return Promise.reject(Sm());let t=this.#u();return t?Promise.reject(t):(mm=!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(_m())},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){Ko(`connect.notify-host`,e),r(wm(e))}};this.#i=setInterval(o,200),this.#a=setTimeout(()=>{r(ym())},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(),mm=!1,a(e??ym());return}i(t)}}#c(e,t,n,r){if(!Cm(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||e.origin!==t){n(xm());return}let i=Tm(e,n);if(!i)return;let a=e.ports.length===1?e.ports[0]:void 0;if(!a){n(Em(`The app host did not transfer exactly one port`));return}this.#n=a,this.#l(),this.#e.removeEventListener(`message`,r),Xp({epoch:i.epoch,isActive:()=>!this.#r,onDisposed:()=>{mm=!1},port:a,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),n(void 0,e)},e=>{n(vm(e))})}#l(){clearInterval(this.#i),clearTimeout(this.#a),this.#i=void 0,this.#a=void 0}#u(){if(this.options.signal?.aborted)return _m();if(mm)return new Y(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Fe(globalThis.window)||this.#e.parent===this.#e)return new Y(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function gm(e){return new hm(e).start()}function _m(){return new Y(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function vm(e){return e instanceof Y?e:new Y(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function ym(){return new Y(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function bm(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function xm(){return new Y(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}function Sm(){return new Y(`expectedHostOrigin must be an origin`,{code:`INVALID_ARGUMENT`,retryable:!1})}var Cm=tn(W({type:G(Bd)}));function wm(e){return new Y(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function Tm(e,t){try{return Of(e.data)}catch(e){Ko(`connect.decode-message`,e),t(e instanceof Y?e:new Y(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function Em(e){return new Y(e,{code:`PROTOCOL`,retryable:!1})}function Dm(e,t,n){e.style.isolation=`isolate`;let r=(0,Go.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=ia(a),s,c,l,u=!1,d=e=>{let i=(0,J.createElement)(Om,{state:e,render:n});r.render(t.queryClient?(0,J.createElement)(la,{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`):ra(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`}),gm({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,ra(e.theme.get(),a),c=e.theme.subscribe(e=>{ra(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 Om({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 km(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 Am(e){return km(e?.context)??null}function jm(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 Mm(e,{canGoBack:t,title:n,onBack:r}){let i=(0,J.useRef)(r);(0,J.useEffect)(()=>{i.current=r},[r]),(0,J.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>i.current());return()=>{t(),Nm(e,{canGoBack:!1})}},[e]),(0,J.useEffect)(()=>{e&&Nm(e,n===void 0?{canGoBack:t}:{canGoBack:t,title:n})},[e,t,n])}function Nm(e,t){e.publish(t).catch(e=>{e instanceof Y&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var Pm=Ye({id:R().min(1).max(256),name:R().min(1).max(128)}),Fm=R().min(1).max(256),Im=Ye({agentId:Fm,sessionId:Fm,commandId:Fm,outcome:c([`completed`,`failed`,`interrupted`,`cancelled`,`outcome_unknown`]),diagnostic:R().min(1).max(200).optional()}),Lm=Ye({author:Pm.optional(),delegation:Ye({ancestors:w(Fm).max(8),maxDepth:qe().int().min(1).max(8),reply:Im.optional()}).optional()});function Rm(e){let t=Lm.safeParse(e);return t.success?t.data.author:void 0}var zm=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 Bm(e,t,n){return new zm(e,t,n)}function Vm(e){let t=$e(e),n=v(Object),r=$e(Object.fromEntries(Object.keys(e).map(e=>[e,Te().optional()])));return Te().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,ce().parse(t).bind(i)]));return{...t.parse(s),[Symbol.dispose](){Rp(e)}}})}function Hm(e){return Te().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{Rp(t)}})}function Um(e){return ce({output:Le(Te().transform(t=>{try{return e.parse(t)}catch(e){throw Rp(t),e instanceof Y?e:new Y(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var Wm=Um(Hm(_())),Gm=Vm({fetch:Um(v(Response)),close:Wm}),Km=q.pipe(V(At(1)),V(z(256))),qm=W({agentId:Km,name:Km,sessionOperations:K(Hn([`agent.read`,`agent.send`,`agent.manage`]))});Ye({agents:w(Ye({agentId:R(),name:R()}))});var Jm=Hn([`new`,`none`]),Ym=W({name:Km,requestId:Km,computer:H(Jm)}),Xm=K(qm),Zm=hn(Xm,{onExcessProperty:`error`}),Qm=hn(Km),$m=hn(Sn(Response)),eh=Bm(`agent.list`,1,Vm({list:Um(Hm(Te().transform(e=>Zm(e))))})),th=Bm(`agent.manage`,1,Vm({open:Um(Gm),create:Um(Hm(Te().transform(e=>hn(qm)(e))))})),nh=W({agentId:Km,name:Km}),rh=Bm(`agent.rename`,1,Vm({rename:Um(Hm(Te().transform(e=>hn(qm)(e))))}));async function ih(e,t){let n=hn(nh)(t),r=await e.require(rh).rename(n);return hn(qm)(r)}var ah=at([$e({status:n(`pending`),revision:R()}),$e({status:n(`approved`),revision:R()})]),oh=at([ah,$e({error:R()})]),sh=Bm(`agent.toolPolicy`,1,Vm({status:Um(Hm(at([ah,L()]))),approve:Um(Hm(oh))})),ch=Bm(`agent.read`,1,Vm({open:Um(Gm),openInbox:Um(Gm)})),lh=Bm(`agent.send`,1,Vm({open:Um(Gm),openInbox:Um(Gm)}));async function uh(e,t){let n=hn(Ym)(t),r=await e.require(th).create(n);return hn(qm)(r)}async function dh(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(),$m(await o.fetch(i))},close:()=>(i||(i=Promise.all([o(n),...r?[r.then(o)]:[]]).then(()=>void 0),i.catch(e=>{Ko(`agents.close`,e)})),i)}}var fh=`https://agent-session.fungi.invalid`;async function ph(e,t){let n=Qm(t.agentId),r=`/agents/id-${encodeURIComponent(n)}`,i=`${fh}${r}`,a=e.has(ch)?e.require(ch):e.has(lh)?e.require(lh):e.require(th),o=()=>a.open({agentId:n}),s=await dh(o,e.has(ch)?()=>(e.has(lh)?e.require(lh):e.require(th)).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!==fh||!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 mh=`${fh}/member`;async function hh(e){let t=e.has(ch)?ch:lh,n=()=>e.require(t).openInbox(),r=await dh(n,e.has(ch)?()=>e.require(lh).openInbox():n);return Object.freeze({baseUrl:mh,fetch:async(e,t)=>{let n=new Request(e,t),i=new URL(n.url);if(i.origin!==fh||!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 gh=`~effect/Sink`,_h={_A:pt,_In:pt,_L:pt,_E:pt,_R:pt},vh={[gh]:_h,pipe(){return m(this,arguments)}},yh=e=>{let t=Object.create(vh);return t.transform=e,t},bh=((e,t,n)=>yh(r=>{let i=e(),a;return t(i)?r.pipe(mt(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)),an();return gt}),oe({disableYield:!0}),hr(()=>Ce([i,a]))):Ce([i])}))(Oe,C,(e,t)=>Je(t)),xh=()=>bh,Sh=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(Th(this),t)}[Symbol.for(`Deno.customInspect`)](e,t){return e(Th(this),t)}};function Ch(e){let t=globalThis.DOMException;return typeof t==`function`?new t(e,`SyntaxError`):SyntaxError(e)}function wh(e){return e instanceof Error?`errors`in e&&Array.isArray(e.errors)?e.errors.map(wh).join(`, `):`cause`in e&&e.cause instanceof Error?`${e}: ${wh(e.cause)}`:e.message:`${e}`}function Th(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var Eh=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}},Dh=10,Oh=13,kh=32,Ah=6;function jh(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<Ah&&!b(s.join(``)+e.slice(0,Ah-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)===Dh?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)===Oh?(h=!1,g=!0,``):(h=!1,e.slice(r+(e.charCodeAt(r)===Oh&&e.charCodeAt(r+1)===Dh?2:1)))}function y(e){if(e){if(e.charCodeAt(e.length-1)===Oh){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&&Ph(e,`data`)||t===101&&Ph(e,`event`)||t===105&&Ph(e,`id`)||t===114&&Ph(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 Eh(`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(Mh(e,t,r)){let r=e.charCodeAt(t+5)===kh?t+6:t+5,o=e.slice(r,n);if(f===0&&e.charCodeAt(n+1)===Dh){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 Nh(e,t,r)?p=e.slice(e.charCodeAt(t+6)===kh?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)===Oh&&e.charCodeAt(t)===Dh&&t++}return e.slice(t)}function C(e,t,r){if(t===r){T();return}let i=e.charCodeAt(t);if(Mh(e,t,i)){let n=e.charCodeAt(t+5)===kh?t+6:t+5,i=e.slice(n,r);d=f===0?i:`${d}\n${i}`,f++;return}if(Nh(e,t,i)){p=e.slice(e.charCodeAt(t+6)===kh?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)===kh?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)===kh?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)===kh?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 Eh(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:n}));break;default:r?.(new Eh(`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 Mh(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 Nh(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 Ph(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 Fh=104857600,Ih=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,Rh());else throw Error(`Invalid URL`)}catch{throw Ch(`An invalid or illegal string was specified`)}this.#l=jh({maxBufferSize:t?.maxBufferSize??Fh,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(wh(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&&zh(r,`origin`,t),r.lastEventId!==n&&zh(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 Sh(`error`,{code:t,message:e});this.dispatchEvent(n)}#S(e,t){if(this.#e===this.CLOSED)return;this.#e=this.CONNECTING;let n=new Sh(`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(Ih,"name",{value:`EventSource`}),Object.defineProperty(Ih,Symbol.for(`eventsource.supports-fetch-override`),{value:!0,writable:!1,configurable:!1,enumerable:!1});var Lh=Ih;function Rh(){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 zh(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0})}var Bh=q.check(At(1),z(256)),Vh=rn.check(Vn(),Nn(0)),Hh=U([W({agentId:Bh,sessionId:Bh,title:q.check(z(4096)),triggerId:H(Bh),createdAt:Vh,lastActivityAt:Vh,settledAt:H(Vh),visitedAt:H(Vh),state:Hn([`needs_you`,`running`,`errored`,`done`])}),W({agentId:Bh,sessionId:Bh,state:G(`unavailable`)})]),Uh=W({runId:Bh,nodeId:Bh,iteration:Bh}),Wh=W({kind:G(`workflow-review`),key:Uh,installationId:Bh,workflowId:br(Bh),workflowTitle:q,reviewTitle:q,reviewers:Hn([`runner`,`owners`]),show:K(Rn),choices:H(K(Bh)),openedAt:Vh,expiresAt:Vh,state:Hn([`pending`,`answered`,`delivered`,`timed_out`,`closed`])}),Gh=U([Hh,Wh]),Kh=U([Gh,W({agentId:Bh,sessionId:Bh,deleted:G(!0)})]);function qh(e,t){return`${e}\u0000${t}`}function Jh(e){return`kind`in e?JSON.stringify([e.kind,e.installationId,e.key.runId,e.key.nodeId,e.key.iteration]):qh(e.agentId,e.sessionId)}var Yh=q.pipe(V(At(1),z(256))),Xh=W({kind:G(`seller-closed`),dispositionId:q.pipe(V(At(1),z(1024))),sellerAccountId:Yh,buyerAccountId:Yh,appId:Yh,releaseIds:Yt([Yh]),displayName:Yh,sellerName:Yh,requestId:Yh}),Zh=q.pipe(V(At(1)),V(z(4096))),Qh=q.pipe(V(At(1)),V(z(513))),$h=W({params:K(W({key:q.check(At(1),z(64)),value:q.check(z(4096))})).check(z(16))}),eg=W({id:Qh,title:Zh,detail:B(q.pipe(V(z(1024)))),tone:B(Hn([`attention`,`running`,`error`,`settled`,`muted`])),status:B(W({label:Zh,tone:Hn([`neutral`,`primary`,`secondary`,`accent`,`success`,`info`,`warning`,`error`])})),open:B($h)}),tg=K(eg).pipe(V(z(200))),ng=e=>new Set(e).size===e.length,rg=q.pipe(V(z(256)),V(Xt(e=>e.trim().length>0,{message:`Declared command text must not be blank`}))),ig=rg.pipe(V(z(64))),ag=W({key:ig,label:rg,kind:Hn([`computer`,`repository`,`branch`]),required:Mn,options:B(rg)}).check(Xt(e=>e.kind!==`computer`||e.options===void 0,{message:`Computer options are host-owned`})),og=K(ag).check(z(4),Xt(e=>ng(e.map(e=>e.key)),{message:`Gill parameter keys must be unique`})),sg=U([W({storage:rg}),W({binding:rg})]),cg=W({id:rg.pipe(V(Xt(e=>!e.includes(`:`),{message:`Gill IDs are App-local`}))),title:rg,source:rg,params:B(og),watch:B(sg),desktop:B(W({sizes:K(Hn([`S`,`M`,`L`])).check(At(1),z(3),Xt(ng,{message:`Desktop Gill sizes must be unique`}))}))}),lg=Ot(ig,q.check(z(256))).check(Xt(e=>Object.keys(e).length<=4,{message:`Gill placement supports at most four parameters`}));W({viewId:Qh,params:B(lg),after:B(q.check(z(1024))),options:B(ig)}),W({id:Qh,params:B(lg),after:B(q.check(z(1024))),options:B(ig)});var ug=U([W({viewId:Qh,title:Zh,state:G(`empty`),rows:Yt([]),next:B(q.pipe(V(z(1024))))}),W({viewId:Qh,title:Zh,state:G(`error`),rows:Yt([]),reason:B(Hn([`exec_isolation_required`,`params_required`])),error:q.pipe(V(At(1)),V(z(512))),recovery:B(U([W({kind:G(`configure`),param:ig}),W({kind:G(`open`)})]))}),W({viewId:Qh,title:Zh,state:G(`full`),rows:tg.pipe(V(At(1))),next:B(q.pipe(V(z(1024))))})]);hn(ug,{onExcessProperty:`error`});var dg=W({options:K(W({value:q.check(z(256)),label:Zh,detail:B(q.check(z(1024)))})).check(z(200)),next:B(q.check(z(1024)))}),fg=U([ug,dg]);hn(fg,{onExcessProperty:`error`}),hn(dg,{onExcessProperty:`error`});var pg={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`}}}},mg=[`dashboard`,`inbox`,`files`,`media`,`sessions`,`terminal`],hg=`agent.list,agent.manage,agent.rename,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(`,`),gg=[`file.open`],_g=[`team`,`member`],vg=Object.freeze({capabilities:[],handlers:[],roles:[]});function yg(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 bg=s(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);ze.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>k(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ee(e,t,n),e.parseAsync=async(t,n)=>j(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>h(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)=>E(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),xg=s(`ZodMiniString`,(e,t)=>{a.init(e,t),bg.init(e,t)});function Sg(e){return xe(xg,e)}var Cg=s(`ZodMiniNever`,(e,t)=>{p.init(e,t),bg.init(e,t)});function wg(e){return ge(Cg,e)}var Tg=s(`ZodMiniObject`,(e,t)=>{N.init(e,t),bg.init(e,t),re(e,`shape`,()=>t.shape)});function Eg(e,t){return new Tg({type:`object`,shape:e??{},...vt(t)})}function Dg(e,t){return new Tg({type:`object`,shape:e,catchall:wg(),...vt(t)})}var Og=s(`ZodMiniDiscriminatedUnion`,(e,t)=>{l.init(e,t),bg.init(e,t)});function kg(e,t,n){return new Og({type:`union`,options:t,discriminator:e,...vt(n)})}var Ag=s(`ZodMiniEnum`,(e,t)=>{dt.init(e,t),bg.init(e,t),e.options=Object.values(t.entries)});function jg(e,t){return new Ag({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...vt(t)})}var Mg=s(`ZodMiniLiteral`,(e,t)=>{se.init(e,t),bg.init(e,t)});function Ng(e,t){return new Mg({type:`literal`,values:Array.isArray(e)?e:[e],...vt(t)})}var Pg=s(`ZodMiniOptional`,(e,t)=>{Ve.init(e,t),bg.init(e,t)});function Fg(e){return new Pg({type:`optional`,innerType:e})}var Ig=s(`ZodMiniNullable`,(e,t)=>{u.init(e,t),bg.init(e,t)});function Lg(e){return new Ig({type:`nullable`,innerType:e})}var Rg=s(`ZodMiniCustom`,(e,t)=>{ae.init(e,t),bg.init(e,t)});function zg(e,t={}){return ct(Rg,e,t)}var Bg=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`]}),Vg=Sg().check(je(1),Pe(256)),Hg=Eg({kind:Ng(`member`),memberId:Vg}),Ug=Eg({kind:Ng(`agent`),agentId:Vg}),Wg=Eg({kind:Ng(`team-key`),keyId:Vg}),Gg=kg(`kind`,[Hg,Ug,Wg]),Kg=Eg({workflowId:Vg,runId:Vg,nodeId:Vg,armedBy:Gg}),qg=Dg({method:Sg().check(zg(e=>Yg(e))),seal:Sg().check(ht(/^[A-Za-z0-9_-]{43}$/u))}),Jg=Eg({computerId:Lg(Vg),actor:Gg,backgroundLane:Fg(Sg().check(je(8),Pe(263))),backgroundOrigin:Fg(qg),role:Fg(jg([`owner`,`member`])),soleMember:Fg(Ng(!0)),workflow:Fg(Kg),idempotencyKey:Fg(Sg().check(je(1),Pe(128)))});Hg.shape,Ug.shape,Wg.shape,{...Jg.shape},{...Kg.shape};var Yg=e=>e.length<=80&&/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(e)&&!Object.values(Bg).flat().some(t=>t===e),Xg=q.check(Xt(Yg));function Zg(e,t=0){return t>16?!1:tn(K(Rn))(e)?e.every(e=>Zg(e,t+1)):!tn(sr)(e)||Object.values(e).every(e=>Zg(e,t+1))}var Qg=sr.pipe(V(Xt(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=2e4&&Zg(e),{message:`App API schema exceeds its byte or depth bound`}))),$g=q.check(At(1),z(128)),e_=W({description:q.pipe(V(At(1)),V(z(1e3))),input:Qg,output:Qg,pending:B(G(!0)),hidden:B(G(!0)),anonymous:B(G(!0)),effect:Hn([`read`,`write`,`external`]),requires:K(Hn(hg)).pipe(V(Xt(e=>new Set(e).size===e.length)))}).check(Xt(e=>e.anonymous!==!0||e.effect===`read`&&e.requires.length===0,{message:`Anonymous methods must be reads with no required capabilities`})),t_=W({methods:Ot(q,e_).pipe(V(Xt(e=>Object.keys(e).every(tn(Xg)),{message:`Invalid App API method name`})),V(Xt(e=>Object.keys(e).length<=64)),V(Xt(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:H(W({name:Xg.check(Xt(e=>!e.includes(`.`))),list:Xg,call:Xg})),events:H(Ot(q,W({description:q.check(At(1),z(1e3)),payload:Qg})).check(Xt(e=>Object.keys(e).every(tn($g)),{message:`Invalid App API event name`}),Xt(e=>Object.keys(e).length<=64)))}).pipe(V(Xt(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`})),V(Xt(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=256e3,{message:`App API exceeds its total byte bound`}))),n_=e=>new Set(e).size===e.length;function r_(e,t){let n=Object.keys(t);for(let e of n)hn(Xg)(e);return{declaration:W({name:G(e),operations:K(Hn(n)).pipe(V(At(1)),V(z(n.length)),V(Xt(n_)))}),shard:W({name:G(e),operations:K(U(Object.entries(t).map(([e,t])=>W({name:G(e),cap:G(t.cap)})))).pipe(V(At(1)),V(z(n.length)),V(Xt(e=>n_(e.map(e=>e.name)),{message:`App backend operation repeated`})))})}}var i_=Object.values(pg).map(e=>r_(e.name,e.operations)),a_=i_.length,o_=K(U(i_.map(e=>e.declaration))).pipe(V(z(a_)),V(Xt(e=>n_(e.map(e=>e.name)))));K(U(i_.map(e=>e.shard))).pipe(V(z(a_)),V(Xt(e=>n_(e.map(e=>e.name)))));var s_=new Map(Object.entries(pg).map(([e,t])=>[e,new Map(Object.entries(t.operations))]));function c_(e,t){return s_.get(e)?.get(t)}var l_=Hn(mg),u_=Hn(hg),d_=Hn(gg),f_={message:`App declaration entries must be unique`},p_=e=>new Set(e).size===e.length,m_=new Set([`super+k`,`meta+k`,`cmd+k`,`mod+k`,`ctrl+k`,`control+k`]),h_=q.pipe(V(z(256)),V(Xt(e=>e.trim().length>0,{message:`Declared command text must not be blank`}))),g_={order:B(Pn)},__=W(g_),v_=W({id:h_.pipe(V(Xt(e=>!e.includes(`:`),{message:`Declared command IDs are namespace-local`}))),title:h_,category:h_,description:B(q.pipe(V(z(1024)))),sigil:B(h_.pipe(V(z(64)))),projections:B(W({bindings:B(W({...g_,values:K(h_).pipe(V(z(16)),V(Xt(e=>!e.some(e=>m_.has(e.trim().toLowerCase())),{message:`Apps cannot bind the reserved leader chord`})))})),agent:B(W({...g_,keybind:B(q)})),help:B(__),menu:B(__),palette:B(__),slash:B(W({...g_,aliases:K(h_).pipe(V(z(16)))}))}))}),y_=e=>p_(e.map(e=>e.id))&&p_(e.flatMap(e=>e.projections?.slash?.aliases??[])),b_=e=>p_(e.map(e=>e.id)),x_=q.check(qn(/^[a-z][a-z0-9.-]{0,63}$/)),S_=W({key:x_,scopes:K(Hn(_g)).check(At(1),Xt(p_,f_)),maxBytes:Pn.check(St({minimum:1,maximum:65536}))}),C_=Gt()([S_],([e])=>(t,n,r)=>pn(e)(t,{...r,onExcessProperty:`error`}),{toCodecJson:()=>new Pt(S_.ast,ir())}),w_=W({appId:q.check(At(1),z(128)),methods:K(Xg).check(At(1),z(16),Xt(p_,f_))}),T_=Gt()([w_],([e])=>(t,n,r)=>pn(e)(t,{...r,onExcessProperty:`error`}),{toCodecJson:()=>new Pt(w_.ast,ir())}),E_=K(T_).check(At(1),z(16),Xt(e=>p_(e.map(e=>e.appId)),f_)),D_=W({api:H(t_),displayName:B(q.pipe(V(At(1)),V(z(64)))),capabilities:K(u_).pipe(V(Xt(p_,f_))),calls:H(E_),guidance:B(q.pipe(V(At(1)),V(z(12e3)))),handlers:K(d_).pipe(V(Xt(p_,f_))),receives:H(K(G(`git.push`)).check(z(1),Xt(p_,f_))),icon:H(q.pipe(V(At(1)),V(z(80)))),roles:K(l_).pipe(V(Xt(p_,f_))),storage:H(K(C_).check(z(16),Xt(e=>p_(e.map(e=>e.key)),f_))),commands:B(K(v_).pipe(V(z(64)),V(Xt(y_,{message:`Declared command IDs and slash aliases must be unique`})))),gills:B(K(cg).pipe(V(z(16)),V(Xt(b_,{message:`Declared Gill IDs must be unique`})))),backend:B(W({bindings:o_,sync:H(W({method:Xg}))}))}).pipe(V(Xt(e=>e.calls===void 0||e.capabilities.includes(`apps.call`),{message:`App calls require apps.call`})),V(Xt(e=>e.backend?.bindings.every(e=>e.name!==`BACKGROUND`)??!0,{message:`BACKGROUND is host-minted and cannot be declared by an App`})),V(Xt(e=>yg(e.api,e.backend?.sync),{message:`Background continuation must be a declared write covering all write requirements`})),V(Xt(e=>!(e.receives?.includes(`git.push`)??!1)||e.capabilities.includes(`git.repository`),{message:`Git push reception requires git.repository`})),V(Xt(e=>e.backend?.bindings.every(t=>t.operations.every(n=>c_(t.name,n)?.requires.every(t=>e.capabilities.includes(t))===!0))??!0,{message:`Backend bindings require declared App capabilities`})),V(Xt(e=>!e.backend?.bindings.some(e=>e.name===`APP_STORAGE`)||(e.storage?.length??0)>0,{message:`App storage bindings require declared keys`})),V(Xt(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 O_(e){return/^app_[a-z0-9]{1,63}$/u.test(e)}function k_(e){return/^rel_[a-z0-9]{1,63}$/u.test(e)}function A_(e){return/^ps_[a-z0-9]{1,63}$/u.test(e)}function j_(e){return/^artifact:[a-z0-9](?:[a-z0-9._-]{0,126}[a-z0-9])?$/u.test(e)}function M_(e){return/^idem_[a-z0-9](?:[a-z0-9_-]{0,126}[a-z0-9])?$/u.test(e)}function N_(e){return/^git:[0-9a-f]{40}$/u.test(e)}function P_(e){return/^sha256:[0-9a-f]{64}$/u.test(e)}function F_(e){return/^\/[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(e)}var I_=Tt({family:`app-release`,version:1,kinds:{transition:{prefix:`app_transition`},surface:{prefix:`ps`},erasure:{prefix:`app_erasure`}}}),L_=I_.transition;I_.surface,I_.erasure;var R_=q.pipe(Wt(O_)),z_=q.pipe(Wt(k_)),B_=q.pipe(Wt(A_)),V_=q.pipe(Wt(j_)),H_=q.pipe(Wt(M_)),U_=q.pipe(Wt(N_)),W_=q.pipe(Wt(P_)),G_=q.pipe(Wt(F_)),K_=W({byteLength:rn,copy:Sn(Function)}).pipe(Wt(e=>e.byteLength>=0)),q_=W({appId:R_}),J_=W({sourceRevision:U_,sourceTreeDigest:W_,buildRecipeDigest:W_}),Y_=W({artifactRef:V_,artifactDigest:W_,provenance:J_}),X_=W({releaseId:z_,appId:R_,artifact:Y_}),Z_=W({publicSurfaceId:B_,appId:R_,stableRoute:G_}),Q_=q.pipe(V(At(1)),V(z(256))),$_=W({...Z_.fields,publisher:W({kind:Hn([`customer`,`platform`]),teamId:Q_,userId:Q_,requestKey:Q_})}),ev=Hn([`text/html; charset=utf-8`,`application/vnd.fungi.app-backend+json`,`application/vnd.fungi.app-assets+json`,`application/vnd.fungi.app+json`]),tv=W({artifactRef:V_,digest:W_,mediaType:Hn([`text/html; charset=utf-8`,`application/vnd.fungi.app-backend+json`,`application/vnd.fungi.app-assets+json`]),version:q.pipe(V(At(1))),byteLength:rn.pipe(V(Vn()),V(An(0)),V(Xt(Number.isSafeInteger)))}),nv=W({runtime:W({kind:G(`durable-facet`),stateSchema:rn.pipe(V(Vn()),V(An(0)))}),compatibilityDate:q.pipe(V(qn(/^\d{4}-\d{2}-\d{2}$/))),exportName:q.pipe(V(At(1)))}),rv=W({format:G(`fungi-app-v1`),ui:br(tv),backend:br(W({artifact:tv,profile:nv})),declaration:D_.pipe(on(Ce(vg)))}),iv=W({kind:G(`verified`),digest:W_,mediaType:ev,bytes:K_,byteLength:rn}),av=U([iv,W({kind:G(`unavailable`)}),W({kind:G(`missing`)}),W({kind:G(`digest-mismatch`),actualDigest:W_})]),ov=U([W({kind:G(`found`),app:q_}),W({kind:G(`absent`)})]),sv=U([W({kind:G(`created`),app:q_}),W({kind:G(`existing`),app:q_})]),cv=U([W({kind:G(`found`),release:X_}),W({kind:G(`absent`)})]),lv=U([W({kind:G(`created`),release:X_}),W({kind:G(`existing`),release:X_})]),uv=U([W({kind:G(`found`),surface:Z_}),W({kind:G(`absent`)})]),dv=U([W({kind:G(`created`),surface:Z_}),W({kind:G(`existing`),surface:Z_}),W({kind:G(`conflict`)})]),fv=U([W({kind:G(`verified`),digest:W_,mediaType:G(`application/vnd.fungi.app+json`),description:rv}),W({kind:G(`unverified`)})]),pv=U([W({kind:G(`active`)}),W({kind:G(`revoked`)})]),mv=U([W({kind:G(`promotion`),publicSurfaceId:B_,releaseId:z_,idempotencyKey:H_}),W({kind:G(`rollback`),publicSurfaceId:B_,releaseId:z_,idempotencyKey:H_}),W({kind:G(`revocation`),releaseId:z_,idempotencyKey:H_})]),hv=zt(e=>L_.schema.safeParse(e).success),gv=W({transition:mv,transitionId:hv}),_v=U([W({kind:G(`none`)}),W({kind:G(`selected`),releaseId:z_})]),vv=U([W({kind:G(`found`),release:X_,verification:fv,revocation:pv}),W({kind:G(`absent`)})]);U([W({kind:G(`found`),surface:Z_,selection:_v}),W({kind:G(`absent`)})]);var yv=U([W({kind:G(`absent`)}),W({kind:G(`found`),receipt:gv}),W({kind:G(`conflict`)})]),bv=U([W({kind:G(`created`),receipt:gv}),W({kind:G(`existing`),receipt:gv}),W({kind:G(`conflict`)}),W({kind:G(`identity-collision`)}),W({kind:G(`lifecycle-conflict`)})]),xv=W({kind:G(`recorded`)}),Sv=W({kind:G(`unavailable`)});function Cv(e){return U([W({kind:G(`success`),value:e}),W({kind:G(`failure`),failure:Sv})])}var wv=Cv(ov),Tv=Cv(sv),Ev=Cv(cv),Dv=Cv(lv),Ov=Cv(uv),kv=Cv(dv),Av=Cv(vv),jv=Cv(xv),Mv=Cv(yv),Nv=Cv(bv);cn(R_,{onExcessProperty:`error`}),cn(z_,{onExcessProperty:`error`}),cn(B_,{onExcessProperty:`error`}),cn(V_,{onExcessProperty:`error`}),cn(H_,{onExcessProperty:`error`}),cn(U_,{onExcessProperty:`error`}),cn(W_,{onExcessProperty:`error`}),cn(G_,{onExcessProperty:`error`}),cn(hv,{onExcessProperty:`error`}),Et(av,{onExcessProperty:`error`}),cn(q_,{onExcessProperty:`error`}),cn(X_,{onExcessProperty:`error`}),cn(Z_,{onExcessProperty:`error`}),cn($_,{onExcessProperty:`error`}),cn(wv,{onExcessProperty:`error`}),cn(Tv,{onExcessProperty:`error`}),cn(Ev,{onExcessProperty:`error`}),cn(Dv,{onExcessProperty:`error`}),cn(Ov,{onExcessProperty:`error`}),cn(kv,{onExcessProperty:`error`}),cn(mv,{onExcessProperty:`error`}),cn(Av,{onExcessProperty:`error`}),cn(jv,{onExcessProperty:`error`}),cn(Mv,{onExcessProperty:`error`}),cn(Nv,{onExcessProperty:`error`});var Pv=q.pipe(V(At(1)),V(z(256))),Fv=q.pipe(V(qn(/\S/u)),V(z(1e3)));W({dispositionId:Pv,requestId:Pv,operatorId:Pv,reason:Fv,action:U([W({kind:G(`retain-detached`)}),W({kind:G(`revoke-with-notice`)})])});var Iv=W({dispositionId:Pv,appId:R_,displayName:q.pipe(V(At(1)),V(z(64))),releaseIds:K(z_).pipe(V(At(1)),V(z(1e4))),reason:Fv}),Lv=W({disposition_id:Pv,app_id:R_,release_ids_json:q,artifact_roots_json:q,created_at:rn,state:Hn([`pending`,`retaining`,`retained`,`revoking`,`revoked`]),request_id:br(Pv),reason:br(Fv),completed_at:br(rn)});W({...Lv.fields,releaseIds:K(z_).pipe(V(z(1e4)))}),vn(K(z_).pipe(V(z(1e4)))),vn(K(V_).pipe(V(z(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 Rv=rn.pipe(V(Vn()),V(Nn(0))),zv=W({items:K(Gh),next:br(q),cursor:Rv});Ye({visited:n(!0)});var Bv=hn(zv),Vv=hn(vn(W({kind:G(`rows`),from:Rv,to:Rv,items:K(Kh),more:Mn})));function Hv(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=Jh(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,Ko(`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=Vv(e.data)}catch(e){Ko(`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=Bv(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;Ko(`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 Uv=hn(W({items:K(U([W({...Iv.fields,reason:B(Iv.fields.reason),createdAt:Rv}),W({...Xh.fields,createdAt:Rv})])).pipe(V(z(100))),next:br(q.pipe(V(z(1024))))}),{onExcessProperty:`error`});async function Wv(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 Uv(await r.json())}function Gv(e,t){return t.status===`live`?t:{...t,data:t.data??e.data}}function Kv(e,t,n={}){return Lo({queryKey:e,...n,retry:!1,staleTime:1/0,refetchOnMount:`always`,queryFn:Co({initialValue:{status:`loading`},refetchMode:`append`,reducer:Gv,streamFn:({signal:e})=>xn(It(n=>i(function*(){let r={status:`loading`},i=()=>{dr(n)};if(yield*nt(st(()=>{e.addEventListener(`abort`,i,{once:!0})}),()=>st(()=>{e.removeEventListener(`abort`,i)})),e.aborted){i();return}yield*nt(Ie({try:()=>Promise.resolve(t(e=>{r=Gv(r,e),Dn(n,r)},e)),catch:Jv}),e=>st(e))}).pipe(we(e=>Gn(n,e))),{bufferSize:1,strategy:`sliding`}))})})}async function qv(e,t,n){if(!e)throw new Y(`No App connection`,{code:`DISCONNECTED`,retryable:!0});let r=await hh(e.capabilities),i=()=>{r.close().catch(e=>{Ko(`inbox.query-close`,e)})};if(n.aborted)return i(),()=>void 0;let a=Hv({baseUrl:r.baseUrl,fetch:r.fetch,openEvents:e=>{let t=new Lh(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:R().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 Jv(e){return e instanceof Y?e:new Y(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var Yv=new WeakMap,Xv={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function Zv(e){let t={};return e&&Yv.set(t,e),t}function Qv(){let e=new So({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&&Yv.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 $v(e,t,n,r){let i=e?.context.get().computerId;return Ro({queryKey:n,meta:Zv(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 Jv(e)}}})}function ey(e){km(e?.context);let t=ca(),n=e?.context.get().computerId,r=(0,J.useMemo)(()=>Xv.of(e,`member-inbox`),[e,n]),i=Kv(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 qv(e,t,r)},[e,n]),{enabled:e!==null,meta:Zv(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 hh(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 ty=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5}),ny=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 ry(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=ry(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function iy(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ry(e))&&(r&&(r+=` `),r+=t);return r}var ay=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,oy=iy,sy=(e,t)=>n=>{if(t?.variants==null)return oy(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=ay(t)||ay(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 oy(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)},cy=Object.defineProperty,ly=((e,t)=>{let n={};for(var r in e)cy(n,r,{get:e[r],enumerable:!0});return t||cy(n,Symbol.toStringTag,{value:`Module`}),n})({isAny:()=>Cy,isAnyNonArbitrary:()=>Oy,isArbitraryFamilyName:()=>Gy,isArbitraryImage:()=>qy,isArbitraryLength:()=>Hy,isArbitraryNumber:()=>Uy,isArbitraryPosition:()=>Ky,isArbitraryShadow:()=>Jy,isArbitrarySize:()=>By,isArbitraryValue:()=>Vy,isArbitraryVariable:()=>Yy,isArbitraryVariableFamilyName:()=>Zy,isArbitraryVariableImage:()=>eb,isArbitraryVariableLength:()=>Xy,isArbitraryVariablePosition:()=>Qy,isArbitraryVariableShadow:()=>tb,isArbitraryVariableSize:()=>$y,isArbitraryVariableWeight:()=>nb,isArbitraryWeight:()=>Wy,isFraction:()=>vy,isInteger:()=>by,isNamedContainerQuery:()=>ky,isNumber:()=>yy,isPercent:()=>xy,isTshirtSize:()=>Sy}),uy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fy=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,py=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,my=/\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$/,hy=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gy=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_y=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vy=e=>fy.test(e),yy=e=>!!e&&!Number.isNaN(Number(e)),by=e=>!!e&&Number.isInteger(Number(e)),xy=e=>e.endsWith(`%`)&&yy(e.slice(0,-1)),Sy=e=>py.test(e),Cy=()=>!0,wy=e=>my.test(e)&&!hy.test(e),Ty=()=>!1,Ey=e=>gy.test(e),Dy=e=>_y.test(e),Oy=e=>!Vy(e)&&!Yy(e),ky=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)),Ay=(e,t,n)=>{let r=uy.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},jy=(e,t,n=!1)=>{let r=dy.exec(e);return r?r[1]?t(r[1]):n:!1},My=e=>e===`position`||e===`percentage`,Ny=e=>e===`image`||e===`url`,Py=e=>e===`length`||e===`size`||e===`bg-size`,Fy=e=>e===`length`,Iy=e=>e===`number`,Ly=e=>e===`family-name`,Ry=e=>e===`number`||e===`weight`,zy=e=>e===`shadow`,By=e=>Ay(e,Py,Ty),Vy=e=>uy.test(e),Hy=e=>Ay(e,Fy,wy),Uy=e=>Ay(e,Iy,yy),Wy=e=>Ay(e,Ry,Cy),Gy=e=>Ay(e,Ly,Ty),Ky=e=>Ay(e,My,Ty),qy=e=>Ay(e,Ny,Dy),Jy=e=>Ay(e,zy,Ey),Yy=e=>dy.test(e),Xy=e=>jy(e,Fy),Zy=e=>jy(e,Ly),Qy=e=>jy(e,My),$y=e=>jy(e,Py),eb=e=>jy(e,Ny),tb=e=>jy(e,zy,!0),nb=e=>jy(e,Ry,!0),rb=(e,t)=>{let n=Object.keys(e);return n.length===1&&n[0]===t&&typeof e[t]==`string`},ib=e=>typeof e==`function`&&e.isThemeGetter===!0,ab=e=>({...e,theme:{...e.theme},classGroups:{...e.classGroups},conflictingClassGroups:{...e.conflictingClassGroups},conflictingClassGroupModifiers:{...e.conflictingClassGroupModifiers},orderSensitiveModifiers:[...e.orderSensitiveModifiers],postfixLookupClassGroups:[...e.postfixLookupClassGroups??[]]}),ob=(e,t)=>{let n=ab(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},sb={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},cb=25,lb=()=>({names:[],idByName:new Map,impls:{},fnName:new Map,classifierFns:new Map}),ub=(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},db=(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),ub(e,n,t)}let n=t.$v,r=ly[n];if(sb[n]===void 0||!r)throw Error(`cn: unknown validator "${n}"`);return ub(e,n,r)},fb=()=>({nextPart:new Map,validators:null,classGroupId:-1,lit:[]}),pb=(e,t)=>e.theme[t]??[],mb=(e,t,n)=>{let r=fb(),i=(e,t)=>{for(let n of t.split(`-`)){let t=e.nextPart.get(n);t||(t=fb(),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(ib(n)){for(let t of n(e.theme))a(t,r,o);return}(r.validators??=[]).push({validatorId:db(t,n),groupId:o});return}if(rb(n,`$t`)){for(let t of pb(e,n.$t))a(t,r,o);return}if(rb(n,`$v`)){(r.validators??=[]).push({validatorId:db(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},hb=e=>{let t=lb(),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=mb(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),ne=0,re=e=>(te[e]===-1&&(te[e]=ne++),te[e]);for(let e=0;e<M.length;e++)M[e]=re(M[e]);for(let e of N)e.gid=re(e.gid);for(let e=0;e<D.length;e++)D[e]>=0&&(D[e]=re(D[e]));for(let e=0;e<I;e++)te[e]===-1&&(te[e]=ne++);let ie=Array(I);for(let e=0;e<I;e++)ie[te[e]]=n[e];let ae=[],oe=[],se=[],L=[],ce=[];for(let t=0;t<I;t++){let n=ie[t],i=(e.conflictingClassGroups[n]??[]).map(e=>te[r.get(e)]),a=(e.conflictingClassGroupModifiers[n]??[]).map(e=>te[r.get(e)]);i.length&&(ae.push(t),oe.push(i.length),se.push(...i));for(let e of a)L.push(t),ce.push(e)}let le=(e.postfixLookupClassGroups??[]).map(e=>te[r.get(e)]),ue=[],de=new Int32Array(j.length);for(let e=0;e<j.length;e++){let n=t.names[j[e]],r=sb[n];if(r!==void 0)de[e]=r;else{let t=ue.indexOf(n);t===-1&&(t=ue.length,ue.push(n)),de[e]=cb+t}}let fe=new Map,pe=[],me=[],he=[];{let e=0;for(let t of d){let n=[];for(let r=0;r<t.length;r++)n.push(de[e++]);let r=n.join(`,`),i=fe.get(r);i===void 0&&(i=pe.length,fe.set(r,i),pe.push(n.length),me.push(...n)),he.push(i)}}let ge={};for(let e of ue)ge[e]=t.classifierFns.get(e);return{G:I,customNames:ue,impls:ge,edgeCounts:w,edgeLabelLen:T,labelText:E,edgeTargetActual:k,nodeGroup:D,nodeVlist:O,nodeCount:S,totalEdges:C,patCounts:pe,patOps:me,listPat:he,vlistGroup:M,litEntries:h,sets:F,attachments:N,uniqueTailCount:ee,adjGid:ae,adjCnt:oe,adjTgt:se,patGid:L,patTgt:ce,postfixLookup:le,orderSensitiveModifiers:e.orderSensitiveModifiers.join(` `),prefix:e.prefix}},gb=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},_b=e=>{let t=hb(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:gb(t.edgeCounts),labelStart:gb(t.edgeLabelLen),labelText:t.labelText,edgeTarget:Int32Array.from(t.edgeTargetActual),nodeGroup:t.nodeGroup,nodeVlist:t.nodeVlist,vlistPat:gb(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:gb(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}},vb=`line`in Error(),yb=-1,bb=-1,xb=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},Sb=(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},Cb=(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=(xb(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=(xb(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}},ne=n.cacheSize??8192,re=n.prefix??e.prefix??``,ie=re===``?``:re+`:`,ae=ie.length,oe=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),se=/\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$/,L=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ce=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,le=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ue=0,de=-1,fe=-1,pe=-1,me=-1,he=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,ge=e=>/\s/.test(String.fromCharCode(e)),_e=(e,t,n)=>{if(ue=0,de=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)ue=1;else if(r===40&&i===41)ue=2;else return;pe=t+1,me=n-1;let a=t+1;if(he(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!he(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(de=t+1,fe=a,pe=a+1)}},ve=(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},ye=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,be=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xe=e=>!!e&&!Number.isNaN(Number(e)),Se=(e,t,n)=>{if(n-t<11||!ve(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&&ve(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&ve(e,t+10,t+18,`-normal/`)},Ce=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],we=`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(` `)),Te=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],Ee=(e,t,n,r)=>{if(e>=10){if(e>=25)return oe[e-25](t.slice(n,r));let i=e-10;if(ue!==Ce[i])return!1;if(de>=0){for(let e of we[i])if(ve(t,de,fe,e))return!0;return!1}switch(Te[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(pe,me);return se.test(e)&&!L.test(e)}case 3:return xe(t.slice(pe,me));case 4:return le.test(t.slice(pe,me));default:return ce.test(t.slice(pe,me))}}switch(e){case 0:return!0;case 1:return ue===0;case 2:return ue===1;case 3:return ue===2;case 4:return ye.test(t.slice(n,r));case 5:return xe(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&&xe(t.slice(n,r-1));case 8:return be.test(t.slice(n,r));default:return Se(t,n,r)}},De=new Set(typeof E==`string`?E.split(` `):E),Oe=(e,t,n,r,i,a)=>{let o=xb(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},ke=new Map,Ae=new Map,je=2,Me=4096,Ne=(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||De.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=Ae.get(s);return c===void 0&&Ae.set(s,c=je++),c},Pe=new Map,Fe=r,Ie=r+4096,Le=()=>Fe++,Re=2097152,ze=8192,Be=new Int32Array(ze),Ve=Array(ze).fill(null),He=new Int32Array(ze),Ue=new Int32Array(ze),We=new Uint8Array(ze),Ge=0,Ke=(e,t,n,r,i,a,o,s)=>{let c=e;if(Ve[e]!==null){if(Ve[e|1]===null)c=e|1;else if(!(Ge++&3))c=e|Ge>>2&1;else return}Ve[c]=t.slice(n,r),Be[c]=i,He[c]=a,Ue[c]=o,We[c]=s},qe=()=>Ve.fill(null),Je=256,Ye=[new Int32Array(Je),new Int32Array(Je),new Int32Array(Je),new Int32Array(Je)],[Xe,Ze,Qe,$e]=Ye,et=new Uint8Array(Je),tt=new Uint8Array(Je),R=()=>{Je*=2,Ye=Ye.map(e=>{let t=new Int32Array(Je);return t.set(e),t}),[Xe,Ze,Qe,$e]=Ye;let e=new Uint8Array(Je);e.set(et),et=e,tt=new Uint8Array(Je)},nt=64,rt=new Int32Array(nt),it=new Int32Array(nt),at=new Int32Array(r),ot=2048,st=21,ct=new Float64Array(ot),lt=new Int32Array(ot),ut=0,dt=(e,t)=>{if(e===0&&t<r)return at[t]===ut?1:(at[t]=ut,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>st;for(;lt[i]===ut;){if(ct[i]===n)return 1;i=i+1&ot-1}return ct[i]=n,lt[i]=ut,0},ft=(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?yb:Oe(Pe,e,t+1,r,0,Le)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=it[t];if(r>n)continue;let i=rt[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;_e(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(Ee(d[t],e,r,n))return p[h+t]}return yb},pt=e=>{let t=e.length,n=0,c=0,u=!1;(je>Me||ke.size>Me)&&(ke=new Map,Ae=new Map,je=2,qe()),Fe>Ie&&(Pe=new Map,Fe=r,qe());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&ge(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&&ge(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===Je&&R();let _=n++;Xe[_]=p,Ze[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(Be[y]===v&&Ve[y]!==null&&Ve[y].length===g?t=y:Be[y|1]===v&&Ve[y|1]!==null&&Ve[y|1].length===g&&(t=y|1),t>=0){let n=Ve[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Qe[_]=He[t],$e[_]=Ue[t],et[_]=We[t];continue}}}let b=p;if(ae!==0){if(h-p<=ae||!e.startsWith(ie,p)){Qe[_]=yb,Ke(y,e,p,h,v,yb,0,0);continue}b=p+ae}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)&&(rt[0]=0,it[0]=M,te=1);let ne=bb,re=0;for(let t=M;t<D;t++)if(t===A&&(ne=F<ee?bb:P,re=te),P!==bb){let n=e.charCodeAt(t),r=-1;if(F<ee)o.charCodeAt(F)===n?(F++,F===ee&&(r=P=I)):P=bb;else{let e=i[P],t=i[P+1],c=bb;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(rt),rt=e;let t=new Int32Array(nt);t.set(it),it=t}rt[te]=r,it[te]=t+2,te++}}A===D&&(ne=F<ee?bb:P,re=te);let oe=F<ee?bb:P,se,L=!1;if(A>=0){if(L=!0,se=ft(e,E,A,ne,re),se!==yb&&se<r&&j[se]){let t=ft(e,E,D,oe,te);t!==yb&&t!==se&&(se=t,L=!1)}else se===yb&&(se=ft(e,E,D,oe,te),L=!1)}else se=ft(e,E,D,oe,te);let ce=0,le=0;se===yb?Qe[_]=yb:(le=+!!L,ce=b>=C?+!!O:Oe(ke,e,b,C,+!!O,e=>Ne(e,O)),Qe[_]=se,et[_]=le,$e[_]=ce),Ke(y,e,p,h,v,se,ce,le)}if(n===0)return``;if(n===1)return Xe[0]===0&&Ze[0]===t?e:e.slice(Xe[0],Ze[0]);if(n*k>ot){for(;n*k>ot;)ot<<=1,st--;ct=new Float64Array(ot),lt=new Int32Array(ot)}if(je>=Re||Fe>=Re)throw Error(`cn: too many distinct classes in one merge`);ut=ut+1|0,ut===0&&(at.fill(0),lt.fill(0),ut=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Qe[e];if(t===yb){tt[e]=1;continue}let n=$e[e];if(dt(n,t)===1){tt[e]=0,f=!0;continue}if(tt[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)dt(n,x[e]);if(et[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&dt(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!tt[m]){m++;continue}let t=Xe[m],r=Ze[m],i=m+1;for(;i<n&&tt[i]&&Xe[i]===r+1&&e.charCodeAt(r)===32;)r=Ze[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},mt=16384,ht=new Int32Array(mt*2),gt=0,_t=1,vt=Object.create(null),yt=Object.create(null),bt=new Map,xt=new Map,St=0,Ct=0,wt=()=>{gt^=mt,_t=_t+1|0,Ct=0},Tt=e=>{let t=vt[e];if(t!==void 0)return t;let n=Sb(e,0,e.length),r=(n&16383)+gt,i=ht[r]===(n^_t)||ht[r^mt]===(n^_t-1);return i&&(t=yt[e],t!==void 0)?(vt[e]=t,t):(t=pt(e),i?(vt[e]=t,++St>ne&&(St=0,yt=vt,vt=Object.create(null),wt())):(ht[r]=n^_t,++Ct>mt&&wt()),t)},Et=e=>{let t=bt.get(e);if(t!==void 0)return t;let n=Sb(e,0,e.length),r=(n&16383)+gt,i=ht[r]===(n^_t)||ht[r^mt]===(n^_t-1);return i&&(t=xt.get(e),t!==void 0)?(bt.set(e,t),t):(t=pt(e),i?(bt.set(e,t),++St>ne&&(St=0,xt=bt,bt=new Map,wt())):(ht[r]=n^_t,++Ct>mt&&wt()),t)},Dt=e=>{let t=Sb(e,0,e.length),n=(t&16383)+gt;return ht[n]===(t^_t)||ht[n^mt]===(t^_t-1)||(ht[n]=t^_t,++Ct>mt&&wt(),!1)},z=ne===0?pt:vb?e=>{let t=bt.get(e);return t===void 0?Et(e):t}:Tt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?z(arguments[0]):z(Eb.apply(null,arguments))},mergeString:z,seenBefore:ne===0?()=>!1:Dt,mergeUncached:pt}},wb=(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:wb(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},Tb=(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:wb(i,t);a&&(n&&(n+=` `),n+=a)}return n},Eb=function(){return Tb(arguments,!1)},Db=(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]=wb(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(wb(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)}},Ob=`{"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"]}`,kb=()=>JSON.parse(Ob),Ab=e=>`classGroups`in e&&`theme`in e&&`conflictingClassGroups`in e,jb=e=>e===void 0?{config:kb()}:typeof e==`function`?{config:e(kb())}:Ab(e)?{config:e}:{config:ob(kb(),e),cacheSize:e.cacheSize},Mb=e=>{let{config:t,cacheSize:n}=jb(e),{tables:r,validatorImpls:i,prefix:a}=_b(t);return Cb(r,i,{cacheSize:n,prefix:a})},Q=(e=>{let t=null,n=()=>t??=Mb(e);return Db(e=>n().mergeString(e),{seenBefore:e=>n().seenBefore(e),mergeUncached:e=>n().mergeUncached(e)})})({extend:{theme:{spacing:[...ny]}}});function Nb(e,t){return typeof e==`function`?e(t):e}var Pb={neutral:`alert-neutral`,primary:`alert-primary`,secondary:`alert-secondary`,accent:`alert-accent`,success:`alert-success`,info:`alert-info`,warning:`alert-warning`,error:`alert-error`},Fb=(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:Q(`alert caps-alert`,Pb[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]})}),Ib=(0,J.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,X.jsx)(`ul`,{...n,className:Q(`list`,t===`compact`&&`list-sm`,e),ref:r})}),Lb=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`li`,{...t,className:Q(`list-row`,e),ref:n})}),Rb=(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:Q(`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})]})}),zb=sy(`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`}}),Bb=(0,J.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,X.jsx)(`div`,{...a,className:Q(zb({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)(Bb,{...i,className:Q(`caps-centered-card`,r===`wide`&&`caps-centered-card-wide`,e),ref:a,variant:n??`surface`,...t?{density:t}:{}})})});var Vb=(0,J.forwardRef)(function({alignment:e=`start`,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Q(`caps-card-header`,e===`center`&&`caps-card-header-centered`,t),ref:r})}),Hb=(0,J.forwardRef)(function({className:e,level:t=3,...n},r){return(0,X.jsx)(t===2?`h2`:`h3`,{...n,className:Q(`caps-card-title`,e),ref:r})});(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`p`,{...t,className:Q(`caps-card-description`,e),ref:n})});var Ub=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Q(`caps-card-content`,e),ref:n})}),Wb=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Q(`caps-card-footer`,e),ref:n})});function Gb(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Kb(...e){return t=>{let n=!1,r=e.map(e=>{let r=Gb(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():Gb(e[t],null)}}}}function qb(...e){return J.useCallback(Kb(...e),e)}function Jb(e){let t=J.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];nx(r)&&typeof ox==`function`&&(r=ox(r._payload)),J.Children.forEach(r,e=>{if(ex(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;nx(n)&&typeof ox==`function`&&(n=ox(n._payload)),a=Zb(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?$b(a):void 0,l=qb(n,c);if(!a){if(r||r===0)throw Error(o?ax(e):ix(e));return r}let u=Qb(i,a.props??{});return a.type!==J.Fragment&&(u.ref=n?l:c),J.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Yb=Jb(`Slot`),Xb=Symbol.for(`radix.slottable`),Zb=(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 Qb(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 $b(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 ex(e){return J.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Xb}var tx=Symbol.for(`react.lazy`);function nx(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===tx&&`_payload`in e&&rx(e._payload)}function rx(e){return typeof e==`object`&&!!e&&`then`in e}var ix=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,ax=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ox=J.use,sx=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)`}),cx=`(prefers-reduced-motion: reduce)`;function lx(e){let t=e.ownerDocument.defaultView;if(!t)return sx;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?.(cx).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`,sx.squish),fast:o(`fast`,sx.fast),normal:o(`normal`,sx.normal),slow:o(`slow`,sx.slow),springDuration:o(`spring-duration`,sx.springDuration),bounce:Math.min(1,s(`bounce`,sx.bounce)),stretch:s(`stretch`,sx.stretch),distance:s(`distance`,sx.distance),stagger:a?0:i(`--stipe-motion-stagger`,sx.stagger),blur:s(`blur`,sx.blur),shake:s(`shake`,sx.shake),steps:Math.floor(s(`steps`,sx.steps)),fuse:r(`--stipe-motion-fuse`,sx.fuse),pressDepth:a?0:r(`--stipe-press-depth`,sx.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,sx.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||sx.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||sx.easeExit}}function ux(e){let[t,n]=(0,J.useState)(()=>({...sx,reduced:!0}));return(0,J.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=lx(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?.(cx);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function dx(e,t){return e.reduced?0:Math.round(t*e.normal/sx.normal)}function fx(e,t){if(e.reduced)return 0;let n=t*e.bounce/sx.bounce;return Math.min(.9,Math.max(0,n))}function px(e,t){return e.reduced?0:Math.round(t*e.springDuration/sx.springDuration)}function mx(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function hx(e){return`animate`in e}var gx=globalThis;function _x(){return gx.matchMedia?.(cx).matches??!1}function vx(e){let t=gx.matchMedia?.(cx);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function yx(){return!0}function bx(){return(0,J.useSyncExternalStore)(vx,_x,yx)}var xx=(0,J.forwardRef)(function({asChild:e=!1,className:t,...n},r){let i=Q(`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)(Yb,{...n,className:i,ref:r}):(0,X.jsx)(`span`,{...n,className:i,ref:r})}),Sx=typeof window<`u`,Cx=Sx?window:null,wx=Sx?document:null,Tx={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},Ex={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},Dx={NONE:0,AUTO:1,FORCE:2},Ox={replace:0,none:1,blend:2},kx=Symbol(),Ax=Symbol(),jx=Symbol(),Mx=Symbol(),Nx=Symbol(),Px=1e-11,Fx=0xe8d4a51000,Ix=1e3,Lx=[],Rx=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),zx=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],Bx=zx.reduce((e,t)=>({...e,[t]:t+`(`}),{}),Vx=()=>{},Hx=e=>e,Ux=/\)\s*[-.\d]/,Wx=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,Gx=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,Kx=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,qx=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,Jx=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Yx=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,Xx=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,Zx=/([a-z])([A-Z])/g,Qx=/(\*=|\+=|-=)/,$x=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,eS={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:Ix,delay:0,loopDelay:0,ease:`out(2)`,composition:Ox.replace,modifier:Hx,onBegin:Vx,onBeforeUpdate:Vx,onUpdate:Vx,onLoop:Vx,onPause:Vx,onComplete:Vx,onRender:Vx},tS={current:null,root:wx},nS={defaults:eS,precision:4,timeScale:1,tickThreshold:200,editor:null},rS={version:`4.5.0`,engine:null};Sx&&(Cx.AnimeJS||=[],Cx.AnimeJS.push(rS));var iS=e=>e.replace(Zx,`$1-$2`).toLowerCase(),aS=(e,t)=>e.indexOf(t)===0,oS=Date.now,sS=Array.isArray,cS=e=>e&&e.constructor===Object,lS=e=>typeof e==`number`&&!isNaN(e),uS=e=>typeof e==`string`,dS=e=>typeof e==`function`,fS=e=>e===void 0,pS=e=>fS(e)||e===null,mS=e=>Sx&&e instanceof SVGElement,hS=e=>Wx.test(e),gS=e=>aS(e,`rgb`),_S=e=>aS(e,`hsl`),vS=e=>hS(e)||(gS(e)||_S(e))&&(e[e.length-1]===`)`||!Ux.test(e)),yS=e=>!nS.defaults.hasOwnProperty(e),bS=[`opacity`,`rotate`,`overflow`,`color`],xS=(e,t)=>{if(bS.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}},SS=Math.pow,CS=Math.sqrt,wS=Math.sin,TS=Math.cos,ES=Math.abs,DS=Math.exp,OS=Math.ceil,kS=Math.floor,AS=Math.asin,jS=Math.PI,MS=Math.round,NS=(e,t,n)=>e<t?t:e>n?n:e,PS=(e,t)=>{if(t<0)return e;if(!t)return MS(e);let n=10**t;return MS(e*n)/n},FS=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,IS=e=>e===1/0?Fx:e===-1/0?-Fx:e,LS=e=>e<=1e-11?Px:IS(PS(e,11)),RS=e=>sS(e)?[...e]:e,zS=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=fS(i)?t[r]:i}return n},BS=(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}},VS=(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},HS=(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},US=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[Mx],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(!fS(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:aS(t,`scale`)?`1`:aS(t,`rotate`)||aS(t,`skew`)?`0deg`:`0px`},WS=e=>{let t=``;for(let n=0,r=zx.length;n<r;n++){let r=zx[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+=`${Bx[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},GS=[];function KS(e,t){if(!e)return null;let n=GS.length;outer:for(let r=0;r<n;r++){let n=GS[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=GS[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 qS=e=>{let t=Gx.exec(e)||Kx.exec(e),n=fS(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},JS=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]},YS=(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),XS=e=>{let t=qx.exec(e)||Jx.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=fS(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=PS(YS(t,e,n+1/3)*255,0),s=PS(YS(t,e,n)*255,0),c=PS(YS(t,e,n-1/3)*255,0)}return[o,s,c,a]},ZS=e=>gS(e)?qS(e):hS(e)?JS(e):_S(e)?XS(e):[0,0,0,1],QS=(e,t)=>fS(e)?t:e,$S=(e,t)=>{let n=e.match($x),r=t[Ax]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},eC=(e,t,n,r,i,a)=>{if(dS(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(uS(e)&&aS(e,`var(`)){if(!i)return $S(e,t);let n=()=>$S(e,t);return i.func=n,n()}return e},tC=(e,t)=>e[Ax]?e[jx]&&xS(e,t)?Tx.ATTRIBUTE:zx.includes(t)||Rx.get(t)?Tx.TRANSFORM:aS(t,`--`)?Tx.CSS_VAR:t in e.style?Tx.CSS:t in e?Tx.OBJECT:Tx.ATTRIBUTE:Tx.OBJECT,nC=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[Nx]||e).getPropertyValue(t);return i===`auto`?`0`:i},rC=(e,t,n,r)=>{let i=fS(n)?tC(e,t):n,a=KS(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===Tx.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===Tx.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===Tx.TRANSFORM?US(e,t,r):i===Tx.CSS_VAR?nC(e,t,r).trimStart():nC(e,t,r)},iC=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,aC=()=>({t:Ex.NUMBER,n:0,u:null,o:null,d:null,s:null}),oC=(e,t)=>{if(t.t=Ex.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(` `)&&Xx.exec(r);if(i)return t.t=Ex.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(vS(r))return t.t=Ex.COLOR,t.d=ZS(r),t;{let e=r.match(Yx);return t.t=Ex.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(Yx)||[],t}},sC=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=RS(e._toNumbers),t.s=RS(e._strings),t),cC=aC(),lC=(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(PS(FS(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},uC=(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=NS(g,-h,o),b=NS(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=Px,T=i===Dx.FORCE,E=0,D=v,O=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=NS(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===Dx.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)>=nS.tickThreshold,i=PS(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!==Ox.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=NS(j-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===Tx.OBJECT,g=f===Ex.NUMBER,_=g&&m||n===0||n===1?-1:nS.precision,v,y;if(g)v=y=i(PS(FS(o._fromNumber,o._toNumber,n),_));else if(f===Ex.UNIT)y=i(PS(FS(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===Ex.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(FS(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${PS(e[0],0)},${PS(e[1],0)},${PS(e[2],0)},${e[3]})`)}else f===Ex.COMPLEX&&(v=lC(o,n,_));if(h&&(o._number=y),!r&&e!==Ox.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===Tx.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===Tx.TRANSFORM?(s!==l&&(l=s,u=s[Mx]),u[e]=v,d=1):p===Tx.CSS?c[e]=v:p===Tx.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=WS(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},dC=(e,t,n,r,i)=>{let a=e._currentIteration;if(uC(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=oS(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;BS(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&uC(t,e,n,1,Dx.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)}BS(o,e=>{let t=PS((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+=uC(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))))}},fC={},pC=(e,t,n)=>{if(n===Tx.TRANSFORM)return Rx.get(e)||e;if(n===Tx.CSS||n===Tx.ATTRIBUTE&&mS(t)&&e in t.style){let t=fC[e];if(t)return t;{let t=e&&iS(e);return fC[e]=t,t}}return e},mC=(e,t=!1)=>{if(e._hasChildren)BS(e,e=>mC(e,t),!0);else{let n=e;n.pause(),BS(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=pS(o)||o===``;if(e._setter){if(!t&&!s){if(oC(o,cC),cC.d){let t=cC.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=cC.n;e._setter(e.target,e._number,e)}}else if(a===Tx.OBJECT)!t&&!s&&(i[r]=o);else if(i[Ax]){if(a===Tx.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===Tx.TRANSFORM){let n=i[Mx];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=WS(n):t.removeProperty(`transform`))}else s?t.removeProperty(iS(r)):t[r]=o}}i[Ax]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},hC=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=Ix/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?Px:t,r=Ix/n;n>eS.frameRate&&(eS.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?Px:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?Dx.NONE:(this._lastTickTime=n>=t?e-n%t:e,Dx.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},gC={animation:null,update:Vx},_C=e=>{let t=gC.animation;return t||(t={duration:Px,computeDeltaTime:Vx,_offset:0,_delay:0,_head:null,_tail:null},gC.animation=t,gC.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===Ex.COMPLEX||e===Ex.COLOR?RS(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}}}),uC(t,1,1,0,Dx.FORCE)}),t},vC=Sx?requestAnimationFrame:setImmediate,yC=Sx?cancelAnimationFrame:clearImmediate,bC=class extends hC{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=eS,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=oS();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?(VS(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):dC(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):Dx.AUTO),r=i}gC.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(oS()),this.reqId=vC(SC)),this}pause(){if(this.reqId)return this.paused=!0,CC()}resume(){if(this.paused)return this.paused=!1,BS(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(nS.timeScale===1?1:Ix)}set speed(e){let t=e*nS.timeScale;this._speed!==t&&(this._speed=t,BS(this,e=>e.speed=e._speed))}get timeUnit(){return nS.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(nS.timeScale!==r){nS.timeScale=r,nS.tickThreshold=200*r;let e=n?t:Ix;this.defaults.duration*=e,this._speed*=e}}get precision(){return nS.precision}set precision(e){nS.precision=e}},xC=(()=>{let e=new bC(oS());return Sx&&(rS.engine=e,wx.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(wx.hidden?e.pause():e.resume())})),e})(),SC=()=>{xC._head?(xC.reqId=vC(SC),xC.update()):xC.reqId=0},CC=()=>(yC(xC.reqId),xC.reqId=0,xC),wC={_rep:new WeakMap,_add:new Map},TC=(e,t,n=`_rep`)=>{let r=wC[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},EC=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,DC=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=Px,e._currentTime=Px},OC=(e,t)=>{let n=e._composition;if(n===Ox.replace){let n=e._absoluteStartTime;HS(t,e,EC,`_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){DC(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)DC(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=PS(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&DC(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(BS(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;BS(e,e=>{e!==t&&BS(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===Ox.blend){let t=TC(e.target,e.property,`_add`),n=_C(wC._add),r=t._head;r||(r={...e},r._composition=Ox.replace,r._updateDuration=Px,r._startTime=0,r._numbers=RS(e._fromNumbers),r._number=0,r._next=null,r._prev=null,HS(t,r),HS(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=RS(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=RS(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}HS(t,e,null,`_prevAdd`,`_nextAdd`)}return e},kC=e=>{let t=e._composition;if(t!==Ox.none){let n=e.target,r=e.property,i=wC._rep.get(n)[r];if(VS(i,e,`_prevRep`,`_nextRep`),t===Ox.blend){let t=wC._add,i=t.get(n);if(!i)return;let a=i[r],o=gC.animation;VS(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){VS(a,s,`_prevAdd`,`_nextAdd`),VS(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},AC=(e,t,n)=>{let r=!1;return BS(t,i=>{let a=i.target;if(e.includes(a)){let e=i.property,o=i._tweenType,s=pC(n,a,o);(!s||s&&s===e)&&(i.parent._tail===i&&i._tweenType===Tx.TRANSFORM&&i._prev&&i._prev._tweenType===Tx.TRANSFORM&&(i._prev._renderTransforms=1),VS(t,i),kC(i),r=!0)}},!0),r},jC=(e,t,n)=>{let r=t||xC,i;if(r._hasChildren){let t=0;BS(r,a=>{if(!a._hasChildren){if(i=AC(e,a,n),i&&!a._head)a.cancel(),VS(r,a);else{let e=a._offset+a._delay+a.duration;e>t&&(t=e)}}a._head?jC(e,a,n):a._hasChildren=!1},!0),fS(r.iterationDuration)||(r.iterationDuration=t)}else i=AC(e,r,n);i&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel())},MC=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),NC=e=>e._cancelled?(e._hasChildren?BS(e,NC):BS(e,e=>{e._composition!==Ox.none&&OC(e,TC(e.target,e.property))}),e._cancelled=0,e):e,PC=0,FC=(e,t)=>e._priority>t._priority,IC=class extends hC{constructor(e={},t=null,n=0){super(0),++PC;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;tS.current&&tS.current.register(this);let b=t?0:xC._lastTickTime,x=t?t.defaults:nS.defaults,S=dS(i)||fS(i)?x.delay:+i,C=dS(a)||fS(a)?1/0:+a,w=QS(c,x.loop),T=QS(l,x.loopDelay),E=w===!0||w===1/0||w<0?1/0:w+1,D=0;t?D=n:(xC.reqId||xC.requestTick(oS()),D=(xC._lastTickTime-xC._startTime)*nS.timeScale),this.id=fS(r)?PC:r,this.parent=t,this.duration=IS((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&&QS(u,x.autoplay),this._offset=D,this._delay=S,this._loopDelay=T,this._iterationTime=0,this._currentIteration=0,this._resolve=Vx,this._running=!1,this._reversed=+QS(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=QS(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=QS(d,x.frameRate),this._speed=QS(f,x.playbackRate),this._priority=+QS(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return NS(PS(this._currentTime,nS.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return NS(PS(this._iterationTime,nS.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return NS(PS(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return NS(PS(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*NS(+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 NC(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,dC(this,0,1,~~e,Dx.FORCE),MC(this),this._hasChildren&&BS(this,MC),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&dC(this,this.duration,1,~~e,Dx.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!fS(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*xC._speed);return this._startTime=oS()-(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?dC(this,Px,0,0,Dx.FORCE):(this._running||=(HS(xC,this,FC),xC._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,xC.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){NC(this),this.completed=!1;let r=this.paused;return this.paused=!0,dC(this,e+this._delay,~~t,~~n,Dx.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?kS(Fx/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?BS(this,e=>e.cancel(),!0):BS(this,kC),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=LS(e);if(t===n)return this;let r=e/t,i=e<=Px;return this.duration=i?Px:n,this.iterationDuration=i?Px:LS(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){dC(this,0,1,0,Dx.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=Vx){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=Vx};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}},LC=e=>new IC(e,null,0).init();function RC(e){let t=uS(e)?tS.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function zC(e){if(pS(e))return[];if(!Sx)return sS(e)&&e.flat(1/0)||[e];if(sS(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!pS(r)){let e=RC(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!pS(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=RC(e);return t?Array.from(t):[e]}function BC(e){let t=zC(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[kx]){n[kx]=!0;let e=mS(n);(n.nodeType||e)&&(n[Ax]=!0,n[jx]=e,n[Mx]={})}}return t}var VC={deg:1,rad:180/jS,turn:360},HC={},UC=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===Ex.UNIT&&i===n)return t;let o=a+i+n,s=HC[o];if(!fS(s)&&!r)t.n=s;else{let r;if(i in VC)r=a*VC[i]/VC[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==wx?o:wx.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,HC[o]=r}return t.t,Ex.UNIT,t.u=n,t},WC=e=>e,GC=(e=1.68)=>t=>SS(t,+e),KC={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},qC=jS/2,JC=jS*2,YC={"":GC,Quad:GC(2),Cubic:GC(3),Quart:GC(4),Quint:GC(5),Sine:e=>1-TS(e*qC),Circ:e=>1-CS(1-e*e),Expo:e=>e?SS(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=SS(2,--n))-1)/11;);return 1/SS(4,3-n)-7.5625*SS((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=NS(+e,1,10),r=NS(+t,Px,2),i=r/JC*AS(1/n),a=JC/r;return e=>e===0||e===1?e:-n*SS(2,-10*(1-e))*wS((1-e-i)*a)}},XC=(()=>{let e={linear:WC,none:WC};for(let t in KC)for(let n in YC){let r=YC[n],i=KC[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),ZC={linear:WC,none:WC},QC=e=>{if(ZC[e])return ZC[e];if(e.indexOf(`(`)<=-1){let t=KC[e]||e.includes(`Back`)||e.includes(`Elastic`)?XC[e]():XC[e];return t?ZC[e]=t:WC}{let t=e.slice(0,-1).split(`(`),n=XC[t[0]];return n?ZC[e]=n(...t[1].split(`,`)):WC}},$C=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],ew=e=>{if(uS(e)){for(let t=0,n=$C.length;t<n;t++)if(aS(e,$C[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}\``),WC}return dS(e)?e:uS(e)?QC(e):WC},tw=aC(),nw=aC(),rw={},iw={func:null},aw={func:null},ow=[null],sw=[null,null],cw={to:null},lw=0,uw=0,dw,fw,pw=(e,t)=>{let n={};if(sS(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(yS);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];yS(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=QS(t.duration,nS.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(yS(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},mw=class extends IC{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++uw;let s=BC(e),c=s.length,l=t.keyframes,u=l?zS(pw(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:nS.defaults,b=QS(m,y.ease),x=QS(h,y.playbackEase),S=x?ew(x):null,C=!fS(b.ease),w=C?b.ease:QS(m,S?`linear`:y.ease),T=C?b.settlingDuration:QS(p,y.duration),E=QS(f,y.delay),D=g||y.modifier,O=fS(_)&&c>=1e3?Ox.none:fS(_)?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(yS(e)){let a=tC(t,e),o=KS(t,e),s=pC(e,t,a),f=u[e],p=sS(f);if(i&&!p&&(sw[0]=f,sw[1]=f,f=sw),p){let e=f.length,t=!cS(f[0]);e===2&&t?(cw.to=f,ow[0]=cw,dw=ow):e>2&&t?(dw=[],f.forEach((e,t)=>{t?t===1?(sw[1]=e,dw.push(sw)):dw.push(e):sw[0]=e})):dw=f}else ow[0]=f,dw=ow;let m=null,h=null,g=NaN,_=0,v=0;for(let e=dw.length;v<e;v++){let i=dw[v];cS(i)?fw=i:(cw.to=i,fw=cw),iw.func=null,aw.func=null;let l=eC(QS(fw.composition,O),t,r,c,null,null),u=lS(l)?l:Ox[l];!m&&u!==Ox.none&&(m=TC(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=eC(fw.to,t,r,c,iw,f),y;cS(p)&&!fS(p.to)?(fw=p,y=p.to):y=p;let b=eC(fw.from,t,r,c,aw,f),x=fw.ease||w,S=eC(x,t,r,c,null,f),C=dS(S)||uS(S)?S:x,A=!fS(C)&&!fS(C.ease),j=A?C.ease:C,P=A?C.settlingDuration:eC(QS(fw.duration,e>1?eC(T,t,r,c,null,f)/e:T),t,r,c,null,f),F=eC(QS(fw.delay,v?0:E),t,r,c,null,f),ee=fw.modifier||D,I=!fS(b),te=!fS(y),ne=sS(y),re=ne||I&&te,ie=h?_:0,ae=h?_+F:F,oe=PS(k+ae,12),se=PS(k+ie,12);!N&&(I||ne)&&(N=1);let L=h;if(u!==Ox.none){let e=m._head;for(;e&&e._absoluteStartTime<=oe;)if(e._isOverridden||(L=e),e=e._nextRep,e&&e._absoluteStartTime>=oe)for(;e;)DC(e),e=e._nextRep}if(re){oC(ne?eC(y[0],t,r,c,aw,f):b,tw),oC(ne?eC(y[1],t,r,c,iw,f):y,nw);let e=rC(t,s,a,rw);tw.t===Ex.NUMBER&&(L?L._valueType===Ex.UNIT&&(tw.t=Ex.UNIT,tw.u=L._unit):(oC(e,cC),cC.t===Ex.UNIT&&(tw.t=Ex.UNIT,tw.u=cC.u)))}else te?oC(y,nw):h?sC(h,nw):oC(n&&L&&L.parent.parent===n?L._value:rC(t,s,a,rw),nw),I?oC(b,tw):h?sC(h,tw):oC(n&&L&&L.parent.parent===n?L._value:rC(t,s,a,rw),tw);if(tw.o&&(tw.n=iC(L?L._toNumber:oC(rC(t,s,a,rw),cC).n,tw.n,tw.o)),nw.o&&(nw.n=iC(tw.n,nw.n,nw.o)),tw.t!==nw.t){if(tw.t===Ex.COMPLEX||nw.t===Ex.COMPLEX){let e=tw.t===Ex.COMPLEX?tw:nw,t=tw.t===Ex.COMPLEX?nw:tw;t.t=Ex.COMPLEX,t.s=RS(e.s),t.d=e.d.map(()=>t.n)}else if(tw.t===Ex.UNIT||nw.t===Ex.UNIT){let e=tw.t===Ex.UNIT?tw:nw,t=tw.t===Ex.UNIT?nw:tw;t.t=Ex.UNIT,t.u=e.u}else if(tw.t===Ex.COLOR||nw.t===Ex.COLOR){let e=tw.t===Ex.COLOR?tw:nw,t=tw.t===Ex.COLOR?nw:tw;t.t=Ex.COLOR,t.d=e.d.map(()=>0)}}if(tw.u!==nw.u){let e=nw.u?tw:nw;e=UC(t,e,nw.u?nw.u:tw.u,!1)}if(nw.d&&tw.d&&nw.d.length!==tw.d.length){let e=tw.d.length>nw.d.length?tw:nw,t=e===tw?nw:tw;t.d=e.d.map((e,n)=>fS(t.d[n])?0:t.d[n]),t.s=RS(e.s)}let ce=PS(+P||1e-11,12),le=rw[s];pS(le)||(rw[s]=null);let ue=o?o.set:null;_=PS(ae+ce,12);let de=tw.d,fe=nw.d,pe=nw.s,me={parent:this,id:lw++,property:s,target:t,_value:null,_toFunc:iw.func,_fromFunc:aw.func,_ease:ew(j),_fromNumbers:de?RS(de):Lx,_toNumbers:fe?RS(fe):Lx,_strings:pe?RS(pe):Lx,_fromNumber:tw.n,_toNumber:nw.n,_numbers:de?RS(de):Lx,_number:tw.n,_unit:nw.u,_modifier:ee,_currentTime:0,_startTime:ae,_delay:+F,_updateDuration:ce,_changeDuration:ce,_absoluteStartTime:oe,_absoluteUpdateStartTime:se,_absoluteEndTime:PS(k+_,12),_hasFromValue:I||ne?1:0,_tweenType:a,_setter:ue,_valueType:nw.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:le,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==Ox.none&&OC(me,m);let he=me._valueType;if(he===Ex.COMPLEX)me._value=lC(me,1,-1);else if(he===Ex.UNIT)me._value=`${ee(me._toNumber)}${me._unit}`;else if(he===Ex.COLOR){let e=nw.d;me._value=`rgba(${PS(e[0],0)},${PS(e[1],0)},${PS(e[2],0)},${e[3]})`}else me._value=ee(me._toNumber);isNaN(g)&&(g=me._startTime),h=me,M++,HS(this,me)}(isNaN(j)||g<j)&&(j=g),(isNaN(A)||_>A)&&(A=_),a===Tx.TRANSFORM&&(l=M-v,d=M)}if(!isNaN(l)){let e=0;BS(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===Ox.blend&&BS(gC.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?(BS(this,e=>{e._startTime-e._delay||(e._delay-=j),e._startTime-=j}),A-=j):j=0,A||(A=Px,this.iterationCount=0),this.targets=s,this.id=fS(d)?uw:d,this.duration=A===1e-11?Px:IS((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===LS(e))return this;let n=e/t;return BS(this,e=>{e._updateDuration=LS(e._updateDuration*n),e._changeDuration=LS(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 BS(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(oC(n(),tw),tw.u!==e._unit&&e.target[Ax]&&UC(e.target,tw,e._unit,!0),e._fromNumbers=RS(tw.d),e._fromNumber=tw.n):t&&(oC(rC(e.target,e.property,e._tweenType),cC),e._fromNumbers=RS(cC.d),e._fromNumber=cC.n),t&&(oC(t(),nw),e._toNumbers=RS(nw.d),e._strings=RS(nw.s),e._toNumber=nw.o?iC(e._fromNumber,nw.n,nw.o):nw.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),mC(this)}then(e){return super.then(e)}},hw=(e,t)=>nS.editor?nS.editor.addAnimation(e,t):new mw(e,t,null,0,!1).init(),gw=Ix*10,_w=class{constructor(e={}){let t=!fS(e.bounce)||!fS(e.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/Ix,this.maxIterations=this.maxDuration/this.timeStep/Ix,this.bn=NS(QS(e.bounce,.5),-1,1),this.pd=NS(QS(e.duration,628),10*nS.timeScale,gw*nS.timeScale),this.m=NS(QS(e.mass,1),1,gw),this.s=NS(QS(e.stiffness,100),Px,gw),this.d=NS(QS(e.damping,10),Px,gw),this.v=NS(QS(e.velocity,0),-gw,gw),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||Vx,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?DS(-a*t*n)*(1*TS(r*a)+i*wS(r*a)):t===1?(1+i*a)*DS(-a*n):((1+i)*DS((-t*n+r)*a)+(1-i)*DS((-t*n-r)*a))/2,1-a}calculateSDFromBD(){let e=nS.timeScale===1?this.pd/Ix:this.pd;this.m=1,this.v=0,this.s=SS(2*jS/e,2),this.d=this.bn>=0?(1-this.bn)*4*jS/e:4*jS/(e*(1+this.bn)),this.s=PS(NS(this.s,Px,gw),3),this.d=PS(NS(this.d,Px,300),3)}calculateBDFromSD(){let e=2*jS/CS(this.s);this.pd=e*(nS.timeScale===1?Ix:1),this.bn=this.d/(2*CS(this.s))<=1?1-this.d*e/(4*jS):4*jS/(this.d*e)-1,this.bn=PS(NS(this.bn,-1,1),3),this.pd=PS(NS(this.pd,10*nS.timeScale,gw*nS.timeScale),3)}compute(){let{maxRestSteps:e,maxIterations:t,restThreshold:n,timeStep:r,m:i,d:a,s:o,v:s}=this,c=this.w0=NS(CS(o/i),Px,Ix),l=this.zeta=a/(2*CS(o*i));l<1?(this.wd=c*CS(1-l*l),this.b=(l*c+-s)/this.wd):l===1?(this.wd=0,this.b=-s+c):(this.wd=c*CS(l*l-1),this.b=(l*c+-s)/this.wd);let u=0,d=0,f=0;for(;d<=e&&f<=t;)ES(1-this.solve(u))<n?d++:d=0,this.solverDuration=u,u+=r,f++;this.settlingDuration=PS(this.solverDuration*Ix,0)*nS.timeScale}get bounce(){return this.bn}set bounce(e){this.bn=NS(QS(e,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(e){this.pd=NS(QS(e,1),10*nS.timeScale,gw*nS.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(e){this.s=NS(QS(e,100),Px,gw),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(e){this.d=NS(QS(e,10),Px,gw),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(e){this.m=NS(QS(e,1),1,gw),this.compute()}get velocity(){return this.v}set velocity(e){this.v=NS(QS(e,0),-gw,gw),this.compute()}},vw=e=>new _w(e),yw=(e=10,t)=>{let n=t?OS:kS;return t=>n(NS(t,0,1)*e)*(1/e)},bw=(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 xw({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 Sw({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 Cw=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function ww({id:e,values:t=ty}){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 Tw(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 Ew(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function Dw(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function Ow(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=Ew(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=Ew((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+Dw(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=Dw(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 kw={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800};function Aw({variant:e}){let t=`caps-loader-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(null),i=ux(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)=>hw(t,{keyframes:Array.from({length:48},(t,r)=>({...Ow(e,n,(r+1)/48),duration:dx(i,kw[e])/48})),ease:`linear`,loop:!0})),o=Tw(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)(ww,{id:t,values:Cw}),(0,X.jsx)(bw,{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)(xw,{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`,{...Ow(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 jw={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},Mw={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`},Nw=(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:Q(`caps-loader`,jw[a],Mw[s],n),"data-variant":o,role:r?void 0:`status`,ref:l,children:[(0,X.jsx)(Aw,{variant:o}),d?(0,X.jsx)(xx,{id:u,children:i}):null]})}),Pw=`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`,Fw=sy(`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 ${Pw}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${Pw}`},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`}}),Iw=(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=Q(Fw({size:c,variant:l}),n),p=(0,J.useRef)(a).current,m=(0,J.useRef)(null);return(0,J.useImperativeHandle)(d,()=>m.current),Lw(m,[i,a,t]),e?(0,X.jsx)(Yb,{...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)(Nw,{className:`size-3`,decorative:!0,size:`sm`}):null,t]}):(0,X.jsx)(Hw,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function Lw(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||!hx(t))return;let s=lx(t);if(s.reduced)return;let c=t.animate([{width:`${String(a)}px`},{width:`${String(o)}px`}],{duration:s.normal,easing:mx(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 Rw=1100;function zw(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:mx(t,`ease-out`)})}function Bw(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:mx(t,`linear`)})}function Vw(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:mx(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:mx(n,n.ease),fill:`backwards`})]}function Hw({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,J.useRef)(null),s=bx(),[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)},Rw);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!hx(t))return;let n=lx(t);if(n.shake<=0)return;let r=Bw(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||!hx(e)){c||d(!1);return}let r=lx(e),i=c?Vw(t,n,r):Vw(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(zw(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:mx(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)(Nw,{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 Uw={...J},Ww={};function Gw(e,t){let n=J.useRef(Ww);return n.current===Ww&&(n.current=e(t)),n}var Kw=Uw.useInsertionEffect,qw=Kw&&Kw!==Uw.useLayoutEffect?Kw:e=>e();function Jw(e){let t=Gw(Yw).current;return t.next=e,qw(t.effect),t.trampoline}function Yw(){let e={next:void 0,callback:Xw,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Xw(){}function Zw(){}var Qw=Object.freeze([]),$w=Object.freeze({});function eT(e){J.useEffect(e,Qw)}var tT=0,nT=class e{static create(){return new e}currentId=tT;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=tT,t()},e)}isStarted(){return this.currentId!==tT}clear=()=>{this.currentId!==tT&&(clearTimeout(this.currentId),this.currentId=tT)};disposeEffect=()=>this.clear};function rT(){let e=Gw(nT.create).current;return eT(e.disposeEffect),e}function iT(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 aT=iT(`https://base-ui.com/production-error`,`Base UI`),oT=J.createContext(void 0);function sT(){let e=J.useContext(oT);if(e===void 0)throw Error(aT(53));return e}function cT(e,t,n,r){let i=Gw(uT).current;return dT(i,e,t,n,r)&&pT(i,[e,t,n,r]),i.callback}function lT(e){let t=Gw(uT).current;return fT(t,e)&&pT(t,e),t.callback}function uT(){return{callback:null,cleanup:null,refs:[]}}function dT(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function fT(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function pT(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 mT=18;function hT(e){return mT>=e}function gT(e){if(!J.isValidElement(e))return null;let t=e,n=t.props;return(hT(19)?n?.ref:t.ref)??null}function _T(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function vT(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 yT(e,t){return typeof e==`function`?e(t):e}function bT(e,t){return typeof e==`function`?e(t):e}var xT={};function ST(e,t,n,r,i){if(!n&&!r&&!i&&!e)return wT(t);let a=wT(e);return t&&(a=TT(a,t)),n&&(a=TT(a,n)),r&&(a=TT(a,r)),i&&(a=TT(a,i)),a}function CT(e){if(e.length===0)return xT;if(e.length===1)return wT(e[0]);let t=wT(e[0]);for(let n=1;n<e.length;n+=1)t=TT(t,e[n]);return t}function wT(e){return kT(e)?{...e(xT)}:ET(e)}function TT(e,t){return kT(t)?t(e):DT(e,t)}function ET(e){let t={...e};for(let e in t){let n=t[e];OT(e,n)&&(t[e]=jT(n))}return t}function DT(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=_T(e.style,r);break;case`className`:e[n]=NT(e.className,r);break;default:e[n]=OT(n,r)?AT(e[n],r):r}}return e}function OT(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 kT(e){return typeof e==`function`}function AT(e,t){return t?e?(...n)=>{let r=n[0];if(PT(r)){let i=r;MT(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:jT(t):e}function jT(e){return e&&((...t)=>{let n=t[0];return PT(n)&&MT(n),e(...t)})}function MT(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function NT(e,t){return t?e?t+` `+e:t:e}function PT(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function FT(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=zT(r));let i=IT(t,n,r);if(n.enabled===!1)return null;let a=n.state??$w;return BT(e,r,i,a)}function IT(e,t,n){let{className:r,style:i}=e,{state:a=$w,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?yT(r,a):void 0,d=l?bT(i,a):void 0,f=l?vT(a,c):$w,p=l&&s?LT(s):void 0,m=l?_T(f,p)??{}:$w;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?lT([m.ref,gT(n),...o]):cT(m.ref,gT(n),o):cT(null,null)),l?(u!==void 0&&(m.className=NT(m.className,u)),d!==void 0&&(m.style=_T(m.style,d)),m):$w}function LT(e){return Array.isArray(e)?CT(e):ST(void 0,e)}var RT=Symbol.for(`react.lazy`);function zT(e){if(e?.$$typeof!==RT)return e;let t=J.Children.toArray(e)[0];return J.isValidElement(t)?t:e}function BT(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=ST(n,t.props);return e.ref=n.ref,J.cloneElement(t,e)}return VT(e,n)}function VT(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 HT(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 UT=`base-ui-disable-scrollbar`,WT={className:UT,getElement(e){return(0,X.jsx)(`style`,{nonce:e,href:UT,precedence:`base-ui:low`,children:`.${UT}{scrollbar-width:none}.${UT}::-webkit-scrollbar{display:none}`})}};function GT(){let[,e]=J.useState({});return J.useCallback(()=>{e({})},[])}var KT=0;function qT(e,t=`mui`){let n=J.useRef(void 0),r=GT(),i=e??n.current;return J.useEffect(()=>{n.current??(KT+=1,n.current=`${t}-${KT}`,e??r())},[e,t,r]),i}var JT=Uw.useId;function YT(e,t){if(JT!==void 0){let n=JT();return e??(t?`${t}-${n}`:n)}return qT(e,t)}function XT(e){return YT(e,`base-ui`)}var ZT=`data-has-overflow-x`,QT=`data-has-overflow-y`,$T=`data-overflow-x-start`,eE=`data-overflow-x-end`,tE=`data-overflow-y-start`,nE=`data-overflow-y-end`,rE=e=>t=>t?{[e]:``}:null,iE={hasOverflowX:rE(ZT),hasOverflowY:rE(QT),overflowXStart:rE($T),overflowXEnd:rE(eE),overflowYStart:rE(tE),overflowYEnd:rE(nE),cornerHidden:()=>null};function aE(){return typeof window<`u`}function oE(e){return lE(e)?(e.nodeName||``).toLowerCase():`#document`}function sE(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cE(e){return((lE(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function lE(e){return aE()?e instanceof Node||e instanceof sE(e).Node:!1}function uE(e){return aE()?e instanceof Element||e instanceof sE(e).Element:!1}function dE(e){return aE()?e instanceof HTMLElement||e instanceof sE(e).HTMLElement:!1}function fE(e){return!aE()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof sE(e).ShadowRoot}function pE(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=wE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function mE(e){return/^(table|td|th)$/.test(oE(e))}function hE(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var gE=/transform|translate|scale|rotate|perspective|filter/,_E=/paint|layout|strict|content/,vE=e=>!!e&&e!==`none`,yE;function bE(e){let t=uE(e)?wE(e):e;return vE(t.transform)||vE(t.translate)||vE(t.scale)||vE(t.rotate)||vE(t.perspective)||!SE()&&(vE(t.backdropFilter)||vE(t.filter))||gE.test(t.willChange||``)||_E.test(t.contain||``)}function xE(e){let t=EE(e);for(;dE(t)&&!CE(t);){if(bE(t))return t;if(hE(t))return null;t=EE(t)}return null}function SE(){return yE??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),yE}function CE(e){return/^(html|body|#document)$/.test(oE(e))}function wE(e){return sE(e).getComputedStyle(e)}function TE(e){return uE(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function EE(e){if(oE(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||fE(e)&&e.host||cE(e);return fE(t)?t.host:t}function DE(e){let t=EE(e);return CE(t)?(e.ownerDocument||e).body:dE(t)&&pE(t)?t:DE(t)}function OE(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=DE(e),i=r===e.ownerDocument?.body,a=sE(r);if(i){let e=kE(a);return t.concat(a,a.visualViewport||[],pE(r)?r:[],e&&n?OE(e):[])}return t.concat(r,OE(r,[],n))}function kE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function AE(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:jE,platform:ME,maxTouchPoints:NE}=AE(),PE=jE.toLowerCase(),FE=ME.toLowerCase(),IE=/^i(os$|p)/.test(FE)||FE===`macintel`&&NE>1,LE=`android`,RE=FE===LE||PE.includes(LE),zE=!IE&&FE.startsWith(`mac`);FE.startsWith(`win`),!RE&&/^(linux|chrome os)/.test(FE);var BE=zE||IE,VE=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!VE&&PE.includes(`firefox`),!VE&&PE.includes(`chrom`);var HE=BE,UE=/jsdom|happydom/.test(PE);function WE(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function GE(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&fE(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function KE(e,t){let n=e;for(;n;){if(uE(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(fE(n)?n.host:null)}return null}function qE(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var JE=`data-base-ui-focusable`,YE=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,XE=`data-starting-style`,ZE=`data-ending-style`,QE={[XE]:``},$E={[ZE]:``},eD={transitionStatus(e){return e===`starting`?QE:e===`ending`?$E:null}},tD=`data-open`,nD=`data-closed`,rD=`data-anchor-hidden`,iD=`data-popup-open`,aD=`data-pressed`,oD={[iD]:``},sD={[iD]:``,[aD]:``},cD={[tD]:``},lD={[nD]:``},uD={[rD]:``},dD={open(e){return e?oD:null}},fD={open(e){return e?sD:null}},pD={open(e){return e?cD:lD},anchorHidden(e){return e?uD:null}},mD={...pD,...eD},hD=`data-trigger-disabled`;function gD(e,t){if(!uE(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(hD);for(let[,e]of t.entries())if(GE(e,n))return!e.hasAttribute(hD);return!1}function _D(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 vD(e){return e.matches(`html,body`)}function yD(e){return dE(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function bD(e){return KE(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${YE}`)!=null}function xD(e){return e?e.getAttribute(`role`)===`combobox`&&yD(e):!1}function SD(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function CD(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...CD(e,t.id,n)])}function wD(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 TD(e){e.preventDefault(),e.stopPropagation()}function ED(e){return`nativeEvent`in e}function DD(e){return e.pointerType===``&&e.isTrusted?!0:RE&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function OD(e){return UE?!1:!RE&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(RE||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function kD(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function AD(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var jD=Math.min,MD=Math.max,ND=Math.round,PD=Math.floor,FD=e=>({x:e,y:e}),ID={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function LD(e,t,n){return MD(e,jD(t,n))}function RD(e,t){return typeof e==`function`?e(t):e}function zD(e){return e.split(`-`)[0]}function BD(e){return e.split(`-`)[1]}function VD(e){return e===`x`?`y`:`x`}function HD(e){return e===`y`?`height`:`width`}function UD(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function WD(e){return VD(UD(e))}function GD(e,t,n){n===void 0&&(n=!1);let r=BD(e),i=WD(e),a=HD(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=eO(o)),[o,eO(o)]}function KD(e){let t=eO(e);return[qD(e),t,qD(t)]}function qD(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var JD=[`left`,`right`],YD=[`right`,`left`],XD=[`top`,`bottom`],ZD=[`bottom`,`top`];function QD(e,t,n){switch(e){case`top`:case`bottom`:return n?t?YD:JD:t?JD:YD;case`left`:case`right`:return t?XD:ZD;default:return[]}}function $D(e,t,n,r){let i=BD(e),a=QD(zD(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(qD)))),a}function eO(e){let t=zD(e);return ID[t]+e.slice(t.length)}function tO(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function nO(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:tO(e)}function rO(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 iO(e){return e.visibility===`hidden`||e.visibility===`collapse`}function aO(e,t=e?wE(e):null){return!e||!e.isConnected||!t||iO(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}function oO(e){return e?.ownerDocument||document}var sO=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function cO(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return fE(n)?n.host:null}function lO(e){for(let t of Array.from(e.children))if(oE(t)===`summary`)return t;return null}function uO(e,t){let n=lO(t);return!!n&&(e===n||GE(n,e))}function dO(e){let t=e?oE(e):``;return e!=null&&e.matches(sO)&&(t!==`summary`||e.parentElement!=null&&oE(e.parentElement)===`details`&&lO(e.parentElement)===e)&&(t!==`details`||lO(e)==null)&&(t!==`input`||e.type!==`hidden`)}function fO(e){if(!dO(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=cO(t)){let n=t!==e,r=oE(t)===`slot`;if(t.hasAttribute(`inert`)||n&&oE(t)===`details`&&!t.open&&!uO(e,t)||t.hasAttribute(`hidden`)||!r&&!pO(t,n))return!1}return!0}function pO(e,t){let n=wE(e);return t?n.display!==`none`:aO(e,n)}function mO(e){let t=e.tabIndex;if(t<0){let t=oE(e);if(t===`details`||t===`audio`||t===`video`||dE(e)&&e.isContentEditable)return 0}return t}function hO(e){if(oE(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function gO(e,t){let n=hO(e);if(!n)return!0;let r=t.find(e=>{let t=hO(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=hO(e);return t?.name===n.name&&t.form===n.form})===n}function _O(e){if(dE(e)&&oE(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dE(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function vO(e,t){_O(e).forEach(e=>{dO(e)&&t.push(e),vO(e,t)})}function yO(e,t,n){_O(e).forEach(e=>{dE(e)&&e.matches(t)&&n.push(e),yO(e,t,n)})}function bO(e){return fO(e)&&mO(e)>=0}function xO(e){let t=[];return vO(e,t),t.filter(fO)}function SO(e){let t=xO(e);return t.filter(e=>mO(e)>=0&&gO(e,t))}function CO(e,t){let n=SO(e),r=n.length;if(r===0)return;let i=WE(oO(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function wO(e){return CO(oO(e).body,1)||e}function TO(e){return CO(oO(e).body,-1)||e}function EO(e,t,n){if(!e)return null;let r=[];vO(oO(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(fO);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!GE(n,o)&&bO(o)&&gO(o,a))return o}return r[i]}function DO(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!GE(n,r)}function OO(e){SO(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function kO(e){let t=[];yO(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 AO=J.createContext(void 0),jO={disableStyleElements:!1};function MO(){return J.useContext(AO)??jO}var NO=`--scroll-area-corner-height`,PO=`--scroll-area-corner-width`,FO=`data-orientation`,IO={x:0,y:0},LO={width:0,height:0},RO={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},zO={x:!0,y:!0,corner:!0},BO=J.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=VO(i),d=XT(),f=rT(),p=rT(),{nonce:m,disableStyleElements:h}=MO(),[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(LO),[O,k]=J.useState(LO),[A,j]=J.useState(RO),[M,N]=J.useState(zO),P=J.useRef(null),F=J.useRef(null),ee=J.useRef(null),I=J.useRef(null),te=J.useRef(null),ne=J.useRef(null),re=J.useRef(null),ie=J.useRef(null),ae=J.useRef(0),oe=J.useRef(0),se=J.useRef(0),L=J.useRef(0),ce=J.useRef(`vertical`),le=J.useRef(IO),ue=J.useRef(null);function de(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let fe=Jw(e=>{let t=e.x-le.current.x,n=e.y-le.current.y;le.current=e,n!==0&&de(!0),t!==0&&de(!1)}),pe=Jw(()=>{let e=F.current;e&&ue.current===null&&(ue.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),me=Jw(e=>{if(e.button!==0||ie.current!==null&&(ce.current===`vertical`?te.current:ne.current)?.hasPointerCapture(ie.current))return;ie.current=e.pointerId,ae.current=e.clientY,oe.current=e.clientX,ce.current=e.currentTarget.getAttribute(FO);let t=F.current;t&&(se.current=t.scrollTop,L.current=t.scrollLeft,pe()),(ce.current===`vertical`?te.current:ne.current)?.setPointerCapture(e.pointerId)}),he=Jw(e=>{if(e.pointerId!==ie.current)return;ie.current=null,(ce.current===`vertical`?x:y)(!1),ue.current!==null&&(F.current&&(F.current.style.scrollSnapType=ue.current),ue.current=null);let t=ce.current===`vertical`?te.current:ne.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),ge=Jw(e=>{if(e.pointerId!==ie.current)return;if(e.buttons%2==0){he(e);return}let t=F.current;if(!t)return;let n=ce.current===`vertical`,r=n?te.current:ne.current,i=n?ee.current:I.current;if(!r||!i)return;let a=n?`y`:`x`,o=HT(i,`padding`,a),s=HT(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-ae.current:e.clientX-oe.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?se.current:L.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),de(n)});function _e(e){C(e.pointerType===`touch`)}function ve(e){if(_e(e),e.pointerType!==`touch`){let t=GE(P.current,e.target);_(t)}}let ye=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]),be={role:`presentation`,onPointerEnter:ve,onPointerMove:ve,onPointerDown:_e,onPointerLeave(){_(!1)},style:{position:`relative`,[NO]:`${E.height}px`,[PO]:`${E.width}px`}},xe=FT(`div`,e,{state:ye,ref:[t,P],props:[be,o],stateAttributesMapping:iE}),Se=J.useMemo(()=>({handlePointerDown:me,handlePointerMove:ge,handlePointerUp:he,handleScroll:fe,disableViewportSnap:pe,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:re,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:ee,scrollbarXRef:I,thumbYRef:te,thumbXRef:ne,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:ye,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[me,ge,he,fe,pe,E,O,w,S,v,b,g,d,M,A,ye,s,c,l,u]);return(0,X.jsxs)(oT.Provider,{value:Se,children:[!h&&WT.getElement(m),xe]})});function VO(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 HO=typeof document<`u`?J.useLayoutEffect:()=>{};function UO(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var WO=J.createContext(void 0);function GO(){let e=J.useContext(WO);if(e===void 0)throw Error(aT(55));return e}var KO=J.createContext(void 0);function qO(){return J.useContext(KO)?.direction??`ltr`}function JO(e,t){if(t<=0)return 0;let n=UO(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 YO(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var XO=`--scroll-area-overflow-x-start`,ZO=`--scroll-area-overflow-x-end`,QO=`--scroll-area-overflow-y-start`,$O=`--scroll-area-overflow-y-end`,ek=`--scroll-area-thumb-height`,tk=`--scroll-area-thumb-width`,nk=[XO,ZO,QO,$O],rk=!1;function ik(){rk||VE||(typeof CSS<`u`&&`registerProperty`in CSS&&nk.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),rk=!0)}var ak=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}=sT(),T=qO(),E=J.useRef(!0),D=J.useRef([NaN,NaN,NaN,NaN]),O=rT(),k=rT(),A=Jw(()=>{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=ok(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=JO(T===`rtl`?-w:w,P),I=P-ee);let te=A?0:JO(x,F),ne=A?0:F-te,re=j?0:b,ie=A?0:y,ae=0,oe=0;!j&&!A&&(ae=t?.offsetWidth||0,oe=n?.offsetHeight||0);let se=f.width===0&&f.height===0,L=se?ae:0,ce=se?oe:0,le=HT(n,`padding`,`x`),ue=HT(t,`padding`,`y`),de=HT(i,`margin`,`x`),fe=HT(r,`margin`,`y`),pe=re-le-de,me=ie-ue-fe,he=n?Math.min(n.offsetWidth-L,pe):pe,ge=t?Math.min(t.offsetHeight-ce,me):me,_e=Math.max(16,he*M),ve=Math.max(16,ge*N);if(m(e=>sk(e,{width:_e,height:ve})),t&&r){let e=ck(r,ek,x,F,h,ve,t.offsetHeight-ve-ue-fe);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-_e-le-de,t=ck(i,tk,T===`rtl`?-w:w,P,_,_e,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let ye=[ee,I,te,ne];nk.forEach((t,n)=>{e.style.setProperty(t,`${ye[n]}px`)}),a&&p(e=>sk(e,{width:ae,height:oe})),g(e=>sk(e,k));let be={xStart:!j&&ee>C.xStart,xEnd:!j&&I>C.xEnd,yStart:!A&&te>C.yStart,yEnd:!A&&ne>C.yEnd};S(e=>sk(e,be))});HO(()=>{ik()},[]),HO(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),HO(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),HO(()=>{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=YO(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(Zw))).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:WT.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=FT(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:iE}),P=J.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,X.jsx)(WO.Provider,{value:P,children:N})});function ok(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function sk(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function ck(e,t,n,r,i,a,o){let s=UO(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 lk(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var uk=J.createContext(void 0);function dk(){let e=J.useContext(uk);if(e===void 0)throw Error(aT(54));return e}var fk=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}=sT(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=qO(),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 lk(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=qE(e.nativeEvent),n=T?h.current:g.current;if(n&&GE(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=HT(n,`margin`,a),s=HT(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(${NO})`,insetInlineEnd:0,[ek]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${PO})`,bottom:0,[tk]:`${S.width}px`}}},M=FT(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:iE});return A?(0,X.jsx)(uk.Provider,{value:i,children:M}):null}),pk=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=GO(),{hasMeasuredScrollbar:s,viewportState:c}=sT(),l=J.useRef(null),u=J.useRef(s);return HO(()=>{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]),FT(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:iE,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),mk=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}=sT(),m=dk(),h=m===`vertical`;return FT(`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]})}),hk=Object.freeze({ease:`linear`,duration:0});function gk(e,t){let n=px(e,t.duration);return n<=0?hk:e.steps>0?{ease:yw(e.steps),duration:n}:{ease:vw({bounce:fx(e,t.bounce),duration:n}),duration:n}}function _k(e,t){let n=dx(e,t.duration);return{ease:e.steps>0?yw(e.steps):t.ease,duration:n}}function vk(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 yk(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 bk=(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:Q(`caps-surface`,e)})}),xk=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:Q(`caps-screen`,e)})}),Sk=(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)(bk,{...a,className:Q(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,X.jsx)(`div`,{className:Q(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,X.jsx)(xk,{className:Q(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:Q(`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:Q(`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:Q(`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 Ck=(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=bx();(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=lx(t),i=_k(r,{ease:`outQuad`,duration:45}),a=gk(r,{bounce:.18,duration:180});n=hw(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=vk(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=yk(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)(ak,{render:a?(0,X.jsx)(xk,{}):(0,X.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,X.jsx)(pk,{style:{minWidth:0},children:e})});return(0,X.jsxs)(BO,{render:n?(0,X.jsx)(bk,{size:r??`md`,depth:i??`shallow`}):(0,X.jsx)(`div`,{}),ref:c,className:Q(`caps-scroll-area`,t),children:[a?(0,X.jsx)(`div`,{className:`caps-display-gasket caps-scroll-display`,children:d}):d,(0,X.jsx)(bk,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,X.jsx)(fk,{className:`caps-scroll-track`,children:(0,X.jsx)(mk,{className:`caps-scroll-thumb`,children:(0,X.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})});function wk(e){let t=`${e.provider}/`;return e.model.startsWith(t)?e.model:`${t}${e.model}`}function Tk(e){return e<1e3?String(e):e<1e6?`${String(Math.round(e/1e3))}K`:`${String(Math.round(e/1e5)/10)}M`}function Ek(e){return e.window===null?Tk(e.tokens):`${Tk(e.tokens)}/${Tk(e.window)}`}var Dk=()=>void 0;function Ok(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 kk=[];for(let e=0;e<256;++e)kk.push((e+256).toString(16).slice(1));function Ak(e,t=0){return(kk[e[t+0]]+kk[e[t+1]]+kk[e[t+2]]+kk[e[t+3]]+`-`+kk[e[t+4]]+kk[e[t+5]]+`-`+kk[e[t+6]]+kk[e[t+7]]+`-`+kk[e[t+8]]+kk[e[t+9]]+`-`+kk[e[t+10]]+kk[e[t+11]]+kk[e[t+12]]+kk[e[t+13]]+kk[e[t+14]]+kk[e[t+15]]).toLowerCase()}var jk,Mk=new Uint8Array(16);function Nk(){if(!jk){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);jk=crypto.getRandomValues.bind(crypto)}return jk(Mk)}var Pk={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fk(e,t,n){if(Pk.randomUUID&&!t&&!e)return Pk.randomUUID();e||={};let r=e.random??e.rng?.()??Nk();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 Ak(r)}var Ik=Xe({version:`v7`}),Lk=R().regex(/^replay_[a-f0-9]{64}$/);fe(e=>Lk.safeParse(e).success);var Rk=Xe({version:`v4`});fe(e=>Ik.safeParse(e).success);var zk=fe(e=>Rk.safeParse(e).success);function Bk(){return zk.parse(Fk())}var Vk=un.mapFields(({extensionId:e,correlation:t})=>({extensionId:e,correlation:t})),Hk=W({meta:H(ar),origin:H(Vk),id:q,sequence:Pn.check(An(0)),commandId:br(q),value:ln}),Uk=Hn([`manual`,`threshold`,`overflow`]),Wk=W({queue:U([W({state:G(`idle`)}),W({state:G(`queued`),commandId:Cr,runningWork:br(U([W({kind:G(`session`),sessionId:Cr,commandId:Cr}),W({kind:G(`host`),lane:Cr,jobId:Cr})]))}),W({state:G(`running`),commandId:Cr})]),cancellationRequested:Mn,retry:br(W({attempt:Pn.check(An(0)),maxAttempts:Pn.check(An(0)),delayMs:Pn.check(Nn(0)),errorMessage:q,scheduledAt:Pn.check(Nn(0))})),activeTool:br(q),lastModelChoiceSequence:br(Pn.check(An(0))),compaction:br(W({trigger:Uk}))}),Gk=q,Kk=U([W({status:G(`running`),revision:Gk,value:ar,catalog:H(ar)}),W({status:G(`stopped`),revision:Gk,reason:q})]),qk=Ot(q,Kk),Jk=W({id:q,version:q,revision:Gk,status:Hn([`running`,`stopped`]),reason:br(q),stoppedAt:br(rn)}),Yk=W({commandId:q,outcome:Hn([`completed`,`cancelled`,`failed`,`interrupted`]),sequence:Pn.check(An(0)),diagnostic:br(q),meta:H(ar)}),Xk=W({id:q,sequence:Pn.check(An(0)),at:Pn.check(Nn(0)),tokensBefore:rn,tokensAfter:br(rn),trigger:br(Uk)}),Zk=W({id:q,sequence:Pn.check(An(0)),at:Pn.check(Nn(0)),trigger:Uk,result:Hn([`nothing_to_compact`,`failed`]),diagnostic:br(q)}),Qk=W({messageId:q,revision:Pn.check(Nn(0)),text:q,thinking:q,textTruncated:Mn,thinkingTruncated:Mn}),$k=W({total:Pn.check(Nn(0)),prompts:K(W({commandId:q,meta:H(ar),origin:H(Vk),text:q,images:H(K(vr)),delivery:Hn([`steer`,`followUp`])})),hasMore:Mn}),eA=W({tokens:Pn.check(Nn(0)),window:br(Pn.check(An(0)))}),tA=W({sessionId:q,cursor:br(q),hasMore:Mn,oldestCursor:H(br(q)),messages:K(Hk),terminals:K(Yk),sandboxFailures:H(K(jn)),compactions:H(K(Xk)),compactionNotices:H(K(Zk)),pending:$k,activity:Wk,progress:br(Qk),extensions:qk,attention:nn,context:H(eA)}),nA=U([W({kind:G(`update`),delivery:Hn([`replay`,`live`]),cursor:br(q),messages:K(Hk),terminals:K(Yk),sandboxFailures:H(K(jn)),compactions:H(K(Xk)),compactionNotices:H(K(Zk)),pending:$k,activity:Wk,extensions:qk,attention:nn,context:H(eA)}),W({kind:G(`progress`),progress:Qk,activity:Wk}),W({kind:G(`reset`),reason:G(`history_unavailable`),cursor:br(q),baseline:tA})]),rA=W({status:G(`accepted`),commandId:q}),iA=U([rA,W({status:G(`too_late`),commandId:q})]),aA=W({sessionId:q}),oA=hn(vn(tA),{onExcessProperty:`error`}),sA=hn(vn(nA),{onExcessProperty:`error`}),cA=hn(vn(rA)),lA=hn(vn(iA)),uA=hn(vn(aA)),dA=hn(vn(Zt)),fA=hn(vn(Jk)),pA=hn(vn(K(Jk))),mA=hn(vn(ar));function hA(e){return fA(e)}function gA(e){return pA(e)}function _A(e){return mA(e)}function vA(e){return cA(e)}function yA(e){return lA(e)}function bA(e){return uA(e)}function xA(e){return oA(e)}function SA(e){return sA(e)}function CA(e){let t=dA(e);return new Kt(t.boundary,t.cause,t.message,t.requestId)}var wA=hn(vn(W({sessions:K(U([W({sessionId:Cr,createdAt:rn,lastActivityAt:rn,settledAt:H(rn),title:q,state:Hn([`needs_you`,`running`,`errored`,`done`])}),W({sessionId:Cr,state:G(`unavailable`)})])),next:B(Cr)})));function TA(e){let t=wA(e);return{sessions:t.sessions,next:t.next}}var EA=hn(vn(W({sessionId:Cr}))),DA=hn(vn(W({deleted:Mn})));function OA(e){return DA(e).deleted}function kA(e){return EA(e).sessionId}function AA(e){return it(e).then(e=>{if(yr(e))return e.value;let t=Qe(kt(e.cause))??Xn(e.cause);return Promise.reject(t instanceof Error?t:Error(String(t)))})}function jA(e){let t=Re(e);if(yr(t))return t.value;let n=Qe(kt(t.cause))??Xn(t.cause);throw n instanceof Error?n:Error(String(n))}function MA(e){let t=xn(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 NA(e,t){function n(e){return AA(t.command(e))}return Object.freeze({address:e,command:n,abort:()=>AA(t.abort),send:(e,n)=>AA(t.send(e,n)),cancel:e=>AA(t.cancel(e)),modelPreference:Object.freeze({read:()=>AA(t.modelPreference.read),set:e=>AA(t.modelPreference.set(e))}),extension:e=>{let n=t.extension(e);return Object.freeze({call:(e,t)=>AA(n.call(e,t))})},read:e=>AA(t.read(e)),subscribe:e=>MA(t.subscribe(e)),watch:e=>AA(t.watch(e)).then(e=>Object.freeze({snapshot:e.snapshot,changes:MA(e.changes),close:()=>AA(e.close)}))})}function PA(e,t){let n=t??`local:${dn()}`;return Object.freeze({createSession:t=>AA(e.createSession(t)),deleteSession:t=>AA(e.deleteSession(t)),listSessions:t=>AA(e.listSessions(t)),extensions:Object.freeze({list:()=>AA(e.extensions.list),resume:t=>AA(e.extensions.resume(t)),call:(t,n,r)=>AA(e.extensions.call(t,n,r))}),session:t=>NA(`${n}/sessions/${encodeURIComponent(t)}`,e.session(t)),close:()=>AA(e.close)})}function FA(e){let t=`local:${dn()}`;return Object.freeze({...PA(e,t),grants:Object.freeze({deliver:(t,n)=>jA(e.grants.deliver(t,n)),read:t=>jA(e.grants.read(t))}),withMeta:n=>PA(e.withMeta(n),t)})}function IA(e=`Remote Shiitake operation is unavailable`){return new Kt(`runtime`,`unavailable`,e)}function LA(e){return new Kt(`runtime`,`invalid`,e)}function RA(){return new Kt(`runtime`,`closed`,`Shiitake client is closed`)}var zA=2,BA=hn(q);function VA(e){if(!(e instanceof MessageEvent))throw LA(`Session stream event is invalid`);return BA(e.data)}function HA(e){return e.kind===`source-error`?Ae(IA(`Session stream is unavailable`)):e.kind===`snapshot`?Me({try:()=>({kind:`snapshot`,value:xA(VA(e.event))}),catch:()=>LA(`Session snapshot is invalid`)}):e.kind===`frame`?Me({try:()=>({kind:`frame`,value:SA(VA(e.event))}),catch:()=>LA(`Session frame is invalid`)}):Me({try:()=>CA(VA(e.event)),catch:()=>LA(`Session runtime error is invalid`)}).pipe(mt(Ae))}function UA(e,t){return st(()=>{e.closed||(e.closed=!0,t.delete(e),e.source.close())})}function WA(e,t,n,r){return It(t=>nt(Me({try:()=>{let i={source:new(r??EventSource)(e),closed:!1},a=(e,n)=>{Dn(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===zA&&a(`source-error`,e)}),n.add(i),i},catch:()=>IA(`Session stream could not open`)}),e=>UA(e,n))).pipe(Bt(HA),lr(t.await))}function GA(e,t){return`${e}/sessions/${encodeURIComponent(t)}`}function KA(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 qA(e,t,n,r){return WA(e,t,n,r).pipe(Bt(e=>e.kind===`frame`?Ce(e.value):Ae(LA(`Session subscription received a snapshot`))))}function JA(e,t,n,r,a,o){return i(function*(){yield*n;let i=yield*xt(!1),s=yield*er();yield*st(()=>t.add(s)),yield*Ln(s,st(()=>{t.delete(s)}));let c=yield*Ne(WA(e,r,a,o).pipe(_n(xh()),Bn(s)));if(On(c))return yield*or(s,c),yield*he(c.cause);let[l,u]=c.value;if(C(l)||l.value.kind!==`snapshot`){let e=LA(`Session stream did not begin with a snapshot`);return yield*or(s,xr(e)),yield*Ae(e)}let d=u.pipe(Bt(e=>e.kind===`frame`?Ce(e.value):Ce({kind:`reset`,reason:`history_unavailable`,cursor:e.value.cursor,baseline:e.value})),lr(i.await),sn(e=>i.isOpen()&&Jt(e)?mn:Ut(e)));return Object.freeze({snapshot:l.value.value,changes:d,close:i.open.pipe(ve(or(s,Dt)))})})}function YA(e,t,n){return Ie({try:async t=>{let n=await e(t);return{response:n,body:await n.text()}},catch:()=>IA(`${n} request failed`)}).pipe(mt(({response:e,body:r})=>e.ok?Me({try:()=>t(r),catch:()=>LA(`${n} response is invalid`)}):Me({try:()=>CA(r),catch:()=>LA(`${n} error response is invalid`)}).pipe(mt(Ae))))}function XA(e){let t=e.baseUrl.replace(/\/+$/u,``),n=e.fetch??globalThis.fetch,r=new Set,i=new Set,a=In(!1),o=!1,s=We(()=>o?Ae(RA()):gt),c=(e,t,n)=>pe(YA(e,t,n),a.await.pipe(ve(Ae(RA())))),l=(e,t)=>s.pipe(ve(c(r=>n(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:r}),_A,`Extension command`)));return Object.freeze({createSession:e=>s.pipe(mt(()=>{let r=Zn({requestId:e});return c(e=>n(`${t}/sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({requestId:r}),signal:e}),kA,`Session creation`)})),deleteSession:e=>s.pipe(mt(()=>{let r=Ct(e);return c(e=>n(`${t}/sessions/${encodeURIComponent(r)}`,{method:`DELETE`,signal:e}),OA,`Session deletion`)})),listSessions:e=>s.pipe(mt(()=>{let r=new URLSearchParams;e!==void 0&&r.set(`after`,Nt(e));let i=r.size===0?``:`?${r.toString()}`;return c(e=>n(`${t}/sessions${i}`,{signal:e}),TA,`Session discovery`)})),extensions:Object.freeze({list:s.pipe(ve(c(e=>n(`${t}/extensions`,{signal:e}),gA,`Extension list`))),resume:e=>s.pipe(ve(c(r=>n(`${t}/extensions/${encodeURIComponent(e)}/resume`,{method:`POST`,signal:r}),hA,`Extension resume`))),call:(e,n,r)=>l(`${t}/extensions/${encodeURIComponent(e)}/commands/${encodeURIComponent(n)}`,r)}),session:o=>{let u=Ct(o),d=GA(t,u),f=`${d}/events`;function p(e){return s.pipe(ve(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`?vA:e.type===`cancel`?yA:e.type===`fork`?bA:()=>void 0,`Command`)))}return Object.freeze({command:p,abort:p({type:`abort`}),send:(e,t)=>st(()=>t?.requestId??dn()).pipe(mt(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 Kt(e.boundary,e.cause,e.message,n)))})),cancel:e=>p({type:`cancel`,...e}),modelPreference:Object.freeze({read:s.pipe(ve(c(e=>n(`${d}/model-preference`,{signal:e}),Rt,`Model preference read`))),set:e=>s.pipe(ve(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(ve(Me({try:()=>jt(e),catch:e=>e instanceof Kt?e:LA(`Read options are invalid`)})),mt(({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}),xA,`Session read`)})),subscribe:t=>en(s.pipe(ve(Me({try:()=>Jn(t),catch:e=>e instanceof Kt?e:LA(`Subscribe options are invalid`)})),F(({after:t,includeSandboxFailures:n})=>qA(KA(f,t,n===!0),a,i,e.eventSource)))),watch:t=>JA(t?.includeSandboxFailures===!0?`${f}?includeSandboxFailures=true`:f,r,s,a,i,e.eventSource)})},close:We(()=>o?gt:(o=!0,a.open.pipe(ve(ut([...r],e=>or(e,Dt),{discard:!0})),ve(ut([...i],e=>UA(e,i),{discard:!0})))))})}function ZA(e){return PA(XA(e),e.baseUrl.replace(/\/+$/u,``))}cn(ar);function QA(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=cn(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 $A=Pn.check(Nn(0)),ej=Pn.check(An(0)),tj=Ot(q,Rn),nj=W({id:Qh,label:Zh,input:B(tj)}),rj=W({...eg.fields,actions:B(K(nj).check(z(8)))}),ij=eg.check(Xt(e=>e.open===void 0,{message:`Client chips are display only`})),aj=W({...rj.fields,inspection:H(W({commandId:Qh,title:Zh,rows:K(ij).check(z(200))}))}),oj=W({id:Qh,order:rn.check(fr()),row:ij,compact:B(Zh)}),sj=W({id:Qh,sequence:ej,at:$A,commandId:br(q),rows:K(rj).check(z(200))}).check(Xt(e=>e.id===String(e.sequence),{message:`Client event identity must equal its sequence`})),cj=e=>new Set(e).size===e.length,lj=W({chips:K(oj).check(z(4)),panel:K(aj).check(z(16)),timeline:W({cells:K(sj).check(z(32)),omitted:$A}),waiting:br(W({summary:Zh,cancel:nj}))}).check(Xt(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`}),Xt(e=>cj(e.chips.map(e=>e.id))&&cj(e.panel.map(e=>e.id))&&e.panel.every(e=>cj((e.inspection?.rows??[]).map(e=>e.id)))&&cj(e.timeline.cells.map(e=>e.id))&&e.timeline.cells.every(e=>cj(e.rows.map(e=>e.id))),{message:`Client contribution contains duplicate identities`})),uj=W({protocol:G(`shiitake.client/v1`),id:Un,correlatedPrompts:H(G(`note`)),attach:H(zt(e=>be(e))),contribute:H(zt(e=>be(e)))}).check(Xt(e=>e.attach!==void 0||e.contribute!==void 0,{message:`Client entry requires attach or contribute`})),dj=hn(uj,{onExcessProperty:`error`});function fj(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=>tr(()=>r(e))}),i!==void 0&&Object.assign(n,{contribute:t=>i(QA(e,t))}),Object.freeze(dj(n))}var pj=`whistle.catalog/v1`,mj=128,hj=16,gj=$e({protocol:n(pj),commands:w(Bi).max(mj)}).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:pj,commands:Object.freeze(e.commands)})}),_j=e=>gj.parse(e),vj=ue(`type`,[$e({type:n(`done`),notice:Ji.optional(),result:Ti.optional()}).strict(),$e({type:n(`prompt`),prompt:qi,notice:Ji.optional(),next:$e({arguments:Ei,answer:R().min(1).max(120)}).strict()}).strict()]).transform(e=>Object.freeze(e)),yj=e=>vj.parse(e);function bj(e,t){if(t.arguments!==void 0)try{return Oi(t.arguments)}catch{throw new Dr(`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=>Oi(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 xj(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 bj(e,n);if(a===void 0)return{cancelled:!0};for(let n=0;n<hj;n+=1){r.throwIfAborted();let n=yj(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 Dr(`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 Dr(`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 Sj=hn(lj,{onExcessProperty:`error`});function Cj(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 wj(e,t){let n=Cj(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=_j(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 Tj(e,t){try{let n=Sj(e(t));return wj(n,t),{status:`admitted`,value:n}}catch(e){return{status:`failed`,error:e instanceof Error?e:Error(`Client contribution failed`,{cause:e})}}}function Ej(e,t){let n=e.map(e=>dj(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=Tj(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 Dj(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=Yi(e),s=Qi(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=Xi(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 Oj(){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=Dj({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 kj(e){return`init`in e}function Aj(e){return typeof e.write==`function`}function jj(e){return!!e.onMount}function Mj(e){return`v`in e||`e`in e}function Nj(e){if(`e`in e)throw e.e;return e.v}function Pj(e){return typeof e?.then==`function`}function Fj(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 Ij(e,t,n){if(!n.p.has(e)){n.p.add(e);let r=()=>n.p.delete(e);t.then(r,r)}}function Lj(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 Rj(e){return!!e.INTERNAL_onInit}var zj=(e,t,n,...r)=>n.read(...r),Bj=(e,t,n,...r)=>n.write(...r),Vj=(e,t,n)=>n.INTERNAL_onInit(t),Hj=(e,t,n,r)=>n.onMount?.call(n,r),Uj=(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),Rj(n)&&s(e,t,n)}return a},Wj=(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)},Gj=(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 Lj(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)}},Kj=(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(Mj(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(!Mj(n)){if(kj(r))g(e,t,r,r.init);else throw Error(`no atom init`)}return Nj(n)}let o=p(e,t,r);try{return Nj(o)}finally{S.delete(r),y.d.set(r,o.n),Pj(y.v)&&Ij(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&&Aj(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),Pj(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(Fj(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))}},qj=(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 Lj(n,s,r)){let n=a(e,t,c);i.get(c)!==n.n&&(i.set(c,n.n),o.push(c))}}},Jj=(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=>Nj(u(e,t,n)),v=(r,...o)=>{var u;let _=s(e,t,r);try{if(r===n){if(!kj(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}},Yj=(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))}},Xj=(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),Aj(n)&&jj(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},Zj=(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},Qj=(e,t,n,r)=>{let i=e[11],a=e[27],o=i(e,t,n),s=`v`in o,c=o.v;if(Pj(r))for(let a of o.d.keys())Ij(n,r,i(e,t,a));o.v=r,delete o.e,(!s||!Object.is(c,o.v))&&(++o.n,Pj(c)&&a(e,t,c))},$j=(e,t,n)=>{let r=e[14];return Nj(r(e,t,n))},eM=(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))}},tM=(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)}},nM=(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)},rM=(e,t,n)=>{e[25].get(n)?.forEach(e=>e())},iM=new WeakMap;function aM(...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,{},zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj,Zj,Qj,$j,eM,tM,void 0,new WeakMap,nM,rM,[0]].map((t,n)=>e[n]||t);iM.set(t,Object.freeze(n));let r=n[21],i=n[22],a=n[23];return t}var oM=0;function sM(e,t){let n=`atom${++oM}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=cM,r.write=lM),t&&(r.write=t),r}function cM(e){return e(this)}function lM(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}function uM(){return aM()}var dM=sM(new So),fM=(e,t,n)=>e?.suspense&&pM(t),pM=(e,t)=>e.isPending&&!0,mM=({result:e,throwOnError:t,query:n})=>e.isError&&!e.isFetching&&hM(t,[e.error,n]);function hM(e,t){return typeof e==`function`?e(...t):!!e}var gM=e=>e.suspense&&typeof e.staleTime!=`number`?{...e,staleTime:1e3}:e;function _M(e,t,n=e=>e(dM)){let r=sM(0),i=sM(n),a=sM(()=>new WeakMap),o=sM(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),gM(o)}),s=sM(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=sM(e=>{let t=e(s),n=e(o),r=sM(t.getOptimisticResult(n));return r.onMount=e=>{let n=t.subscribe(Wa.batchCalls(e));return()=>{t.getCurrentResult().isError&&t.getCurrentQuery().reset(),n()}},r});return sM(e=>{e(r);let t=e(s),n=e(o),i=e(e(c));if(fM(n,i))return t.fetchOptimistic(n);if(mM({result:i,query:t.getCurrentQuery(),throwOnError:n.throwOnError}))throw i.error;return i},(e,t)=>{t(r,e=>e+1)})}function vM(e,t=e=>e(dM)){return _M(e,oo,t)}function yM(e,t=e=>e(dM)){return _M(e,po,t)}function bM(e,t=e=>e(dM)){let n=Symbol(),r=sM(n=>{let r=t(n),i=e(n);return r.defaultMutationOptions(i)}),i=sM(()=>new WeakMap),a=sM(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 vo(o,a);return s.set(o,l),l}),o=sM(e=>{let t=e(a),n=sM(t.getCurrentResult());return n.onMount=e=>(t.subscribe(Wa.batchCalls(e)),()=>{t.reset()}),n}),s=sM(e=>{let t=e(a);return(e,n)=>{t.mutate(e,n).catch(xM)}});return sM(e=>{let t=e(a),n=e(e(o)),r=e(s);if(n.isError&&hM(t.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:r,mutateAsync:n.mutate}})}function xM(){}var SM=160,CM=200;function wM(e,t){return e.replace(/\s+/gu,` `).trim().slice(0,t)}function TM({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:wM(n.diagnostic??(n.outcome===`interrupted`?`Run was interrupted`:`Run failed without a diagnostic`),CM)}:{kind:`waiting_for_you`}}function EM(e){let{activity:t,progress:n}=e,{queue:r}=t;return r.state===`idle`?TM(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:wM(t.retry.errorMessage,SM),nextRetryAt:t.retry.scheduledAt+t.retry.delayMs}:{kind:`compacting`,trigger:t.compaction.trigger}}function DM(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 OM(e){let t=e.runningWork;return t===null?`Queued for host`:t.kind===`session`?`Waiting for Session ${wM(t.sessionId,256)}`:`Waiting for host job ${wM(t.lane,256)} · ${wM(t.jobId,256)}`}function kM(e,t){return e.kind===t.kind?e.kind===`queued`&&t.kind===`queued`?e.queuedCommandId===t.queuedCommandId&&DM(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 AM(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 jM=new WeakMap;function MM(e){let t=jM.get(e);if(t!==void 0)return t;let n=new Set(e.map(({id:e})=>e));return jM.set(e,n),n}function NM(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 PM(e,t){return NM(e,t)}function FM(e,t){return e===null||MM(t).has(e.messageId)?null:e}function IM(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 LM(e,t){return NM(e,t)}function RM(e,t){return NM(e,t)}function zM(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 BM(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 VM(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`||DM(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 HM(e,t){return e===t||JSON.stringify(e)===JSON.stringify(t)}function UM(e,t){if(t.kind===`reset`)return{...t.baseline,terminals:IM([],t.baseline.terminals),compactions:LM([],t.baseline.compactions??[]),compactionNotices:RM([],t.baseline.compactionNotices??[])};if(t.kind===`progress`){let n=MM(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=VM(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=BM(e.pending,t.pending)?e.pending:t.pending,r=PM(e.messages,t.messages),i=IM(e.terminals,t.terminals),a=e.compactions??[],o=LM(a,t.compactions??[]),s=e.compactionNotices??[],c=RM(s,t.compactionNotices??[]),l=t.activity.queue.state===`idle`?null:FM(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&&HM(t.extensions,e.extensions)&&zM(t.attention,e.attention)&&t.cursor===e.cursor&&VM(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:VM(e.activity,t.activity)?e.activity:t.activity,pending:n,attention:zM(t.attention,e.attention)?e.attention:t.attention,extensions:HM(t.extensions,e.extensions)?e.extensions:t.extensions};return u===void 0?d:{...d,context:u}}var WM=ye(R(),me());function GM(e){return e.text.trim()!==``||(e.thinking?.trim()??``)!==``}var KM=[[`*** Add File: `,`add`],[`*** Delete File: `,`delete`],[`*** Update File: `,`update`]],qM=/^\*\*\* Move to: (.+)$/u;function JM(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 YM(e){let t=[],n;for(let r of e.split(`
32
- `)){let e=KM.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=qM.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=JM(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 XM=131072,ZM=new TextEncoder,QM=R().min(1).max(4096).refine(e=>!e.includes(`\0`),`Path cannot contain null bytes`);function $M(e=0){return R().min(e).refine(e=>ZM.encode(e).byteLength<=XM,`Text exceeds the ${String(XM)}-byte Files bound`)}Ye({path:QM,offset:qe().int().min(0).default(0),limit:qe().int().min(4).max(XM).default(XM)});var eN=Ye({path:QM,content:$M(),offset:qe().int().min(0),nextOffset:qe().int().min(0).nullable(),truncated:S(),file:Ye({computerId:R().min(1).max(256),path:QM.refine(e=>e.startsWith(`/`),`Computer file paths must be absolute`)}).exactOptional()}),tN=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 tN{};function nN(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 rN(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 iN(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 aN(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 oN(e,t){return iN(e,t,``)}function sN(e,t){return aN(e,t,``)}function cN(e,t){return t.slice(0,lN(e,t))}function lN(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 uN(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 dN(e,t){if(t)return pN(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function fN(e,t){if(t)return pN(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function pN(e,t){if(!t)return[fN(e),dN(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=uN(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var mN=`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}`,hN=RegExp(`[${mN}]+|\\s+|[^${mN}]`,`ug`);new class extends tN{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=uN(e,r)}else n=e.match(hN)||[];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)&&gN(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&gN(n,i,r,null,t.intlSegmenter),e}};function gN(e,t,n,r,i){if(t&&n){let[a,o]=pN(t.value,i),[s,c]=pN(n.value,i);if(e){let r=nN(a,s);e.value=aN(e.value,s,r),t.value=oN(t.value,r),n.value=oN(n.value,r)}if(r){let e=rN(o,c);r.value=iN(r.value,c,e),t.value=sN(t.value,e),n.value=sN(n.value,e)}}else if(n){if(e){let e=fN(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=fN(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=fN(r.value,i),[a,o]=pN(t.value,i),s=nN(n,a);t.value=oN(t.value,s);let c=rN(oN(n,s),o);t.value=sN(t.value,c),r.value=iN(r.value,n,c),e.value=aN(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=fN(r.value,i),n=cN(dN(t.value,i),e);t.value=sN(t.value,n)}else if(e){let n=cN(dN(e.value,i),fN(t.value,i));t.value=oN(t.value,n)}}new class extends tN{tokenize(e){let t=RegExp(`(\\r?\\n)|[${mN}]+|[^\\S\\n\\r]+|[^${mN}]`,`ug`);return e.match(t)||[]}};var _N=new class extends tN{constructor(){super(...arguments),this.tokenize=yN}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 vN(e,t,n){return _N.diff(e,t,n)}function yN(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 bN(e){return e==`.`||e==`!`||e==`?`}new class extends tN{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(bN(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 tN{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends tN{constructor(){super(...arguments),this.tokenize=yN}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(xN(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 xN(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]=xN(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]=xN(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends tN{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function SN(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 CN={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function wN(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;vN(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(vN(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||EN(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 TN(e,t){if(t||=CN,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=>TN(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 EN(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 DN=512,ON=256;new TextEncoder,Ye({path:QM,limit:qe().int().min(1).max(ON).default(ON)});var kN=Ye({path:QM,name:R().min(1),type:c([`file`,`directory`,`symlink`]),size:qe().int().nonnegative(),modifiedAt:qe()});Ye({path:QM,entries:w(kN).max(ON),truncated:S()}),Ye({path:QM,pattern:R().min(1).max(DN),limit:qe().int().min(1).max(ON).default(ON)}),Ye({path:QM,matches:w(QM).max(ON),truncated:S()}),Ye({path:QM,pattern:R().min(1).max(DN),regex:S().default(!1),ignoreCase:S().default(!1),limit:qe().int().min(1).max(ON).default(ON)}),Ye({path:QM,matches:w(Ye({path:QM,line:qe().int().positive(),text:R()})).max(ON),truncated:S()}),Ye({path:QM,oldText:$M(1),newText:$M()});var AN=Ye({path:QM,bytes:qe().int().nonnegative(),diff:R(),firstChangedLine:qe().int().positive().nullable(),unifiedPatch:R().nullable(),unifiedPatchBytes:qe().int().nonnegative(),unifiedPatchAddedLines:qe().int().nonnegative(),unifiedPatchRemovedLines:qe().int().nonnegative(),unifiedPatchTruncated:S()}),jN=Ye({status:n(`failed`),error:Ye({kind:c([`not-found`,`ambiguous`,`file-too-large`,`partial-character`,`unchanged`,`conflict`]),path:QM,message:R()})});at([AN,jN]),new Intl.Segmenter(void 0,{granularity:`grapheme`});function MN({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 NN=MN();function PN(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(NN,``)}function FN(e,t){console.error(JSON.stringify({event:`parakeet_operation_failed`,operation:e,causeKind:t instanceof Error?`error`:`non_error`}),Kn(t))}function IN(e){return e===`error`?`error`:e===`unknown`?`neutral`:e===`running`?`info`:`success`}var LN={code:`computer`,command:`run`,edit:`write`,other:`working`,read:`read`,search:`list`},RN=40,zN=6,BN=400,VN=72,HN=new Map([[`apply_patch`,`edit`],[`bash`,`command`],[`edit`,`edit`],[`execute`,`code`],[`find`,`search`],[`grep`,`search`],[`ls`,`search`],[`read`,`read`],[`write`,`edit`]]),UN={code:[`Ran script`,`Running script`],command:[`Ran`,`Running`],edit:[`Updated`,`Updating`],other:[`Called`,`Calling`],read:[`Read`,`Reading`],search:[`Searched`,`Searching`]},WN=De({path:R()}),GN=De({file_path:R()}),KN=De({command:R()}),qN=De({code:R()}),JN=De({patch:R()}),YN=De({pattern:R()}),XN=De({oldText:R(),newText:R()}),ZN=De({content:R()}),QN=R(),$N=De({content:R(),offset:qe().int().min(0).optional()}),eP=De({matches:w(De({path:R(),line:qe().int(),text:R()}))}),tP=De({stdout:R().optional(),stderr:R().optional(),exitCode:qe().int().nullable().optional()}).refine(e=>e.stdout!==void 0||e.stderr!==void 0||e.exitCode!==void 0),nP=Ye({path:R(),bytes:qe().int().nonnegative(),diff:R(),firstChangedLine:qe().int().positive().nullable(),unifiedPatch:R().nullable(),unifiedPatchBytes:qe().int().nonnegative(),unifiedPatchAddedLines:qe().int().nonnegative(),unifiedPatchRemovedLines:qe().int().nonnegative(),unifiedPatchTruncated:S()}),rP=/^(.+?:\d+)[:-]\s?(.*)$/u;function iP(e){return HN.get(e)??`other`}function aP(e){let t=e.split(`
45
- `).map(e=>e.trim()).find(e=>e!==``)??``;return t.length>VN?`${t.slice(0,71)}…`:t}function oP(e){return e.slice(0,BN)}function sP(e){return oP(PN(e).replace(/\n$/u,``).split(`
46
- `))}function cP(e){let t=WN.safeParse(e);if(t.success)return t.data.path;let n=GN.safeParse(e);return n.success?n.data.file_path:void 0}function lP(e){try{return{kind:`parsed`,value:JSON.parse(e)}}catch(e){return{kind:`invalid`,cause:e}}}function uP(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=lP(t);if(n.kind===`invalid`)return{kind:`text`,text:t};let r=n.value,i=QN.safeParse(r);if(i.success)return{kind:`text`,text:i.data};let a=me().safeParse(r);return a.success?{kind:`json`,value:a.data}:{kind:`text`,text:t}}function dP(e,t){let n=t===void 0||t===0;return{kind:`excerpt`,lines:sP(e).map((e,t)=>n?{number:t+1,text:e}:{text:e}),preview:12}}function fP(e){return{kind:`matches`,matches:sP(e).filter(e=>e.trim()!==``).map(e=>{let t=rP.exec(e);return t===null?{location:``,text:e}:{location:t[1]??``,text:t[2]??``}}),preview:12}}function pP(e,t){let n=[];if(e!==void 0&&e.trim()!==``)for(let t of sP(e))n.push({stream:`stdout`,text:t});if(t!==void 0&&t.trim()!==``)for(let e of sP(t))n.push({stream:`stderr`,text:e});return n.length===0?void 0:{kind:`output`,lines:oP(n),preview:12}}function mP(e,t){return{kind:`text`,label:t,language:`json`,lines:sP(JSON.stringify(e,null,2)),preview:12}}function hP(e,t){if(e.kind===`none`)return{sections:[]};if(e.kind===`text`){if(t===`read`)return{sections:[dP(e.text,void 0)]};if(t===`search`)return{sections:[fP(e.text)]};if(t===`command`){let t=pP(e.text,void 0);return{failure:aP(e.text),sections:t===void 0?[]:[t]}}return{failure:aP(e.text),sections:[{kind:`text`,lines:sP(e.text),preview:12}]}}let n=$N.safeParse(e.value);if(n.success)return{sections:[dP(n.data.content,n.data.offset)]};let r=eP.safeParse(e.value);if(r.success)return{sections:[{kind:`matches`,matches:oP(r.data.matches).map(e=>({location:`${e.path}:${String(e.line)}`,text:PN(e.text)})),preview:12}]};let i=jN.safeParse(e.value);if(i.success)return{failure:i.data.error.message,sections:[{kind:`text`,lines:[i.data.error.message],preview:12}]};let a=nP.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=SN(e),n=t[0];if(t.length===1&&n?.oldFileName===a.data.path&&n.newFileName===a.data.path)return{sections:[vP([{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=xP.get(e.charAt(0));return t===void 0?[]:[{kind:t,text:e.slice(1)}]})}))}])]}}catch(e){FN(`render tool patch`,e)}}let o=tP.safeParse(e.value);if(o.success){let{stdout:e,stderr:t,exitCode:n}=o.data,r=pP(e,t),i=n!=null&&n!==0;return{exitCode:i?n:void 0,failure:t!==void 0&&t.trim()!==``?aP(PN(t)):i?`Exited with code ${String(n)}`:void 0,sections:r===void 0?[]:[r]}}return{sections:[mP(e.value)]}}var gP={add:`Add`,delete:`Delete`,update:`Update`};function _P(e){let t=e.length>1;return e.flatMap(e=>[...t?[{kind:`file`,text:`${gP[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 vP(e){return{kind:`diff`,files:e,lines:oP(_P(e)),preview:RN}}var yP={add:`+`,context:` `,remove:`-`};function bP(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=>`${yP[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?``:TN(i)}})}var xP=new Map([[`+`,`add`],[`-`,`remove`],[` `,`context`]]);function SP(e,t,n){let r=e??`file`,i=wN(r,r,t,n,``,``,{context:3});return{lineNumbers:!0,unified:TN(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=xP.get(e.charAt(0));return t===void 0?[]:[{kind:t,text:e.slice(1)}]})})),operation:t===``?`add`:`update`,path:e}}function CP(e,t){let n=JN.safeParse(e.args);if(n.success){let t=YM(n.data.patch),r=[...new Set(t.flatMap(e=>e.path?[e.path]:[]))];return{get input(){return[vP(bP(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=XN.safeParse(e.args);if(i.success)return{...r,get input(){return[vP([SP(t,i.data.oldText,i.data.newText)])]}};let a=ZN.safeParse(e.args);return{...r,get input(){return a.success?[vP([SP(t,``,a.data.content)])]:[]}}}function wP(e){return{get input(){return Object.keys(e.args).length===0?[]:[mP(e.args,`Arguments`)]},label:e.name,paths:[]}}function TP(e,t){let n=cP(e.args);switch(t){case`code`:{let t=qN.safeParse(e.args);return t.success?{get input(){return[{kind:`script`,lines:sP(t.data.code),preview:zN}]},label:aP(t.data.code),paths:[]}:wP(e)}case`command`:{let t=KN.safeParse(e.args);return t.success?{get input(){return[{kind:`command`,lines:sP(t.data.command),preview:zN}]},label:aP(t.data.command),paths:[]}:wP(e)}case`edit`:return CP(e,n);case`read`:return{input:[],label:n??e.name,paths:n===void 0?[]:[n]};case`search`:{let t=YN.safeParse(e.args);return{input:[],label:aP(t.success?n===void 0?t.data.pattern:`${t.data.pattern} in ${n}`:n??`.`),paths:[]}}case`other`:return wP(e)}}function EP(e){let t=iP(e.name),n=TP(e,t),[r,i]=UN[t],a=e.status===`completed`?uP(e.result):void 0,o=a?.kind===`json`&&jN.safeParse(a.value).success,s,c=()=>{if(s!==void 0)return s;let r=hP(uP(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 DP(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 OP={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 kP(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]=OP[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 AP(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 jP(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 MP(e){let t=e.map(EP),n=AP(t);return{active:[...t].reverse().find(e=>e.status===`running`),calls:t,durationMs:n===`running`?void 0:jP(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}`:kP(t),tools:e}}function NP(e){let t=[],n=[],r=[],i=()=>{let[e,...i]=n;e!==void 0&&t.push(MP([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`&&!GM(a)&&n.length>0){r.push(a);continue}i(),t.push(a)}return i(),t}var PP=Object.freeze({mode:`default`,overrides:new Map});function FP(e){return e.status!==`completed`}function IP(e,t){return t?e.calls:e.calls.slice(-3)}function LP(e){return e.status===`error`}function RP(e,t,n){let r=e.overrides.get(t);return r===void 0?e.mode==="default"?n:e.mode===`expanded`:r}function zP(e,t,n){let r=new Map(e.overrides);return r.set(t,!RP(e,t,n)),{...e,overrides:r}}function BP(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 VP=()=>void 0;function HP(e,t){return t===void 0?e:{...e,requestId:t}}function UP(e){return Array.isArray(e)?e.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
48
- `):e}function WP(e,t){return{args:WM.parse(e.arguments),id:e.id,kind:`tool`,name:e.name,startedAt:t,status:`unknown`}}function GP(e){let t={id:e.messageId,kind:`assistant_message`,pending:!0,text:e.text};return e.thinking===``?t:{...t,thinking:e.thinking}}function KP(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(WP(i,e.timestamp));return{text:t,thinking:n,tools:r}}function qP(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 JP(e,t,n){let r=KP(t),i=qP(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 YP(e,t,n){for(let r of n.items)r.kind===`tool`&&t.set(r.id,e.length),e.push(r)}function XP(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 ZP(e,t=[],n,r=Dk,i=VP,a=[]){let o=[],s=new Map,c=new Set,l=new Map,u,d=0,f=0;for(let n of BP(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:UP(t.content),author:r(e.meta),origin:e.origin};o.push(HP(a,i(n)));break}case`assistant`:{let n=JP(e.id,t,r(e.meta));u=n.model,d+=n.usage.tokens,f+=n.usage.cost,YP(o,s,n);break}case`toolResult`:if(XP(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=NP(o),h=new Map;for(let e of m){if(e.kind===`assistant_message`&&!GM(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:MM(e),items:m,commandIds:c};return u===void 0?g:{...g,model:u,usage:{cost:f,tokens:d}}}function QP(e,t,n,r=[],i=Dk,a=VP){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(HP(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?[]:[GP(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 $P=Object.freeze({observation:`connecting`,snapshot:void 0,latestPrompt:void 0}),eF=200,tF=400;function nF(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*rF(e,t){yield{kind:`opening`};let n=await e.watch({limit:eF}),r,i=()=>(r??=n.close(),r),a=()=>{i().catch(e=>{FN(`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=UM(r,t),r.messages.length>tF?(r=await e.read({limit:eF}),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 iF(e,t){if(t.kind===`opening`)return{...e,observation:`connecting`};if(t.kind===`snapshot`)return{observation:`live`,snapshot:t.value,latestPrompt:nF(t.value.messages,e.latestPrompt)};if(e.snapshot===void 0)return t.value.kind===`reset`?{observation:`live`,snapshot:t.value.baseline,latestPrompt:nF(t.value.baseline.messages)}:e;let n=UM(e.snapshot,t.value);return{observation:`live`,snapshot:n,latestPrompt:nF(n.messages,e.latestPrompt)}}function aF(e){return Ro({queryKey:[`shiitake-session`,e.address],queryFn:Co({streamFn:({signal:t})=>rF(e,t),reducer:iF,initialValue:$P,refetchMode:`append`}),refetchOnMount:`always`,retry:!1,staleTime:1/0})}function oF(e,t,n){e.setQueryData(aF(t).queryKey,{observation:`connecting`,snapshot:n,latestPrompt:nF(n.messages)})}function sF(e,t=null){let n={before:t,newerBefore:[],newerOverflow:!1};return zo({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 cF(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 lF(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],cF(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,keys:t.get(e.commandId)??[],availability:e.availability}))}function uF(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?cF(n.binding):`${e.keys}, ${cF(n.binding)}`,title:n.title,order:e?.order??n.order})}return[...t.values()]}function dF(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 fF(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:dF(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 pF(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 mF(e,t,n,r){return e.map(e=>({entry:e,match:pF(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}))}function hF(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:mF(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>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 gF=new WeakMap;function _F(e){return e.status===`handled`&&De({cancelled:n(!0)}).safeParse(e.result).success}async function vF(e,t,n,r){let i=fF(lF(t.snapshot()),e);if(i.kind===`prompt`){n();return}if(i.kind===`invalid`)return{status:`failed`,error:{code:`invalid_arguments`,message:i.message}};let{command:a,requestIdField:o}=i;if(i.arguments===void 0)return t.execute(a.commandId,{origin:r});if(o===void 0)return t.execute(a.commandId,{origin:r,arguments:i.arguments});let s=gF.get(t)??new Map;gF.set(t,s);let c=s.get(a.commandId);if(c?.draft===e&&c.running!==void 0)return c.running;let l={draft:e,requestId:c?.draft===e?c.requestId:dn()};s.set(a.commandId,l);let u=t.execute(a.commandId,{origin:r,arguments:{...i.arguments,[o]:l.requestId}}).then(e=>s.get(a.commandId)===l?(l.running=void 0,e.status===`handled`&&!_F(e)&&s.delete(a.commandId),e):e);return l.running=u,u}var yF=Object.freeze([]),bF=Object.freeze([]),xF=Object.freeze([]),SF=Object.freeze([]),CF=Object.freeze([]),wF=Object.freeze({}),TF=Object.freeze({total:0,hasMore:!1,prompts:Object.freeze([])}),EF=Object.freeze({status:`connecting`}),DF=Object.freeze({status:`live`}),OF=32;function kF(e){return e instanceof Error&&e.message.trim().length>0?e.message:`Prompt admission failed`}function AF(e){return(e instanceof Error&&e.message.trim().length>0?e.message.trim():`Session history is unavailable`).slice(0,500)}function jF(e,t,n){if(e===void 0)return`connecting`;let r=EM(e),i=AM(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 MF(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 NF(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 PF(e,t,n){let r=vM(()=>aF(e),()=>t),i=sM(e=>e(r).data?.snapshot),a=sM(void 0),o=sM(e=>(e(a)??e(i))?.oldestCursor??null),s=yM(t=>sF(e,t(o)),()=>t),c=sM(e=>{let t=e(s);return t.data===void 0?e(o)!==null:t.hasNextPage}),l=sM(e=>e(s).isFetching),u=sM(e=>{let t=e(s);return t.hasPreviousPage||t.data?.newerOverflow===!0}),d=sM(null,e=>{!e(c)||e(l)||e(s).fetchNextPage({cancelRefetch:!1,throwOnError:!0}).catch(e=>{e instanceof Ja||FN(`read older Session history`,e)})}),f=sM(null,(n,r)=>{r(a,void 0),t.resetQueries({queryKey:sF(e).queryKey,exact:!0})}),p=sM(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 Ja||FN(`read newer Session history`,e)})}}),m=sM(null,(e,t)=>{e(a)===void 0&&t(a,e(i))}),h=sM(e=>{let t=e(s),n=e(i)?.messages??yF,r=t.data?.pages.flatMap(e=>e.messages)??yF,o=e(a)?.messages??yF;return r.length===0?o.length===0?n:PM(o,n):e(u)?r:PM(PM(r,o),n)}),g=sM(e=>{let t=e(s),n=e(i)?.compactions??bF,r=t.data?.pages.flatMap(e=>e.compactions??bF)??bF,o=e(a)?.compactions??bF;return r.length===0?o.length===0?n:LM(o,n):e(u)?r:LM(LM(r,o),n)}),_=sM(e=>{let t=e(s),n=e(i)?.compactionNotices??xF,r=t.data?.pages.flatMap(e=>e.compactionNotices??xF)??xF,o=e(a)?.compactionNotices??xF;return r.length===0?o.length===0?n:RM(o,n):e(u)?r:RM(RM(r,o),n)}),v=sM(e=>e(r).data?.latestPrompt?.[0]??MF(e(h))),y=sM(e=>e(i)?.pending??TF),b=sM(e=>e(i)?.extensions??wF),x,S=sM(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=sM(new Map),w=sM(e=>{let t=e(C);return e=>t.get(e)}),T=sM(e=>ZP(e(h),e(g),e(S),n,e(w),e(_))),E=sM(``),D=sM(0),O=sM([]),k=sM(void 0),A=sM(e=>new Set([...e(T).commandIds,...e(y).prompts.map(({commandId:e})=>e),...e(i)?.terminals.map(({commandId:e})=>e)??[]])),j=sM(e=>{let t=e(A);return e(O).filter(e=>e.status===`failed`||e.commandId===void 0||!t.has(e.commandId))}),M=sM(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=sM(void 0),P=sM(null,(e,t,n)=>{e(E)!==n&&t(D,e=>e+1),t(E,n),t(N,void 0)}),F=sM(null,(e,t,n)=>{e(D)===n.revision&&t(E,e=>e===n.draft?``:e)}),ee=bM(()=>({mutationFn:t=>e.command({type:`cancel`,commandId:t})}),()=>t),I=sM(e=>{if(e(u))return[];let t=e(i),r=e(y);return QP(e(T),t?.progress??null,r.prompts,e(j),n,e(w))}),te=sM(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}}),ne=sM(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&&AM(EM(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}),re=sM(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`?DF:EF}),ie=sM(e=>e(re).status===`unavailable`?`disconnected`:e(re).status===`connecting`?`connecting`:jF(e(i),e(j),e(ne))),ae=sM(e=>e(i)?.context),oe=sM(e=>{let t=e(i)?.activity.queue;return t?.state===`idle`?void 0:t?.commandId}),se,L=sM(e=>{let t=e(re);if(t.status===`unavailable`)return{kind:`disconnected`,cause:t.reason};if(t.status===`connecting`)return{kind:`connecting`};if(e(ne)===`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=EM(n);return se!==void 0&&kM(se,r)?se:(se=r,r)}),ce=sM(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:kF(e)}:t))})}),le=sM(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>=OF){t(N,`queue_full`);return}let s={content:i,delivery:n,requestId:dn(),submittedDraft:r,submittedDraftRevision:o,status:`admitting`};t(O,[...a,s]),t(k,s.requestId),t(N,void 0),t(ce,s)}),ue=sM(null,async(e,t,n)=>{let r={draft:e(E),revision:e(D)},i=await n(r.draft);return i?.status===`handled`&&!_F(i)&&t(F,r),i}),de=sM(null,(e,t)=>{let n=e(j);if(e(ne)===`interrupted`||e(ne)===`failed`){let a=e(i),o=e(v);if(a===void 0||o===void 0)return;let s=NF(a.messages,o)??e(r).data?.latestPrompt?.[1];if(s===void 0)return;if(n.filter(({status:e})=>e!==`failed`).length>=OF){t(N,`queue_full`);return}let c={content:s,delivery:`followUp`,requestId:dn(),submittedDraft:s,submittedDraftRevision:e(D),status:`admitting`};t(O,[...e(O),c]),t(k,c.requestId),t(N,void 0),t(ce,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>=OF){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(ce,o)}),fe=sM(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))}),pe,me=sM(null,e=>{if(pe!==void 0)return pe;let t=e(i)?.activity.queue;if(t?.state!==`running`)return Promise.resolve();let n=e(ee).mutateAsync(t.commandId).then(()=>void 0).finally(()=>{pe===n&&(pe=void 0)});return pe=n,n}),he;return{abortAtom:ee,commandIdAtom:oe,contextAtom:ae,admissionErrorAtom:N,admissionsAtom:j,cancelAtom:me,draftAtom:E,dismissFailedAtom:fe,extensionsAtom:b,failureAtom:ne,jumpToLatestAtom:f,loadOlderHistoryAtom:d,loadNewerHistoryAtom:p,observationAtom:re,observedCommandIdsAtom:A,pinVisibleHistoryAtom:m,queryAtom:r,reconcileAdmissionsAtom:M,reconnectAtom:sM(null,n=>{let i=n(re);if(i.status!==`unavailable`)return Promise.resolve({kind:`nothing_to_reconnect`,state:i.status===`live`?`connected`:`connecting`});if(he!==void 0)return he;let a=t.getQueryCache().find({queryKey:aF(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 he=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(aF(e).queryKey)?.observation===`live`){u({kind:`reconnected`});return}a.state.errorUpdateCount>s&&u({kind:`failed`,cause:AF(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:AF(e)})}),d()}).finally(()=>{he=void 0}),he}),retryAtom:de,setDraftAtom:P,sendAtom:le,snapshotAtom:i,statusAtom:ie,viewStateAtom:L,submitCommandAtom:ue,timelineAtom:te}}var FF=(0,J.createContext)(null);function IF(){let e=(0,J.useContext)(FF);if(e===null)throw Error(`Parakeet hooks require a ParakeetProvider`);return e}function LF(e){let{store:t}=IF(),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 RF(e){let{store:t}=IF();return(0,J.useCallback)((...n)=>t.set(e,...n),[e,t])}function zF({children:e,session:t,clients:n=SF,interactionStore:r,authorOf:i=Dk}){let a=ca(),o=(0,J.useMemo)(()=>({atoms:PF(t,a,i),session:t,store:uM(),contributions:sM(CF),interactions:r??Oj()}),[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=Ej(n,(e,t)=>{FN(`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)(FF.Provider,{value:o,children:e})}function BF(){let{atoms:e}=IF(),t=LF(e.timelineAtom),n=RF(e.loadOlderHistoryAtom),r=RF(e.loadNewerHistoryAtom),i=RF(e.jumpToLatestAtom),a=RF(e.pinVisibleHistoryAtom);return(0,J.useMemo)(()=>({...t,jumpToLatest:i,loadNewerHistory:r,loadOlderHistory:n,pinVisibleHistory:a}),[t,i,r,n,a])}function VF(){let{atoms:e}=IF(),t=LF(e.draftAtom),n=LF(e.failureAtom),r=LF(e.admissionErrorAtom),i=RF(e.setDraftAtom),a=RF(e.sendAtom),o=RF(e.submitCommandAtom),s=RF(e.retryAtom),c=(0,J.useCallback)(()=>{s()},[s]),l=RF(e.dismissFailedAtom),u=RF(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 HF(){let{atoms:e}=IF();return RF(e.dismissFailedAtom)}function UF(){return IF().session}function WF(){return LF(IF().atoms.extensionsAtom)}function GF(){let{atoms:e}=IF(),t=LF(e.commandIdAtom),n=LF(e.statusAtom),r=LF(e.viewStateAtom),i=LF(e.observationAtom),a=RF(e.reconnectAtom),o=LF(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 KF(){return LF(IF().contributions)}function qF(){return IF().interactions}var JF=e(Wo(),1),YF=class extends Error{_tag=`WatchdogError`;cause;underlying;constructor(e,t){super(`Watchdog ${e.replaceAll(`_`,` `)}`),this.name=this._tag,this.cause=e,this.underlying=t}},XF=Tt({family:`watchdog`,version:1,kinds:{claim:{prefix:`watchdog_claim`}}});function ZF(e){if(Jt(e))return`execution_interrupted`;let t=kt(e);return t._tag===`Some`?t.value.cause:`execution_defect`}var QF=(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(Ee(t=>{if(t.status!==`recorded`&&t.status!==`replayed`)return gt;let i=r;return i?.jobId===n.jobId?st(()=>{i.fiber.interruptUnsafe()}):e.wake.recompute()})),u=n=>t.failLane(n).pipe(Ee(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?gt:e.wake.recompute()}),F(({jobs:e,more:t})=>({settled:e.length,more:t}))),d=e=>t.purgeQueued(e),p=()=>Me({try:()=>XF.claim.generate(),catch:()=>new YF(`claim_unavailable`)}).pipe(mt(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*Ae(new YF(`settlement_rejected`))}}});return Object.freeze({hasPendingWork:t.hasPendingWork,ingest:a,read:o,readQueueHead:s,readSettled:c,tick:()=>We(()=>n===`idle`?(n=`running`,m().pipe(mt(e=>e.status===`recovered`?Ce({status:`recovered`,job:e.job}):p().pipe(F(t=>t.status===`no_ready`&&e.status===`liveness_unknown`?e:t))),mt(n=>n.status===`no_ready`?Ce({status:`no_ready`}):n.status===`liveness_unknown`?Ce(n):n.status===`claim_unavailable`?Ae(new YF(`claim_unavailable`)):n.status===`cancelled`?e.wake.recompute().pipe(tt({status:`settled`,job:n.job})):n.status===`recovered`?Ce({status:`settled`,job:n.job}):i(function*(){let i=yield*Cn(),a=yield*f(zn(i).pipe(ve(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*rr(a)):yield*_r(i,void 0);let c=yield*mr(a).pipe(Ge(st(()=>{r?.fiber===a&&(r=void 0)})));if(o.failed!==void 0)return yield*e.wake.recompute().pipe(tt({status:`settled`,job:o.failed}));let l=yr(c)?c.value:{kind:`failed`,reason:ZF(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(tt({status:`settled`,job:u.job}));case`conflict`:case`missing`:return yield*Ae(new YF(`settlement_rejected`))}})),Ge(st(()=>{n=`idle`})))):Ce({status:`busy`})),cancel:l,failLane:u,purge:d})},$F=q.check(At(1),z(512)),eI=q.check(At(1),z(256)),tI=Pn.check(Nn(-(2**53-1)),Sr(2**53-1)),nI=Pn.check(Nn(0),Sr(2**53-1)),rI=q.check(At(1),z(200)),iI=W({lane:$F,reason:rI});function aI(e){try{return hn(iI,{onExcessProperty:`error`})(e)}catch(e){throw new YF(`store_invalid`,e)}}var oI=W({sequence:Pn,job_id:eI,queue_name:eI,lane:$F,priority:tI,payload_json:q,recovery_max:br(nI),state:Hn([`queued`,`running`,`settled`]),outcome:br(Hn([`completed`,`failed`,`cancelled`,`outcome_unknown`,`interrupted`])),claim_token:br(eI),recovery_count:nI,cancellation_id:br(eI),failure_reason:br(rI)}),sI=vn(qt),cI=fn(oI,{onExcessProperty:`error`}),lI=fn(sI),uI=Vt(sI);function dI(e){return e===void 0?{predicate:`1 = 1`,values:[]}:{predicate:e.include?`lane = ?`:`lane <> ?`,values:[e.lane]}}var fI=`sequence, job_id, queue_name, lane, priority, payload_json,
53
- recovery_max, state, outcome, claim_token, recovery_count,
54
- cancellation_id, failure_reason`;function pI(e){return new YF(`store_unavailable`,e)}function mI(e){return Me({try:e,catch:e=>e instanceof YF?e:pI(e)})}function hI(e){let t=uI(e);if(t._tag===`Failure`)throw pI(Xn(t.cause));return t.value}function gI(e){let t=cI(e);if(t._tag===`Failure`)throw pI(Xn(t.cause));let n=t.value,r=lI(n.payload_json);if(r._tag===`Failure`)throw pI(Xn(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 pI();return{row:n,job:{...i,state:`running`}}}if(n.outcome===null)throw pI();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 _I(e,t){let n=e.sql.exec(`SELECT ${fI}
55
- FROM watchdog_jobs
56
- WHERE job_id = ?`,t).toArray()[0];return n===void 0?void 0:gI(n)}function vI(e,t,n,r){let i=dI(r);return e.sql.exec(`SELECT ${fI} 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=gI(e);if(t.job.state!==`settled`)throw pI();return{sequence:t.row.sequence,job:t.job}})}function yI(e,t){let n=e.sql.exec(`SELECT ${fI}
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=gI(n);if(r.job.state===`settled`)throw pI();return{state:r.job.state,jobId:r.job.jobId,cancellationRequested:r.row.cancellation_id!==null}}function bI(e,t){let n=e.sql.exec(`SELECT ${fI}
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=gI(n);if(r.job.state!==`settled`)throw pI();return r.job}function xI(e,t,n,r){if(t===void 0)return;let i=yI(e,n);t(r===void 0?{queue:n,head:i}:{queue:n,head:i,settled:r})}function SI(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 CI(e,t,n){let r=hI(n.payload),i=_I(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 pI();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),xI(e,t,n.queue),!0}function wI(e,t,n){let r=_I(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),xI(e,t,r.job.queue),{status:`recorded`,intent:n}):r.row.cancellation_id===n.cancellationId?{status:`replayed`,intent:n}:{status:`conflict`}}function TI(e,t,n,r){let i=dI(r);return e.transactionSync(()=>{let r=e.sql.exec(`SELECT ${fI}
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=gI(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=_I(e,a.job.jobId)?.job;return n?.state!==`settled`||n.outcome!==`cancelled`?{status:`claim_unavailable`}:(xI(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=_I(e,a.job.jobId)?.job;return o?.state===`running`?(xI(e,t,o.queue),{status:`claimed`,job:o,claimToken:n}):{status:`claim_unavailable`}})}function EI(e,t,n){return e.transactionSync(()=>{let r=_I(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=_I(e,n.jobId)?.job;return a?.state===`settled`?(xI(e,t,a.queue,a),{status:`settled`,job:a}):{status:`conflict`}})}function DI(e,t,n){SI(e);let r=Object.freeze({readQueueHead:t=>yI(e,t),readLatestSettledJob:t=>bI(e,t),enqueueAcceptedJob:n=>{CI(e,t,n)},recordCancellationIntent:n=>wI(e,t,n)}),i=n=>{let r=dI(n);return Object.freeze({hasPendingWork:mI(()=>e.sql.exec(`SELECT 1 FROM watchdog_jobs WHERE state IN ('queued', 'running') LIMIT 1`).toArray().length!==0),ingest:n=>mI(()=>e.transactionSync(()=>({status:CI(e,t,n)?`queued`:`duplicate`}))),read:t=>mI(()=>{let n=_I(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=>mI(()=>yI(e,t)),readSettled:(t,r)=>mI(()=>vI(e,t,r,n)),selectAndClaim:r=>mI(()=>TI(e,t,r,n)),settleExactClaim:n=>mI(()=>EI(e,t,n)),recordCancellation:n=>mI(()=>e.transactionSync(()=>({status:wI(e,t,n).status}))),failLane:n=>mI(()=>{let r=aI(n);return e.transactionSync(()=>{let n=e.sql.exec(`SELECT ${fI} 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=gI(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=_I(e,n.job.jobId)?.job;if(o?.state!==`settled`||o.outcome!==`failed`)throw pI();xI(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=>mI(()=>{e.transactionSync(()=>{e.sql.exec(`DELETE FROM watchdog_jobs
127
- WHERE queue_name = ? AND state = 'queued'`,n),xI(e,t,n)})}),nextRunningClaim:()=>mI(()=>{let t=e.sql.exec(`SELECT ${fI}
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=gI(t);if(n.job.state!==`running`||n.row.claim_token===null)throw pI();return{job:n.job,claimToken:n.row.claim_token,recoveryCount:n.row.recovery_count}}),reconcileDisappearedClaim:n=>mI(()=>e.transactionSync(()=>{let r=_I(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),xI(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=_I(e,n.job.jobId)?.job;return o?.state===`settled`?(xI(e,t,o.queue,o),{status:`settled`,job:o}):{status:`conflict`}}))})};return Object.freeze({store:i(n),partition:i,transactional:r})}var OI=q.check(At(1),z(256)),kI=q.check(At(1),z(200)),AI=Pn.check(Nn(-(2**53-1)),Sr(2**53-1)),jI=Pn.check(Nn(0),Sr(2**53-1)),MI=W({maxRecoveries:jI}),NI={jobId:OI,queue:OI,lane:$F,priority:AI,payload:qt,recovery:B(MI)},PI=W({...NI,state:G(`queued`)}),FI=W({...NI,state:G(`settled`),outcome:Hn([`completed`,`failed`,`cancelled`,`outcome_unknown`,`interrupted`]),failureReason:H(kI)}),II=W({...NI,state:G(`running`)}),LI=U([PI,II,FI]);U([W({kind:G(`completed`)}),W({kind:G(`failed`),reason:H(kI)}),W({kind:G(`cancelled`)}),W({kind:G(`outcome_unknown`)})]);var RI=W({jobId:OI,cancellationId:OI,onlyIfQueued:B(Mn)}),zI=U([W({status:G(`absent`)}),W({status:G(`present`),cancellation:RI})]);U([W({status:G(`found`),job:LI,cancellation:zI}),W({status:G(`missing`)})]),U([W({state:G(`idle`)}),W({state:Hn([`queued`,`running`]),jobId:OI,cancellationRequested:Mn})]),U([W({status:G(`queued`)}),W({status:G(`duplicate`)})]),U([W({status:Hn([`recorded`,`replayed`])}),W({status:Hn([`conflict`,`missing`])})]);var BI=U([Sn(ArrayBuffer),q,rn,kn]);Ot(q,BI);function VI(e){return Me({try:()=>{let t=e.concurrentLane===void 0?void 0:hn($F)(e.concurrentLane),n=DI(e.owner,e.project,t===void 0?void 0:{lane:t,include:!1}),r=QF(e,n.store),i={...r,transactional:n.transactional};if(t===void 0)return Object.freeze(i);let a=QF(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(mt(n=>n.status===`found`&&n.job.lane===t?a.cancel(e):r.cancel(e)))})},catch:e=>new YF(`store_unavailable`,e)})}var HI=e=>({owner:e.owner,project:e.project,isAlive:t=>Ie({try:()=>e.isAlive(t),catch:e=>new YF(`liveness_unavailable`,e)}),executor:{execute:t=>Ie({try:n=>e.execute(t,n),catch:()=>new YF(`execution_failed`)})},wake:{recompute:()=>Ie({try:()=>e.wake.recompute(),catch:()=>new YF(`wake_unavailable`)})}}),UI=e=>it(e).then(e=>{if(yr(e))return e.value;let t=Qe(kt(e.cause))??Xn(e.cause);return Promise.reject(t instanceof Error?t:Error(String(t)))});function WI(e){let t=HI(e);return e.concurrentLane===void 0?UI(VI(t)).then(GI):UI(VI({...t,concurrentLane:e.concurrentLane})).then(e=>Object.freeze({...GI(e),tickConcurrent:()=>UI(e.tickConcurrent())}))}function GI(e){return Object.freeze({hasPendingWork:()=>UI(e.hasPendingWork),ingest:t=>UI(e.ingest(t)),read:t=>UI(e.read(t)),readQueueHead:t=>UI(e.readQueueHead(t)),tick:()=>UI(e.tick()),cancel:t=>UI(e.cancel(t)),failLane:t=>UI(e.failLane(t)),purge:t=>UI(e.purge(t)),transactional:e.transactional})}Object.freeze({make:WI});function KI(e){return x(()=>wr(()=>import(`./runtime-core-CvcjUkf6.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]))).pipe(mt(({openRuntimeCore:t})=>t(e)),F(({agent:e})=>e))}function qI(e){return e instanceof Kt?e:new Kt(`model`,`rejected`,`Model acquisition failed`,void 0,e)}function JI(e){return new Kt(`model`,`rejected`,`Model release failed`,void 0,e)}function YI(e){let t=Ie({try:()=>e.release(),catch:JI}),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 XI(e){return Ue((t,n)=>{if(n.aborted)return;let r;try{r=Promise.resolve(e(n))}catch(e){t(Ae(qI(e)));return}let i=r.then(e=>{if(n.aborted)return Promise.resolve(e.release()).then(()=>void 0);t(Ce(YI(e)))},e=>{n.aborted?En(`late-model-acquisition`,e):t(Ae(qI(e)))});return Ie({try:()=>i,catch:JI}).pipe(Ze)})}function ZI(e){let t,n=lt(n=>mt(n(e),e=>st(()=>(t=e,e))));return nt(n,()=>t===void 0?gt:t.release.pipe(Ze),{interruptible:!0})}function QI(e){let t=({sessionId:t,preference:n})=>XI(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})=>Ie({try:r=>n({sessionId:e,preference:t,signal:r}),catch:qI})})}function $I(e,t){return new Kt(e,`rejected`,t)}var eL=q.pipe(V(At(1)),V(z(256))),tL=q.pipe(V(At(1)),V(Xt(e=>new TextEncoder().encode(e).byteLength<=32e3))),nL=W({revision:eL,text:tL,modules:H(zt(e=>Array.isArray(e)&&e.every(ot)))}),rL=zt(e=>be(e)),iL=zt(e=>be(e)),aL=W({bind:rL}),oL=zt(e=>be(e)),sL=W({commit:oL,requestWake:iL,close:iL}),cL=W({close:iL}),lL=cn(nL),uL=cn(aL),dL=cn(sL),fL=cn(cL);function pL(e){return new Kt(`runtime`,`invalid`,`Runtime host is invalid`,void 0,e)}function mL(){return new Kt(`runtime`,`unavailable`,`Runtime host is unavailable`)}function hL(e,t){return Me({try:()=>t.call(e),catch:mL}).pipe(mt(e=>Ie({try:()=>Promise.resolve(e),catch:mL})),mt(e=>e===void 0?gt:Ae(pL())))}function gL(e,t,n){let r=fL({close:t});return r._tag===`Failure`?Ae(pL(n)):_e(hL(e,r.success.close)).pipe(_t({onFailure:e=>Ae(pL({cause:n,cleanup:e})),onSuccess:()=>Ae(pL(n))}))}function _L(e){return We(()=>{if(!ot(e))return Ae(pL());let t=e,n;try{n=t.close}catch(e){return Ae(pL(e))}let r;try{r=t.requestWake}catch(e){return gL(t,n,e)}let i=dL({commit:t.commit,requestWake:r,close:n});return i._tag===`Failure`?gL(t,n):Ce(Object.freeze({commit:e=>Ie({try:()=>t.commit(()=>AA(e)),catch:e=>e instanceof Kt?e:mL()}),requestWake:hL(t,i.success.requestWake),close:hL(t,i.success.close)}))})}function vL(e){return Me({try:()=>{let t=e.runtime;if(!ot(t))throw pL();let n=uL(t);if(n._tag===`Failure`)throw pL();return{receiver:t,bind:n.success.bind}},catch:pL}).pipe(F(({receiver:e,bind:t})=>Object.freeze({bind:({reconcile:n,pendingWork:r})=>Me({try:()=>t.call(e,{reconcile:()=>AA(n),pendingWork:()=>AA(r)}),catch:mL}).pipe(mt(e=>Ie({try:()=>Promise.resolve(e),catch:mL})),mt(_L))})))}function yL(e,t){let n={store:e.store,runtime:t,extensions:e.extensions,instructions:{load:({sessionId:t,commandId:n})=>Ie({try:r=>e.instructions.load({sessionId:t,commandId:n,signal:r}),catch:()=>$I(`instructions`,`Instruction acquisition failed`)}).pipe(mt(e=>{let t=lL(e);return t._tag===`Success`?Ce(t.success):Ae(new Kt(`contract`,`invalid`,`Instruction revision is invalid`))}))},model:QI(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:$n(r.sandbox),access:r.access??{}};return{...n,tools:r.execution===void 0?i:{...i,execution:r.execution}}}function bL(e,t){return AA(vL(e).pipe(mt(n=>t(yL(e,n))))).then(FA)}Object.freeze({make:e=>bL(e,KI)});var xL=200,SL=ue(`action`,[Ye({action:n(`list`)}),Ye({action:n(`editLast`)})]),CL=ye(R(),me()).parse(structuredClone(Ke(SL))),wL=120,TL=Ye({title:R()}).optional().transform(e=>e?.title.trim().replaceAll(/\s+/gu,` `)??``),EL=4096,DL=Ye({instructions:R()}).optional().transform(e=>e?.instructions.trim()??``);function OL(e,t){return e?.notify({type:`info`,message:t}),t}function kL(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 OL(e,`Session ${n.sessionId} is ${AM(EM(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:CL},handler:async({arguments:e,interaction:r})=>{let i=SL.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}`);OL(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),OL(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(AM(EM(i))!==`idle`)throw Error(`Wait for the current run to finish, then fork.`);let a=ZP(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,xL),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 Kt){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),OL(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=DL.safeParse(e);if(!r.success)throw Error(`Use /compact, or /compact <what to focus on>.`);let i=r.data;if(i.length>EL)throw Error(`Compaction instructions are at most ${String(EL)} characters.`);return await t.command(i.length===0?{type:`compact`,requestId:dn()}:{type:`compact`,requestId:dn(),instructions:i}),OL(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=TL.safeParse(e);if(!i.success)throw Error(`Use /name <title>, or /name to clear it.`);let a=i.data;if(Array.from(a).length>wL)throw Error(`A conversation title is at most ${String(wL)} characters.`);let o=a.length===0?null:a;return await t.command({type:`title`,title:o}),await n.onTitled?.(o),OL(r,o===null?`Conversation title cleared; it follows the first prompt again.`:`Conversation named "${o}".`)}}]};return e.contribute(i)}var AL=new Set([`Esc`,`Ctrl+C`]);function jL(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=>AL.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 ML=` · `;function NL(e){return e.map(e=>`${e.keys} ${e.label}`).join(ML)}function PL(e,t,n){setTimeout(()=>{e.execute(t,{origin:n})},0)}function FL(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=lF(e.snapshot()).filter(e=>e.alias!==`help`);if(n.interaction===void 0)return r.map(e=>`/${e.alias}`);PL(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}},handler:async t=>{let n=uF(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}PL(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 IL=tn(W({cancelled:G(!0)})),LL=tn(Yn(Ot(q,wn)));function RL(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=xj(_j(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`&&LL(t.arguments)&&!IL(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 zL(e){if(e!==void 0&&e.status!==`handled`)return e.status===`failed`?e.error.message:e.status===`unavailable`?e.reason:`Command ${e.status}`}function BL(e){let{commands:t,origin:n}=e,r=e.enabled??!0,i=UF(),a=VF(),o=WF(),s=KF(),c=(0,J.useRef)(s);c.current=s;let l=qF(),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:FL(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)(()=>RL(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)(()=>lF(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`}:hF(_,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=jL({completion:C,busy:e.busy,bindings:uF(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=>vF(r,t,()=>{a.send(e)},n)).then(e=>{let t=zL(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 VL(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
138
- `)}function HL(e){return/^\s*$/.test(e)}function UL(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function WL(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=WL(n.children):n.type===`image`&&(t+=n.alt);return t}function GL(){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 KL(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 qL(e){return e.trim().toLowerCase()}function JL(e){return qL(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function YL(e,t={}){let n=hR(QL(e,t));for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var XL=32,ZL=16;function QL(e,t,n={scans:Math.max(e.length*ZL,1024),depth:0}){if(n.depth>=XL)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=iR(e,i,"`"),s=aR(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=eR(e,i+1,t,n);if(a){o(),r.push({type:`image`,src:KL(a.href),alt:mR(a.label,n),...a.title?{title:a.title}:{}}),i=a.end;continue}}if(s===`[`){let a=$L(e,i,t,n);if(a){o(),r.push(a.node),i=a.end;continue}let s=eR(e,i,t,n);if(s){let e=KL(s.href);o(),e?r.push({type:`link`,href:e,...s.title?{title:s.title}:{},children:QL(s.label,t,n)}):r.push(...QL(s.label,t,n)),i=s.end;continue}}if(s===`*`&&c===`*`&&e[i+2]===`*`){let a=oR(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:QL(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`*`&&c===`*`||s===`_`&&c===`_`){let l=s===`_`&&!uR(e,i,2,!0)?-1:oR(e,i+2,s+s,n);if(l!==-1){o(),r.push({type:`strong`,children:QL(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=iR(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`~`&&c===`~`){let s=oR(e,i+2,`~~`,n);if(s!==-1){o(),r.push({type:`strike`,children:QL(e.slice(i+2,s),t,n)}),i=s+2;continue}a+=`~~`,i+=2;continue}if(s===`~`){let a=sR(e,i+1,n);if(a!==-1){o(),r.push({type:`strike`,children:QL(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`*`||s===`_`){let a=s===`_`&&!uR(e,i,1,!0)?-1:oR(e,i+1,s,n);if(a!==-1){o(),r.push({type:`emphasis`,children:QL(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`<`&&t.allowHtml){let t=cR(e,i+1,`>`,n);if(t!==-1&&tR(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 $L(e,t,n,r){if(e[t+1]!==`^`)return;let i=cR(e,t+2,`]`,r);if(i===-1)return;let a=qL(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??(JL(o.label)||`footnote`),number:s+1,...c>1?{referenceIndex:c}:{}},end:i+1}}function eR(e,t,n,r){let i=rR(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i);if(e[i+1]===`(`){let t=rR(e,i+1,`(`,`)`,r);if(t===-1)return;let n=nR(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=rR(e,i+1,`[`,`]`,r);if(t===-1)return;let o=e.slice(i+2,t),s=n.references?.[qL(o||a)];return s?{label:a,href:s.href,...s.title?{title:s.title}:{},end:t+1}:void 0}let o=n.references?.[qL(a)];if(o)return{label:a,href:o.href,...o.title?{title:o.title}:{},end:i+1}}function tR(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 nR(e){let t=e.match(/^(\S+)(?:\s+["']([^"']*)["'])?$/);return t?{href:t[1].replace(/^<|>$/g,``),...t[2]?{title:t[2]}:{}}:{href:e}}function rR(e,t,n,r,i){let a=0;for(let o=t;o<e.length;o++){if(!lR(i))return-1;if(e[o-1]!==`\\`&&(e[o]===n&&a++,e[o]===r&&(a--,a===0)))return o}return-1}function iR(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&!lR(r));)i++;return i}function aR(e,t,n,r,i){for(let a=t;a<e.length;a++){if(!lR(i))return-1;if(e[a]===n&&iR(e,a,n,i)>=r)return a}return-1}function oR(e,t,n,r){for(let i=t;i<e.length;i++){if(!lR(r))return-1;if(e[i-1]!==`\\`&&(n!==`~~`||e[i-1]!==`~`&&e[i+2]!==`~`)&&!(n[0]===`_`&&!uR(e,i,n.length,!1))&&e.startsWith(n,i))return i}return-1}function sR(e,t,n){if(pR(e[t]??``)||/\d/.test(e[t]??``))return-1;for(let r=t;r<e.length;r++){if(!lR(n))return-1;if(e[r-1]!==`\\`&&e[r]===`~`&&e[r-1]!==`~`&&e[r+1]!==`~`)return pR(e[r-1]??``)?-1:r}return-1}function cR(e,t,n,r){for(let i=t;i<e.length;i++){if(!lR(r))return-1;if(e[i]===n)return i}return-1}function lR(e){return e.scans<=0?!1:(e.scans--,!0)}function uR(e,t,n,r){let i=e[t-1],a=e[t+n],o=!dR(a)&&(!fR(a)||dR(i)||fR(i)),s=!dR(i)&&(!fR(i)||dR(a)||fR(a));return r?o&&(!s||fR(i)):s&&(!o||fR(a))}function dR(e){return e===void 0||/\s/.test(e)}function fR(e){return e!==void 0&&/[^\p{L}\p{N}\s]/u.test(e)}function pR(e){return/\s/.test(e)}function mR(e,t){return QL(e,{},t).map(e=>e.type===`text`||e.type===`inlineCode`?e.value:``).join(``)}function hR(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 gR=64;function _R(e,t={}){let n=VL(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=bR(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 vR(i,d,GL()).parse();u&&s.length>0&&f.push(xR(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 vR=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>=gR){let e=this.lines.slice(this.index).join(`
142
- `);return this.index=this.lines.length,e?[{type:`paragraph`,children:YL(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(HL(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=>YL(e,this.options),parseBlocks:t=>new e(VL(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
- `),...yR(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=YL((/^#+[ \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(HL(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=CR(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=CR(this.current());if(!r||!wR(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=CR(e);if(n&&n.indent===i)break;if(HL(e)){let e=this.index;for(;e<this.lines.length&&HL(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let a=CR(n);if(a?.indent===i){if(!wR(a,t))break;o=!0,this.index=e;break}if(TR(n)<r.contentIndent)break;o=!0,l.push(``),this.index=e;continue}if(TR(e)>=r.contentIndent){l.push(UL(e,r.contentIndent)),this.index++;continue}if(ER(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||!DR(e,t))return;let n=OR(e),r=OR(t).map(kR),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(HL(e)||ER(e,this.next()))break;let t=OR(e);a.push(Array.from({length:i},(e,n)=>AR(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>AR(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&&!HL(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(HL(t)||e.length>0&&ER(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:YL(e.join(`
147
- `),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=WL(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 yR(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=SR(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 bR(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=qL(t);if(!n[o]){let e=JL(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[qL(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 xR(e,t,n){let r=[];for(let i=0;i<t.length;i++){let a=e[t[i]];a&&r.push({id:a.id??(JL(a.label)||`footnote`),number:i+1,children:new vR(VL(a.content).split(`
149
- `),n,GL()).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 SR(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 CR(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 wR(e,t){return e.ordered===t.ordered&&e.marker===t.marker}function TR(e){return e.match(/^ */)?.[0].length??0}function ER(e,t){let n=CR(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&&DR(e,t)}function DR(e,t){if(!e.includes(`|`))return!1;let n=OR(t);return n.length===OR(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function OR(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 kR(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function AR(e,t){return{type:`tableCell`,children:YL(e,t)}}function jR(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 MR(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 jR(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||!jR(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 Dr(`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(FN(`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 NR=new Map,PR=()=>NR,FR=()=>()=>void 0;function IR(e){let t=KF(),{observation:n}=GF(),r=qF(),i=UF(),[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=MR({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??FR,a?.snapshot??PR,a?.snapshot??PR),enabled:a!==void 0&&n.status===`live`,execute:(e,t,n=!1)=>a?.execute(e,t,n)??Promise.resolve()}}function LR(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 RR(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,LR(t)])),unanchored:LR(r),omitted:e.flatMap(({entryId:e,value:t})=>t.timeline.omitted===0?[]:[{entryId:e,count:t.timeline.omitted}])}}var zR=J.createContext(void 0);function BR(e){let t=J.useContext(zR);if(!e&&t===void 0)throw Error(aT(27));return t}var VR=J.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=BR(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return FT(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:mD,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),HR=J.createContext(void 0);function UR(e=!1){let t=J.useContext(HR);if(t===void 0&&!e)throw Error(aT(16));return t}function WR(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 GR(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(sE(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 KR(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=J.useRef(null),s=UR(!0),c=a??s!==void 0,{props:l}=WR({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=J.useCallback(()=>{let e=o.current;qR(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return HO(u,[u]),{getButtonProps:J.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return ST({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(MT(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=qR(r),s=!i&&JR(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(),GR(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),GR(r,e)))},onKeyUp(e){if(!t){if(MT(e),a?.(e),e.target===e.currentTarget&&i&&c&&qR(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),GR(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Jw(e=>{o.current=e,u()})}}function qR(e){return dE(e)&&e.tagName===`BUTTON`}function JR(e){return dE(e)&&e.tagName===`A`&&!!e.href}function YR(e,t,n,r){let i=!1,a=!1,o=r??$w;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 XR=`none`,ZR=`trigger-press`,QR=`trigger-hover`,$R=`outside-press`,ez=`close-press`,tz=`focus-out`,nz=`escape-key`,rz=`imperative-action`,iz=J.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=BR(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=KR({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,YR(ez,e.nativeEvent))}return FT(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),az=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=BR(),c=XT(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),FT(`p`,e,{ref:t,props:[{id:c},o]})});function oz(e,t){return t!=null&&!kD(t)?0:typeof e==`function`?e():e}function sz(e,t,n){let r=oz(e,n);return typeof r==`number`?r:r?.[t]}function cz(e){return typeof e==`function`?e():e}function lz(e,t){return t||e===`click`||e===`mousedown`}function uz(e){return e?.includes(`mouse`)&&e!==`mousedown`}function dz(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function fz(e){let t=Gw(pz,e).current;return t.next=e,HO(t.effect),t}function pz(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var mz=null;globalThis.requestAnimationFrame;var hz=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)}},gz=class e{static create(){return new e}static request(e){return hz.request(e)}static cancel(e){return hz.cancel(e)}currentId=mz;request(e){this.cancel(),this.currentId=hz.request(()=>{this.currentId=mz,e()})}cancel=()=>{this.currentId!==mz&&(hz.cancel(this.currentId),this.currentId=mz)};disposeEffect=()=>this.cancel};function _z(){let e=Gw(gz.create).current;return eT(e.disposeEffect),e}var vz={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},yz={...vz,position:`fixed`,margin:0,top:0,left:0};({...vz});var bz=J.forwardRef(function(e,t){let[n,r]=J.useState();HO(()=>{HE&&VE&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,X.jsx)(`span`,{...e,ref:t,style:yz,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function xz(e){return`data-base-ui-${e}`}var Sz=0;function Cz(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Sz);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),Zw;let o=requestAnimationFrame(a);return Sz=o,()=>{Sz===o&&(cancelAnimationFrame(o),Sz=0)}}var wz=`data-base-ui-inert`,Tz=new WeakMap,Ez=new WeakSet,Dz=new WeakMap,Oz=0;function kz(e){return e?fE(e)?e.host:kz(e.parentNode):null}var Az=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=kz(t);return e.contains(n)?n:null}).filter(e=>e!=null),jz=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Mz=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{oE(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Nz(e,t,n,{mark:r=!0}){let i=Az(t,e),a=r?Mz(t,jz(i),new Set(i)):[],o=[],s=[];if(n){let e=Az(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);Mz(t,jz(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(Tz.get(e)||0)+1;Tz.set(e,r),o.push(e),r===1&&n&&Ez.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(Dz.get(e)||0)+1;Dz.set(e,t),s.push(e),t===1&&e.setAttribute(wz,``)}),Oz+=1,()=>{o.forEach(e=>{let t=(Tz.get(e)||0)-1;Tz.set(e,t),t||(Ez.has(e)||e.removeAttribute(`aria-hidden`),Ez.delete(e))}),r&&s.forEach(e=>{let t=(Dz.get(e)||0)-1;Dz.set(e,t),t||e.removeAttribute(wz)}),--Oz,Oz||(Tz=new WeakMap,Ez=new WeakSet,Dz=new WeakMap)}}function Pz(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=oO(e[0]).body;return Nz(e,i,n,{mark:r})}var Fz={style:{transition:`none`}},Iz=`data-base-ui-click-trigger`,Lz={fallbackAxisSide:`end`},Rz={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},zz=J.createContext(null),Bz=()=>J.useContext(zz),Vz=xz(`portal`);function Hz(e={}){let{ref:t,container:n,componentProps:r=$w,elementProps:i}=e,a=YT(),o=Bz()?.portalNode,[s,c]=J.useState(null),[l,u]=J.useState(null),d=Jw(e=>{e!==null&&u(e)}),f=J.useRef(null);HO(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(lE(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=FT(`div`,r,{ref:[t,d],props:[{id:a,[Vz]:``},i]}),m=s&&p?JF.createPortal(p,s):null;return{node:l,nodeId:J.isValidElement(p)?p.props.id:void 0,subtree:m}}var Uz=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}=Hz({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&&DO(e)&&(e.type===`focusin`?v.current&&=(kO(l),!1):(OO(l),v.current=!0))}return dz(lk(l,`focusin`,e,!0),lk(l,`focusout`,e,!0))},[l,y]),HO(()=>{!l||b!==!0||!v.current||(kO(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)(zz.Provider,{value:S,children:[x&&l&&(0,X.jsx)(bz,{"data-type":`outside`,ref:f,onFocus:e=>{DO(e,l)?m.current?.focus():TO(g?g.domReference:null)?.focus()}}),x&&l&&(0,X.jsx)(`span`,{role:s,"aria-owns":u,style:Rz}),l&&JF.createPortal(a,l),x&&l&&(0,X.jsx)(bz,{"data-type":`outside`,ref:p,onFocus:e=>{DO(e,l)?h.current?.focus():(wO(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,YR(`focus-out`,e.nativeEvent)))}})]})]})});function Wz(){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 Gz=class{nodesRef={current:[]};events=Wz();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)}},Kz=J.createContext(null),qz=J.createContext(null),Jz=()=>J.useContext(Kz)?.id||null,Yz=e=>{let t=J.useContext(qz);return e??t};function Xz(e){let t=YT(),n=Yz(e),r=Jz();return HO(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Zz(e){let{children:t,id:n}=e,r=Jz();return(0,X.jsx)(Kz.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Qz(e){let{children:t,externalTree:n}=e,r=Gw(()=>n??new Gz).current;return(0,X.jsx)(qz.Provider,{value:r,children:t})}function $z(e){return e==null?e:`current`in e?e.current:e}function eB(e,t){let n=sE(qE(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(DD(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var tB=20,nB=[];function rB(){nB=nB.filter(e=>e.deref()?.isConnected)}function iB(e){rB(),e&&oE(e)!==`body`&&(nB.push(new WeakRef(e)),nB.length>tB&&(nB=nB.slice(-20)))}function aB(){return rB(),nB[nB.length-1]?.deref()}function oB(e){return e?bO(e)?e:SO(e)[0]||e:null}function sB(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=xO(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return bO(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 cB(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=Jw(()=>b.current.floatingContext?.nodeId),S=i===!1,C=xD(_)&&S,w=fz(i),T=fz(a),E=fz(o),D=fz(u),O=fz(g),k=Yz(m),A=Bz(),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),ne=cT(I,p,A?.beforeInsideRef),re=cT(te,A?.afterInsideRef),ie=rT(),ae=rT(),oe=_z(),se=A!=null,L=SD(v),ce=Jw((e=L)=>e?SO(e):[]),le=Jw(()=>h?.().filter(e=>e!=null)??[]);J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&GE(L,WE(oO(L)))&&ce().length===0&&!C&&TD(e)}return lk(oO(L),`keydown`,e)},[r,L,c,C,ce]),J.useEffect(()=>{if(r||!g)return;let e=oO(L);function t(){N.current=!1}function n(e){let t=qE(e),n=le(),r=GE(v,t)||GE(_,t)||GE(A?.portalNode,t)||n.some(e=>e===t||GE(e,t));N.current=!r,ee.current=e.pointerType||`keyboard`,KE(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,ae.start(0,()=>{M.current=!1}))}function i(){ee.current=`keyboard`}return dz(lk(e,`pointerdown`,n,!0),lk(e,`pointerup`,t,!0),lk(e,`pointercancel`,t,!0),lk(e,`keydown`,i,!0),t)},[r,v,_,L,g,A,ae,le]),J.useEffect(()=>{if(r||!l)return;let e=oO(L);function n(){M.current=!0,ae.start(0,()=>{M.current=!1})}function i(e){let t=qE(e);bO(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=qE(n);c&&r==null&&a!=null&&GE(v,a)&&iB(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=le(),p=r?.hasAttribute(xz(`focus-guard`))&&[I.current,te.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,$z(f),$z(d)].includes(r),m=!(GE(_,r)||GE(v,r)||GE(r,v)||GE(A?.portalNode,r)||u.some(e=>e===r||GE(e,r))||l.hasMatchingElement(e=>GE(e,r))||p||k&&(CD(k.nodesRef.current,o).find(e=>GE(e.context?.elements.floating,r)||GE(e.context?.elements.domReference,r))||wD(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,SD(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&L&&sB(L),s&&i!==_&&!aO(a)&&WE(e)===e.body){if(dE(L)&&(L.focus(),s===`popup`)){oe.request(()=>{L.focus()});return}let e=ce(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||L;dE(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==aB())&&(j.current=!0,t.setOpen(!1,YR(tz,n)))})}function o(){N.current||(b.current.insideReactTree=!0,ie.start(0,()=>{b.current.insideReactTree=!1}))}let u=dE(_)?_:null;if(!(!v&&!u))return dz(u&&lk(u,`focusout`,a),u&&lk(u,`pointerdown`,n),v&&lk(v,`focusin`,i),v&&lk(v,`focusout`,a),v&&A&&lk(v,`focusout`,o,!0))},[r,_,v,L,c,k,A,t,l,s,ce,C,x,b,ie,ae,oe,d,f,le]),J.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${xz(`portal`)}]`)||[]),t=(k?wD(k.nodesRef.current,x()):[]).find(e=>xD(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Pz([v,...e,I.current,te.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...le(),t,$z(f),$z(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=Pz([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,le]),HO(()=>{if(!g||r||!dE(L))return;F.current=``,ee.current=``;let e=oO(L),t=WE(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||GE(L,t))return;let i=null,a=()=>(i??=ce(L),i[0]||L),o;o=r===!0||r===null?a():$z(r),o||=a();let s=GE(L,WE(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&DD(c);Cz(o,{sync:l,preventScroll:o===L,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=WE(e);return!(t!==o&&GE(L,t))}})})},[r,g,L,ce,w,D,O,b]);let ue=J.useRef(null);HO(()=>{if(r||!L){ue.current=null;return}ue.current&&=(ue.current.cancelled=!0,null);let e=oO(L),t=WE(e),n=D.current==null;iB(t);function i(e){if(e.open||(F.current=eB(e.nativeEvent,ee.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(xz(`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(DD(e.nativeEvent)||OD(e.nativeEvent))j.current=!1;else{let e=!1;oO(L).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&&oE(t)!==`body`?t:null,s=n?o||a:a||o;return s||=aB()||null,typeof i==`boolean`?s:$z(i)||s||null}return()=>{y.off(`openchange`,i);let t=WE(e),n=le(),r=GE(v,t)||n.some(e=>e===t||GE(e,t))||k&&CD(k.nodesRef.current,x(),!1).some(e=>GE(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};ue.current=l,queueMicrotask(()=>{ue.current===l&&(ue.current=null);let n=oB(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&dE(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,L,T,E,D,y,k,_,x,le]),HO(()=>{if(!VE||g||!v)return;let e=WE(oO(v));!dE(e)||!yD(e)||GE(v,e)&&e.blur()},[g,v]),HO(()=>{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,_]),HO(()=>{if(!(r||!L))return sB(L),()=>{queueMicrotask(rB)}},[r,L]);let de=!r&&(!c||!C)&&(se||c);return(0,X.jsxs)(J.Fragment,{children:[de&&(0,X.jsx)(bz,{"data-type":`inside`,ref:ne,onFocus:e=>{if(c){let e=ce();Cz(e[e.length-1])}else A?.portalNode&&(j.current=!1,DO(e,A.portalNode)?wO(_)?.focus():$z(f??A.beforeOutsideRef)?.focus())}}),n,de&&(0,X.jsx)(bz,{"data-type":`inside`,ref:re,onFocus:e=>{c?Cz(ce()[0]):A?.portalNode&&(l&&(j.current=!0),DO(e,A.portalNode)?TO(_)?.focus():$z(d??A.afterOutsideRef)?.focus())}})]})}function lB(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=ZR}=t,l=e.context.dataRef,u=J.useRef(void 0),d=_z(),f=rT(),p=J.useMemo(()=>{function t(t,n,r,i){let a=YR(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=kD(e.pointerType,!0)&&OD(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||kD(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=qE(s),p=yD(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}kD(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}:$w,[n,p])}function uB(){return!1}function dB(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function fB(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=uB,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=Yz(c),m=Jw(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=Jw(()=>a),{escapeKey:v,outsidePress:y}=dB(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=rT(),O=rT(),k=rT(),A=Jw(()=>{O.clear(),d.current.insideReactTree=!1}),j=Jw(e=>{let t=d.current.floatingContext?.nodeId;return(p?CD(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=Jw(t=>_D(t,e.select(`floatingElement`))||_D(t,e.select(`domReferenceElement`))),N=Jw(t=>{o()&&e.setOpen(!1,YR(ZR,t.nativeEvent))}),P=Jw(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=ED(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=YR(nz,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=Jw(()=>{d.current.insideReactTree=!0,O.start(0,A)}),ee=Jw(t=>{if(!l||!n||t.button!==0)return;let r=qE(t.nativeEvent);GE(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),I=Jw(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 nT,i=oO(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(VE?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&&CD(p.nodesRef.current,t).some(t=>_D(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=qE(n),i=`[${xz(`inert`)}]`,a=uE(r)?r.getRootNode():null,o=Array.from((fE(a)?a:oO(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>GE(e,r))))return;let c=uE(r)?r:null;for(;c&&!CE(c);){let e=EE(c);if(CE(e)||!uE(e))break;c=e}if(!(o.length&&uE(r)&&!vD(r)&&!GE(r,e.select(`floatingElement`))&&o.every(e=>!GE(c,e)))){if(dE(r)&&!(`touches`in n)){let e=CE(r),t=wE(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&&!DD(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,YR($R,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=qE(e);if(!n)return;let r=lk(n,e.type,()=>{t(e),r()})}function te(e){T.current=`touch`,I(e,ee)}function ne(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 re(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 ie(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 ae(e){I(e,ie)}function oe(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function se(e){I(e,oe)}let L=dz(r&&dz(lk(i,`keydown`,P),lk(i,`compositionstart`,a),lk(i,`compositionend`,o)),g&&dz(lk(i,`click`,ne,!0),lk(i,`pointerdown`,ne,!0),lk(i,`pointerup`,re,!0),lk(i,`pointercancel`,re,!0),lk(i,`mousedown`,ne,!0),lk(i,`mouseup`,re,!0),lk(i,`touchstart`,te,{capture:!0,passive:!0}),lk(i,`touchmove`,ae,{capture:!0,passive:!0}),lk(i,`touchend`,se,{capture:!0,passive:!0})));return()=>{L(),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]),ne=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:ne,trigger:te}:{},[n,te,ne])}function pB(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),HO(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};uE(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 mB(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),HO(()=>{if(!e&&o&&i!==`ending`&&n){let e=gz.request(()=>{a(`ending`)});return()=>{gz.cancel(e)}}},[e,o,i,n]),HO(()=>{if(!e||t||i===void 0)return;let n=gz.request(()=>{a(void 0)});return()=>{gz.cancel(n)}},[t,e,i]),HO(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=gz.request(()=>{a(`idle`)});return()=>{gz.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var hB=null;function gB(e){if(!hB){let e=[];hB=e,queueMicrotask(()=>{hB=null,JF.flushSync(()=>{for(let t of e)t()})})}hB.push(e)}function _B(e,t=!1,n=!1){let r=_z();return Jw((i,a=null)=>{r.cancel();let o=$z(e);if(o==null)return;let s=o,c=()=>{if(!n){JF.flushSync(i);return}gB(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(YO(s).map(e=>e.finished.then(Zw))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(YO(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=XE;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 vB(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=Jw(a),s=_B(r,n,i);J.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function yB(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=Jw(i),{mounted:c,setMounted:l,transitionStatus:u}=mB(t,!1,!1,o),d=!t&&r;HO(()=>{t&&s(!1)},[t,s]);let f=J.useRef(c),p=J.useRef(!1),m=GT(),h=()=>{f.current=!1,l(!1),a()};HO(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=Jw(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return vB({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var bB={tabIndex:-1,[JE]:``};function xB(e){return t=>t!==`touch`||e.current}function SB(e,t=!1){let n=YT(),r=Jz()!=null,i=Gw(()=>e(n,r)).current;return pB({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function CB({handle:e,store:t}){return HO(()=>e.attachStore(t),[e,t]),null}function wB(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function TB(e,t){let n=J.useRef(null);return Jw(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),wB(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),wB(t))})}function EB(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 DB(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function OB(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=TB(e,n),o=Jw(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=Jw(e=>{a(e),e&&o(e)});return HO(()=>(s(t.current),()=>s(null)),[s,t,n,e]),HO(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function kB(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=J.useRef(null),i=e.useState(`open`);HO(()=>{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=YR(XR);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 AB(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=yB({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 Gw(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function jB(e,t){e.useSyncedValues(t),HO(()=>()=>{e.update({activeTriggerProps:$w,inactiveTriggerProps:$w,popupProps:$w})},[e])}function MB(e,t){HO(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),HO(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var NB=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}},PB=t((e=>{var t=Er();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})),FB=t(((e,t)=>{t.exports=PB()})),IB=t((e=>{var t=Er(),n=FB();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}})),LB=t(((e,t)=>{t.exports=IB()})),RB=[],zB=void 0;function BB(){return zB}function VB(e){RB.push(e)}function HB(e){let t=(t,n)=>{let r=Gw(WB).current,i;try{zB=r;for(let e of RB)e.before(r);i=e(t,n);for(let e of RB)e.after(r);r.didInitialize=!0}finally{zB=void 0}return i};return t.displayName=e.displayName||e.name,t}function UB(e){return J.forwardRef(HB(e))}function WB(){return{didInitialize:!1}}var GB=FB(),KB=LB(),qB=hT(19)?XB:ZB;function JB(e,t,n,r,i){return qB(e,t,n,r,i)}function YB(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,GB.useSyncExternalStore)(e.subscribe,a,a)}VB({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,GB.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function XB(e,t,n,r,i){let a=BB();if(!a)return YB(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 ZB(e,t,n,r,i){return(0,KB.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var QB=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 JB(this,e,t,n,r)}},$B=class extends QB{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){J.useDebugValue(e);let n=this;HO(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;HO(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;HO(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){J.useDebugValue(e);let n=this,r=t!==void 0;HO(()=>{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),JB(this,this.selectors[e],t,n,r)}useContextCallback(e,t){J.useDebugValue(e);let n=Jw(t??Zw);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)}})}},eV={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},tV=class extends $B{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:Wz(),nested:n,triggerElements:i},eV),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&AD(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 nV(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new tV({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:$w,inactiveTriggerProps:$w,popupProps:$w}}var rV=e=>e.triggerIdProp??e.activeTriggerId,iV=e=>e.openProp??e.open,aV=e=>(e.popupElement?.id??e.floatingId)||void 0;function oV(e,t){return t!==void 0&&iV(e)&&rV(e)===t}function sV(e,t){return oV(e,t)?!0:t!==void 0&&iV(e)&&rV(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var cV={open:iV,mounted:e=>e.mounted,transitionStatus:e=>iV(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:rV,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:aV,isTriggerActive:(e,t)=>t!==void 0&&rV(e)===t,isOpenedByTrigger:(e,t)=>oV(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&rV(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>sV(e,t)?aV(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function lV(e){let t=J.useCallback(t=>e===void 0?Zw:e.subscribeStore(t),[e]),n=J.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,GB.useSyncExternalStore)(t,n,()=>e?.serverStore)}var uV=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new nT;restTimeout=new nT;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},dV=new WeakMap;function fV(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&dV.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),dV.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function pV(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=dV.get(n);a&&a!==e&&fV(a),fV(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,dV.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function mV(e){let t=e.context.dataRef.current,n=Gw(()=>t.hoverInteractionState??uV.create()).current;return t.hoverInteractionState||=n,eT(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function hV(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=Yz(),u=Jz(),d=mV(e),f=rT(),p=Jw(()=>lz(c.current.openEvent?.type,d.interactedInside)),m=Jw(()=>uz(c.current.openEvent?.type)),h=Jw(()=>{fV(d)});HO(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),J.useEffect(()=>h,[h]),HO(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&uE(s)&&o){let e=s,t=o,n=oO(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??KE(e,`[data-rootownerid]`)??n.body;return pV(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&&CD(l.nodesRef.current,u).length>0)}function a(t){let n=sz(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,YR(QR,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=qE(e);if(!bD(t)){d.interactedInside=!1;return}d.interactedInside=KE(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(gD(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&uE(o)&&CD(l.nodesRef.current,r,!1).some(e=>GE(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,YR(QR,n)),l.events.emit(`floating.closed`,n)})}let y=o;return dz(y&&lk(y,`mouseenter`,g),y&&lk(y,`mouseleave`,_),y&&lk(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var gV={current:null};function _V(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=gV,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=Yz(l),v=mV(e),y=J.useRef(!1),b=fz(i),x=fz(r),S=fz(o),C=fz(n),w=fz(p),T=fz(f),E=Jw(()=>lz(h.current.openEvent?.type,v.interactedInside)),D=Jw(()=>w.current?.()!==!1),O=Jw((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!GE(t,n);if(!uE(r))return!1;let a=r;return i.hasMatchingElement(e=>GE(e,a))&&(!t||!GE(t,a))}),k=Jw(()=>{v.handler&&=(oO(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=Jw(()=>{fV(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===QR,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=sz(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,YR(QR,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,YR(QR,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!uE(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!kD(v.pointerType))return;let n=cz(S.current),r=sz(x.current,`open`,v.pointerType),i=qE(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(uE(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(GE(t,i)){c=t;break}}uE(o)&&uE(s)&&!e.context.triggerElements.hasElement(o)&&GE(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&&uE(c)&&uE(s)&&GE(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,YR(QR,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,YR(QR,t,c))}):g&&D()&&e.setOpen(!0,YR(QR,t,c)))}function o(n){if(E()){A();return}k();let r=oO(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!gD(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`||!GE(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){GE(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?lk(r,`mouseout`,l):void 0;return s?dz(lk(r,`mousemove`,i,{once:!0}),lk(r,`mouseenter`,i),lk(r,`mouseleave`,o),f):dz(lk(r,`mouseenter`,i),lk(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&&!kD(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;pV(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=cz(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,YR(QR,n,r))}v.pointerType===`touch`?JF.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}var vV=.1,yV=vV*vV,bV=.5;function xV(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function SV(e,t,n,r,i,a,o,s,c,l){let u=!1;return xV(e,t,n,r,i,a)&&(u=!u),xV(e,t,i,a,o,s)&&(u=!u),xV(e,t,o,s,c,l)&&(u=!u),xV(e,t,c,l,n,r)&&(u=!u),u}function CV(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function wV(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 TV(e={}){let{blockPointerEvents:t=!1}=e,n=new nT,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*yV;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=qE(r),g=r.type===`mouseleave`,_=GE(u,h),v=GE(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&uE(r.relatedTarget)&&GE(u,r.relatedTarget))return;function y(){return!!(s&&CD(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=wV(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=wV(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=wV(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=wV(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!CV(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?bV/2:bV*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+bV+1,o=C||T?S.bottom-bV:S.top,s=C?T?S.bottom-bV:S.top:S.bottom-bV;M=SV(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?bV/2:bV*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-bV,o=C||T?S.top+bV:S.bottom,s=C?T?S.top+bV:S.bottom:S.top+bV;M=SV(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?bV/2:bV*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+bV+1,o=w||E?S.right-bV:S.left,s=w?E?S.right-bV:S.left:S.right-bV;M=SV(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?bV/2:bV*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-bV,o=w||E?S.left+bV:S.right,s=w?E?S.left+bV:S.right:S.left+bV;M=SV(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 EV(e,t,n){let{reference:r,floating:i}=e,a=UD(t),o=WD(t),s=HD(o),c=zD(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=BD(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function DV(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}=RD(t,e),p=nO(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=rO(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=rO(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 OV=50,kV=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:DV},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=EV(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<OV&&(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}=EV(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},AV=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}=RD(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=zD(r),_=UD(o),v=zD(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[eO(o)]:KD(o)),x=p!==`none`;!d&&x&&b.push(...$D(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=GD(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`||_===UD(t)||T.every(e=>UD(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=UD(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{}}}},jV=new Set([`left`,`top`]);async function MV(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=zD(n),s=BD(n),c=UD(n)===`y`,l=jV.has(o)?-1:1,u=a&&c?-1:1,d=RD(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 NV=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 MV(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}}}}},PV=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}=RD(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=UD(i),p=VD(f),m=u[p],h=u[f],g=(e,t)=>LD(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}}}}}},FV=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}=RD(e,t),u={x:n,y:r},d=UD(i),f=VD(d),p=u[f],m=u[d],h=RD(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=jV.has(zD(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}}}},IV=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}=RD(e,t),c=await i.detectOverflow(t,s),l=zD(n),u=BD(n),d=UD(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=jD(p-c[m],g),y=jD(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*MD(c.left,c.right):S=p-2*MD(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 LV(e){let t=wE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=dE(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ND(n)!==a||ND(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function RV(e){return uE(e)?e:e.contextElement}function zV(e){let t=RV(e);if(!dE(t))return FD(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=LV(t),o=(a?ND(n.width):n.width)/r,s=(a?ND(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var BV=FD(0);function VV(e){let t=sE(e);return!SE()||!t.visualViewport?BV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function HV(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===sE(e)}function UV(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=RV(e),o=FD(1);t&&(r?uE(r)&&(o=zV(r)):o=zV(e));let s=HV(a,n,r)?VV(a):FD(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=sE(a),t=uE(r)?sE(r):r,n=e,i=kE(n);for(;i&&t!==n;){let e=zV(i),t=i.getBoundingClientRect(),r=wE(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=sE(i),i=kE(n)}}return rO({width:u,height:d,x:c,y:l})}function WV(e,t){let n=TE(e).scrollLeft;return t?t.left+n:UV(cE(e)).left+n}function GV(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-WV(e,n),y:n.top+t.scrollTop}}function KV(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=cE(r),s=t?hE(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=FD(1),u=FD(0),d=dE(r);if((d||!a)&&((oE(r)!==`body`||pE(o))&&(c=TE(r)),d)){let e=UV(r);l=zV(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?GV(o,c):FD(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 qV(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function JV(e){let t=TE(e),n=e.ownerDocument.body,r=MD(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=MD(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+WV(e),o=-t.scrollTop;return wE(n).direction===`rtl`&&(a+=MD(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var YV=25;function XV(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=sE(e),a=cE(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!SE()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(WV(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<=YV&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ZV(e,t){let n=UV(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=zV(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function QV(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=XV(e,n,t);else if(t===`document`)r=JV(cE(e));else if(uE(t))r=ZV(t,n);else{let n=VV(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return rO(r)}function $V(e,t){let n=t.get(e);if(n)return n;let r=OE(e,[],!1).filter(e=>uE(e)&&oE(e)!==`body`),i=null,a=wE(e).position===`fixed`,o=a?EE(e):e;for(;uE(o)&&!CE(o);){let e=wE(o),t=bE(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=EE(o)}return t.set(e,r),r}function eH(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?hE(t)?[]:$V(t,this._c):[].concat(n),r],o=QV(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=QV(t,a[e],i);s=MD(n.top,s),c=jD(n.right,c),l=jD(n.bottom,l),u=MD(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function tH(e){let{width:t,height:n}=LV(e);return{width:t,height:n}}function nH(e,t,n){let r=dE(t),i=cE(t),a=n===`fixed`,o=UV(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=FD(0);if((r||!a)&&((oE(t)!==`body`||pE(i))&&(s=TE(t)),r)){let e=UV(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=WV(i));let l=i&&!r&&!a?GV(i,s):FD(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 rH(e){return wE(e).position===`static`}function iH(e,t){if(!dE(e)||wE(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return cE(e)===n&&(n=n.ownerDocument.body),n}function aH(e,t){let n=sE(e);if(hE(e))return n;if(!dE(e)){let t=EE(e);for(;t&&!CE(t);){if(uE(t)&&!rH(t))return t;t=EE(t)}return n}let r=iH(e,t);for(;r&&mE(r)&&rH(r);)r=iH(r,t);return r&&CE(r)&&rH(r)&&!bE(r)?n:r||xE(e)||n}var oH=async function(e){let t=this.getOffsetParent||aH,n=this.getDimensions,r=await n(e.floating);return{reference:nH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sH(e){return wE(e).direction===`rtl`}var cH={convertOffsetParentRelativeRectToViewportRelativeRect:KV,getDocumentElement:cE,getClippingRect:eH,getOffsetParent:aH,getElementRects:oH,getClientRects:qV,getDimensions:tH,getScale:zV,isElement:uE,isRTL:sH};function lH(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uH(e,t,n){let r=null,i,a=cE(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=PD(d),h=PD(a.clientWidth-(u+f)),g=PD(a.clientHeight-(d+p)),_=PD(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:MD(0,jD(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!lH(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=sE(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function dH(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=RV(e),u=i||a?[...l?OE(l):[],...t?OE(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?uH(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?UV(e):null;c&&g();function g(){let t=UV(e);h&&!lH(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 fH=NV,pH=PV,mH=AV,hH=IV,gH=FV,_H=(e,t,n)=>{let r=new Map,i=n??{},a={...cH,...i.platform,_c:r};return kV(e,t,{...i,platform:a})},vH=typeof document<`u`?J.useLayoutEffect:function(){};function yH(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(!yH(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)&&!yH(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bH(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xH(e,t){let n=bH(e);return Math.round(t*n)/n}function SH(e){let t=J.useRef(e);return vH(()=>{t.current=e}),t}function CH(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);yH(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=SH(c),D=SH(i),O=SH(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),_H(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!yH(w.current,t)&&(w.current=t,JF.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);vH(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);vH(()=>(A.current=!0,()=>{A.current=!1}),[]),vH(()=>{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=xH(M.floating,u.x),r=xH(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bH(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 wH=(e,t)=>{let n=fH(e);return{name:n.name,fn:n.fn,options:[e,t]}},TH=(e,t)=>{let n=pH(e);return{name:n.name,fn:n.fn,options:[e,t]}},EH=(e,t)=>({fn:gH(e).fn,options:[e,t]}),DH=(e,t)=>{let n=mH(e);return{name:n.name,fn:n.fn,options:[e,t]}},OH=(e,t)=>{let n=hH(e);return{name:n.name,fn:n.fn,options:[e,t]}},kH=J.createContext(void 0);function AH(){let e=J.useContext(kH);if(e===void 0)throw Error(aT(26));return e}var jH=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),MH=`--nested-dialogs`,NH=`data-nested-dialog-open`,PH={...pD,...eD,nestedDialogOpen(e){return e?{[NH]:``}:null}},FH=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=BR(),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`);AH(),vB({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?xB(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=FT(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...bB,hidden:!m,onKeyDown(e){jH.has(e.key)&&e.stopPropagation()},style:{[MH]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:PH});return(0,X.jsx)(cB,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function IH(e){return hT(19)?e:e?`true`:void 0}var LH=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}})}),RH=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=BR(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,X.jsx)(kH.Provider,{value:n,children:(0,X.jsxs)(Uz,{ref:t,...r,children:[a&&o===!0&&(0,X.jsx)(LH,{ref:i.context.internalBackdropRef,inert:IH(!s)}),e.children]})}):null}),zH={},BH={},VH=``;function HH(e,t){return pE(e)?e:t}function UH(e,t,n){return/hidden|clip/.test(e.getComputedStyle(HH(t,n)).overflowY)}function WH(e){if(typeof document>`u`)return!1;let t=oO(e);return sE(t).innerWidth-t.documentElement.clientWidth>0}function GH(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=oO(e),n=t.documentElement,r=t.body,i=HH(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 KH(e){let t=oO(e),n=t.documentElement,r=t.body,i=HH(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 qH(e){let t=oO(e),n=t.documentElement,r=t.body,i=sE(n),a=0,o=0,s=!1,c=gz.create();if(VE&&(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,zH={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},VH=n.style.scrollBehavior,BH={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=HH(n,r);if(s=GH(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,zH),Object.assign(r.style,BH),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=VH)}function d(){u(),c.request(l)}l();let f=lk(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var JH=new class{lockCount=0;restore=null;timeoutLock=nT.create();timeoutUnlock=nT.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=oO(e),n=t.documentElement,r=t.body,i=sE(n);if(UH(i,n,r)){let t=new i.MutationObserver(()=>{UH(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=IE||!WH(e);this.restore=a?KH(e):qH(e)}};function YH(e=!0,t=null){HO(()=>{if(e)return JH.acquire(t)},[e,t])}function XH({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=fB(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=qE(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||GE(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return YH(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{!e.select(`open`)&&!e.select(`mounted`)||(u(t),f(n))}),HO(()=>{!r&&!i&&(u(0),f(0))},[r,i]),HO(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),jB(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var ZH={...cV,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},QH=class extends $B{constructor(e,t,n){let r=new NB,i=$H(e,r,t,n);super(i,eU(r),ZH)}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(EB(this.state,e,t.trigger)))}};function $H(e,t,n,r=!1){return{...nV(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 eU(e){return{popupRef:J.createRef(),backdropRef:J.createRef(),internalBackdropRef:J.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function tU(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=BR(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=SB((e,t)=>new QH({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`);MB(b,x),kB(b);let{forceUnmount:w}=AB(x,b);J.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,YR(rz))}),[w,b]);let T=x||S||u!=null;return(0,X.jsxs)(zR.Provider,{value:b,children:[u&&(0,X.jsx)(CB,{handle:u,store:b}),T&&(0,X.jsx)(XH,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var nU=HB(function(e){return tU(`dialog`,e)}),rU=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=BR(),c=XT(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),FT(`h2`,e,{ref:t,props:[{id:c},o]})});function iU(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 aU(e,t){let{onClick:n,onPointerDown:r}=iU(Jw((n,r)=>{(typeof e==`function`?e():e)||t(r||(IE?`touch`:``))}));return J.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var oU=UB(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=BR(!0),f=lV(l)??d;if(!f)throw Error(aT(79));let p=XT(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=J.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=OB(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=KR({disabled:a,native:o}),S=lB(m),C=aU(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return FT(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[Iz]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:dD})}),sU=(0,J.createContext)(void 0),cU=(0,J.createContext)(null);function lU(e){let t=(0,J.useContext)(cU);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function uU(e){let t=(0,J.useContext)(sU),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>t?.(()=>{n.current()}),[t])}var dU=(0,J.createContext)(null);function fU({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,X.jsx)(dU.Provider,{value:{interactionOwner:t,modal:n},children:(0,X.jsx)(nU,{...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 pU(){let e=(0,J.useContext)(dU);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)(oU,{...n,className:t=>Q(`btn`,Nb(e,t)),ref:r,type:t})});var mU=(0,J.forwardRef)(function({container:e,...t},n){let r=lU(`dialog`);return e==null&&r===null?null:(0,X.jsx)(RH,{...t,container:e??r,ref:n})}),hU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(VR,{...t,ref:n,className:t=>Q(`caps-dialog-backdrop fixed inset-0 bg-black/40`,Nb(e,t))})}),gU=(0,J.forwardRef)(function({className:e,finalFocus:t,...n},r){let i=pU();return(0,X.jsx)(FH,{...n,className:t=>Q(`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`,Nb(e,t)),finalFocus:i.interactionOwner===`host`?!1:t??!0,ref:r})}),_U=(0,J.forwardRef)(function({container:e,keepMounted:t=!0,className:n,...r},i){let{modal:a}=pU();return(0,X.jsxs)(mU,{container:e,keepMounted:t,children:[a===!0?(0,X.jsx)(hU,{}):null,(0,X.jsx)(gU,{...r,className:e=>Q(`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,Nb(n,e)),ref:i})]})});function vU({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Q(`flex justify-end gap-sm`,e)})}function yU({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Q(`flex flex-col gap-sm`,e)})}var bU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(rU,{...t,className:t=>Q(`text-lg font-semibold`,Nb(e,t)),ref:n})}),xU=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(az,{...t,className:t=>Q(`text-sm text-base-content`,Nb(e,t)),ref:n})}),SU=(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(iz,{...n,className:t=>Q(`btn btn-ghost`,Nb(e,t)),ref:r,type:t})}),CU=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),wU=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),TU={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`},EU=(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,...TU,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:wU(`lucide`,i),...s},[...o.map(([e,t])=>(0,J.createElement)(e,t)),...Array.isArray(a)?a:[a]])),DU=(e,t)=>{let n=(0,J.forwardRef)(({className:n,...r},i)=>(0,J.createElement)(EU,{ref:i,iconNode:t,className:wU(`lucide-${CU(e)}`,n),...r}));return n.displayName=`${e}`,n},OU=DU(`ArrowDownToLine`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),kU=DU(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),AU=DU(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),jU=DU(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),MU=DU(`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`}]]),NU=DU(`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`}]]),PU=DU(`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`}]]),FU=DU(`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`}]]),IU=DU(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),LU=DU(`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`}]]),RU=DU(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),zU=DU(`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`}]]),BU=DU(`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`}]]),VU=DU(`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`}]]),HU=DU(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function UU(e,t){return Math.max(0,t===`reverse`?-e.scrollTop:e.scrollHeight-e.clientHeight-e.scrollTop)}function WU(){return{phase:`hidden`,shown:!1,jumped:!1,velocity:0,y:0,vy:0,volume:0,vv:0,opacity:0,unread:0,bead:0}}function GU(e){return 1+Math.min(.15,.06*Math.log2(1+Math.max(0,e)))}function KU(e,t,n,r,i,a){let o=t+(-i*i*(e-n)-2*a*i*t)*r;return[e+o*r,o]}function qU(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?GU(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=GU(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]=KU(i.y,i.vy,c,a/l/1e3,e,t),[i.volume,i.vv]=KU(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)?WU():(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 JU=(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)(WU()),p=(0,J.useRef)(()=>void 0),m=(0,J.useRef)(!1),h=(0,J.useRef)(r),g=ux(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=qU(f.current,{distance:UU(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=Tw(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)(OU,{ref:d,className:`text-base-content`,size:13})})]})})});function YU(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 XU(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 ZU(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var QU=(e,t)=>Math.abs(e-t)<1.01,$U=(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)}})},eW,tW=()=>{if(eW!==void 0)return eW;if(typeof navigator>`u`)return eW=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return eW=!0;let e=navigator.maxTouchPoints;return eW=navigator.platform===`MacIntel`&&e!==void 0&&e>0},nW=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},rW=e=>e,iW=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},aW=(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(nW(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(nW(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},oW={passive:!0},sW=typeof window>`u`||`onscrollend`in window,cW=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&sW,o=0,s=a?null:$U(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,oW),a&&r.addEventListener(`scrollend`,u,oW),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},lW=(e,t)=>cW(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),uW=(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`]},dW=(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})},fW=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:rW,rangeExtractor:iW,onChange:()=>{},measureElement:uW,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=XU(()=>(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,!(!tW()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,oW),e.addEventListener(`touchend`,n,oW),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&&(tW()&&(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=XU(()=>[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=XU(()=>[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=YU(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=XU(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=hW(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=XU(()=>{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=XU(()=>[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 ZU(t[pW(0,t.length-1,r?e=>n[e*2]:e=>ZU(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:tW()&&(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&&QU(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()}},pW=(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 mW(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 hW(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=mW(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=pW(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 gW=typeof document<`u`?J.useLayoutEffect:J.useEffect;function _W({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,JF.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[l]=J.useState(()=>{let e=new fW(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),gW(()=>l._didMount(),[]),gW(()=>(o(l),l._willUpdate())),gW(()=>{s(l)}),l}function vW(e){return _W({observeElementRect:aW,observeElementOffset:lW,scrollToFn:dW,...e})}function yW(e){return e<1e3?`${String(e)} tok`:`${(e/1e3).toFixed(1)}K`}var bW=(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]})})}),xW=Eg({keyCode:Ng(229)});function SW(e){return e.nativeEvent.isComposing||ee(xW,e.nativeEvent).success}var CW={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 wW({failure:e,cause:t,onRetry:n}){return(0,X.jsx)(Fb,{tone:`warning`,title:e===`cancelled`?`Taking a breather`:`A little tangle`,description:(0,X.jsxs)(X.Fragment,{children:[CW[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)(Iw,{"aria-label":`Retry prompt`,variant:`outline`,onClick:n,children:`Retry`})})}var TW=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),EW=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:5});function DW(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?EW.format(e):TW.format(e)}var OW=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:Q(`caps-popover-anchor`,e)})}),kW=(0,J.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,X.jsx)(`div`,{...r,ref:i,className:Q(`caps-popover`,e),"data-side":n}):null}),AW=(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:Q(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})}),jW={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function MW({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)(jW[t]).current,d=(0,J.useRef)(t===`dot`?1:4).current,f=(0,J.useRef)(+(t===`bang`)).current,p=(0,J.useRef)(t),m=ux(s),{reduced:h}=m;return(0,J.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=jW[t],n=h||p.current===t;p.current=t;let r=lx(i.current),o=n?{duration:0}:gk(r,{bounce:.3,duration:360}),s=hw(i.current,{y:e.y,height:e.height,...o}),u=hw(a.current,{cy:e.cy,...n?{duration:0}:{delay:dx(r,35),...gk(r,{bounce:.3,duration:420})}}),d=hw(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=hw(l.current,{opacity:+(t===`bang`),...n?hk:_k(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`?hw(o.current,{opacity:[1,.45],..._k(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):hw(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}},..._k(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=Tw(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)(ww,{id:r,values:Cw}),(0,X.jsx)(bw,{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)(xw,{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 NW=.28;function PW(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?NW: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 FW=7.25;function IW({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)(PW(t,n)).current,p=(0,J.useRef)(t),m=bx();(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=PW(t,n),y=p.current;p.current=t;let b=lx(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:hk:_k(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=_k(b,{ease:`inOutSine`,duration:220}),T=[hw(r,{opacity:v.dashes,...S}),hw(c,{opacity:v.track*.28,...S}),hw(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?hk:S:w}),hw(h,{r:v.disc*FW,...C?{delay:w.duration*.7,...gk(b,{bounce:.35,duration:360})}:m?hk:_k(b,{ease:`inCubic`,duration:140})}),hw(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,..._k(b,{ease:`outCubic`,duration:240})}:hk}),hw(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,..._k(b,{ease:`outCubic`,duration:240})}:hk})];return t===`cross`&&C&&b.shake>0&&T.push(hw(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,..._k(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=lx(i.current),t=hw(c.current,{rotate:[0,360],..._k(e,{ease:`linear`,duration:900}),loop:!0}),n=Tw(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)(bw,{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*FW,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var LW=new Set([`ring`,`arc`,`check`,`cross`]);function RW(e){return LW.has(e)}var zW={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`},BW=(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:Q(`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:[RW(n)?(0,X.jsx)(IW,{className:zW[i],glyph:n,progress:s}):(0,X.jsx)(MW,{className:zW[i],glyph:n,motion:r}),t===void 0?null:(0,X.jsx)(`span`,{children:t})]})}),VW=(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:Q(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function HW(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 UW(e,t){return`${e}-${String(t)}`}function WW({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:HW(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:HW(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)(AW,{id:UW(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 GW={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 KW({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(!SW(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)(VW,{"aria-autocomplete":`list`,"aria-controls":g?a:void 0,"aria-expanded":g,"aria-activedescendant":g&&i!==void 0?UW(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 qW(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 JW({statusChips:e,model:t,status:n,viewState:r,usage:i,context:a}){let o=r.kind===`error`?`error`:GW[n].tone,s=qW(n,r);return(0,X.jsxs)(`div`,{className:`composer-footer`,children:[(0,X.jsx)(BW,{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:wk(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:Ek(a)})]}):null,i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono`,children:yW(i.tokens)}),(0,X.jsx)(`span`,{className:`footer-divider`}),(0,X.jsx)(`span`,{className:`font-mono`,children:DW(i.cost)})]}):null]})}var YW=(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}=GW[p],S={action:x?(0,X.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,X.jsx)(Iw,{"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)(Iw,{"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)(Iw,{"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)(KW,{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)(wW,{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)(OW,{className:`composer-body`,children:[v===void 0?null:(0,X.jsx)(kW,{open:v.open,side:`top`,"data-parakeet-slash":``,children:(0,X.jsx)(WW,{slash:v,listId:b})}),(0,X.jsx)(bW,{...S})]})]}),t?(0,X.jsx)(JW,{...C}):null,v===void 0?null:(0,X.jsx)(`p`,{className:`parakeet-key-hints`,"aria-live":`polite`,children:NL(v.hints)})]})}),XW={attention:`text-warning`,running:`text-info`,error:`text-error`,settled:`text-success`,muted:`text-dim`};function ZW({entryId:e,rows:t,actions:n,onOpen:r}){let i=qF(),{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?``:XW[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)(Iw,{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)(Iw,{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)(Rb,{aside:(0,X.jsx)(Iw,{size:`xs`,variant:`ghost`,onClick:()=>{i.inspect(void 0)},children:`Close`}),children:t.title}),(0,X.jsx)(Ib,{density:`compact`,tabIndex:0,className:`max-h-64 overflow-y-auto overscroll-contain`,children:t.inspection.rows.map(e=>(0,X.jsxs)(Lb,{children:[(0,X.jsx)(BW,{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 QW=(0,J.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,X.jsxs)(`label`,{...i,className:Q(`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]})}),$W=(0,J.forwardRef)(function({children:e,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Q(`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:Q(`join-item caps-input-group-control`,e.props.className)}):e)})}),eG=(0,J.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Q(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function tG(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=bx(),[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(!hx(n)){e||l(!1);return}let i=lx(n),a=`translateY(${String(i.distance)}px)`,c=mx(i,i.ease),d=n.getBoundingClientRect().height,f=tG(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:mx(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:Q(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var nG=(0,J.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,X.jsx)(`div`,{...r,ref:i,className:Q(`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=bx(),[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(!hx(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=lx(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:mx(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:mx(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:mx(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,X.jsx)(`div`,{...i,ref:o,className:Q(`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 rG({children:e,...t}){let[n,r]=(0,J.useState)(e);return e&&e!==n&&r(e),(0,X.jsx)(nG,{...t,className:Q(`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 iG({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,X.jsxs)(`footer`,{...a,className:Q(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,X.jsx)(rG,{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 aG=(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:Q(`caps-form`,n),ref:i,children:(0,X.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),oG={2:`h2`,3:`h3`,4:`h4`},sG=(0,J.forwardRef)(function({children:e,className:t,description:n,level:r=3,title:i,...a},o){let s=(0,J.useId)(),c=oG[r];return(0,X.jsxs)(`section`,{...a,"aria-labelledby":`${s}-title`,className:Q(`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})]})}),cG=(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:Q(`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)(rG,{id:`${s}-error`,children:r})]})});function lG(e){let t=[];return J.Children.forEach(e.props.children,e=>{(0,J.isValidElement)(e)&&e.type!==eG&&t.push(e)}),t[0]??null}var uG=(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===$W,h=m?lG(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)(QW,{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:Q(`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)(rG,{id:v,children:r})]})});function dG(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var fG=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,pG=6,mG=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),hG=(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=dG(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)/pG),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,X.jsxs)(`span`,{className:Q(`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:fG,pathLength:100}),(0,X.jsx)(`path`,{className:`caps-number-field-dial-level`,d:fG,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,X.jsx)(Iw,{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)(IU,{"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=mG.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)(Iw,{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)(RU,{"aria-hidden":`true`})})]})}),gG=(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:Q(`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)(gG,{...n,type:`search`,className:t,ref:r})]})});var _G=`data-glide-stand-in`;function vG(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 yG(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function bG(e){let t=(0,J.useRef)(null);return(0,J.useCallback)(n=>{t.current?.(),t.current=n?xG(n,e):null},[e])}function xG(e,t){if(!hx(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?vG(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(_G);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=lx(e),u=vG(e,t),d=o&&a?vG(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(_G,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(_G,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([yG(d),yG(u)],{duration:r.normal,easing:mx(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 SG({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 CG(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=bG(`[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=wG(TG(m,C),x),E=SG({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:Q(`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:Q(`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 wG(e,t){return t?Array.isArray(e)?e.slice():[]:e==null||Array.isArray(e)?[]:[e]}function TG(e,t){switch(e){case void 0:return t;default:return e}}function EG({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)(CG,{"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)(Iw,{variant:`ghost`,onClick:()=>e.answer(t.sequence,!1),children:i.cancelLabel??`Cancel`}),(0,X.jsx)(Iw,{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)(uG,{label:i.message,children:(0,X.jsx)(gG,{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)(Iw,{type:`submit`,children:`Continue`})})]})}function DG({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)(Sk,{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)(BW,{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)(EG,{host:e,pending:r.prompt},r.prompt.sequence),r.status===`failed`?(0,X.jsx)(Fb,{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)(Iw,{variant:`ghost`,onClick:e.cancel,children:`Cancel`}):null,r.status===`failed`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iw,{variant:`ghost`,onClick:()=>{e.cancel(),t?.()},children:`Close`}),n===void 0?null:(0,X.jsx)(Iw,{onClick:n,children:`Try again`})]}):null,r.status===`done`||r.status===`cancelled`?(0,X.jsx)(Iw,{onClick:t,children:`Done`}):null]})]})}function OG({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:OM(e)})})}function kG({children:e,...t}){return(0,J.createElement)(J.Fragment,null,AG(e,t))}function AG(e,t={}){return(typeof e==`string`?_R(e,t):e).children.map((e,n)=>jG(e,t,`b:${n}`))}function jG(e,t={},n){switch(e.type){case`heading`:return HG(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},NG(e.children,t),WG(e.id,t));case`paragraph`:return HG(t,`p`,{key:n},NG(e.children,t));case`code`:return PG(e,t,n);case`list`:return HG(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>HG(t,`li`,{key:r},FG(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return HG(t,`blockquote`,{key:n},e.children.map((e,r)=>jG(e,t,`${n}:${r}`)));case`table`:return HG(t,`table`,{key:n},HG(t,`thead`,null,HG(t,`tr`,null,e.header.map((n,r)=>LG(`th`,n,e.align[r],t,r)))),e.rows.length?HG(t,`tbody`,null,e.rows.map((n,r)=>HG(t,`tr`,{key:r},n.map((n,r)=>LG(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return RG(e.items,t,n);case`thematicBreak`:return HG(t,`hr`,{key:n});case`html`:return t.allowHtml?HG(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):HG(t,`p`,{key:n},e.value);case`callout`:return HG(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},HG(t,`p`,{className:`markdown-alert-title`},e.title),HG(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>jG(e,t,`${n}:${r}`))));case`component`:return UG(e,t,n)}}function MG(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return HG(t,`code`,{key:n},e.value);case`strong`:return HG(t,`strong`,{key:n},NG(e.children,t));case`emphasis`:return HG(t,`em`,{key:n},NG(e.children,t));case`strike`:return HG(t,`del`,{key:n},NG(e.children,t));case`footnoteReference`:return HG(t,`sup`,{key:n},HG(t,`a`,{id:`user-content-fnref-${VG(e)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return HG(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},NG(e.children,t));case`image`:return HG(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return HG(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?HG(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function NG(e,t){return e.map((e,n)=>MG(e,t,`i:${n}`))}function PG(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=HG(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}:{}},HG(t,`code`,{...a,...s},o));return e.title?HG(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},HG(t,`figcaption`,null,e.title),c):HG(t,J.Fragment,{key:n},c)}function FG(e,t,n,r,i){let[a,...o]=e,s=t===void 0?[]:[HG(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];if(a?.type===`paragraph`){let e=[...s,...NG(a.children,r)];return[...n?[HG(r,`p`,{key:`${i}:paragraph`},e)]:e,...o.flatMap((e,t)=>IG(e,n,r,`${i}:${t+1}`))]}return[...s,...e.flatMap((e,t)=>IG(e,n,r,`${i}:${t}`))]}function IG(e,t,n,r){return!t&&e.type===`paragraph`?NG(e.children,n):[jG(e,n,r)]}function LG(e,t,n,r,i){return HG(r,e,{key:i,...n?{style:{textAlign:n}}:{}},NG(t.children,r))}function RG(e,t,n){return HG(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},HG(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,WG(`footnote-label`,t)),HG(t,`ol`,null,e.map(e=>HG(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},zG(e,t)))))}function zG(e,t){let n=e.children.length-1,r=BG(e,t);return n<0?[HG(t,`p`,{key:`backref-wrapper`},r.slice(1))]:e.children.map((e,i)=>i===n&&e.type===`paragraph`?HG(t,`p`,{key:i},NG(e.children,t),r):jG(e,t,`${i}`))}function BG(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(` `,HG(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 VG(e){return e.referenceIndex&&e.referenceIndex>1?`${e.id}-${e.referenceIndex}`:e.id}function HG(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,J.createElement)(i,n,...r)}function UG(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)),HG(t,r,{key:n,...i},e.children.map((e,r)=>jG(e,t,`${n}:${r}`)))}function WG(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return HG(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function GG(e){return e}function KG({fallbackLanguage:e=`plaintext`,languages:t}){let n=new Map,r=new Map;for(let e of t){let t=XG(e.name);n.set(t,e),r.set(t,t);for(let n of e.aliases||[])r.set(XG(n),t)}let i=XG(e);function a(e){return r.get(XG(e||i))||i}function o(e,t,i=0){let s=n.get(a(t));return!s||i>24?[]:ZG(e.length,s.tokenize(e,{hasLanguage(e){let t=r.get(XG(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?QG(e,r):[{value:e}]}}function c(e,t={}){let n=s(e,t),r=JG(qG(n.tokens,t));return{...n,html:`<pre class="th-code th-code--${lK(n.lang)}${t.lineNumbers?` th-code--line-numbers`:``}" data-language="${lK(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 qG(e,t={}){let n=e.map(e=>e.value).join(``),r=t.decorations||[],i=r.filter(eK),a=r.filter(tK);if(!(t.lineNumbers||a.length))return $G(e,0,n.length,i);let o=[],s=nK(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=>rK(e.lines,r));o.push({type:`element`,classNames:[`th-line`,...f.flatMap(e=>sK(e.className))],data:{...iK(f),line:String(r)},children:$G(e,c,d,i)}),u&&o.push({type:`text`,value:`
151
- `})}return o}function JG(e){let t=``;for(let n of e){if(n.type===`text`){t+=YG(n.value);continue}let e=n.classNames.map(lK).join(` `),r=Object.entries(n.data||{}).map(([e,t])=>` data-${lK(cK(e))}="${lK(t)}"`).join(``);t+=`<span${e?` class="${e}"`:``}${r}>${JG(n.children)}</span>`}return t}function YG(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`).replaceAll(`'`,`&#39;`)}function XG(e){return e.trim().toLowerCase()}function ZG(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 QG(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 $G(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`,...sK(e.className)],data:aK(e.data),children:[c]};i.push(c)}}if(a=e,a>=n)break}return i}function eK(e){return`range`in e}function tK(e){return`lines`in e}function nK(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 rK(e,t){return typeof e==`number`?e===t:t>=e[0]&&t<=e[1]}function iK(e){let t={};for(let n of e)Object.assign(t,aK(n.data));return t}function aK(e){if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>[oK(e),String(t)]))}function oK(e){return cK(e).replace(/[^a-z0-9_.:-]/gi,`-`)}function sK(e){return e?.trim().split(/\s+/).filter(Boolean)||[]}function cK(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function lK(e){return YG(e)}function uK(e){return t=>dK(t,e)}function dK(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))pK(r,i,t);continue}let t=mK(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;pK(r,i,{start:s,end:s+e.length,className:typeof n.className==`function`?n.className(a):n.className})}}return r}function fK(e,t){return e.map(e=>({...e,start:e.start+t,end:e.end+t}))}function pK(e,t,n){return n.start>=n.end||n.start<0||n.end>t.length||hK(t,n.start,n.end)?!1:(e.push(n),t.fill(1,n.start,n.end),!0)}function mK(e){return new RegExp(e.source,e.flags.includes(`g`)?e.flags:`${e.flags}g`)}function hK(e,t,n){for(let r=t;r<n;r++)if(e[r])return!0;return!1}var gK=GG({name:`css`,tokenize:uK([{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}])}),_K=GG({name:`dockerfile`,aliases:[`docker`],tokenize:uK([{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 vK(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=CK(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||yK(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=bK(l,e.slice(a,c+1));i.push({start:c+1,end:n,lang:t})}}a=c+1}n===`vue`&&xK(e,`{{`,`}}`,`js`,i),n===`svelte`&&SK(e,i);for(let n of i)n.start>=n.end||!t.hasLanguage(n.lang)||r.push(...fK(t.tokenize(e.slice(n.start,n.end),n.lang),n.start));return r}function yK(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=wK(e,s,t,n);r.push({start:s,end:i,className:`string`}),s=i}}function bK(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 xK(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 SK(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 CK(e,t){let n=t;for(;n<e.length;)if(e[n]===`"`||e[n]===`'`)n=wK(e,n,e[n],e.length);else if(e[n]===`>`)return n;else n++;return-1}function wK(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 TK=GG({name:`html`,aliases:[`htm`,`xml`,`angular-html`],tokenize:(e,t)=>vK(e,t)}),EK=[{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 DK(e,t=!1,n=!1){let r=OK(e,t,n),i=t?MK(e,n):[];return dK(e,EK,[...r,...i])}function OK(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i],o=e[i+1];if(a===`/`&&o===`/`){let t=BK(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=zK(e,i,a);r.push({start:i,end:t,className:`string`}),i=t;continue}if(a==="`"){i=kK(e,i,r,t,n);continue}if(a===`/`&&!(t&&e[i-1]===`<`)&&IK(e,i)){let t=LK(e,i);if(t>i+1){r.push({start:i,end:t,className:`literal`}),i=t;continue}}i++}return r}function kK(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=AK(e,o+2),s=t<0?e.length:t,c=e.slice(o+2,s);if(n.push(...fK(DK(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 AK(e,t){let n=1,r=t;for(;r<e.length;){let t=e[r],i=e[r+1];if(t===`'`||t===`"`){r=zK(e,r,t);continue}if(t==="`"){r=jK(e,r);continue}if(t===`/`&&i===`/`){r=BK(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 jK(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=AK(e,n+2);n=t<0?e.length:t+1}else n++;return e.length}function MK(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]==="`"?jK(e,r):zK(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||PK(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)&&!PK(e,r,t)){r++;continue}let l=RK(e,s+c[0].length);if(l<0||FK(e,r,l,o)){r++;continue}n.push({start:s,end:s+c[0].length,className:`tag`}),o||NK(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 NK(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 PK(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 FK(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 IK(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 LK(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 RK(e,t){let n=0,r=t;for(;r<e.length;){let t=e[r];if(t===`'`||t===`"`){r=zK(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 zK(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 BK(e,t){let n=e.indexOf(`
157
- `,t);return n<0?e.length:n}var VK=GG({name:`js`,aliases:[`javascript`,`mjs`,`cjs`,`js-vue`],tokenize:e=>DK(e)}),HK=GG({name:`json`,aliases:[`jsonc`,`json5`],tokenize:uK([{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}])}),UK=GG({name:`jsx`,tokenize:e=>DK(e,!0)}),WK=GG({name:`markdown`,aliases:[`md`],tokenize(e,t){return dK(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}],GK(e,t))}});function GK(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)?fK(t.tokenize(e.slice(o+1,l),u),o+1):[];n.push({start:i.index,end:o,className:`meta`}),n.push(...KK(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 KK(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 qK=GG({name:`plaintext`,aliases:[`text`,`txt`,`-->`],tokenize:()=>[]}),JK=GG({name:`python`,aliases:[`py`],tokenize(e){return dK(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}])}}),YK=GG({name:`shell`,aliases:[`bash`,`sh`,`zsh`,`cmd`,`console`],tokenize(e){return dK(e,[{collect:XK},{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 XK(e){let t=[];ZK(e,t);let n=0;for(;n<e.length;){if($K(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 ZK(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]===`<`||QK(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*${eq(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 QK(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 $K(e,t){return t.some(t=>t.start<=e&&t.end>e)}function eq(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var tq=GG({name:`sql`,tokenize:uK([{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}])}),nq=GG({name:`ts`,aliases:[`typescript`,`angular-ts`],tokenize:e=>DK(e)}),rq=GG({name:`tsx`,tokenize:e=>DK(e,!0)}),iq=GG({name:`yaml`,aliases:[`yml`],tokenize(e){let t=[...aq(e),...oq(e)];return dK(e,[{className:`property`,regex:/^[ \t-]*([A-Za-z0-9_.-]+)(?=\s*:)/gm,group:1},{collect:sq},{className:`literal`,regex:/\b(?:false|null|true|yes|no|on|off|~)\b/gi},{className:`number`,regex:/\b\d+(?:\.\d+)?\b/g}],t)}});function aq(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 oq(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 sq(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 cq=/[ \t]*(?:(?:\/\/|#)[ \t]*\[!code[ \t]+(\+\+|--)\]|\/\*[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*\*\/|<!--[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*-->)[ \t]*$/;function lq(e){let t=[];return{code:e.split(`
168
- `).map((e,n)=>{let r=cq.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 uq(e){return(t,n=`plaintext`,r={})=>{let i=lq(t);return JG(qG(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 dq=KG({fallbackLanguage:`plaintext`,languages:[gK,_K,TK,VK,HK,UK,WK,qK,JK,YK,tq,nq,rq,iq]}),fq=uq(dq);function pq(e,t){return dq.highlightToHtml(e,t?{lang:t}:{})}var mq=(0,J.forwardRef)(function({className:e,variant:t=`default`,...n},r){return(0,X.jsx)(`article`,{...n,className:Q(`prose prose-caps`,t===`dropcap`&&`caps-prose-dropcap`,e),ref:r})});function hq(e){return URL.parse(e)?.protocol??null}function gq(e){if(e===``||e.startsWith(`//`))return!1;let t=hq(e);return t===null||t===`http:`||t===`https:`||t===`mailto:`}function _q(e){let t=hq(e);return t===`http:`||t===`https:`}function vq(e){if(e===``||e.startsWith(`//`))return!1;let t=hq(e);return t===null||t===`http:`||t===`https:`}function yq({children:e,className:t,components:n,frontmatter:r=!0,policy:i=`default`,typography:a=`prose`}){let o=(0,J.useMemo)(()=>_R(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||!_q(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(!gq(t))return(0,X.jsx)(X.Fragment,{children:e.children});let n=_q(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 vq(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)(kG,{allowHtml:!1,components:s,highlighter:fq,children:o}),l=Q(`min-w-0 break-words`,t);return a===`prose`?(0,X.jsx)(mq,{className:l,children:c}):(0,X.jsx)(`div`,{className:l,children:c})}var bq=(0,J.createContext)(`session`),xq={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:Q(`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 Sq({children:e,policy:t}){let n=(0,J.useContext)(bq);return(0,X.jsx)(yq,{className:`markdown-renderer`,components:xq,frontmatter:!1,policy:(t??n)===`visitor`?`visitor`:`default`,typography:`inherit`,children:e})}var Cq=(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)(jU,{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)(Sq,{children:e})}):null]})});function wq({children:e,isError:t,pending:n,speaker:r,thinking:i,markdownPolicy:a}){let o=(0,X.jsx)(Sq,{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)(Cq,{thinking:i}):null,s?(0,X.jsx)(`div`,{className:`px-3 py-2 ${t?`text-error`:`text-base-content`}`,children:o}):null]})}var Tq=sy(`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`}}),Eq=(0,J.forwardRef)(function({className:e,size:t,tone:n,variant:r,...i},a){return(0,X.jsx)(`span`,{...i,className:Q(Tq({size:t,tone:n,variant:r}),e),ref:a})}),Dq={add:`+`,context:` `,file:``,hunk:`@@`,remove:`-`};function Oq({lines:e,hiddenLines:t=0,className:n,...r}){return(0,X.jsxs)(`pre`,{...r,className:Q(`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:Dq[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 kq({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 Aq(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=kq({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=mB(a,!0,!0),u=XT(),[d,f]=J.useState(),p=d===null?void 0:d??u,m=Jw(e=>{let t=!a,n=YR(ZR,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 jq=J.createContext(void 0);function Mq(){let e=J.useContext(jq);if(e===void 0)throw Error(aT(15));return e}var Nq=`data-open`,Pq=`data-closed`,Fq=XE,Iq=`data-panel-open`,Lq={[Nq]:``},Rq={[Pq]:``},zq={open(e){return e?{[Iq]:``}:null}},Bq={open(e){return e?Lq:Rq},...eD},Vq=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=Jw(o),d=Aq({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=FT(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:Bq});return(0,X.jsx)(jq.Provider,{value:p,children:m})}),Hq={...zq,...eD},Uq=J.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=Mq(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=KR({disabled:c,native:u});return FT(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:Hq})}),Wq={height:void 0,width:void 0};function Gq(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(Wq),h=J.useRef(Wq),g=J.useRef(!1),_=J.useRef(s),v=J.useRef(!1),[y,b]=J.useState(!1),x=J.useRef(null),S=cT(t,d),C=fz(s),w=_B(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=Jw((e,t=!0)=>{t&&(h.current=e),m(e)}),j=Jw(()=>{x.current?.(),x.current=null}),M=Jw(e=>{j(),x.current=()=>{x.current=null,e()}}),N=Jw(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});HO(()=>{!y||u===`starting`||b(!1)},[y,u]),J.useEffect(()=>()=>{N(),j()},[N,j]),HO(()=>{s||(_.current=!1,v.current=!1);let e=d.current;if(!e)return;!s&&x.current&&j();let t=qq(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=Kq(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(Kq(e)),b(!0);return}if(t===`css-transition`){let t=Xq(e);if(A(Kq(e)),!n)return t;let r=Yq(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(Kq(e));let r=Yq(e,`animation-name`,`none`);if(!n){r();return}let i=Yq(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(t===`none`){A(Wq,!1),c(!1);return}A(Kq(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=Kq(e);if(!(n.height>0||n.width>0)){c(!1);return}A(n),t===`css-animation`&&Yq(e,`animation-name`,`none`)()},[a,s,j,A,c,M,D,u]),vB({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(Wq,!1)}}),J.useEffect(()=>{if(s||!a||E!==`ending`)return;if(!d.current){c(!1),A(Wq,!1);return}let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(Wq,!1))}return t=gz.request(()=>{w(n,e.signal)}),()=>{gz.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),HO(()=>{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=nT.create(),n=-1,r=(r,i)=>{t.start(0,()=>{C.current||(n=gz.request(()=>{C.current||(r&&(g.current=!1),i&&e.setAttribute(Fq,``),e.setAttribute(`hidden`,`until-found`))}))})},i=lk(e,`beforematch`,t=>{let n=YR(XR,t);if(o(!0,n),n.isCanceled){r(!1,!1);return}g.current=!0;let i=e.hasAttribute(Fq);e.removeAttribute(Fq),l(!0),r(!0,i)});return()=>{t.clear(),gz.cancel(n),i()}},[C,o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[Fq]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function Kq(e){return{height:e.scrollHeight,width:e.scrollWidth}}function qq(e,t){let n=sE(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&Jq(n.animationDuration),i=Jq(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function Jq(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function Yq(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 Xq(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=gz.request(n);return()=>{gz.cancel(r),n()}}var Zq=`--collapsible-panel-height`,Qq=`--collapsible-panel-width`,$q=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:_}=Mq(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;HO(()=>(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}=Gq({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=bT(s,k),j=FT(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[Zq]:S===void 0?`auto`:`${S}px`,[Qq]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:Bq});return E?j:null}),eJ=sy(`caps-disclosure`,{variants:{tone:{neutral:``,error:`caps-disclosure-error`},size:{group:`caps-disclosure-group`,row:`caps-disclosure-row`}},defaultVariants:{tone:`neutral`,size:`group`}});function tJ({open:e,onOpenChange:t,summary:n,leading:r,trailing:i,children:a,tone:o,size:s,className:c}){return(0,X.jsxs)(Vq,{className:Q(eJ({tone:o,size:s}),c),onOpenChange:t,open:e,children:[(0,X.jsxs)(Uq,{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)(jU,{"aria-hidden":`true`,className:`caps-disclosure-chevron`,size:12})]}),(0,X.jsx)($q,{className:`caps-disclosure-panel`,children:a})]})}var nJ={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)`},rJ=`light-dark(var(--stipe-sketch-ink, #242c28), var(--stipe-art-cream, #fff4de))`,iJ=`var(--color-base-100, light-dark(#fff4de, #242c28))`;function aJ({transform:e,fill:t=rJ}){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 oJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(aJ,{transform:`translate(25.4 19.8) rotate(-39) scale(.95 .76)`}),(0,X.jsx)(aJ,{transform:`translate(32.1 17.8) scale(.96 .95)`}),(0,X.jsx)(aJ,{transform:`translate(38.8 19.9) rotate(39) scale(.95 .77)`})]})}function sJ(){return(0,X.jsxs)(`g`,{style:{fill:nJ.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 cJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:nJ.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:nJ.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 lJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:nJ.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:nJ.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 uJ({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 dJ({onFigure:e=!1}){return(0,X.jsxs)(`g`,{style:{fill:e?iJ:nJ.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 fJ(){return(0,X.jsx)(`path`,{style:{fill:nJ.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 pJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:nJ.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:nJ.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:nJ.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:nJ.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 mJ(){return(0,X.jsx)(`path`,{style:{fill:nJ.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 hJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:rJ},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:nJ.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:nJ.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 gJ(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:rJ},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:nJ.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:nJ.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:nJ.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:nJ.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 _J(){return(0,X.jsxs)(`g`,{transform:`translate(2 8) scale(.114) translate(-125 -122)`,children:[(0,X.jsx)(`path`,{style:{fill:nJ.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:nJ.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:nJ.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:nJ.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:nJ.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 vJ(){return(0,X.jsxs)(`g`,{transform:`translate(3 10) scale(.114) translate(-760 -140)`,children:[(0,X.jsx)(`path`,{style:{fill:nJ.blue},d:`M1226 153C1257 153 1273 195 1267 231Q1263 265 1237 268L1176 270V215C1176 178 1195 153 1226 153Z`}),(0,X.jsx)(`path`,{style:{fill:nJ.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:nJ.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:nJ.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 yJ(){return(0,X.jsxs)(`g`,{transform:`translate(2 7) scale(.11) translate(-1380 -96)`,children:[(0,X.jsx)(`path`,{style:{fill:nJ.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:nJ.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:nJ.inkcap},d:`M1634 456A18 18 0 1 1 1648 456V492Q1648 500 1641 500T1634 492Z`}),(0,X.jsx)(`path`,{style:{fill:nJ.inkcap},d:`M1780 391Q1786 386 1793 396C1810 420 1828 444 1827 467C1826 508 1768 510 1753 480C1741 456 1762 413 1780 391Z`})]})}var{coral:bJ,blue:xJ,mint:SJ,grape:CJ,yellow:wJ,cream:TJ,ink:EJ}=nJ,DJ={bonsai:(0,X.jsxs)(`g`,{transform:`scale(2)`,children:[(0,X.jsx)(`rect`,{width:`32`,height:`32`,rx:`8`,fill:`#242c28`}),(0,X.jsx)(`path`,{d:`M9 23V9m0 4c0 4 14 2 14 9`,fill:`none`,stroke:`#63cfaa`,strokeWidth:`3`,strokeLinecap:`round`}),(0,X.jsx)(`circle`,{cx:`9`,cy:`9`,r:`3`,fill:`#43a6f2`}),(0,X.jsx)(`circle`,{cx:`9`,cy:`23`,r:`3`,fill:`#fff4de`}),(0,X.jsx)(`circle`,{cx:`23`,cy:`22`,r:`3`,fill:`#ff6558`})]}),computer:(0,X.jsx)(_J,{}),prints:(0,X.jsx)(vJ,{}),inkcap:(0,X.jsx)(yJ,{}),vishnu:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:bJ},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:TJ},cx:`19`,cy:`25`,r:`4`}),(0,X.jsx)(`circle`,{style:{fill:TJ},cx:`33`,cy:`19.5`,r:`4.8`}),(0,X.jsx)(`circle`,{style:{fill:TJ},cx:`46`,cy:`28`,r:`3.4`}),(0,X.jsx)(`rect`,{style:{fill:xJ},x:`13`,y:`39`,width:`38`,height:`18`,rx:`9`}),(0,X.jsx)(`rect`,{style:{fill:TJ},x:`18.5`,y:`46.2`,width:`10`,height:`3.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{style:{fill:TJ},x:`21.7`,y:`43`,width:`3.6`,height:`10`,rx:`1.8`}),(0,X.jsx)(`circle`,{style:{fill:wJ},cx:`39`,cy:`50.5`,r:`2.7`}),(0,X.jsx)(`circle`,{style:{fill:TJ},cx:`45`,cy:`45.5`,r:`2.7`})]}),generateText:(0,X.jsx)(hJ,{}),generateMedia:(0,X.jsx)(gJ,{}),buyApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`circle`,{fill:wJ,cx:`32`,cy:`20`,r:`12`}),(0,X.jsx)(`circle`,{stroke:TJ,strokeWidth:`4`,cx:`32`,cy:`20`,r:`6`}),(0,X.jsx)(aJ,{fill:wJ,transform:`translate(15.5 12) rotate(-60) scale(1.1 .85)`}),(0,X.jsx)(aJ,{fill:wJ,transform:`translate(48.5 12) rotate(60) scale(1.1 .85)`}),(0,X.jsx)(`path`,{fill:xJ,d:`M10 35H54L50 53Q49 58 44 58H20Q15 58 14 53Z`}),(0,X.jsx)(`rect`,{fill:bJ,x:`5`,y:`27`,width:`54`,height:`10`,rx:`5`}),(0,X.jsxs)(`g`,{fill:TJ,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:xJ,x:`10`,y:`14`,width:`44`,height:`38`,rx:`6`}),(0,X.jsx)(`rect`,{fill:xJ,x:`5`,y:`47`,width:`54`,height:`12`,rx:`6`}),(0,X.jsx)(`rect`,{fill:TJ,x:`12`,y:`50.5`,width:`40`,height:`4.5`,rx:`2.25`}),(0,X.jsx)(`rect`,{fill:bJ,x:`2`,y:`4`,width:`60`,height:`9`,rx:`4.5`}),(0,X.jsx)(`path`,{fill:bJ,d:`M3 9H14.6V18A5.8 5.8 0 0 1 3 18Z`}),(0,X.jsx)(`path`,{fill:TJ,d:`M14.6 9H26.2V18A5.8 5.8 0 0 1 14.6 18Z`}),(0,X.jsx)(`path`,{fill:bJ,d:`M26.2 9H37.8V18A5.8 5.8 0 0 1 26.2 18Z`}),(0,X.jsx)(`path`,{fill:TJ,d:`M37.8 9H49.4V18A5.8 5.8 0 0 1 37.8 18Z`}),(0,X.jsx)(`path`,{fill:bJ,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)(cJ,{})})]}),agent:(0,X.jsxs)(`g`,{transform:`translate(32 33) scale(2.02) translate(-47.2 -41.8)`,children:[(0,X.jsx)(`path`,{fill:xJ,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)(dJ,{})})]}),list:(0,X.jsxs)(`g`,{transform:`rotate(-7 32 32)`,children:[(0,X.jsx)(`path`,{style:{fill:xJ},d:`M12 13Q6 13 6 19V50Q6 57 13 57H47Q53 57 53 50V20Q53 13 47 13Z`}),(0,X.jsx)(`path`,{style:{fill:TJ},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:bJ},d:`M39 7V18Q39 24 45 24H57Q57 22 55 20L44 9Q42 7 39 7Z`}),(0,X.jsxs)(`g`,{style:{fill:bJ},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:xJ},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)(lJ,{})}),(0,X.jsx)(aJ,{transform:`translate(38.2 18) rotate(16) scale(.95 .6)`}),(0,X.jsx)(aJ,{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)(sJ,{})}),(0,X.jsx)(`g`,{transform:`translate(32 38.6) scale(.3164)`,children:(0,X.jsx)(cJ,{})}),(0,X.jsx)(oJ,{})]}),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)(uJ,{fill:xJ})}),(0,X.jsx)(`g`,{transform:`translate(32.2 30.3) scale(.352)`,children:(0,X.jsx)(cJ,{})})]}),listAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.04) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:rJ},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)(dJ,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:bJ},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)(dJ,{})}),(0,X.jsx)(`path`,{style:{fill:xJ},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)(dJ,{})})]}),createAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:rJ},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)(dJ,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:SJ},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)(dJ,{})}),(0,X.jsx)(aJ,{fill:wJ,transform:`translate(48.1 15.7) rotate(31) scale(1.25 .85)`}),(0,X.jsx)(aJ,{fill:wJ,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)(uJ,{fill:bJ})}),(0,X.jsx)(`g`,{transform:`translate(17.1 28.7) scale(.19)`,children:(0,X.jsx)(fJ,{})}),(0,X.jsx)(aJ,{fill:SJ,transform:`translate(48.1 26.4) rotate(65) scale(1.7 1.28)`}),(0,X.jsx)(aJ,{fill:SJ,transform:`translate(48.4 33.8) rotate(110) scale(1.7 1.28)`})]}),write:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(pJ,{}),(0,X.jsx)(mJ,{})]}),run:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{style:{fill:xJ},x:`6`,y:`9`,width:`52`,height:`43`,rx:`7`}),(0,X.jsx)(`path`,{style:{stroke:TJ},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:xJ},strokeWidth:`12`,strokeLinecap:`round`,d:`M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:bJ},strokeWidth:`12`,strokeLinecap:`round`,d:`M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10`}),(0,X.jsx)(`path`,{style:{stroke:wJ},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:SJ},cx:`23`,cy:`14`,rx:`13`,ry:`8`,transform:`rotate(-30 23 14)`}),(0,X.jsx)(`ellipse`,{style:{fill:wJ},cx:`48`,cy:`36`,rx:`13`,ry:`8`,transform:`rotate(35 48 36)`}),(0,X.jsx)(`ellipse`,{style:{fill:CJ},cx:`22`,cy:`48`,rx:`13`,ry:`8`,transform:`rotate(45 22 48)`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:rJ},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:SJ},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:EJ},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m23 29 7 7 13-15`}),(0,X.jsx)(`path`,{style:{stroke:rJ},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:xJ},x:`9`,y:`26`,width:`46`,height:`32`,rx:`10`}),(0,X.jsx)(`rect`,{style:{fill:TJ},x:`17`,y:`33`,width:`30`,height:`18`,rx:`5`}),(0,X.jsx)(`path`,{style:{fill:SJ},d:`M22 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{fill:CJ},d:`M34 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{stroke:bJ},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:bJ},strokeWidth:`9`,strokeLinecap:`round`,d:`M16 23V19q0-17 16-17t16 17v4`}),(0,X.jsx)(`rect`,{style:{fill:bJ},x:`8`,y:`26`,width:`48`,height:`36`,rx:`9`}),(0,X.jsx)(`path`,{style:{fill:TJ},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:bJ},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:TJ},strokeWidth:`7`,strokeLinecap:`round`,d:`M32 18v15`}),(0,X.jsx)(`circle`,{style:{fill:TJ},cx:`32`,cy:`45`,r:`4`})]})};function OJ({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:DJ[e]})}var kJ=1e4;function AJ({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){FN(`copy code to clipboard`,e),c(`failed`)}},u=i&&t.length<=kJ?pq(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)(kU,{size:10}):(0,X.jsx)(MU,{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>kJ?(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 jJ(e,t,n){return n||e.length<=t?{shown:e,hidden:0}:{shown:e.slice(0,t),hidden:e.length-t}}function MJ({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 NJ=`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 PJ({section:e,full:t,onShowAll:n}){switch(e.kind){case`diff`:{let{shown:r,hidden:i}=jJ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{className:`not-prose`,children:[(0,X.jsx)(Oq,{hiddenLines:0,lines:r}),(0,X.jsx)(MJ,{hidden:i,onShowAll:n})]})}case`excerpt`:{let{shown:r,hidden:i}=jJ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:NJ,"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)(MJ,{hidden:i,onShowAll:n})]})}case`matches`:{let{shown:r,hidden:i}=jJ(e.matches,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:NJ,"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)(MJ,{hidden:i,onShowAll:n})]})}case`command`:case`script`:{let{shown:r,hidden:i}=jJ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:NJ,"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)(MJ,{hidden:i,onShowAll:n})]})}case`output`:{let{shown:r,hidden:i}=jJ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`pre`,{className:NJ,"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)(MJ,{hidden:i,onShowAll:n})]})}case`text`:{let{shown:r,hidden:i}=jJ(e.lines,e.preview,t);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(AJ,{className:`overflow-hidden rounded-lg`,content:r.join(`
171
- `),header:e.label,...e.language===void 0?{}:{language:e.language}}),(0,X.jsx)(MJ,{hidden:i,onShowAll:n})]})}}}function FJ({call:e,tool:t,disclosure:n,onToggle:r}){let i=`${e.id}:full`,a=RP(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)(PJ,{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 IJ({call:e,tool:t,disclosureId:n,size:r,disclosure:i,onToggle:a,renderToolActions:o}){let s=LP(e),c=RP(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)(tJ,{leading:(0,X.jsx)(OJ,{name:LN[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)(Eq,{size:`sm`,tone:`error`,children:[`exit `,String(e.exitCode)]}),e.durationMs===void 0?null:(0,X.jsx)(`span`,{children:DP(e.durationMs)}),(0,X.jsx)(BW,{motion:l?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:IN(e.status)})]}),children:(0,X.jsx)(FJ,{call:e,disclosure:i,onToggle:a,tool:t})}),e.status===`completed`&&t?.result!==void 0?o?.(t):null]})}var LJ=(0,J.memo)(function({group:e,disclosure:t,onToggle:n,renderToolActions:r}){let i=FP(e),a=RP(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)(tJ,{className:`[&>.caps-disclosure-panel]:hidden`,leading:(0,X.jsx)(OJ,{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:DP(e.durationMs)}),(0,X.jsx)(BW,{motion:o?`bounce`:`none`,title:e.status===`unknown`?`result unavailable`:e.status,tone:IN(e.status)})]})}),IP(e,a).map(i=>(0,X.jsx)(IJ,{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)(IJ,{call:c,disclosure:t,disclosureId:c.id,onToggle:n,renderToolActions:r,size:`row`,tool:e.tools[0]})})}),RJ=()=>void 0,zJ=(0,J.memo)(function({item:e,onDismissFailed:t,renderToolActions:n,renderAssistantAttachment:r,formatAssistantText:i,toolDisclosure:a=PP,onToggleTool:o=RJ}){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)(wq,{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 GM(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)(wq,{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)(LJ,{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 ${Tk(e.tokensBefore)} → ${Tk(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 BJ({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)(()=>kr()),f=BL({enabled:t===void 0,commands:i??d,origin:`browser`,keys:{newline:`Shift+Enter`},busy:HJ()}),p=IR(i??d),m=KF(),h=BF(),g=(0,J.useMemo)(()=>RR(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)(WJ,{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)(ZW,{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)(GJ,{clientActions:p}),(0,X.jsx)(KJ,{visitor:t,textareaRef:u,composerActionVariant:n,slash:f})]}),t===void 0?(0,X.jsx)(UJ,{slash:f}):null]})}var VJ=new Set([`cancelling`,`queued`,`retrying`,`sending`,`streaming`,`thinking`]);function HJ(){return VJ.has(GF().status)}function UJ({slash:e}){let t=e.interactions.open;return(0,X.jsx)(fU,{open:t!==void 0,onOpenChange:t=>{t||e.store.close()},children:(0,X.jsx)(_U,{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)(DG,{host:t.host,onClose:e.store.close,onRetry:()=>{e.store.close(),t.retry()}},t.key)})})}function WJ({disambiguateAuthors:e,clientActions:t,onOpen:n,focusAfterJump:r,empty:i,renderToolActions:a,renderAssistantAttachment:o,formatAssistantText:s}){let c=HF(),l=BF(),u=(0,J.useMemo)(()=>Ok(e?[...l.settled,...l.tail].flatMap(e=>`author`in e&&e.author?[e.author]:[]):[]),[e,l.settled,l.tail]),d=RR(KF(),l.commandAnchors),[f,p]=(0,J.useState)(PP),m=(0,J.useCallback)((e,t)=>{p(n=>zP(n,e,t))},[]),h=GF(),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=vW({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:qW(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)(zJ,{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)(ZW,{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)(JU,{direction:`forward`,unread:C,focusAfterJump:r,onJump:P,scrollerRef:g}):null]})}function GJ({clientActions:e}){let{viewState:t}=GF(),n=KF(),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)(Iw,{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)(OG,{waiting:i})]})}function KJ({visitor:e,textareaRef:t,composerActionVariant:n,slash:r}){let i=VF(),a=GF(),o=KF(),s=BF();(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)(YW,{...l})}function qJ({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)(bq.Provider,{value:r,children:(0,X.jsx)(zF,{session:o,clients:s,authorOf:e,children:(0,X.jsx)(BJ,{disambiguateAuthors:t,visitor:n,composerActionVariant:i,empty:a,renderToolActions:c,renderAssistantAttachment:l,formatAssistantText:u,commands:d,onLink:f,onOpen:p})})})}function JJ(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619)>>>0;return t}var YJ=[`primary`,`secondary`,`accent`,`info`,`success`,`warning`];function XJ(e){return YJ[JJ(e)%YJ.length]??`primary`}var ZJ=(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:Q(`caps-monogram`,e),"data-subject":i===`actor`?void 0:i,"data-size":r==="default"?void 0:r,"data-tone":XJ(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})}),QJ=(0,J.createContext)(null),$J=(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)(QJ),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})}),eY=R().trim().min(1),tY=R().regex(/^#[0-9a-f]{6}$/i),nY=Ye({type:n(`number`),label:eY,default:qe(),min:qe(),max:qe(),step:qe().positive().optional()}).refine(e=>e.min<=e.default&&e.default<=e.max,{message:`Number control default must be within its bounds`}),rY=Ye({type:n(`choice`),label:eY,default:R(),options:w(Ye({value:R(),label:eY})).min(1)}).refine(e=>e.options.some(t=>t.value===e.default)&&new Set(e.options.map(e=>e.value)).size===e.options.length,{message:`Choice control needs unique options and a declared default`}),iY=ue(`type`,[nY,rY,Ye({type:n(`color`),label:eY,default:tY}),Ye({type:n(`boolean`),label:eY,default:S()})]);function aY(e,t={}){for(let n of Object.keys(t))if(!Object.hasOwn(e,n))throw Error(`Unknown appearance control: ${n}`);return Object.fromEntries(Object.entries(e).map(([e,n])=>{let r=Object.hasOwn(t,e)?t[e]:n.default;switch(n.type){case`number`:return[e,qe().min(n.min).max(n.max).parse(r)];case`color`:return[e,tY.parse(r)];case`boolean`:return[e,S().parse(r)];case`choice`:{let t=R().parse(r);if(!n.options.some(e=>e.value===t))throw Error(`Unknown choice for ${e}: ${t}`);return[e,t]}}}))}var oY=c([`plain`,`pencil`,`manga`,`riso`,`halftone`,`blueprint`,`crt`,`watercolor`]),sY={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))`},$=(e,t={},...n)=>({tag:e,attributes:t,children:n}),cY=(e,t,n=1)=>$(`feFlood`,{style:`flood-color: ${e}`,"flood-opacity":n,result:t}),lY=(e,t,n)=>[$(`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`}),$(`feTile`,{in:`${n}Cell`,result:n})],uY=(e,t,n)=>$(`feColorMatrix`,{in:t,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${e}`,result:n}),dY=(e,t)=>uY(`-0.333 -0.333 -0.333 1 0`,e,t),fY=(e,t,n,r=1.1)=>[$(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 1 0 1 -4 1 0 1 0`,result:`${t}In`}),$(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 -1 0 -1 4 -1 0 -1 0`,result:`${t}Out`}),$(`feComposite`,{in:`${t}In`,in2:`${t}Out`,operator:`arithmetic`,k2:1,k3:1,result:`${t}Edges`}),uY(`${String(n)} ${String(n)} ${String(n)} ${String(r)} 0`,`${t}Edges`,t)],pY=(e,t,n,r)=>[$(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 1 0 1 -4 1 0 1 0`,preserveAlpha:`true`,result:`${t}In`}),$(`feConvolveMatrix`,{in:e,order:3,kernelMatrix:`0 -1 0 -1 4 -1 0 -1 0`,preserveAlpha:`true`,result:`${t}Out`}),$(`feComposite`,{in:`${t}In`,in2:`${t}Out`,operator:`arithmetic`,k2:1,k3:1,result:`${t}Edges`}),uY(`${String(n)} ${String(n)} ${String(n)} 0 -0.15`,`${t}Edges`,`${t}Inner`),$(`feMorphology`,{in:e,operator:`dilate`,radius:r,result:`${t}Grown`}),$(`feComposite`,{in:`${t}Grown`,in2:e,operator:`out`,result:`${t}Ring`}),uY(`0 0 0 1 0`,`${t}Ring`,`${t}Outline`),hY(t,`${t}Inner`,`${t}Outline`)],mY=(e,t,n)=>$(`feComponentTransfer`,{in:e,result:n},$(`feFuncA`,{type:`discrete`,tableValues:t})),hY=(e,...t)=>$(`feMerge`,{result:e},...t.map(e=>$(`feMergeNode`,{in:e}))),gY=(e,t,n,r=1)=>[cY(e,`${n}Flood`,r),$(`feComposite`,{in:`${n}Flood`,in2:t,operator:`in`,result:n})],_Y={x:`0%`,y:`0%`,width:`100%`,height:`100%`},vY={x:`-8%`,y:`-8%`,width:`116%`,height:`116%`},yY={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},bY=e=>({region:vY,primitives:[$(`feComponentTransfer`,{in:`SourceGraphic`,result:`valued`},...[`feFuncR`,`feFuncG`,`feFuncB`].map(t=>$(t,{type:`gamma`,amplitude:1,exponent:e.value,offset:0}))),$(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.05,numOctaves:2,seed:1,result:`wobble`,"data-sprite-boil":`wobble`}),$(`feDisplacementMap`,{in:`valued`,in2:`wobble`,scale:2.6,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...fY(`drawn`,`line`,e.line,e.outline),dY(`drawn`,`dark`),...lY(`<path d='M-1 1l2-2M0 6l6-6M5 7l2-2' stroke='black' stroke-width='1.1'/>`,6,`hatch45`),$(`feOffset`,{in:`hatch45`,dx:0,dy:0,result:`hatchOffset`,"data-sprite-boil":`hatch`}),$(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.07,numOctaves:2,seed:5,result:`strokeBend`}),$(`feDisplacementMap`,{in:`hatchOffset`,in2:`strokeBend`,scale:4,xChannelSelector:`R`,yChannelSelector:`B`,result:`hatchA`}),...lY(`<path d='M-1 4l2 2M0 0l5 5M4 -1l2 2' stroke='black' stroke-width='0.9'/>`,5,`hatch135`),$(`feDisplacementMap`,{in:`hatch135`,in2:`strokeBend`,scale:3,xChannelSelector:`G`,yChannelSelector:`R`,result:`hatchB`}),$(`feComposite`,{in:`dark`,in2:`hatchA`,operator:`arithmetic`,k1:e.midHatch[0],k4:e.midHatch[1],result:`shadeA`}),$(`feComposite`,{in:`dark`,in2:`hatchB`,operator:`arithmetic`,k1:e.darkHatch[0],k4:e.darkHatch[1],result:`shadeB`}),$(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.9,numOctaves:1,seed:3,result:`tooth`}),uY(e.tooth,`tooth`,`toothMask`),uY(`0 0 0 6 -4.6`,`dark`,`solid`),hY(`graphiteRaw`,`solid`,`shadeA`,`shadeB`,`line`),$(`feComposite`,{in:`graphiteRaw`,in2:`toothMask`,operator:`in`,result:`graphite`}),...gY(sY.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]}]}}),xY={region:vY,primitives:[$(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.04,numOctaves:2,seed:2,result:`brush`,"data-sprite-boil":`brush`}),$(`feDisplacementMap`,{in:`SourceGraphic`,in2:`brush`,scale:2,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...gY(sY.paper,`SourceAlpha`,`paperFill`),dY(`drawn`,`dark`),...lY(`<circle cx='2.5' cy='2.5' r='1.15' fill='black'/>`,5,`dots`),mY(`dark`,`0 1 1 0`,`midTone`),$(`feComposite`,{in:`dots`,in2:`midTone`,operator:`in`,result:`tone`}),mY(`dark`,`0 0 0 1`,`solid`),uY(`3 -3 0 0 -0.35`,`drawn`,`satRG`),uY(`-3 3 0 0 -0.35`,`drawn`,`satGR`),uY(`0 3 -3 0 -0.35`,`drawn`,`satGB`),uY(`0 -3 3 0 -0.35`,`drawn`,`satBG`),hY(`saturation`,`satRG`,`satGR`,`satGB`,`satBG`),mY(`saturation`,`0 1`,`accentMask`),...gY(sY.accent,`accentMask`,`accentFill`),...pY(`drawn`,`edge`,2,2.2),$(`feMorphology`,{in:`edge`,operator:`dilate`,radius:.25,result:`stroke`}),hY(`inkRaw`,`tone`,`solid`,`stroke`),...gY(sY.ink,`inkRaw`,`ink`),hY(`manga`,`paperFill`,`accentFill`,`ink`)],boil:{intervalMs:180,tracks:[{name:`brush`,attribute:`seed`,frames:[2,4,6]}]}},SY={region:vY,primitives:[uY(`-0.55 -0.55 -0.55 1.65 0`,`SourceGraphic`,`dark`),$(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.85,numOctaves:1,seed:7,result:`grain`}),uY(`0 0 0 -0.9 1.35`,`grain`,`grainMask`),$(`feComposite`,{in:`dark`,in2:`grainMask`,operator:`in`,result:`firstMask`}),...gY(sY.risoFirst,`firstMask`,`firstInk`,.92),uY(`0 -1.9 0 1.9 0`,`SourceGraphic`,`secondMask`),...gY(sY.risoSecond,`secondMask`,`secondInk`,.9),$(`feOffset`,{in:`firstInk`,dx:-1.5,dy:1,result:`firstPlate`,"data-sprite-boil":`register`}),$(`feOffset`,{in:`secondInk`,dx:1.5,dy:-.5,result:`secondPlate`}),$(`feBlend`,{in:`firstPlate`,in2:`secondPlate`,mode:`multiply`})],boil:{intervalMs:240,tracks:[{name:`register`,attribute:`dx`,frames:[-1.5,-1,-2]}]}},CY={region:vY,primitives:[uY(`-0.5 -0.5 -0.5 1.65 0`,`SourceGraphic`,`value`),uY(`0 0 0 0.16 0`,`SourceGraphic`,`floor`),hY(`dark`,`floor`,`value`),...lY(`<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`),$(`feComposite`,{in:`dark`,in2:`screen`,operator:`arithmetic`,k2:1,k3:1,k4:-.92,result:`dotField`}),$(`feComponentTransfer`,{in:`dotField`,result:`dotsRaw`},$(`feFuncA`,{type:`linear`,slope:12,intercept:0})),$(`feComposite`,{in:`dotsRaw`,in2:`SourceAlpha`,operator:`in`,result:`dots`}),...gY(sY.ink,`dots`,`halftone`)]},wY={region:_Y,primitives:[cY(sY.blueprint,`ground`),$(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.05,numOctaves:1,seed:4,result:`hand`,"data-sprite-boil":`hand`}),$(`feDisplacementMap`,{in:`SourceGraphic`,in2:`hand`,scale:1.6,xChannelSelector:`R`,yChannelSelector:`G`,result:`drawn`}),...lY(`<path d='M0 0.5h16M0.5 0v16' stroke='black' stroke-width='1' stroke-opacity='0.22'/>`,16,`grid`),...gY(sY.blueprintLine,`grid`,`gridLines`),...gY(sY.blueprintLine,`SourceAlpha`,`wash`,.12),...pY(`drawn`,`edge`,3,1.2),$(`feMorphology`,{in:`edge`,operator:`dilate`,radius:.3,result:`stroke`}),...gY(sY.blueprintLine,`stroke`,`lines`),hY(`blueprint`,`ground`,`gridLines`,`wash`,`lines`)],boil:{intervalMs:200,tracks:[{name:`hand`,attribute:`seed`,frames:[4,5,6]}]}},TY={region:_Y,primitives:[cY(sY.screen,`ground`),$(`feColorMatrix`,{in:`SourceGraphic`,type:`luminanceToAlpha`,result:`lumRaw`}),$(`feComposite`,{in:`lumRaw`,in2:`SourceAlpha`,operator:`in`,result:`lum`}),$(`feComponentTransfer`,{in:`lum`,result:`beam`},$(`feFuncA`,{type:`linear`,slope:1.5,intercept:-.35})),$(`feComposite`,{in:`beam`,in2:`SourceAlpha`,operator:`in`,result:`trace`}),...gY(sY.phosphor,`trace`,`glow`),$(`feGaussianBlur`,{in:`glow`,stdDeviation:2.5,result:`bloom`}),...lY(`<rect y='2' width='3' height='1' fill='black'/>`,3,`scan`),$(`feOffset`,{in:`scan`,dx:0,dy:0,result:`scanRoll`,"data-sprite-boil":`roll`}),...gY(sY.screen,`scanRoll`,`scanlines`,.6),hY(`crt`,`ground`,`bloom`,`glow`,`scanlines`)],boil:{intervalMs:120,tracks:[{name:`roll`,attribute:`dy`,frames:[0,1,2]}]}},EY={region:vY,primitives:[$(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.03,numOctaves:3,seed:9,result:`flow`}),$(`feDisplacementMap`,{in:`SourceGraphic`,in2:`flow`,scale:7,xChannelSelector:`R`,yChannelSelector:`G`,result:`bled`}),$(`feGaussianBlur`,{in:`bled`,stdDeviation:1.4,result:`wash`}),$(`feComponentTransfer`,{in:`wash`,result:`thin`},$(`feFuncR`,{type:`linear`,slope:.78,intercept:.2}),$(`feFuncG`,{type:`linear`,slope:.78,intercept:.2}),$(`feFuncB`,{type:`linear`,slope:.78,intercept:.2}),$(`feFuncA`,{type:`linear`,slope:.9,intercept:0})),$(`feGaussianBlur`,{in:`wash`,stdDeviation:3,result:`spread`}),$(`feComposite`,{in:`wash`,in2:`spread`,operator:`arithmetic`,k2:1.6,k3:-1.4,result:`rimMask`}),$(`feComponentTransfer`,{in:`wash`,result:`deep`},$(`feFuncR`,{type:`linear`,slope:.6,intercept:0}),$(`feFuncG`,{type:`linear`,slope:.6,intercept:0}),$(`feFuncB`,{type:`linear`,slope:.6,intercept:0})),$(`feComposite`,{in:`deep`,in2:`rimMask`,operator:`in`,result:`rim`}),$(`feTurbulence`,{type:`fractalNoise`,baseFrequency:.7,numOctaves:2,seed:11,result:`tooth`}),uY(`0 0 0 -0.8 1.5`,`tooth`,`toothMask`),dY(`SourceGraphic`,`dark`),uY(`0 0 0 5 -3.8`,`dark`,`keyMask`),...gY(sY.ink,`keyMask`,`key`,.9),hY(`paint`,`thin`,`rim`,`key`),$(`feComposite`,{in:`paint`,in2:`toothMask`,operator:`in`})]},DY=bY(yY),OY={manga:xY,riso:SY,halftone:CY,blueprint:wY,crt:TY,watercolor:EY},kY=e=>e===`pencil`?DY:OY[e],AY=`http://www.w3.org/2000/svg`,jY=(e,t)=>{let n=e.createElementNS(AY,t.tag);for(let[e,r]of Object.entries(t.attributes))n.setAttribute(e,String(r));for(let r of t.children)n.append(jY(e,r));return n};function MY(e){let t=`sprite-style-${Bk()}`,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=kY(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=kY(r),l=`${t}-${r}`,u=n.createElementNS(AY,`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(jY(n,$(`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 NY=[`mushroom`,`cat`,`burger`];c([`shift`,`keep`]);var PY=R().regex(/^#[0-9a-f]{6}$/i),FY=at([PY,qe(),S()]),IY=16;Ye({v:n(1),character:c(NY),appearance:ye(R().min(1),FY).refine(e=>Object.keys(e).length<=IY,{message:`Avatar appearance cannot exceed ${String(IY)} keys`}),expression:R().min(1),renderStyle:oY});function LY(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 RY(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619)>>>0;return t}function zY(e){let t=RY(e)%360;return{cap:LY(t,68,72),capSpot:LY(t,70,92)}}function BY(e){return{v:1,character:`mushroom`,appearance:zY(e),expression:`normal`,renderStyle:`plain`}}function VY(e,t){let n=e??BY(t);return{src:{local:n.character},appearance:n.appearance,expression:n.expression,renderStyle:n.renderStyle}}function HY(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 UY=Ye({version:n(1),name:R().trim().min(1),renderer:R().trim().min(1),controls:ye(R().min(1),iY).default({}),poster:R().min(1).optional(),data:me()}),WY=Ye({local:R().trim().min(1)}),GY=(e,t)=>{let n=WY.safeParse(e);return n.success?{kind:`local`,key:n.data.local}:{kind:`remote`,url:new URL(R().parse(e),t).href}},KY=e=>e instanceof Error?e:Error(String(e),{cause:e}),qY=e=>On(e)?KY(Xn(e.cause)):Error(`Unexpected Sprite success`);function JY(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=HY(n),a=new WeakSet,o=new WeakMap,s=e=>{let t=GY(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=et(er()),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=MY(c),T=()=>{let e=b||c.ownerDocument.hidden||x?.matches===!0;w.still(e);try{p?.native?.pause(e)}catch(e){C(KY(e))}};et(Ln(l,st(()=>{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=it(or(e.scope,Dt)).then(e=>{if(On(e))throw qY(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=aY(n.controls,r.appearance),s=oY.parse(r.renderStyle??`plain`)}catch(e){let t=KY(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(KY(e))}},O=async(a,o,s)=>{let l=r(),u=et(er()),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,et(Ln(u,st(()=>{f.remove()}))),c.append(f);let g=i(function*(){let r,o,s=n.baseURL,c=GY(a.src,n.baseURL);if(c.kind===`remote`){let t=yield*Ie({try:()=>l(c.url,d.signal),catch:KY});s=t.url,r=UY.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*Ie({try:n,catch:KY})).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*Ie({try:n,catch:KY});r=UY.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*Ie({try:()=>l(e,d.signal,s),catch:KY});return yield*nt(st(()=>URL.createObjectURL(new Blob([t.bytes],{type:t.contentType}))),e=>st(()=>{URL.revokeObjectURL(e)}))})});if(!u.activities.includes(`idle`))throw Error(`Character has no idle fallback`);return u.pause(!0),{native:u,document:r}}).pipe(Bn(u)),_=await it(g,{signal:d.signal});if(!(y||s!==m||p!==h)){if(On(_)){let e=qY(_);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:KY(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 it(or(l,Dt));if(On(e))throw qY(e)})(),o.set(c,v.then(()=>({kind:`closed`}),e=>({kind:`failed`,error:KY(e)}))),v)}}}}}var YY=JY({characters:{mushroom:async()=>(await wr(async()=>{let{default:e}=await import(`./mushroom-BBaCYNmw.js`);return{default:e}},__vite__mapDeps([6,7,1,2]))).default,cat:async()=>(await wr(async()=>{let{default:e}=await import(`./cat-UfLh6DHG.js`);return{default:e}},__vite__mapDeps([8,7,1,2,9]))).default,burger:async()=>(await wr(async()=>{let{default:e}=await import(`./burger-DMbWZ2jd.js`);return{default:e}},__vite__mapDeps([10,7,1,2,9]))).default}}),XY=128,ZY=new Map;function QY(e,t,n){return JSON.stringify([e.src,e.appearance,e.expression,e.renderStyle,t,n])}function $Y(e){let t=ZY.get(e);if(t!==void 0)return ZY.delete(e),ZY.set(e,t),t}function eX(e,t){if(ZY.delete(e),ZY.set(e,t),ZY.size<=XY)return;let n=ZY.keys().next().value;n!==void 0&&ZY.delete(n)}function tX(e){let t=e?.querySelector(`canvas`);if(t)try{return t.toDataURL(`image/png`)}catch(e){if(e instanceof DOMException&&e.name===`SecurityError`)return;throw Error(`Could not capture an avatar still frame`,{cause:e})}}var nX=(0,J.memo)(function({activity:e=`idle`,avatar:t,className:n,name:r,seed:i,size:a=24}){let[o,s]=(0,J.useState)(!1),c=(0,J.useRef)(null),l=(0,J.useMemo)(()=>VY(t,i),[t,i]),u=window.devicePixelRatio,d=(0,J.useMemo)(()=>QY(l,a,u),[l,a,u]),[f,p]=(0,J.useState)(()=>$Y(d));(0,J.useEffect)(()=>{p($Y(d))},[d]);let m=e!==`idle`||f===void 0||l.renderStyle!==`plain`;return(0,J.useEffect)(()=>{m||s(!1)},[m]),(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`relative inline-block shrink-0 ${n??``}`,"data-agent-head":f!==void 0||o?`ready`:`loading`,style:{height:a,width:a},children:[f===void 0&&!o?(0,X.jsx)(ZJ,{className:`absolute inset-0`,name:r,seed:i}):null,f!==void 0&&l.renderStyle===`plain`&&(!m||!o)?(0,X.jsx)(`img`,{alt:``,className:`absolute inset-0 h-full w-full`,src:f}):null,m?(0,X.jsx)($J,{activity:e,appearance:l.appearance,className:`absolute inset-0`,expression:l.expression,onState:t=>{if(s(t.status===`ready`),t.status===`ready`&&e===`idle`&&l.renderStyle===`plain`){let e=tX(c.current);e!==void 0&&(eX(d,e),p(e))}},paused:e===`idle`,ref:c,renderStyle:l.renderStyle,service:YY,src:l.src}):null]})}),rX=(0,J.memo)(function({avatar:e,className:t=`h-12 w-12 shrink-0`,service:n=YY,state:r}){let i=(0,J.useMemo)(()=>e?VY(e,`shiitake-mascot`):void 0,[e]);return(0,X.jsx)($J,{"aria-hidden":`true`,className:t,service:n,src:i?.src??{local:`mushroom`},...i?{appearance:i.appearance,renderStyle:i.renderStyle}:{},...r})}),iX={needs_you:`Waiting for you`,running:`Working`,errored:`Failed`,done:`Done`},aX={needs_you:0,errored_unseen:1,running:2,recent:3};function oX(e){return e===`running`||e===`needs_you`}function sX(e,t){return e!==void 0&&(t===void 0||e>t)}function cX(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 lX(e,t){return aX[e.tier]-aX[t.tier]||(t.settledAt??t.createdAt)-(e.settledAt??e.createdAt)||e.agentId.localeCompare(t.agentId)||e.sessionId.localeCompare(t.sessionId)}var uX=[`Needs you`,`Working`,`Ready`,`Finished`];function dX(e){return e.tier===`running`?`Working`:e.shelf===`active`?`Needs you`:e.ready?`Ready`:`Finished`}function fX(e){return{key:_X(e.agentId,e.sessionId),shelf:dX(e),attention:e.tier===`needs_you`||e.tier===`errored_unseen`?`${e.tier}:${String(e.settledAt??e.createdAt)}`:null}}function pX(e,t,n){let r=new Map(t.map(e=>[_X(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(fX).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=uX.flatMap(t=>{let a;a=e===null||n.reorder?i.map(fX).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:fX(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:fX(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 mX(e){switch(e.kind){case`idle`:return`done`;case`waiting_for_you`:return`needs_you`;case`error`:return`errored`;default:return`running`}}function hX(e,t,n=null,r){let i=new Set(e.map(e=>e.agentId));return gX(t.filter(e=>!(`kind`in e)&&i.has(e.agentId)&&(n===null||e.agentId===n)),r)}function gX(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=sX(i.settledAt,i.visitedAt),a=t?.agentId===i.agentId&&t.sessionId===i.sessionId?t.state:void 0,o=a?mX(a):i.state,s=a?a.kind===`idle`:o===`done`&&i.settledAt===void 0,c=cX(o,e);n.push({...i,state:o,ready:s,unseen:e,tier:c,shelf:c===`recent`?`settled`:`active`})}return n.sort(lX),{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 _X(e,t){return`${e}\u0000${t}`}function vX(e){return e.name}function yX({children:e}){return(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:e})}function bX({open:e,agents:t,agentFilterId:n,websitesSelected:r,websitesVisible:i,canCreate:a,createOpen:o,onAll:s,onWebsites:c,onAgent:l,onCreate:u}){let d=`grove-rail-cell relative size-12 rounded-field p-0`,f=n===null&&!(r&&i);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)(Iw,{variant:`ghost`,"aria-label":`All Agents`,"aria-pressed":f,className:`${d} text-xs ${f?`bg-base-300`:``}`,onClick:s,children:(0,X.jsx)(yX,{children:`All`})}),i?(0,X.jsx)(Iw,{variant:`ghost`,"aria-label":`Websites`,"aria-pressed":r,className:`${d} ${r?`bg-base-300`:``}`,onClick:c,children:(0,X.jsx)(yX,{children:(0,X.jsx)(OJ,{name:`connected`,size:28})})}):null,(0,X.jsx)(Ck,{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)(Iw,{variant:`ghost`,"aria-label":vX(e),title:vX(e),"aria-pressed":n===e.agentId&&!r,"data-agent-id":e.agentId,className:`${d} ${n===e.agentId&&!r?`bg-base-300`:``}`,onClick:()=>{l(e.agentId)},children:(0,X.jsx)(yX,{children:(0,X.jsx)(nX,{name:vX(e),seed:e.agentId,size:32})})},e.agentId))})}),a?(0,X.jsx)(Iw,{variant:`ghost`,"aria-label":`New Agent`,"aria-expanded":o,"aria-haspopup":`dialog`,className:`${d} mt-auto`,onClick:u,children:(0,X.jsx)(`span`,{className:`grove-rail-mark grid size-full place-items-center`,children:(0,X.jsx)(RU,{size:20})})}):null]})}function xX({active:e,className:t,label:n,tone:r=`mycelium`,...i}){return(0,X.jsxs)(`span`,{...i,"aria-label":`${n}: ${e?`on`:`off`}`,className:Q(`caps-led`,t),"data-active":e,"data-tone":r,role:`img`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-led-bead`}),(0,X.jsx)(`span`,{"aria-hidden":`true`,children:n})]})}function SX({app:e}){let[t,n]=(0,J.useState)(null),r=Lo({queryKey:Xv.of(e,`team-inbox-notices`,t),enabled:e!==null&&(e.capabilities.has(ch)||e.capabilities.has(lh)),queryFn:async()=>{if(!e)throw Error(`No App connection`);let n=await hh(e.capabilities);try{return await Wv(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)(Ck,{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)(Ib,{density:`compact`,className:`px-3 py-2`,children:r.data.items.map(e=>(0,X.jsx)(Lb,{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)(xX,{className:`col-span-2 grid grid-cols-subgrid [--caps-led-color:var(--color-warning)]`,active:!0,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)(Iw,{variant:`ghost`,size:`sm`,onClick:()=>{n(r.data.next)},children:`Older notices`}):null,t===null?null:(0,X.jsx)(Iw,{variant:`ghost`,size:`sm`,onClick:()=>{n(null)},children:`Newest notices`})]})})}var CX=`(min-width: 900px)`;function wX(e){let t=globalThis.matchMedia(CX);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}}function TX(){return globalThis.matchMedia(CX).matches}function EX(){return(0,J.useSyncExternalStore)(wX,TX,()=>!0)}function DX({open:e,onOpenChange:t,returnFocus:n,children:r}){let i=EX(),[a,o]=(0,J.useState)(null);return(0,X.jsxs)(fU,{open:i||e,modal:!i,disablePointerDismissal:i,onOpenChange:e=>{i||t(e)},children:[(0,X.jsx)(`div`,{ref:o,className:`contents`}),(0,X.jsxs)(mU,{container:a,keepMounted:!0,className:`contents`,children:[i?null:(0,X.jsx)(hU,{className:`grove-nav-scrim z-30 bg-base-200`}),(0,X.jsx)(gU,{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 OX=W({path:q,entries:K(W({name:q,type:Hn([`file`,`directory`,`symlink`]),size:rn,modifiedAt:rn})),nextOffset:br(rn)}),kX=Bm(`computer.list`,1,Vm({list:Um(Hm(Te().transform(e=>hn(OX)(e))))})),AX=U([W({state:Hn([`running`,`sleeping`,`starting`])}),W({state:G(`queued`),position:rn.pipe(V(Vn()),V(An(0)))})]),jX=W({enabled:Mn,effective:Mn,blockedBy:br(Hn([`team`,`global`]))}),MX=W({computerId:Cr,name:Cr,runtime:AX,backends:K(W({id:Cr,kind:Hn([`platform-container`,`on-box-vm`,`local`]),status:Hn([`ready`,`queued`,`online`,`offline`]),queuePosition:br(rn.pipe(V(Vn()),V(An(0)))),hostId:br(q),hostLabel:br(q),folderLabel:br(q),detachable:Mn})),internet:jX});Bm(`computer.instrument.read`,1,Vm({read:Um(Hm(Te().transform(e=>hn(MX)(e))))})),Bm(`computer.instrument.control`,1,Vm({start:Um(Hm(Te().transform(e=>hn(AX)(e)))),setInternetAccess:Um(Hm(Te().transform(e=>hn(jX)(e)))),detachLocal:Um(Hm(Te().transform(e=>hn(W({detached:Mn}))(e))))}));var NX=W({ports:K(W({port:rn.pipe(V(Vn()),V(St({minimum:1,maximum:65535}))),previewUrl:Cr,openMode:Hn([`inline`,`external-only`]),expiresAt:rn.pipe(V(Vn()),V(An(0)))})).pipe(V(z(64)))}),PX=U([NX,W({error:G(`port_previews_not_configured`)})]),FX=W({port:rn.annotate({message:`Use a port from 1 to 65535.`}).check(Vn({message:`Use a port from 1 to 65535.`}),St({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:Mn}),IX=W({port:rn.pipe(V(Vn()),V(St({minimum:1,maximum:65535}))),removed:Mn});Bm(`computer.ports`,2,Vm({list:Um(Hm(Te().transform(e=>hn(PX)(e)))),expose:Um(Hm(Te().transform(e=>hn(FX)(e)))),unexpose:Um(Hm(Te().transform(e=>hn(IX)(e))))}));var LX=Hn([`synced`,`pending`,`unknown`]),RX=W({port:br(FX.fields.port),id:Cr,command:Cr,cwd:br(q),startedAt:rn.pipe(V(Vn()),V(Nn(0))),state:Hn([`running`,`exited`,`uncertain`]),exitCode:br(rn.pipe(V(Vn()))),sync:LX,endedAt:br(rn.pipe(V(Vn()),V(Nn(0))))}),zX=W({processes:K(RX)}),BX=W({process:RX,signalled:Mn});W({requestId:Cr.pipe(V(z(256))),command:Cr.pipe(V(z(16384))),cwd:H(q),port:H(FX.fields.port)}),Bm(`computer.processes`,1,Vm({start:Um(Hm(Te().transform(e=>hn(RX)(e)))),list:Um(Hm(Te().transform(e=>hn(zX)(e)))),kill:Um(Hm(Te().transform(e=>hn(BX)(e))))})),Bm(`computer.readFile`,1,Vm({open:Um(Vm({response:Um(v(Response)),close:Wm}))})),Bm(`computer.writeFile`,3,Vm({open:Um(Vm({write:Wm,close:Wm})),mkdir:Wm,replace:Um(Hm(Te().transform(e=>hn(VX)(e))))}));var VX=U([W({kind:G(`replaced`),path:Cr,bytes:rn.pipe(V(Vn()),V(Nn(0)))}),W({kind:G(`conflict`)})]),HX=W({computerName:Cr.pipe(V(z(256))),teamName:Cr.pipe(V(z(256))),modelDoor:Cr.pipe(V(z(256))),uptimeSeconds:rn.pipe(V(Vn()),V(Nn(0))),version:Cr.pipe(V(z(64)))});Bm(`computer.terminal`,2,Vm({open:Um(Vm({information:Um(Hm(Te().transform(e=>hn(HX)(e)))),output:Um(v(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(v(Uint8Array).parse(e))}})))),input:Um(v(WritableStream)),resize:Wm,close:Wm}))}));function UX({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 WX(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 GX=[],KX=0,{link:qX,unlink:JX,propagate:YX,checkDirty:XX,shallowPropagate:ZX}=UX({update(e){return e._update()},notify(e){GX[$X++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,rZ(e))}}),QX=0,$X=0,eZ,tZ=0;function nZ(e){try{++tZ,e()}finally{--tZ||iZ()}}function rZ(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=JX(n,e)}function iZ(){if(!(tZ>0)){for(;QX<$X;){let e=GX[QX];GX[QX++]=void 0,e.notify()}QX=0,$X=0}}function aZ(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 eZ!==void 0&&qX(i,eZ,KX),i._snapshot},subscribe(e){let t=WX(e),n={current:!1},r=oZ(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=eZ,o=t?.compare??Object.is;if(n)eZ=i,++KX,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{eZ=a,n&&(i.flags&=-5),rZ(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&XX(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ZX(e)}}else e&32&&(i.flags=e&-33);return eZ!==void 0&&qX(i,eZ,KX),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(YX(e),ZX(e),iZ())}},i}function oZ(e){let t=()=>{let t=eZ;eZ=n,++KX,n.depsTail=void 0,n.flags=6;try{return e()}finally{eZ=t,n.flags&=-5,rZ(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&&XX(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,rZ(this)}};return t(),n}var sZ=class{constructor(e,t){this.atom=aZ(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(WX(e))}},cZ=class{constructor(e){this.atom=aZ(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(WX(e))}};function lZ(e,t){return typeof e==`function`?new cZ(e):t?new sZ(e,t):new sZ(e)}var uZ=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 dZ(e,t){return new uZ(e,t).maybeExecute}var fZ=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 fZ{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function mZ(e,t){return typeof e==`function`?e(t):e}function hZ(e,t){return CZ(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function gZ(e,t,n){let r=CZ(t);function i(e){if(!r.length)return mZ(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 _Z(e,t){let n=CZ(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 vZ=46,yZ=91,bZ=93,xZ=48,SZ=57;function CZ(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)===yZ),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===vZ||s===yZ||s===bZ){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==xZ),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!==bZ&&(a!==-1||s!==bZ)&&(a!==s||s!==vZ&&s!==yZ)&&n.push(``);r=o+1,i=!0}else(s<xZ||s>SZ)&&(i=!1);a=s}return n.length||n.push(``),n}function wZ(e){return!(Array.isArray(e)&&e.length===0)}function TZ(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 EZ(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 DZ=e=>!!e&&typeof e==`object`&&`fields`in e;function OZ(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)||!OZ(e[i],t[i]))return!1;return!0}var kZ=({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},AZ=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function jZ(e,t){return e==null?t:{...e,...t}}for(var MZ=256,NZ=[],PZ;MZ--;)NZ[MZ]=(MZ+256).toString(16).substring(1);function FZ(){let e=0,t,n=``;if(!PZ||MZ+16>256){for(PZ=Array(256),e=256;e--;)PZ[e]=256*Math.random()|0;e=0,MZ=0}for(;e<16;e++)t=PZ[MZ+e],n+=e===6?NZ[t&15|64]:e===8?NZ[t&63|128]:NZ[t],e&1&&e>1&&e<11&&(n+=`-`);return MZ++,n}var IZ=dZ(e=>pZ.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function LZ(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]=LZ(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,LZ(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(LZ(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=LZ(e[n]));return t}function RZ(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var zZ=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 BZ(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 VZ=(e,t)=>{let n=BZ(e,t);return{form:n,fields:n}},HZ={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:VZ(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:VZ(r.issues,e)}},UZ=e=>!!e&&`~standard`in e,WZ={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function GZ(e){function t(t){let n=e.getFieldMeta(t)??WZ;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=()=>WZ;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function KZ(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 qZ=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{IZ(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&&!OZ(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!OZ(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(nZ(()=>{this.baseStore.setState(()=>KZ(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=GZ(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=gZ(t,e.instance.name,e.instance.options.defaultValue))}),KZ({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return nZ(()=>{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 nZ(()=>{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=TZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||zZ}),r=!1,i={};return nZ(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=JZ(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=YZ(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)??WZ,r=a?.[e],{newErrorValue:s,newSource:c}=kZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=WZ)=>({...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=YZ(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=YZ(`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=EZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||zZ});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=YZ(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}=JZ(r);s&&(i=i?{...i,...s}:s);let c=YZ(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)??WZ,r=i?.[e],{newErrorValue:a,newSource:o}=kZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=WZ)=>({...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})),nZ(()=>{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}nZ(()=>{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}),nZ(()=>{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=>hZ(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]:mZ(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=WZ,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;nZ(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:gZ(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=_Z(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),GZ(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],jZ(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),GZ(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),jZ(r,{dontValidate:!0})),GZ(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),jZ(n,{dontValidate:!0})),GZ(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 gZ(gZ(e,`${t}`,i),`${n}`,r)},jZ(r,{dontValidate:!0})),GZ(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},jZ(r,{dontValidate:!0})),GZ(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,[],jZ(t,{dontValidate:!0})),GZ(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=hZ(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:WZ},values:i===void 0?t.values:gZ(t.values,e,i)}})},this.setErrorMap=e=>{nZ(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(DZ(t)){let{formError:e,fieldErrors:r}=JZ(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=>HZ.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>HZ.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??FZ(),this._devtoolsSubmissionOverride=!1;let t=KZ({...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||!DZ(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=lZ(t);let n;this.fieldMetaDerived=lZ(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=hZ(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=!wZ(u),f=!o.isDirty,p=OZ(l,this.getFieldInfo(a)?.instance?.options.defaultValue??hZ(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=lZ(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||!RZ(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&&RZ(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=lZ(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&&DZ(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&&OZ(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 UZ(e.validate)?HZ[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function JZ(e){return e?DZ(e)?{formError:JZ(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function YZ(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 XZ=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]:{...WZ,isTouched:e.fieldMetaBase[this.name]?.isTouched??WZ.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??WZ.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??WZ.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&&(OZ(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,jZ(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,jZ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,jZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,jZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,jZ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,jZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,jZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,jZ(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=TZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||zZ}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=TZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||zZ});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;nZ(()=>{let e=(e,n)=>{let r=QZ(n.cause),a=n.validate?ZZ(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}=AZ({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=QZ(`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=EZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||zZ}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=EZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||zZ});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)));nZ(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=QZ(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=ZZ(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=AZ({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)),nZ(()=>{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=>RZ(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[QZ(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[QZ(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=>HZ.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>HZ.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)RZ(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=lZ(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...WZ,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!OZ(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 UZ(e.validate)?HZ[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 ZZ(e){if(e)return e}function QZ(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 $Z(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function eQ(e){return{...WZ,...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 tQ=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??$Z({});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&&(OZ(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,{...WZ,...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]??$Z({...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;rQ(t)&&(n=t.group,r=t.fields);let i=nQ(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]:$Z({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,jZ(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 XZ&&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&&RZ(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}=kZ({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=WZ)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=TZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||zZ}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=TZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||zZ});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;nZ(()=>{let t=(t,r)=>{let i=aQ(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&&rQ(s)&&(c=s.group,l=s.fields);let u=nQ(c),d=n[i],{newErrorValue:f,newSource:p}=AZ({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=aQ(`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=EZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||zZ}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=EZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||zZ});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=aQ(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&&rQ(o)&&(l=o.group,u=o.fields);let d=nQ(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=AZ({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 nZ(()=>{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=>RZ(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[aQ(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>RZ(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})),nZ(()=>{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}nZ(()=>{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}),nZ(()=>{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=lZ(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??eQ(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!OZ(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(UZ(e.validate)){let t=HZ[e.type](e.value,e.validate);return e.type===`validate`?iQ(t):t.then(iQ)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function nQ(e){if(e)return e}function rQ(e){return!!e&&typeof e==`object`&&`fields`in e}function iQ(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 aQ(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 oQ(e,t){if(!t)return;let n=Object.assign({},e,{state:LZ(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 nZ(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}function sQ(e,t){return e===t}function cQ(e,t=e=>e,n){let r=n?.compare??sQ,i=(0,J.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,J.useCallback)(()=>e.get(),[e]);return(0,KB.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var lQ=typeof window<`u`?J.useLayoutEffect:J.useEffect;function uQ(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new XZ({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new XZ({...e}),i(a),n({form:e.form,name:e.name}));let o=cQ(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=cQ(a.store,e=>e.meta.isTouched),c=cQ(a.store,e=>e.meta.isBlurred),l=cQ(a.store,e=>e.meta.isDirty),u=cQ(a.store,e=>e.meta.errorMap),d=cQ(a.store,e=>e.meta.errorSourceMap),f=cQ(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 lQ(a.mount,[a]),lQ(()=>{a.update(e)}),p}var dQ=(({children:e,...t})=>{let n=uQ(t),r=(0,J.useMemo)(()=>mZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function fQ(){return(0,J.useState)(()=>FZ())[0]}var pQ=J,mQ=`18.3.1`.split(`.`)[0]===`17`?fQ:pQ.useId;function hQ(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new tQ({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new tQ({...e})),n({form:e.form,name:e.name}));let a=cQ(r.store,e=>e.value),o=cQ(r.store,e=>e.meta.isTouched),s=cQ(r.store,e=>e.meta.isBlurred),c=cQ(r.store,e=>e.meta.isDirty),l=cQ(r.store,e=>e.meta.errorMap),u=cQ(r.store,e=>e.meta.errorSourceMap),d=cQ(r.store,e=>e.meta.isValidating),f=cQ(r.store,e=>e.meta.isSubmitting),p=cQ(r.store,e=>e.meta.isSubmitted),m=cQ(r.store,e=>e.meta.submissionAttempts),h=cQ(r.store,e=>e.meta.isSubmitSuccessful),g=cQ(r.store,e=>e.meta.canSubmit),_=cQ(r.store,e=>e.meta.isValid),v=cQ(r.store,e=>e.meta.isFieldsValid),y=cQ(r.store,e=>e.meta.isFieldsValidating),b=cQ(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 lQ(r.mount,[r]),lQ(()=>{r.update(e)}),x}var gQ=(({children:e,...t})=>{let n=hQ(t),r=(0,J.useMemo)(()=>mZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function _Q({form:e,selector:t=e=>e,children:n}){let r=cQ(e.store,t);return(0,X.jsx)(X.Fragment,{children:mZ(n,r)})}function vQ(e){let t=mQ(),[n,r]=(0,J.useState)(e?.formId),[i,a]=(0,J.useState)(()=>new qZ({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new qZ({...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)(dQ,{...e,form:i})},e.FormGroup=function(e){return(0,X.jsx)(gQ,{...e,form:i})},e.Subscribe=function(e){return(0,X.jsx)(_Q,{form:i,selector:e.selector,children:e.children})},e},[i]);lQ(i.mount,[]),lQ(()=>{i.update(e)});let s=(0,J.useRef)(!1);return lQ(()=>{s.current&&e?.transform&&oQ(i,e.transform)},[i,e?.transform]),lQ(()=>{s.current=!0}),o}var yQ=Lt(q),bQ=Lt(W({message:q}));function xQ(e){for(let t of e.errors){let e=Qe(rt(ne(bQ(t),e=>e.message),()=>yQ(t)));if(e!==void 0&&e.length>0)return e}}var SQ={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},CQ=(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)(Iw,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:Q(`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:Q(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,SQ[n]),children:t})})}),wQ={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},TQ=(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:Q(`progress caps-gooey-motion caps-gooey-progress w-full`,wQ[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:Q(`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)(TQ,{"aria-label":e,value:t,max:n,tone:r})]})});function EQ({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)(kQ,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function DQ({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,X.jsx)(CQ,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,X.jsx)(zU,{}):(0,X.jsx)(HU,{}),onClick:()=>void n(t),type:`button`}):null}function OQ({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 kQ({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)(FU,{className:`size-4`})}),(0,X.jsx)(OQ,{item:e}),(0,X.jsx)(AQ,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,X.jsx)(TQ,{"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 AQ({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)(DQ,{action:e.retry,id:t,onAction:i,retry:!0}),(0,X.jsx)(DQ,{action:e.cancel,id:t,onAction:n}),(0,X.jsx)(DQ,{action:e.remove,id:t,onAction:r})]})}var jQ={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`},MQ={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function NQ({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=bx();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=lx(n.current),c=_k(s,{ease:`inCubic`,duration:160}),l=hw(n.current,{d:{to:jQ[e],...o?hk:_k(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?hk:t?_k(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,..._k(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:dx(s,120),...gk(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)(bw,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(xw,{id:`${t}-shadow`}),(0,X.jsx)(Sw,{id:`${t}-inset`}),(0,X.jsx)(ww,{id:`${t}-goo`,values:MQ}),(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:jQ[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 PQ=(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:Q(`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)(NQ,{state:m}):n]})}),FQ=J.createContext(void 0);function IQ(e){let t=J.useContext(FQ);if(t===void 0&&!e)throw Error(aT(47));return t}var LQ={...cV,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!cV.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&cV.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>cV.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},RQ=class extends $B{constructor(e,t,n){let r=new NB;super(zQ(e,r,t,n),BQ(r),LQ)}setOpen=(e,t)=>{let n=t.reason===QR,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=DB(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=EB(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}),JF.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function zQ(e,t,n,r=!1){let i={...nV(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 BQ(e){return{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:J.createRef(),beforeTriggerFocusGuardRef:J.createRef(),beforeContentFocusGuardRef:J.createRef(),stickIfOpenTimeout:new nT,stickIfOpen:!0,triggerElements:e}}var VQ=HB(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=UQ(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),MB(u,d),kB(u);let{forceUnmount:m}=AB(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,YR(rz))}),[m,u]);let h=d||f||s!=null;return(0,X.jsxs)(FQ.Provider,{value:u,children:[s&&(0,X.jsx)(CB,{handle:s,store:u}),h&&(0,X.jsx)(WQ,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function HQ(e){return IQ(!0)?(0,X.jsx)(VQ,{props:e}):(0,X.jsx)(Qz,{children:(0,X.jsx)(VQ,{props:e})})}function UQ(e,t){let n=SB((e,n)=>new RQ(t,e,n));return J.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function WQ({store:e,modal:t}){let n=fB(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return jB(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function GQ(e,t){function n(n,r,i){let a=n.currentTarget;JF.flushSync(()=>{e.setOpen(!1,YR(tz,n.nativeEvent,a))}),EO(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&&DO(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var KQ=UB(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=IQ(!0),h=lV(s)??m;if(!h)throw Error(aT(74));let g=XT(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}=OB(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=_V(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:TV(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=lB(v,{stickIfOpen:Jw(()=>h.context.stickIfOpen)}),k=aU(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=KR({disabled:a,native:o}),N={open(e){return w?fD.open(e):dD.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=GQ(h,x),ee=FT(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[Iz]:``,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)(bz,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),I,(0,X.jsx)(bz,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):I}),qQ=J.createContext(void 0);function JQ(){let e=J.useContext(qQ);if(e===void 0)throw Error(aT(45));return e}var YQ=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return IQ().useState(`mounted`)||n?(0,X.jsx)(qQ.Provider,{value:n,children:(0,X.jsx)(Uz,{ref:t,...r})}):null}),XQ=J.createContext(void 0);function ZQ(){let e=J.useContext(XQ);if(!e)throw Error(aT(46));return e}function QQ(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=Yz(n),p=J.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=CH({...e,elements:{...p,...l&&{reference:l}}}),h=J.useCallback(e=>{let t=uE(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 HO(()=>{o&&(d.current=o)},[o]),HO(()=>{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 $Q=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}=RD(e,t)||{};if(l==null)return{};let d=nO(u),f={x:n,y:r},p=WD(i),m=HD(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=LD(D,k,O),j=!c.arrow&&BD(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}}}),e$=(e,t)=>{let{name:n,fn:r}=$Q(e);return{name:n,fn:r,options:[e,t]}},t$={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}}}},n$={sideX:`left`,sideY:`top`},r$=`--available-width`,i$=`--available-height`,a$=`--anchor-width`,o$=`--anchor-height`,s$=`--transform-origin`,c$=r$,l$=i$;function u$(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 d$(e,t,n){let{rects:r,placement:i}=e;return{side:u$(t,zD(i),n),align:BD(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function f$(e){return p$(e,QQ)}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=Jw(O),A=O?k:n,j=fz(n),M=fz(g),N=qO()===`rtl`,[P,F]=J.useState(null);!g&&P!==null&&F(null);let ee=x===`placement`,I=P?zD(P):null,te=P&&ee?BD(P)||`center`:null,ne=I||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],re=te||o,ie=re===`center`?ne:`${ne}-${re}`,ae=l;typeof ae==`number`?ae={top:ae,right:ae,bottom:ae,left:ae}:ae&&={top:ae.top||0,right:ae.right||0,bottom:ae.bottom||0,left:ae.left||0};let oe=+(i===`bottom`),se=+(i===`top`),L=+(i===`right`),ce=+(i===`left`),le={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:ae},ue=J.useRef(null),de=fz(a),fe=fz(s),pe=typeof a==`function`?0:a,me=typeof s==`function`?0:s,he=[];p&&he.push(p),he.push(wH(e=>{let t=d$(e,i,N),n=typeof de.current==`function`?de.current(t):de.current,r=typeof fe.current==`function`?fe.current(t):fe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[pe,me,N,i]));let ge=w===`none`&&C!==`shift`,_e=!ge&&(u||E||C===`shift`),ve=C===`none`?null:DH({...le,padding:{top:ae.top+1+oe,right:ae.right+1+ce,bottom:ae.bottom+1+se,left:ae.left+1+L},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),ye=ge?null:TH({...le,rootBoundary:D,mainAxis:w!==`none`,crossAxis:_e,limiter:u||E?void 0:EH(e=>{if(!ue.current)return{};let{width:t,height:n}=ue.current.getBoundingClientRect(),r=UD(zD(e.placement)),i=r===`y`?t:n,a=r===`y`?ae.left+ae.right:ae.top+ae.bottom;return{offset:i/2+a/2}})},[le,u,E,D,ae,w]);C===`shift`||w===`shift`||re===`center`?he.push(ye,ve):he.push(ve,ye),he.push(OH({...le,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(c$,`${t}px`),i.setProperty(l$,`${n}px`);let a=sE(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(a$,`${u}px`),i.setProperty(o$,`${d}px`)}}),e$(e=>({element:ue.current||oO(e.elements.floating).createElement(`div`),padding:ue.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=zD(r),u=BD(r),d=UD(l)===`y`,f=ue.current,p=typeof a==`function`?a(d$(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 _e&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(s$,d?`${m} ${h}`:`${h} ${m}`),{}}},t$,b),HO(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let be=J.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:xe,elements:Se,x:Ce,y:we,middlewareData:Te,update:Ee,placement:De,context:Oe,isPositioned:ke,floatingStyles:Ae}=t({rootContext:h,open:m?g:void 0,placement:ie,middleware:he,strategy:r,whileElementsMounted:m?void 0:(...e)=>dH(...e,be),nodeId:y,externalTree:S}),{sideX:je,sideY:Me}=Te.adaptiveOrigin||n$,Ne=ke?r:`fixed`,Pe=J.useMemo(()=>{let e;return e=ke?b?{position:Ne,[je]:Ce,[Me]:we}:{...Ae,position:Ne}:{position:Ne,top:0,left:0},e[c$]=`100vw`,e[l$]=`100vh`,ke||(e.opacity=0),e},[b,Ne,je,Ce,Me,we,Ae,ke]),Fe=J.useRef(null);HO(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(m$(t)?t.current:t)||null;n!==Fe.current&&(xe.setPositionReference(n),Fe.current=n)},[g,xe,A,j]),J.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&m$(e)&&e.current!==Fe.current&&(xe.setPositionReference(e.current),Fe.current=e.current)},[g,xe,A,j]),J.useEffect(()=>{if(m&&g&&Se.reference&&Se.floating)return dH(Se.reference,Se.floating,Ee,be)},[m,g,Se,Ee,be]);let Ie=zD(De),Le=u$(i,Ie,N),Re=BD(De)||`center`,ze=!!Te.hide?.referenceHidden;HO(()=>{x&&g&&ke&&(Ie!==ne||ee&&Re!==re)&&F(De)},[x,ee,g,ke,De,Ie,Re,ne,re]);let Be=J.useMemo(()=>({position:`absolute`,top:Te.arrow?.y,left:Te.arrow?.x}),[Te.arrow]),Ve=Te.arrow?.centerOffset!==0;return J.useMemo(()=>({positionerStyles:Pe,arrowStyles:Be,arrowRef:ue,arrowUncentered:Ve,side:Le,align:Re,physicalSide:Ie,anchorHidden:ze,refs:xe,context:Oe,isPositioned:ke,update:Ee}),[Pe,Be,ue,Ve,Le,Re,Ie,ze,xe,Oe,ke,Ee])}function m$(e){return e!=null&&`current`in e}function h$(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=J.useRef(null),o=J.useRef(null),s=_B(r);HO(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),HO(()=>{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 g$(e){return e===`starting`?Fz:$w}function _$(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),FT(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},g$(r),i],stateAttributesMapping:pD})}var v$=20;function y$(e,t,n,r){let[i,a]=J.useState(!1);HO(()=>{if(!e||!t||n==null){a(!1);return}let r=oO(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-v$)},[e,t,n]),YH(e&&(!t||i),r)}var b$=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=Lz,..._}=e,v=IQ(),y=JQ(),b=Xz(),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=f$({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`)});h$({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;y$(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=_$(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)(XQ.Provider,{value:j,children:[S&&M&&(0,X.jsx)(LH,{inert:IH(!C),cutout:T}),(0,X.jsx)(Zz,{id:b,children:P})]})}),x$=J.createContext(void 0);function S$(e){let t=J.useContext(x$);if(t===void 0&&!e)throw Error(aT(69));return t}var C$=J.createContext(void 0);function w$(){let[e,t]=J.useState(0),n=Jw(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:J.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var T$=J.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=IQ(),l=ZQ(),u=S$(!0)!=null,{context:d,hasClosePart:f}=w$(),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`);vB({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),hV(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?xB(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=FT(`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`,...bB,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&jH.has(e.key)&&e.stopPropagation()}},g$(g),s],stateAttributesMapping:mD});return(0,X.jsx)(cB,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:dE(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,X.jsx)(C$.Provider,{value:d,children:M})})}),E$=(0,J.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,X.jsxs)(`button`,{...r,ref:i,type:n,className:Q(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(AU,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function D$({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=SG({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(SW(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 O$(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:ne,activeItem:re,activeKey:ie,commit:ae,groups:oe,inputValue:se,listboxId:L,onInputChange:ce,onInputKeyDown:le,open:ue,optionId:de,selectedKeys:fe,setOpen:pe}=D$({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});uU(()=>{O&&pe(!1)});let me=lU(`popover`),he=s===void 0?me:s,ge=bG(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),_e=(0,X.jsx)(gG,{..._,...O?{}:I,"aria-activedescendant":re?de(f(re)):void 0,"aria-autocomplete":`list`,"aria-controls":L,"aria-expanded":!0,className:Q(`input-sm`,_?.className),id:O?_?.id??`${ee}-input`:ee,onChange:e=>{_?.onChange?.(e),ce(e)},onKeyDown:e=>{_?.onKeyDown?.(e),e.defaultPrevented||le(e)},placeholder:_?.placeholder??T,ref:v,role:`combobox`,value:se}),ve=(0,X.jsx)(`div`,{id:L,ref:ge,className:`caps-combobox-list`,"data-navigation":te?`keyboard`:`pointer`,onPointerMove:ne,role:`listbox`,"aria-multiselectable":C??void 0,children:oe.every(e=>e.items.length===0)?(0,X.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:d}):oe.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=ie===t,i={active:r,disabled:n,selected:fe.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:de(t),onClick:()=>{ae(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)(kU,{}):null}),E?.(e,r,i)??p(e)]},t)})]},e.label))});return O?(0,X.jsx)(`div`,{...j,className:Q(j.className),ref:D,children:(0,X.jsxs)(HQ,{modal:!0,onOpenChange:pe,open:ue,children:[(0,X.jsx)(KQ,{...I,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),he===null?null:(0,X.jsx)(YQ,{container:he,children:(0,X.jsx)(b$,{align:`start`,side:`bottom`,sideOffset:4,children:(0,X.jsxs)(T$,{"data-active-tone":o,className:Q(`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:_e}),ve]})})})]})}):(0,X.jsx)(`div`,{...j,className:Q(j.className),ref:D,children:(0,X.jsxs)(`div`,{className:Q(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:_e}),ve]})})}function k$({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 A$=(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)(PQ,{...a,appearance:r??`default`,"aria-label":e,className:Q(`caps-icon-choice-input`,i),indicator:(0,X.jsx)(k$,{icon:t,caption:n}),ref:o})})});function j$({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=ux(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=_k(o,{ease:`outCubic`,duration:75}),c=e?gk(o,{bounce:.65,duration:300}):_k(o,{ease:`inCubic`,duration:100}),l=hw(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)(bw,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(xw,{id:`${t}-shadow`}),(0,X.jsx)(Sw,{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 M$=(0,J.createContext)(null),N$=(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)(M$.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,X.jsx)(`fieldset`,{...c,className:Q(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),P$=(0,J.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,J.useContext)(M$);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:Q(`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)(j$,{checked:c}):t]})}),F$=(0,J.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,J.useContext)(M$),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)(P$,{...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]})}),I$=(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)(P$,{...i,"aria-label":e,className:Q(`caps-icon-choice-input`,r),indicator:(0,X.jsx)(k$,{icon:t,caption:n}),ref:a})})}),L$=(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:Q(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,X.jsx)(AU,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function R$({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=bx();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=lx(n.current),c=gk(s,{bounce:.25,duration:440}),l=_k(s,{ease:`inOutSine`,duration:100}),u=hw(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=hw(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)(bw,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(xw,{id:`${t}-shadow`}),(0,X.jsx)(Sw,{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 z$=(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:Q(`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)(R$,{checked:u})]})}),B$=Lt(q),V$=Lt(Mn),H$=Lt(br(gr)),U$=Lt(K(q)),W$=K(Sn(File)),G$=Lt(W$),K$=U([q,gr,Mn,kn,wt,K(q),W$]),q$=Lt(K$),J$=e=>T(B$(e.state.value),()=>``),Y$=e=>T(V$(e.state.value),()=>!1),X$=e=>T(H$(e.state.value),()=>null),Z$=e=>T(U$(e.state.value),()=>[]),Q$=e=>T(G$(e.state.value),()=>[]),$$=e=>T(q$(e.state.value),()=>null);function e1({field:e,spec:t,locked:n,...r}){let[i,a]=(0,J.useState)(!1);return(0,X.jsxs)($W,{children:[(0,X.jsx)(gG,{...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:J$(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,X.jsx)(Iw,{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)(NU,{"aria-hidden":`true`}):(0,X.jsx)(PU,{"aria-hidden":`true`})})]})}var t1={text:`text`,email:`email`,url:`url`,tel:`tel`};function n1({spec:e,field:t,locked:n,...r}){let i=Q$(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)(xx,{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)(Iw,{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)(EQ,{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 r1({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)(gG,{...a,type:t1[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:J$(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,X.jsx)(VW,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:J$(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,X.jsx)(e1,{...r,field:t,spec:e,locked:n});case`money`:return(0,X.jsxs)($W,{children:[(0,X.jsx)(eG,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,X.jsx)(gG,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:J$(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,X.jsx)(gG,{...a,type:`date`,readOnly:e.readOnly,value:J$(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,X.jsx)(hG,{...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:X$(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,X.jsxs)(L$,{...a,value:J$(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)(O$,{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:J$(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,X.jsx)(E$,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===J$(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)(n1,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,X.jsx)(PQ,{...a,disabled:n||e.readOnly===!0,checked:Y$(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,X.jsx)(z$,{...a,disabled:n||e.readOnly===!0,checked:Y$(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var i1=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function a1({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=Z$(t),o=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,X.jsx)(cG,{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)(A$,{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)(uG,{label:r.label,description:r.description,orientation:`inline`,children:(0,X.jsx)(PQ,{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)(cG,{legend:a,description:e.help,disabled:i,error:r??null,children:(0,X.jsx)(N$,{name:e.name,"aria-label":a,value:J$(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)(I$,{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)(F$,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,X.jsx)(uG,{label:t.label,orientation:`inline`,children:(0,X.jsx)(P$,{value:t.value,disabled:t.disabled})},t.value))})})}function o1({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:$$(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 s1({form:e,spec:t,locked:n}){let r=uQ({form:e,name:t.name}),i=cQ(e.store,e=>e.submissionAttempts>0),a=r.state.meta.isBlurred||i?xQ(r.state.meta):void 0;if(t.render===void 0&&i1.has(t.kind))return(0,X.jsx)(a1,{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)(uG,{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)(r1,{spec:t,field:r,locked:n}):(0,X.jsx)(o1,{spec:t,field:r,locked:n,error:a,render:t.render})})}var c1=Lt(Ot(q,K$));function l1({form:e,spec:t,locked:n}){let r=t.when;return cQ(e.store,e=>r===void 0||r(T(c1(e.values),()=>({}))))?(0,X.jsx)(s1,{form:e,spec:t,locked:n}):null}function u1({form:e,section:t,locked:n}){let r=t.fields.map(t=>(0,X.jsx)(l1,{form:e,spec:t,locked:n},t.name));return t.title===void 0?r:(0,X.jsx)(sG,{title:t.title,description:t.description,children:r})}function d1({model:e,names:t,disabled:n=!1}){let r=e.form;return t===void 0?e.description.sections.map(e=>(0,X.jsx)(u1,{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)(l1,{form:r,spec:i,locked:n},t)})}var f1=class{annotation;constructor(e){this.annotation=e}},p1=class{sections;constructor(e){this.sections=e}},m1=`caps/form`,h1=0;function g1(e){h1+=1;let t={[`${m1}:${String(h1)}`]:new f1(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}q.annotate(g1({kind:`secret`})).pipe(Qt(`Secret`));var _1=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 v1(e){return Object.values(e??{}).reduce((e,t)=>t instanceof f1?{...e,...t.annotation}:e,{})}function y1(e){return e.reduce((e,t)=>({...e,...v1(t)}),{})}function b1(e){let t=e?.[m1];return t instanceof p1?t.sections:{}}var x1=Lt(q);function S1(e){if(yn(e))return r(x1(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!pr(e))return null;let t=[];for(let n of e.types){if(Fn(n))continue;let e=S1(n);if(e===null)return null;t.push(...e)}return t}function C1(e){if(bt(e))return{type:`string`,literals:[]};if(bn(e))return{type:`number`,nullable:!1};if(cr(e))return{type:`boolean`};let t=S1(e);if(t!==null)return{type:`string`,literals:t};if(Ht(e)){let[t]=e.rest;if(t===void 0)return null;if(bt(t))return{type:`strings`,literals:[]};let n=S1(t);return n===null?null:{type:`strings`,literals:n}}if(pr(e)){let t=e.types.filter(e=>!Fn(e)&&!gn(e)),n=e.types.some(e=>gn(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=C1(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function w1(e){let t=e.ast;if(!$t(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=Tn(e.type),r=y1([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:C1(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:Wn(e.type),description:ur(e.type)}}),sections:b1(nr(t))}}function T1(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 He)t=t.unwrap();else if(t instanceof b)t=t.in;else return{node:t,optional:n,nullable:r}}function E1(e){if(e instanceof yt){let t=e.options.map(e=>E1(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof o?e.options:e instanceof Be?[...e.values]:null;if(t===null)return null;let n=t.map(e=>x1(e));return n.every(de)?n.map(e=>e.value):null}function D1(e){let{node:t,nullable:n}=T1(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=E1(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof d){let e=T1(t.element).node;if(e instanceof D)return{type:`strings`,literals:[]};let n=E1(e);return n===null?null:{type:`strings`,literals:n}}return null}function O1(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 He?e.unwrap():e instanceof b?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>ft.get(e))}function k1(e){return O1(e).reduce((e,t)=>({...e,...t}),{})}function A1(e){return Object.entries(e.shape)}function j1(e){let t=T1(e).node;if(!(t instanceof I))throw Error(`A schema form needs a z.object.`);return{fields:A1(t).map(([e,t])=>{let n=y1(O1(t)),r=n.kind===`file`?{type:`files`}:D1(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=k1(t);return{name:e,valueType:r,optional:T1(t).optional,annotation:n,title:i.title,description:i.description}}),sections:b1(k1(e))}}function M1(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??_1(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function N1(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 P1(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 F1(e){let t=e instanceof ie?j1(e):w1(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=M1(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??_1(e.name),help:a,kind:n??N1(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=P1(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 I1(e){let t=e instanceof ie?e:Ft(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>L1(e)):L1(n)}}}}function L1(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 R1=`onServer`;function z1(e){return e.state.meta.errorMap.onServer!==void 0}function B1(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[R1]:void 0}}))}function V1(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[R1]:n}}))}function H1(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);OZ(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,J.useMemo)(()=>F1(l),[l]),d=(0,J.useMemo)(()=>I1(l),[l]),f=vQ({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),z1(e)&&B1(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await I1(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&&V1(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 U1(e){return{dirty:cQ(e.form.store,e=>!e.isDefaultValue),submitting:cQ(e.form.store,e=>e.isSubmitting),canSubmit:cQ(e.form.store,e=>e.canSubmit)}}function W1({model:e,submitLabel:t=`Save changes`,discardLabel:n,allowClean:r,footer:i,children:a,disabled:o=!1,...s}){let{submitting:c}=U1(e);return(0,X.jsxs)(aG,{...s,busy:c,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit()},children:[a??(0,X.jsx)(d1,{model:e,disabled:o}),i===void 0?(0,X.jsx)(q1,{model:e,label:t,...n===void 0?{}:{discardLabel:n},...r===void 0?{}:{allowClean:r}}):i]})}function G1({schema:e,defaultValues:t,onSubmit:n,...r}){let i=H1({schema:e,defaultValues:t,onSubmit:n});return(0,X.jsx)(W1,{...r,model:i})}function K1(e){return`model`in e?(0,X.jsx)(W1,{...e}):(0,X.jsx)(G1,{...e})}function q1({model:e,label:t,discardLabel:n,allowClean:r=!1,dirtyLabel:i=`Unsaved changes`,buttonProps:a,...o}){let{dirty:s,submitting:c,canSubmit:l}=U1(e),u=c?null:e.saved&&!s?(0,X.jsx)(BW,{tone:`success`,size:`compact`,label:e.saved}):s?(0,X.jsx)(BW,{tone:`neutral`,size:`compact`,label:i}):null;return(0,X.jsxs)(iG,{...o,error:e.error,status:u,children:[n&&s?(0,X.jsx)(Iw,{type:`button`,variant:`ghost`,disabled:c,onClick:e.discard,children:n}):null,(0,X.jsx)(Iw,{...a,type:`submit`,loading:c,disabled:c||!l||!s&&!r,children:t})]})}var J1=Mt.check(At(1,{message:`Give your Agent a name.`}),z(256,{message:`Use at most 256 characters.`})),Y1=Lt(J1),X1=Jm.annotate(g1({label:`Computer`,kind:`select`,options:{new:`New Computer`,none:`No Computer`}})),Z1=Tt({family:`grove-agent-create-request`,version:1,kinds:{request:{prefix:`request`}}});function Q1({create:e,canChooseComputer:t,inputRef:n,error:r,onCancel:i}){let a=(0,J.useRef)(null),o=H1({schema:(0,J.useMemo)(()=>W({name:J1.annotate(g1({label:`Name`,render:e=>(0,X.jsx)(gG,{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:X1}),[n]),defaultValues:{name:``,computer:Jm.make(`new`)},onSubmit:async({name:n,computer:r})=>{let i=t?r:void 0,o=a.current;if(o?.name!==n||o.computer!==i){let e={name:n,requestId:Z1.request.generate()};o=i===void 0?e:{...e,computer:i}}return a.current=o,await e(o)?(a.current=null,{kind:`saved`,values:{name:``,computer:Jm.make(`new`)}}):{kind:`refused`}}}),{submitting:s,canSubmit:c,dirty:l}=U1(o);return(0,X.jsx)(K1,{model:o,"aria-label":`Create Agent`,footer:(0,X.jsxs)(iG,{divider:!1,error:r,children:[(0,X.jsx)(Iw,{type:`button`,variant:`ghost`,disabled:s,onClick:i,children:`Cancel`}),(0,X.jsx)(Iw,{type:`submit`,className:`shrink-0 disabled:-outline-offset-1`,variant:`primary`,loading:s,disabled:s||!c||!l,children:`Create Agent`})]}),onSubmitCapture:e=>{C(Y1(o.form.state.values.name))&&e.currentTarget.querySelector(`input[name="name"]`)?.focus()},onChange:()=>{let e=o.form.state.values;(e.name.trim()!==a.current?.name||t&&e.computer!==a.current.computer)&&(a.current=null)},children:(0,X.jsx)(d1,{model:o,names:t?[`name`,`computer`]:[`name`]})})}function $1({open:e,pending:t,error:n,canChooseComputer:r,create:i,onClose:a,returnFocus:o}){let s=(0,J.useRef)(null);return(0,X.jsx)(fU,{open:e,onOpenChange:e=>{!e&&!t&&a()},children:(0,X.jsxs)(_U,{className:`flex flex-col gap-lg`,initialFocus:s,finalFocus:o,keepMounted:!1,children:[(0,X.jsxs)(yU,{children:[(0,X.jsx)(bU,{children:`New Agent`}),(0,X.jsx)(xU,{children:`Agents chat, write and make little games with you.`})]}),(0,X.jsx)(Q1,{create:i,canChooseComputer:r,inputRef:s,error:n,onCancel:a})]})})}function e0({open:e,agents:t,defaultAgentId:n,start:r,pending:i,onClose:a,onNewAgent:o,returnFocus:s}){let c=H1({schema:(0,J.useMemo)(()=>W({agentId:q.check(Xt(e=>t.some(t=>t.agentId===e)||`Choose an Agent.`)).annotate(g1({label:`Agent`,kind:`select`,options:Object.fromEntries(t.map(e=>[e.agentId,vX(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}=U1(c);return(0,X.jsx)(fU,{open:e,onOpenChange:e=>{!e&&!i&&!c.form.state.isSubmitting&&a()},children:(0,X.jsxs)(_U,{className:`flex flex-col gap-lg`,keepMounted:!1,finalFocus:s,children:[(0,X.jsxs)(yU,{children:[(0,X.jsx)(bU,{children:`New conversation`}),(0,X.jsx)(xU,{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)(Iw,{onClick:o,children:`New Agent`}):null,(0,X.jsx)(Iw,{variant:`ghost`,onClick:a,children:`Cancel`})]}):(0,X.jsx)(K1,{model:c,"aria-label":`New conversation`,footer:(0,X.jsxs)(iG,{divider:!1,error:c.error,children:[(0,X.jsx)(Iw,{type:`button`,variant:`ghost`,disabled:l||i,onClick:a,children:`Cancel`}),(0,X.jsx)(Iw,{type:`submit`,loading:l||i,disabled:!u||l||i,children:`Start`})]})})]})})}var t0=J.useLayoutEffect;function n0(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 r0(e){let t=J.useRef(null);return J.useImperativeHandle(e,()=>t.current,[]),t}function i0(e){return e[e.length-1]}function a0(e){return typeof e==`function`}function o0(e,t){return a0(e)?e(t):e}var s0=Object.prototype.hasOwnProperty,c0=Object.prototype.propertyIsEnumerable;function l0(e){for(let t in e)if(s0.call(e,t))return!0;return!1}var u0=()=>Object.create(null),d0=(e,t)=>f0(e,t,u0);function f0(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=g0(e)&&g0(i);if(!a&&!(m0(e)&&m0(i)))return i;let o=a?e:p0(e);if(!o)return i;let s=a?i:p0(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:s0.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=f0(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function p0(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(!c0.call(e,r))return!1;t.push(r)}return t}function m0(e){if(!h0(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!h0(n)||!n.hasOwnProperty(`isPrototypeOf`))}function h0(e){return Object.prototype.toString.call(e)===`[object Object]`}function g0(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function _0(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(!_0(e[r],t[r],n))return!1;return!0}if(m0(e)&&m0(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!_0(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||!_0(e[o],t[o],n)))return!1;return i===a}return!1}var v0=/[\x00-\x1f\x7f"<>`{}]/g;function y0(e){return e.replace(v0,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function b0(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 y0(t)}var x0=[`http:`,`https:`,`mailto:`,`tel:`];function S0(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function C0(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+=b0(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=b0(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function w0(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function T0(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 E0(){throw Error(`Invariant failed`)}function D0(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 O0=4,k0=5;function A0(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 j0(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=A0(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 M0(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=j0(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=P0(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=F0(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=P0(r);e.kind=k0,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=P0(r);e.kind=O0,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)M0(e,t,r,c,i,a,o,s)}function N0(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 P0(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 F0(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 I0(e,t){let n=P0(`/`),r=new Uint16Array(6),i=[];for(let t of e)M0(!1,r,t,1,n,0,i);for(let e of i)e.sort(N0);t.masksTree=n,t.flatCache=D0(1e3)}function L0(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=H0(e,t.masksTree);return t.flatCache.set(e,r),r}function R0(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=P0(`/`),M0(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),H0(r,o,n)}function z0(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=H0(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=W0(a.route)),t.matchCache.set(r,a),a}function B0(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function V0(e,t=!1,n){let r=P0(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;M0(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&E0(),o[e.id]=e,c!==0&&e.path){let t=B0(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(N0);return{processedTree:{segmentTree:r,singleCache:D0(1e3),matchCache:D0(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function H0(e,t,n=!1){let r=e.split(`/`),i=K0(e,r,t,n);if(!i)return null;let[a]=U0(e,r,i);return{route:i.node.route,rawParams:a}}function U0(e,t,n){let r=G0(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===O0)break;if(u.kind===k0){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 W0(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function G0(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function K0(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!i0(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&&!X0(l,n))continue;if(i.parse){if(!Y0(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==O0&&X0(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===O0||i.kind===2)&&X0(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&&(Y0(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&J0(f,o))return n;X0(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+q0(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+q0(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+q0(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+q0(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 q0(e,t){return 2**(e-t-1)}function J0(e,t){return e===2**(t-1)-1}function Y0(e,t,n){let r,i;try{[r,i]=U0(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 X0(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===O0)>(e.node.kind===O0)||t.node.kind===O0==(e.node.kind===O0)&&t.node.depth>e.node.depth)))}function Z0(e){return Q0(e.filter(e=>e!==void 0).join(`/`))}function Q0(e){return e.replace(/\/{2,}/g,`/`)}function $0(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function e2(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function t2(e){return e2($0(e))}function n2(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function r2(e,t,n){return n2(e,n)===n2(t,n)}function i2({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&&i0(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&&(i0(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=Q0(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function a2(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 o2(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>c2(e,n)).join(`/`):c2(r,n):r}function s2({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=j0(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=o2(`_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=o2(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=o2(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function c2(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function l2(e){return e?.isNotFound===!0}function u2(){try{return sessionStorage}catch{return}}var d2=`tsr-scroll-restoration-v1_3`,f2=u2();function p2(){try{return JSON.parse(f2?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function m2(){try{f2?.setItem(d2,JSON.stringify(h2))}catch{}}var h2=p2(),g2=`data-scroll-restoration-id`,_2=e=>e.state.__TSR_key||e.href;function v2(e){let t=e.getAttribute(g2);if(t)return`[${g2}="${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 y2=!1,b2=`window`;function x2(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function S2(e){let t=new Set;for(let n of e){if(n===b2)continue;let e=x2(n);e&&t.add(e)}return t}function C2(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||_2,a=new Set,o=e=>{let t=h2[e]||={};for(let e of a)e===document?t[b2]={scrollX,scrollY}:e.isConnected&&(t[v2(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,y2=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{y2||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())),m2()})),!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=h2[d];if(e){let t=h2[u];for(let n in e){if(n===b2){if(s)continue}else{let e=x2(n);if(!e||s&&o&&(l??=S2(o),l.has(e)))continue}t||=h2[u]={},t[n]??=e[n]}}}y2=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=S2(o));let t=e&&i&&c,s=r.restoring?h2[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===b2){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=x2(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{y2=!1}}))}function w2(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 T2(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function E2(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]=T2(r):Array.isArray(t)?t.push(T2(r)):n[e]=[t,T2(r)]}return n}var D2=/^(?:\s|["[{\d-]|fa|nu|tr)/,O2=A2(JSON.parse),k2=j2(JSON.stringify,JSON.parse);function A2(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=E2(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function j2(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&&!D2.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=w2(e,r);return t?`?${t}`:``}}var M2=`__root__`;function N2(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 P2(e){return e instanceof Response&&!!e.options}function F2(e){return{input:({url:t})=>{for(let n of e)t=L2(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=R2(e[n],t);return t}}}function I2(e){let t=t2(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=Z0([`/`,t,e.pathname]),e)}}function L2(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 R2(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 z2(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(()=>{T0(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 B2=`__TSR_index`,V2=`popstate`,H2=`beforeunload`;function U2(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=J2(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[B2];i=W2(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[B2];i=W2(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[B2]!==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 W2(e,t){t||={};let n=Y2();return{...t,key:n,__TSR_key:n,[B2]:e}}function G2(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??(()=>J2(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Y2();t.history.replaceState({[B2]: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=J2(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[B2]-l.state[B2],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=U2({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(H2,x,{capture:!0}),t.removeEventListener(V2,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(H2,x,{capture:!0}),t.addEventListener(V2,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 K2(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)=>W2(t,void 0)),i=()=>J2(t[n],r[n]),a=[];return U2({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 q2(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function J2(e,t){let n=q2(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Y2();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||{[B2]:0,key:a,__TSR_key:a}}}function Y2(){return(Math.random()+1).toString(36).substring(7)}function X2(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Z2(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Q2({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function $2(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 e4=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=a2(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:G2()),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=D0(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=z2(this.latestLocation,e),C2(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=t2(a);t&&t!==`/`&&e.push(I2({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:F2(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=V0(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&I0(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:C0(e).path,external:!1,searchStr:o,search:d0(t?.search,i),hash:C0(r.slice(1)).path,state:f0(t?.state,a)}}let o=new URL(i,this.origin),s=L2(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:C0(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:d0(t?.search,c),hash:C0(s.hash.slice(1)).path,state:f0(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)=>i2({base:e,to:t.includes(`//`)?Q0(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=z0(e2(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=o4(t.params,s),d=this.routesByPath[e2(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&&l0(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:C0(s2({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,r4(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=i4(m,t,f,e._includeValidateSearch),m=d0(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?o0(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?o0(t.state,n.state):{};v=f0(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=R2(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=w0(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=L0(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=o4(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=e2(this.latestLocation.href)===e2(n.href)&&_0(Q2(n.state),Q2(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=J2(o,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);s.to=L2(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(S0(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 Q4(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(Z2(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`)&&X2(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&&S0(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=u4,this.preloadRoute=e=>$4(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=R0(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!_0(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?_0(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??k2,parseSearch:e.parseSearch??O2,protocolAllowlist:e.protocolAllowlist??x0}),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=W0(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[`**`]:e2(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?a4(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=r4(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof t4||(r=new t4(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:_}=s2({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{s4(i,d)}catch(e){if(x=l2(e)||P2(e)?e:new n4(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:d0(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=X2(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?d0(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?f0(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`?d0(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=i0(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=i0(a),c={...e.search};for(let e of a)try{Object.assign(c,r4(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{s4(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},t4=class extends Error{},n4=class extends Error{};function r4(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new t4(`Async validation not supported`);if(n.issues)throw new t4(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 i4(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=r4(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=o0(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 a4(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 M2}function o4(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,o0(e,t))}function s4(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function c4(e,t){return e.options[t]?.preload?.()}function l4(e,t){let n=c4(e,`component`),r=c4(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function u4(e,t,n){let r=()=>t===!1?void 0:t?c4(e,t):l4(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 d4(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var f4=0,p4=1,m4=2,h4=3,g4=4;function _4(e){return typeof e[0]==`number`}function v4(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 y4(e,t){return e.routesById[t.routeId]}function b4(e,t,n){return P2(e)?[h4,e]:l2(e)?(e.routeId||=n,[m4,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[p4,e]:[f4,e])}function x4(e,t){let n=b4(t,!0,e.id);if(n[0]!==p4)return n;try{e.options.onError?.(n[1])}catch(t){n=b4(t,!0,e.id)}return n}function S4(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[g4]):x4(e,t)}function C4(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function w4(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=y4(e,r);r.abortController=n[0];let u=s[t-1]?.context??e.options.context??{},d={params:r.params,location:o,navigate:C4(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 E4(e,r),[t,S4(i,a,n)]}if(c.aborted||!n[2]())return n[0].abort(),[t,[g4]];let p=r.paramsError??r.searchError;if(p!==void 0)return E4(e,r),[t,S4(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{k4(e,r,`beforeLoad`,n[0]);let a=await v4(m(h),c);if(!n[2]())return n[0].abort(),[t,[g4]];let o=b4(a,!1,i.id);if(o[0]!==f4)return E4(e,r),[t,o];r.context={...f,...a}}catch(a){return E4(e,r),[t,S4(i,a,n)]}finally{g===`success`&&r.status===`pending`&&(r.status=`success`),k4(e,r,!1,n[0])}}i()}function T4(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 E4(e,t){let n=t._flight;t._flight=void 0,T4(e,t,n)?.abort()}function D4(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=T4(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function O4(e){for(let t of e){let e=t._flight;e&&e[2]++}}function k4(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 A4(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:C4(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 j4(e,t,n,r,i,a,o,s){let c=s.signal;if(c.aborted)return[g4];if(!i)return[f4,void 0];let l=n._flight;k4(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(A4(e,t,n,r,s,a,o))).then(e=>b4(e,!1,r.id),e=>b4(e,!0,r.id)).then(t=>(t[0]!==f4&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===p4&&l[2]?x4(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],await v4(l[0],c)}catch(t){if(t!==c)throw t;return E4(e,n),[g4]}finally{k4(e,n,!1,s)}}function M4(e,t,n){t[0]===f4?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==h4&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function N4(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&&E4(e,r)}function P4(e,t){return t[0]===p4||t[0]===m4?{...e,status:t[0]===p4?`error`:`notFound`,error:t[1],_flight:void 0}:e}function F4(e,t,n,r,i,a,o){let s=t[1][n],c=y4(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(A4(e,t,s,c,a[0],i,l))),a[2]()||(a[0].abort(),p=[g4])),!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,E4(e,s),p=S4(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,T4(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?j4(e,t,s,c,h,i,l,a[0]):Promise.resolve([f4,s.loaderData])).then(t=>(y&&(M4(s,t,l),t[0]===f4&&(m&&!a[0].signal.aborted&&N4(e,s,u),s.status=`pending`)),t)),S=v4(Promise.resolve().then(()=>u4(c,void 0,b)),a[0].signal).then(()=>void 0,e=>[n,S4(c,e,a)]).then(e=>x.then(t=>(y&&!e&&t[0]===f4&&s.status===`pending`&&a[2]()&&(s.status=`success`,a[8]?.()),e)));if(r.push([n,x,S]),!_)return x.then(e=>P4(s,e));let C={...s,status:`pending`,preload:!1,_flight:g};s.invalid=!1,s.isFetching=`loader`;let w=j4(e,t,C,c,h,i,!1,a[0]).then(e=>(s.isFetching=!1,M4(C,e,!1),e));return(t[2]??=[]).push([n,w,S,C]),w.then(e=>P4(C,e))}async function I4(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=y4(e,t[n]),a=u4(i,!1);if(a)try{await v4(a,r)}catch(e){if(e===r)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function L4(e,t){t[2]&&=(D4(e,t[2].map(e=>e[3])),void 0)}async function R4(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]>=h4)throw[a,t];!i&&t[0]!==f4&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===h4)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}async function z4(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]===m4?I4(e,s,t,r.signal):t[0],f=u<0?s.length:u;if((c?.[1][0]??0)>=h4)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]!==f4&&t[0]<h4&&!(`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)>=h4){let n=c[1];if(n[0]!==h4||n[1].options.reloadDocument||i<20)return L4(e,t),n;l=!0,c=[0,[p4,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===p4?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=y4(e,u);try{await v4(i?Promise.resolve().then(()=>u4(m,a===p4?`errorComponent`:`notFoundComponent`)):Promise.all([u4(m),u4(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal)return L4(e,t),[g4]}i?l&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),L4(e,t),D4(e,s),f()):(u.status=`success`,o?.())}return t}async function B4(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=y4(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 v4(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 V4(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 I4(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=F4(e,i,t,l,d,r,c)},p=await w4(e,i,r,s,f,c);if(p&&(r[5]=!0,s=p[0],p[1][0]===m4?(p[2]=await I4(e,i[1],p,r[0].signal),s=Math.min(s,p[2]+1)):p[1][0]>=h4&&(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=z4(e,i,l,r[0],r[1],R4(l,p,i[2]),r[8]);i[2]?.length&&(i[3]=R4(i[2],void 0,void 0,t.then(e=>_4(e)?0:d4(e[1]).length,()=>0))),m=await t}catch(t){throw L4(e,i),t}return _4(m)?m:B4(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function H4(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=y4(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(()=>H4(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 U4(e,t){let n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function W4(e,t){e._committed=t,e.stores.setMatches(t)}function G4(e,t){D4(e,t[1]),L4(e,t)}function K4(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=d4(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=y4(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,W4(e,n),D4(e,[...a.values(),...i],[...n,...s.values()]),$2(e,i,n,()=>e._tx===t)}async function q4(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function J4(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function Y4(e,t){U4(e,t),t[0].abort(),D4(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 X4(e,t,n,r,i){let a=n.map(e=>({...e}));O4(a);for(let t of r)E4(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await z4(e,o,r,t[0],t[1],i)}catch(t){throw D4(e,a),t}if(_4(s)){D4(e,a),s[0]===h4&&e._tx===t&&e._committed===n&&await J4(e,t,s[1]);return}let c=await B4(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){D4(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),E4(e,n))}W4(e,c[1]),D4(e,n,c[1])}async function Z4(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 V4(e,t[2],t[3],o);if(_4(s)){s[0]===h4&&e._tx===t?(U4(e,t),D4(e,t[3]),t[3]=[],e._tx===t&&await J4(e,t,s[1])):Y4(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 v4(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 v4(new Promise(t=>{c[3]=setTimeout(t,e)}),n)}catch{}clearTimeout(c[3])}}}if(e._tx!==t){U4(e,t),G4(e,s);return}let l=t[2],u=Z2(l,e.stores.resolvedLocation.get()),d=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){G4(e,s);return}let n=await e.startTransition(()=>{U4(e,t),K4(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){L4(e,s);return}d?.length&&X4(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 Q4(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 q4(e,n);return}let f=Z2(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await q4(e,n);return}let p=i.href===a.href,m,h=u;try{m=e.matchRoutes(a,{_controller:u}),O4(m)}catch(t){if(u.abort(),!P2(t)){await q4(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...t.options,replace:!0,ignoreBlocker:!0}),await q4(e,n);return}let g=l?c[1](m):void 0;if(g?h=l:l?.abort(),u.signal.aborted){D4(e,m),await q4(e,n);return}e._preflight=void 0;let _=[h,s,a,m,Date.now(),Promise.resolve().then(()=>Z4(e,_,p,()=>H4(e,_),t?.sync,g)).catch(()=>{e._tx===_&&Y4(e,_)})];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&k4(e,t,!1)}n[0].abort(),D4(e,n[3],_[3],!0)}if(e._tx!==_){D4(e,_[3]),_[3]=[],await q4(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),!r&&!m.some(e=>e._notFound)&&H4(e,_);try{await _[5]}finally{await q4(e,_)}}async function $4(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}),O4(o)}catch(e){a.abort(),l2(e)||console.error(e);return}(e._preloads??=new Map).set(a,o);let s;try{let t;try{t=await V4(e,r,o,[a,n,()=>!0,i,!0])}finally{s=e._preloads.delete(a),D4(e,o),a.abort()}if(!_4(t))return t[1];if(s&&t[0]===h4&&!t[1].options.reloadDocument)return $4(e,{...t[1].options,_fromLocation:r},n+1)}catch(e){l2(e)||console.error(e)}}var e3=`Error preloading route! ☝️`,t3=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=M2:this.parentRoute||E0();let r=n?M2:t?.path;r&&r!==`/`&&(r=$0(r));let i=t?.id||r,a=n?M2:Z0([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Z0([`/`,a]));let o=a===`__root__`?`/`:Z0([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=e2(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=>N2({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.`)}},n3=class extends t3{constructor(e){super(e)}};function r3(e){return(0,X.jsx)(i3,{...e})}var i3=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??a3,{error:e,reset:this.reset}):this.props.children}};function a3({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 o3({children:e,fallback:t=null}){return(0,X.jsx)(J.Fragment,{children:s3()?e:t})}function s3(){return J.useSyncExternalStore(c3,()=>!0,()=>!1)}function c3(){return()=>{}}var l3=J.createContext(null);function u3(e){return J.useContext(l3)}var d3=J.createContext(void 0),f3=J.createContext(void 0),p3=(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))(p3||{});function m3({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 h3(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 g3=[],_3=0,{link:v3,unlink:y3,propagate:b3,checkDirty:x3,shallowPropagate:S3}=m3({update(e){return e._update()},notify(e){g3[w3++]=e,e.flags&=~p3.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=p3.Mutable|p3.Dirty,O3(e))}}),C3=0,w3=0,T3,E3=0;function D3(e){try{++E3,e()}finally{--E3||k3()}}function O3(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=y3(n,e)}function k3(){if(!(E3>0)){for(;C3<w3;){let e=g3[C3];g3[C3++]=void 0,e.notify()}C3=0,w3=0}}function A3(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?p3.None:p3.Mutable,get(){return T3!==void 0&&v3(i,T3,_3),i._snapshot},subscribe(e){let t=h3(e),n={current:!1},r=j3(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=T3,o=t?.compare??Object.is;if(n)T3=i,++_3,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=p3.Mutable|p3.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{T3=a,n&&(i.flags&=~p3.RecursedCheck),O3(i)}}};return n?(i.flags=p3.Mutable|p3.Dirty,i.get=function(){let e=i.flags;if(e&p3.Dirty||e&p3.Pending&&x3(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&S3(e)}}else e&p3.Pending&&(i.flags=e&~p3.Pending);return T3!==void 0&&v3(i,T3,_3),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(b3(e),S3(e),k3())}},i}function j3(e){let t=()=>{let t=T3;T3=n,++_3,n.depsTail=void 0,n.flags=p3.Watching|p3.RecursedCheck;try{return e()}finally{T3=t,n.flags&=~p3.RecursedCheck,O3(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:p3.Watching|p3.RecursedCheck,notify(){let e=this.flags;e&p3.Dirty||e&p3.Pending&&x3(this.deps,this)?t():this.flags=p3.Watching},stop(){this.flags=p3.None,this.depsTail=void 0,O3(this)}};return t(),n}var M3=t((e=>{var t=Er();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})),N3=t(((e,t)=>{t.exports=M3()})),P3=t((e=>{var t=Er(),n=N3();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}})),F3=t(((e,t)=>{t.exports=P3()}))();function I3(e,t){return e===t}function L3(e,t,n=I3){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,F3.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var R3={};function z3(e,t){let n=J.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=f0(n.current,i):i}}function B3(e){let t=u3(),n=J.useContext(e.from?f3:d3),r=e.from??n,i=t.stores.getMatchStore(r),a=z3(e,t),o=L3(i,e=>e?a(e):R3);if(o!==R3)return o;(e.shouldThrow??!0)&&E0()}function V3(e){return B3({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function H3(e){let{select:t,...n}=e;return B3({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function U3(e){return B3({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 W3(e){return B3({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function G3(e){let t=u3();return J.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function K3(e){return B3({...e,select:t=>e.select?e.select(t.context):t.context})}function q3(e){let t=J.useRef(e);return _0(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function J3(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Y3(e,t,n){if(e?.external)return S0(e.href,n)?void 0:e.href;if(!o6(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),S0(t,n)?void 0:t}catch{}}function X3(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!r2(e.pathname,t.pathname,r))return!1}else{let n=n2(e.pathname,r),i=n2(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!_0(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function Z3(e,t){let n=u3(),r=r0(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=s3(),ne=q3(e.search),re=q3(e.params),ie=q3(o),ae=J.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ne,re,e.state,e.mask,e.unsafeRelative]),oe=J.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...ae}),r=a6(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=Y3(r,s,n.protocolAllowlist);return[r?.href,i,X3(e,t,ie,n.basepath,te,i!==void 0)]},[ie,v,te,ae,n,s]),[se,L,ce]=L3(n.stores.location,oe,J3),le=ce?o0(i,{})??$3:Q3,ue=ce?Q3:o0(a,{})??Q3,de=[b,le.className,ue.className].filter(Boolean).join(` `),fe=(y||le.style||ue.style)&&{...y,...le.style,...ue.style},pe=J.useRef(!1),me=e.reloadDocument||L||v?!1:c??n.options.defaultPreload,he=l??n.options.defaultPreloadDelay??0,ge=J.useCallback(()=>{n.preloadRoute(ae).catch(e=>{console.warn(e),console.warn(e3)})},[n,ae]),_e=J.useCallback(e=>{if(!e){r6(r);return}if(!(e.isIntersecting??me===`intent`)){e.isIntersecting===!1&&r6(r);return}if(!he){ge();return}n6.has(r)||n6.set(r,setTimeout(()=>{n6.delete(r),ge()},he))},[ge,r,me,he]);n0(r,_e,me!==`viewport`),J.useEffect(()=>{pe.current||me===`render`&&(ge(),pe.current=!0)},[ge,me]);let ve=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!c6(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...ae,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(L)return{...I,ref:r,href:L,...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 ye=()=>{me===`intent`&&ge()},be=()=>{me===`intent`&&r6(r)};return{...I,...le,...ue,href:se,ref:r,onClick:i6([x,ve]),onBlur:i6([S,be]),onFocus:i6([C,_e]),onMouseEnter:i6([w,_e]),onMouseLeave:i6([T,be]),onTouchStart:i6([E,ye]),disabled:!!v,target:_,...fe&&{style:fe},...de&&{className:de},...v&&e6,...ce&&t6}}var Q3={},$3={className:`active`},e6={role:`link`,"aria-disabled":!0},t6={"data-status":`active`,"aria-current":`page`},n6=new WeakMap,r6=e=>{clearTimeout(n6.get(e)),n6.delete(e)},i6=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function a6(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function o6(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var s6=J.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Z3(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 c6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var l6=class extends t3{constructor(e){super(e),this.useMatch=e=>B3({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>K3({...e,from:this.id}),this.useSearch=e=>W3({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>U3({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>H3({...e,from:this.id}),this.useLoaderData=e=>V3({...e,from:this.id}),this.useNavigate=()=>G3({from:this.fullPath}),this.Link=J.forwardRef((e,t)=>(0,X.jsx)(s6,{ref:t,from:this.fullPath,...e}))}};function u6(e){return new l6(e)}var d6=class extends n3{constructor(e){super(e),this.useMatch=e=>B3({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>K3({...e,from:this.id}),this.useSearch=e=>W3({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>U3({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>H3({...e,from:this.id}),this.useLoaderData=e=>V3({...e,from:this.id}),this.useNavigate=()=>G3({from:this.fullPath}),this.Link=J.forwardRef((e,t)=>(0,X.jsx)(s6,{ref:t,from:this.fullPath,...e}))}};function f6(e){return new d6(e)}function p6(e){let t=u3(),n=`not-found-${L3(t.stores.location,e=>e.pathname)}-${L3(t.stores.status,e=>e)}`;return(0,X.jsx)(r3,{getResetKey:()=>n,onCatch:(t,n)=>{if(l2(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(l2(t))return e.fallback?.(t);throw t},children:e.children})}function m6(){return(0,X.jsx)(`p`,{children:`Not Found`})}function h6(e){return(0,X.jsx)(X.Fragment,{children:e.children})}function g6(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)(m6,{})}function _6(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,X.jsx)(n,{}):null}var v6=(e,t)=>e[0]===t[0]&&e[1]===t[1],y6=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,b6=J.memo(function({routeId:e}){let t=u3();return(0,X.jsx)(x6,{router:t,match:L3(t.stores.getMatchStore(e),e=>e)})});function x6({router:e,match:t}){let n=e.routesById[t.routeId],r=_6(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=y6(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?J.Suspense:h6,l=i?r3:h6,u=o?p6:h6;return(0,X.jsxs)(n.isRoot?n.options.shellComponent??h6:h6,{children:[(0,X.jsx)(d3.Provider,{value:t.routeId,children:(0,X.jsx)(c,{fallback:r,children:(0,X.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(l2(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)(o3,{fallback:r,children:(0,X.jsx)(S6,{match:t})}):(0,X.jsx)(S6,{match:t})})})})}),null]})}var S6=J.memo(function({match:e}){let t=u3(),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)(C6,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!y6(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return _6(t,r)}if(e.status===`notFound`)return g6(t,r,e.error);if(e.status===`error`)throw e.error;return a}),C6=J.memo(function(){let e=u3(),t=J.useContext(d3),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=L3(a,e=>[!!e._notFound,e.error],v6),i=L3(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return g6(e,e.routesById[t],r);if(!i)return null;let a=(0,X.jsx)(b6,{routeId:i});return t===`__root__`?(0,X.jsx)(J.Suspense,{fallback:_6(e),children:a}):a});function w6(e,t){let n=e[1];e.length=0,n?.(t)}function T6({t:e}){let t=u3(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise((a,o)=>{w6(n,!1),n.push(i,a),e(t),J.startTransition(()=>{try{r()}catch(e){n[1]===a&&(n.length=0),o(e)}})}),t0(()=>{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(e2(r.publicHref)!==e2(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`,...Z2(a,a)})}):t._tx||t.load().catch(console.error),e},[t,t.history]),null}function E6(){let e=u3(),t=e.routesById[M2],n=_6(e,t),r=e.ssr?h6:J.Suspense,i=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(T6,{t:J.useState()[1]}),(0,X.jsx)(r,{fallback:n,children:(0,X.jsx)(D6,{})})]});return e.options.InnerWrap?(0,X.jsx)(e.options.InnerWrap,{children:i}):i}function D6(){let e=u3(),t=e._rendered,n=L3(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;t0(()=>{t[0]===n&&w6(t,!0)},[t,n]);let a=i?(0,X.jsx)(b6,{routeId:i}):null;return(0,X.jsx)(d3.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,X.jsx)(r3,{getResetKey:()=>r,onCatch:void 0,children:a})})}var O6=e=>({createMutableStore:A3,createReadonlyStore:A3,batch:D3}),k6=e=>new A6(e),A6=class extends e4{constructor(e){super(e,O6)}};function j6({router:e,children:t,...n}){l0(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,X.jsx)(l3.Provider,{value:e,children:t});return e.options.Wrap?(0,X.jsx)(e.options.Wrap,{children:r}):r}function M6({router:e,...t}){return(0,X.jsx)(j6,{router:e,...t,children:(0,X.jsx)(E6,{})})}function N6(e){let t=u3({warn:e?.router===void 0}),n=e?.router||t;return L3(n.stores.__store,z3(e,n))}function P6(){return L3(u3().stores.location,e=>e.state.__TSR_index!==0)}var F6=(0,J.createContext)(null),I6=F6.Provider,L6=f6({validateSearch:$e({agent:R().min(1).optional()}),component:()=>null}),R6=u6({getParentRoute:()=>L6,path:`/`}),z6=u6({getParentRoute:()=>L6,path:`/sessions/$agentId/$sessionId`,params:{parse:e=>$e({agentId:R().min(1),sessionId:R().min(1)}).parse(e)}});function B6(){return k6({routeTree:L6.addChildren([R6,z6]),history:K2(),InnerWrap:({children:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,J.useContext)(F6),e]}),defaultPendingMs:0,defaultPendingMinMs:0})}function V6(e,t){let n=N6({router:e,select:e=>e.location.search}),r=B3({from:z6.id,shouldThrow:!1});Mm(t,{canGoBack:P6(),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 H6=Mt.check(At(1,{message:`Give your Agent a name.`}),z(256,{message:`Use at most 256 characters.`}));function U6({agentId:e,name:t,rename:n}){let[r,i]=(0,J.useState)(!1),a=H1({schema:(0,J.useMemo)(()=>W({name:H6.annotate(g1({label:`Agent name`,render:e=>(0,X.jsx)(gG,{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}=U1(a);return r?(0,X.jsxs)(K1,{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)(d1,{model:a,names:[`name`]})}),(0,X.jsx)(Iw,{type:`submit`,size:`sm`,loading:o,disabled:o||!s,children:`Save`}),(0,X.jsx)(CQ,{"aria-label":`Cancel rename`,type:`button`,icon:(0,X.jsx)(HU,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!1)}})]}):(0,X.jsx)(CQ,{"aria-label":`Rename Agent`,icon:(0,X.jsx)(LU,{size:14,"aria-hidden":`true`}),onClick:()=>{i(!0)}})}function W6({status:e,approving:t,onApprove:n}){return e?.status===`pending`?(0,X.jsx)(Iw,{variant:`outline`,size:`sm`,className:`flex-none`,loading:t,disabled:t,onClick:n,children:`Allow App tools`}):null}function G6(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 K6(e,t){let n=(0,J.useRef)(e);n.current=e;let r=(0,J.useMemo)(()=>G6(()=>n.current),[]),i=(0,J.useMemo)(()=>kr(),[]);return(0,J.useEffect)(()=>{let e=i.contribute({sourceId:`grove`,namespace:`grove`,commands:r});return()=>{e.dispose()}},[r,i]),(0,J.useEffect)(()=>t?$i(t,r):void 0,[r,t]),i}function q6(e){let t=ca(),n=e?.capabilities.has(ch)===!0||e?.capabilities.has(lh)===!0,r=ey(n?e:null),i=e&&!n?{...r,status:`live`}:r,a=Xv.of(e,`agents`),o=Lo({...$v(e,eh,a,e=>e.list()),enabled:e?.capabilities.has(eh)===!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:Bo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return uh(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:Bo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return ih(e.capabilities,t)},onSuccess:e=>{t.setQueryData(a,(t=[])=>t.map(t=>t.agentId===e.agentId?e:t))}})}}function J6(e,t){let n=ca(),r=e?.capabilities.has(sh)===!0,i=Xv.of(e,`agent-tool-policy`,t??`none`);return{canRead:r,status:Lo({...$v(e,sh,i,e=>t===null?Promise.resolve(null):e.status({agentId:t})),enabled:r&&t!==null}),approve:Bo({mutationFn:t=>{if(!e)throw Error(`No App connection`);return e.capabilities.require(sh).approve({agentId:t.agentId,level:`write`,expectedRevision:t.expectedRevision})},onSuccess:e=>{`error`in e||n.setQueryData(i,e)}})}}var Y6=(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:Q(`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`})})});sM({frames:new Map,order:[],tiles:[],minima:new Map,participating:new Set,mainSize:void 0,zoomed:null,gesture:null,restore:new Map});function X6(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 Z6=(0,J.createContext)(null);(0,J.forwardRef)(function({layer:e,style:t,children:n,...r},i){let a=(0,J.useContext)(Z6),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 Q6={min:224,max:480,initial:320},$6={agentRailOpen:!0,listRailOpen:!0,listWidth:Q6.initial},e8=`fungi.grove.layout.v1`,t8=Lt(vn(W({agentRailOpen:Mn,listRailOpen:Mn,listWidth:rn.pipe(V(fr()))})));function n8(e){return Math.round(Math.min(Q6.max,Math.max(Q6.min,e)))}function r8(e){try{let t=e?.getItem(e8);if(t==null)return $6;let n=t8(t);return de(n)?{...n.value,listWidth:n8(n.value.listWidth)}:$6}catch(e){return console.warn(`Grove could not read its saved rail layout`,e),$6}}function i8(e,t){try{e?.setItem(e8,JSON.stringify(t))}catch(e){console.warn(`Grove could not save its rail layout`,e)}}function a8(){try{return globalThis.localStorage}catch(e){console.warn(`Grove rail layout storage is unavailable`,e);return}}function o8(){let[e,t]=(0,J.useState)(()=>r8(a8()));return(0,J.useEffect)(()=>{i8(a8(),e)},[e]),[e,t]}var s8={2:`h2`,3:`h3`,4:`h4`};function c8(e,t){let{reduced:n}=t,r=e&&!n,i=dx(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 l8=(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=ux(p),h=c8(l===`speech`,m)&&!a,g=s8[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)(Iw,{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:Q(`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 u8({description:e,icon:t,label:n,density:r=`regular`,appearance:i=`plain`,iconSize:a=`default`,size:o,trailing:s,...c}){return(0,X.jsxs)(Iw,{...c,className:Q(`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 d8(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=>[_X(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:_X(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:_X(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 f8({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?_X(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)(()=>pX(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)(()=>d8(t,w,d,r,i),[t,w,d,r,i]),E=(0,J.useCallback)(e=>T[e]?.key??e,[T]),D=vW({count:T.length,getScrollElement:()=>e.current,getItemKey:E,estimateSize:e=>T[e]?.kind===`heading`?24:44,measureElement:(e,t,n)=>{let r=uW(e,t,n);return r>0?r:uW(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)(Rb,{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)(u8,{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)(OJ,{name:`connected`,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)(BW,{size:`compact`,tone:`accent`,title:t.website.conversation.needsYou.reason}):null,onClick:()=>{p(t.website)},variant:`ghost`}):t.kind===`unavailable`?i?(0,X.jsx)(m8,{agent:i,row:t.session}):null:i?(0,X.jsx)(p8,{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 p8({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`:iX[t.state]}):null,r||c?(0,X.jsx)(BW,{size:`compact`,title:r?`Opening`:iX[t.state],motion:t.state===`running`||r?`pulse`:`none`,tone:r?`neutral`:t.state===`needs_you`?`accent`:`info`}):l?(0,X.jsx)(BW,{size:`compact`,title:iX.errored,glyph:`bang`,tone:`error`}):n?(0,X.jsx)(BW,{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:h8(t.lastActivityAt)})]});return(0,X.jsxs)(`div`,{className:`relative group`,children:[(0,X.jsx)(u8,{"aria-current":i?`page`:void 0,"aria-label":`${t.title||`Untitled session`} — ${vX(e)}${n?` — Finished since your last visit`:``}${t.ready?` — Ready`:c||l?` — ${iX[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:vX(e),label:t.title||`Untitled session`,onClick:a,trailing:u,variant:`ghost`}),o?(0,X.jsx)(CQ,{"aria-label":`Delete conversation ${t.title||`Untitled session`}`,title:`Delete conversation`,icon:(0,X.jsx)(VU,{}),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 m8({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:[vX(e),` `,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` This saved conversation could not be read.`]})]}),(0,X.jsx)(BW,{className:`inbox-row-status`,glyph:`bang`,tone:`error`,title:`This saved conversation could not be read`})]})}function h8(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 g8=R().min(1).max(256),_8=qe().int().nonnegative();ue(`state`,[Ye({state:n(`agent`),version:_8}),Ye({state:n(`requested`),version:_8,reason:R().max(4e3),at:qe().int().nonnegative()}),Ye({state:n(`person`),version:_8,memberId:g8,memberName:R().min(1).max(128),since:qe().int().nonnegative()})]);var v8=Ye({bindingId:g8,agentId:g8,origins:w(R().min(1).max(2048)).min(1).max(16),lifecycle:c([`active`,`suspended`])}),y8=Ye({sessionId:g8,label:R().max(4096),lastEventAt:qe().int().nonnegative(),needsYou:Ye({at:qe().int().nonnegative(),reason:R().max(4e3)}).nullable(),held:S(),heldByYou:S(),heldByName:R().min(1).max(128).nullable(),holdVersion:qe().int().nonnegative()}),b8=Ye({bindingId:g8}).extend({sessionId:g8});b8.extend({requestId:R().min(1).max(128),text:R().trim().min(1).max(4e3)});var x8=Ye({expectedVersion:_8,confirm:S()});b8.extend(x8.shape),b8.extend({expectedVersion:_8});var S8=Ye({websites:w(v8).max(1e3)}),C8=Ye({conversations:w(y8).max(100)});Ye({conversation:y8});var w8=Ye({status:n(`sent`)}),T8=Bm(`channels.read`,1,Vm({list:Um(Hm(S8)),conversations:Um(Hm(C8))})),E8=Bm(`channels.personal.manage`,1,Vm({hold:Um(Hm(y8)),release:Um(Hm(y8)),dismiss:Um(Hm(y8)),reply:Um(Hm(w8))}));function D8(e,t){let n=!1,r=async()=>{try{return await t.read()}catch(e){if(!(e instanceof Kt)||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`);oF(e,t,r)}),close:()=>{n=!0,i()}}}function O8(e){return class{#e;constructor(t){this.#e=new Lh(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 k8(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:O8(s.fetch),fetch:s.fetch}),f=c.session(d),m=D8(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 A8(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 j8(e,t){(0,J.useSyncExternalStore)(t=>e?.capabilities.subscribe(t)??(()=>void 0),()=>e?.capabilities.version??0);let n=ca(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=e?.capabilities.has(T8)===!0,u=e?.capabilities.has(E8)===!0,d=Lo({...$v(e,T8,Xv.of(e,`websites`),e=>e.list()),enabled:l}),f=l?d.data?.websites??[]:[],p=Fo({queries:f.map(t=>({...$v(e,T8,Xv.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:k8({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 _=Bo({mutationFn:t=>{if(e===null)throw Error(`No App connection`);let n=e.capabilities.require(E8);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(Xv.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:A8(a.session,{bindingId:v,sessionId:y,canReply:()=>b&&e.capabilities.has(E8),reply:t=>e.capabilities.require(E8).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 M8({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)(Iw,{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)(fU,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,X.jsxs)(_U,{children:[(0,X.jsxs)(yU,{children:[(0,X.jsxs)(bU,{children:[o?.name,` is replying — take over?`]}),(0,X.jsx)(xU,{children:`You will reply as yourself. Their replies stop until they take over again.`})]}),(0,X.jsxs)(vU,{children:[(0,X.jsx)(SU,{render:(0,X.jsx)(Iw,{variant:`outline`}),children:`Cancel`}),(0,X.jsx)(Iw,{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)(qJ,{authorOf:Rm,disambiguateAuthors:!0,session:n,markdownPolicy:`visitor`,composerActionVariant:`outline`},`${t.bindingId}:${c.sessionId}`)}):null]})}var N8=(0,J.lazy)(async()=>({default:(await wr(()=>import(`./parakeet-conversation-C3pQoKx-.js`),__vite__mapDeps([11,1,2,3,4,5,12]))).ParakeetConversation})),P8={openAgent:ph,createClient:ZA},F8=[`agent.list`,`agent.manage`,`agent.read`,`agent.send`],I8=[`agent.read`,`agent.send`,`agent.manage`],L8=Tt({family:`grove-session-create-request`,version:1,kinds:{request:{prefix:`request`}}});async function R8(e,t,n,r){let i=await n.openAgent(e.capabilities,{agentId:t}),a=n.createClient({baseUrl:i.baseUrl,eventSource:O8(i.fetch),fetch:i.fetch});try{return await r(a)}finally{Promise.allSettled([a.close(),i.close()])}}function z8({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=kL(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)(N8,{session:l,connection:n,commands:r,prefill:i,onPrefilled:a,onOpen:s})})})}function B8(e){return Am(e.connection),(0,X.jsx)(V8,{...e},JSON.stringify(Xv.of(e.connection)))}function V8(e){let t=(0,J.useMemo)(B6,[e.connection]);return(0,X.jsx)(I6,{value:(0,X.jsx)(H8,{...e,router:t}),children:(0,X.jsx)(M6,{router:t})})}function H8({router:e,connection:t,services:n=P8}){let{agentFilterId:r,setFilter:i,selection:a,open:o}=V6(e,t?.window.navigation),s=ca(),c=j8(t,n),{directory:l,inbox:u,createAgent:d,renameAgent:f}=q6(t),p=l.data??[],m=l.isPending&&(t?.capabilities.has(eh)??!0),h=l.error?.message??null,g=d.isPending,_=Bo({mutationFn:e=>{if(!t)throw Error(`No App connection`);return R8(t,e.agentId,n,t=>t.createSession(e.requestId))}}),v=Bo({mutationFn:e=>{if(!t)throw Error(`No App connection`);return R8(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()}}),y=_.isPending?_.variables.agentId:null,[b,x]=(0,J.useState)(null),[S,C]=(0,J.useState)(null),[w,T]=(0,J.useState)(!1),E=S?.agentId??null,D=S?.sessionId??null,[O,k]=(0,J.useState)(null),A=(0,J.useRef)(null),[j,M]=o8(),{agentRailOpen:N,listRailOpen:P,listWidth:F}=j,ee=e=>{M(t=>({...t,agentRailOpen:e(t.agentRailOpen)}))},I=e=>{M(t=>({...t,listRailOpen:e(t.listRailOpen)}))},te=e=>{M(t=>({...t,listWidth:n8(e(t.listWidth))}))},ne=X6({begin:()=>!0,move:e=>{te(t=>t+e)},end:()=>void 0}),[re,ie]=(0,J.useState)(!1),ae=EX(),oe=(0,J.useRef)(null),[se,L]=(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=Am(t)?.openRequest??null,ge=(0,J.useRef)(null),_e=(0,J.useMemo)(()=>t===null?null:k8({connection:t,queryClient:s,services:n,onPending:x,onConversation:C,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)(()=>kr(),[]),xe=(0,J.useMemo)(()=>t===null?null:k8({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&&(_.isError&&_.reset(),c.clear(),T(!1),Ce.current={agentId:e,sessionId:t},_e.select(e,t,n,r),o(e,t))},[_e,o,c.clear,_.isError,_.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=>{S&&(we(S.agentId,e,!1,!1),u.refresh())},[S,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||g||!t.capabilities.has(th))return!1;try{let t=await d.mutateAsync(e);return i(t.agentId),L(t.agentId),k(null),!0}catch{return!1}},[t,g,d.mutateAsync,i]),ke=(0,J.useCallback)(async e=>{if(!t||y!==null)return`Conversation creation is unavailable.`;fe(null);let n=ue.current?.agentId===e?ue.current:{agentId:e,requestId:L8.request.generate()};ue.current=n;try{let t=await _.mutateAsync(n);we(e,t,!1,!1),u.refresh(),k(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,y,_.mutateAsync,u.refresh]);(0,J.useEffect)(()=>{if(!(!t||he?.kind!==`compose`)&&ge.current!==he.requestId&&!(!S&&m)&&(ge.current=he.requestId,me({requestId:he.requestId,text:he.text}),!S)){let e=t.capabilities.has(lh)?p.find(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)):void 0;e?ke(e.agentId):k(`agent`)}},[p,t,m,S,he,ke]);let Ae=K6({newConversation:()=>{S&&ke(S.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=Fo({queries:(S?[S.session]:[]).map(e=>({...aF(e),enabled:!1}))}).at(0)?.data?.snapshot,Pe=(0,J.useMemo)(()=>S&&Ne?{agentId:S.agentId,sessionId:S.sessionId,state:EM(Ne)}:void 0,[S,Ne]),Fe=(0,J.useMemo)(()=>hX(p,w&&c.canRead?[]:Me,r,Pe),[r,p,Me,w,c.canRead,Pe]),Ie=(0,J.useMemo)(()=>new Map(p.map(e=>[e.agentId,e])),[p]),Le=(0,J.useRef)(null),Re=Me.find(e=>e.agentId===E&&e.sessionId===D),ze=Re!==void 0&&Re.state!==`unavailable`,Be=Re!==void 0&&Re.state!==`unavailable`?Re.settledAt:void 0;(0,J.useEffect)(()=>{!ze||E===null||D===null||u.visit(E,D).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},[ze,Be,E,D,u.visit]);let Ve=u.status===`loading`,He=u.status===`error`,Ue=t?.capabilities.has(th)??!1,We=t?.capabilities.has(lh)??!1,Ge=p.filter(e=>e.sessionOperations.includes(`agent.read`)&&e.sessionOperations.includes(`agent.send`)&&e.sessionOperations.includes(`agent.manage`)),Ke=Ge.find(e=>e.agentId===(se??r))??Ge.at(0),qe=We&&Ke!==void 0,Je=()=>{t?.ui.requestAppPermissions({agents:F8}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},Ye=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&&!S&&!qe&&d.isIdle?`Choose an Agent to compose your game idea.`:null,Xe=(0,J.useMemo)(()=>hX(p,Me,null,Pe),[p,Me,Pe]),Ze=(e,t)=>{ie(!1),we(e,t)};jm(t,ae?[{kind:`button`,id:`agents`,text:`Agents`,expanded:N,title:N?`Hide Agents`:`Show Agents`},{kind:`button`,id:`conversations`,text:`Conversations`,expanded:P,title:P?`Hide conversations`:`Show conversations`}]:[{kind:`button`,id:`agents`,text:`Agents and conversations`,opens:`dialog`,expanded:re}],e=>{if(O!==null)return!1;if(ae&&e.itemId===`agents`)ee(e=>!e);else if(ae&&e.itemId===`conversations`)I(e=>!e);else if(!ae&&e.itemId===`agents`)re||(oe.current=document.activeElement instanceof HTMLElement?document.activeElement:null),ie(e=>!e);else return!1;return!0});let Qe=e=>{i(e),L(e);let t=[...Xe.active,...Xe.settled].filter(t=>t.agentId===e).sort((e,t)=>t.lastActivityAt-e.lastActivityAt).at(0);t&&Ze(e,t.sessionId)},$e={"--grove-list-width":`${String(F)}px`},et=S?Ie.get(S.agentId):void 0,tt=ve?Ie.get(ve.agentId):void 0,R=t?.capabilities.has(rh)??!1,nt=J6(t,et?.agentId??null),rt=Re!==void 0&&Re.state!==`unavailable`?Re.title||`Untitled conversation`:`Conversation`,it=r===null?void 0:Ie.get(r),at=Fe.active.length+Fe.settled.length,ot=(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]),st=(0,J.useCallback)(()=>{let e=nt.status.data;!et||e==null||nt.approve.mutate({agentId:et.agentId,expectedRevision:e.revision})},[et,nt.status.data,nt.approve]),ct=(0,J.useCallback)(e=>{!t||g||y!==null||e===`agent`&&!Ue||(O===null&&(A.current=re?oe.current:document.activeElement instanceof HTMLElement?document.activeElement:null),ie(!1),e===`session`&&L(et?.agentId??r??Ge.at(0)?.agentId??null),k(e))},[t,g,y,Ue,O,re,et?.agentId,r,Ge]);(0,J.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||!e.ctrlKey||e.altKey||e.metaKey||e.key.toLowerCase()!==`n`||!t||e.shiftKey&&!Ue||(e.preventDefault(),ct(e.shiftKey?`agent`:`session`))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[t,Ue,ct]);let lt=_.isError?_.variables:null,ut=lt&&O!==`session`?(0,X.jsx)(Fb,{className:S||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)(Iw,{variant:`outline`,onClick:()=>void ke(lt.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":!!S||c.selected!==void 0,children:[t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($1,{open:O===`agent`,pending:g,error:ce,canChooseComputer:t.capabilities.has(kX),create:Oe,onClose:()=>{k(null)},returnFocus:A}),O===`session`?(0,X.jsx)(e0,{open:!0,agents:We?Ge:[],defaultAgentId:Ke?.agentId??null,start:ke,pending:y!==null,onClose:()=>{k(null)},onNewAgent:Ue?()=>{k(`agent`)}:void 0,returnFocus:A}):null]}):null,(0,X.jsxs)(DX,{open:re,onOpenChange:ie,returnFocus:oe,children:[(0,X.jsx)(bX,{open:N,agents:p,agentFilterId:r,websitesSelected:w,websitesVisible:c.canRead,canCreate:t!==null&&Ue,createOpen:O===`agent`,onAll:()=>{i(null),T(!1)},onWebsites:()=>{i(null),T(!0)},onAgent:e=>{T(!1),Qe(e)},onCreate:()=>{ct(`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 ${P?`flex`:`flex min-[900px]:hidden`}`,style:$e,"aria-label":`Conversations`,children:[ae?(0,X.jsx)(Y6,{"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:F,min:Q6.min,max:Q6.max,onValueChange:e=>{te(()=>e)},onDoubleClick:()=>{te(()=>Q6.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)(Rb,{className:`min-w-0 flex-1 truncate`,children:w&&c.canRead?`Websites`:it?vX(it):`All Agents`}),t&&(qe||Ue)?(0,X.jsx)(CQ,{"aria-label":`New conversation`,"aria-haspopup":`dialog`,icon:(0,X.jsx)(BU,{}),iconSize:`sm`,size:`sm`,onClick:()=>{ct(`session`)}}):null]}),Ye?(0,X.jsx)(Fb,{tone:`info`,title:Ye,action:(0,X.jsx)(Iw,{variant:`ghost`,onClick:()=>{t?.ui.requestAppPermissions({agents:I8}).catch(e=>{console.error(`Chat inbox or permission request failed`,e)})},children:`Allow conversation access`})}):null,t&&p.length>0&&!qe&&!Ue?(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)(Hb,{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)(Iw,{size:`sm`,onClick:Je,children:`Allow Agent access`})]}):null,v.error?(0,X.jsx)(Fb,{tone:`error`,title:v.error.message}):null,h?(0,X.jsx)(Fb,{className:`inbox-error`,tone:`error`,title:h,action:(0,X.jsx)(Iw,{variant:`ghost`,size:`sm`,onClick:()=>{l.refetch()},children:`Try again`})}):null,He?(0,X.jsx)(Fb,{className:`inbox-error`,tone:`error`,title:`Conversations are unavailable.`,action:(0,X.jsx)(Iw,{variant:`ghost`,size:`sm`,onClick:()=>{u.refresh()},children:`Retry conversations`})}):null,(0,X.jsx)(Ck,{ref:Le,className:`inbox-surface min-h-0 flex-1`,"aria-label":`Conversations`,children:t?m?(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)(f8,{viewport:Le,view:Fe,agents:Ie,loading:Ve||c.loading,failed:!!h||He||c.failed,pendingSelection:b,selectedAgentId:E,selectedSessionId:D,onSelect:Ze,onDelete:We?(e,t)=>{v.mutate({agentId:e,sessionId:t})}:void 0,deleting:v.isPending?v.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.jsx)(`header`,{className:`grove-head flex h-10 flex-none items-center gap-2 border-b border-base-300 px-2 text-xs`,children: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)(OJ,{name:`connected`,size:14}),(0,X.jsx)(Rb,{className:`min-w-0 truncate`,children:c.selected.siteLabel}),(0,X.jsx)(jU,{"aria-hidden":`true`,size:12}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:c.selected.conversation.label||`Website visitor`})]}):et?(0,X.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,X.jsx)(Rb,{className:`flex-none`,children:vX(et)}),R?(0,X.jsx)(U6,{agentId:et.agentId,name:et.name,rename:ot},et.agentId):null,nt.canRead?(0,X.jsx)(W6,{status:nt.status.data,approving:nt.approve.isPending,onApprove:st}):null,(0,X.jsx)(jU,{"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:rt})]}):null}),(0,X.jsx)(SX,{app:t}),de?(0,X.jsx)(Fb,{className:`inbox-error m-2`,tone:`error`,title:de}):null,S||c.selected?ut:null,c.selected?(0,X.jsx)(M8,{inbox:c}):S?(0,X.jsx)(z8,{open:S,connection:t,commands:Ae,renderConversation:n.renderConversation,composeDraft:pe,onPrefilled:()=>{me(null)},onForked:De,onOpen:Se}):!t||m?null:p.length===0&&!h?(0,X.jsx)(l8,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`speech`,thinking:g,renderVisual:({speaking:e,thinking:t})=>(0,X.jsx)(rX,{className:`h-full w-full`,state:{activity:t?`thinking`:e?`speaking`:`idle`,expression:`normal`}}),title:Ue?`No one's here yet.`:`Welcome to Grove`,description:Ue?`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:Ue?(0,X.jsx)(Iw,{onClick:()=>{ct(`agent`)},children:`Name your first Agent`}):(0,X.jsx)(Iw,{onClick:Je,children:`Allow Agent access`})}):ut??(0,X.jsx)(l8,{className:`inbox-empty m-auto max-w-[28rem]`,variant:`panel`,title:at>0?`Pick up a conversation`:Ke?`Say hello to ${vX(Ke)}`:`No conversations yet`,description:at>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:qe?(0,X.jsx)(Iw,{variant:`outline`,loading:y===Ke.agentId,disabled:y!==null,onClick:()=>void ke(Ke.agentId),children:at>0?`Ask ${vX(Ke)} something`:`Start a conversation`}):void 0})]}),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)(Rb,{className:`min-w-0 flex-1 truncate`,children:tt===void 0?ve.agentId:vX(tt)}),(0,X.jsx)(CQ,{"aria-label":`Close beside conversation`,icon:(0,X.jsx)(HU,{}),iconSize:`sm`,size:`sm`,onClick:()=>{xe?.clear()}})]}),(0,X.jsx)(z8,{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 U8=document.getElementById(`inbox-root`);if(!U8)throw Error(`Inbox root is missing`);Dm(U8,{name:`Grove`,queryClient:Qv()},({app:e})=>(0,J.createElement)(B8,{connection:e}));export{Lo as $,BS as A,nS as B,jC as C,QS as D,iC as E,uS as F,xx as G,Px as H,fS as I,Wb as J,Bb as K,zS as L,pS as M,lS as N,HS as O,cS as P,Rm as Q,LS as R,LC as S,dC as T,Qx as U,Ox as V,Dx as W,Q as X,Vb as Y,Xv as Z,Iw as _,$W as a,zC as b,kU as c,YF as d,oa as et,zF as f,fj as g,vj as h,gG as i,dS as j,IS as k,ZI as l,eN as m,BJ as n,QW as o,VF as p,Ub as q,Eq as r,MU as s,UY as t,Er as tt,VI as u,mw as v,mC as w,IC as x,ew as y,aS as z};