@fungi.computer/grove 0.10.2 → 0.10.3

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 (24) hide show
  1. package/dist/assets/{anthropic-messages-DR2xAH_A.js → anthropic-messages-dhdSZQHh.js} +3 -3
  2. package/dist/assets/{azure-openai-responses-DhQXk8P1.js → azure-openai-responses-DZ_87FTJ.js} +1 -1
  3. package/dist/assets/{burger-B54hSd-t.js → burger-DrCCNm9Q.js} +1 -1
  4. package/dist/assets/{cat-PtdqG6C3.js → cat-PcbuH79a.js} +1 -1
  5. package/dist/assets/{compat-HNsFMIP3.js → compat-CTlPjeXf.js} +2 -2
  6. package/dist/assets/{extension-hook-B-ufQ44r.js → extension-hook-TXWlsyri.js} +2 -2
  7. package/dist/assets/{google-generative-ai-Btw82Wap.js → google-generative-ai-YxFSrkHg.js} +1 -1
  8. package/dist/assets/{google-shared-eJZvt5a2.js → google-shared-BdaSUTuo.js} +1 -1
  9. package/dist/assets/{google-vertex-DT1ZMRCW.js → google-vertex-nsZCfEGW.js} +1 -1
  10. package/dist/assets/{index-CVzMdSlI.js → index-D1_UIO2Y.js} +4 -4
  11. package/dist/assets/{mistral-conversations-DmzxifbZ.js → mistral-conversations-CF-mWKB5.js} +1 -1
  12. package/dist/assets/{node.browser-DHOibYLI.js → node.browser-BCRZH2FH.js} +1 -1
  13. package/dist/assets/{openai-codex-responses-Do6dstv4.js → openai-codex-responses-DO2jOPV4.js} +1 -1
  14. package/dist/assets/{openai-completions-WnfGAF3X.js → openai-completions-rcgYpl7N.js} +1 -1
  15. package/dist/assets/{openai-responses-BkHqfL0F.js → openai-responses-CJz81TLZ.js} +1 -1
  16. package/dist/assets/{openai-responses-shared-DO8YxWbJ.js → openai-responses-shared-BhyHCBgw.js} +1 -1
  17. package/dist/assets/{parakeet-DDqWjFXC.js → parakeet-DSXcEA6r.js} +3 -3
  18. package/dist/assets/{parakeet-conversation-BQpv2YtG.js → parakeet-conversation-5gtL-N8q.js} +1 -1
  19. package/dist/assets/{runtime-core-DZaDilzo.js → runtime-core-BDds1RWk.js} +1 -1
  20. package/dist/assets/{sigil-DP7aTMwF.js → sigil-CumoCbKe.js} +1 -1
  21. package/dist/assets/{transform-messages-jnVkxqIS.js → transform-messages-UVC-QukO.js} +1 -1
  22. package/dist/assets/{website-conversation-Dc3Ac9Ok.js → website-conversation-vF8iWv5k.js} +1 -1
  23. package/dist/index.html +3 -3
  24. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ar as t,Dr as n,Ei as r,Er as i,Fr as a,Or as o,br as s,c,ki as l,kr as u,mi as d,mr as f,p,tn as m,u as ee,w as te}from"./sigil-DP7aTMwF.js";import{Ea as h,Ta as ne,Zi as g,_a as _,ar as v,ba as re,da as ie,fa as ae,ht as oe,ra as se,sr as ce,xa as y,ya as le}from"./Effect-CsknxyoC.js";import{Ai as b,Bi as ue,Ci as x,Dr as de,Hi as S,Ji as C,Ma as fe,Na as w,Ni as T,Pa as E,Pi as pe,Si as D,Ta as O,Wi as me,Zi as he,_a as k,_i as ge,bi as _e,fi as A,i as j,ii as M,ji as ve,ka as N,kr as ye,la as P,li as F,oa as be,oi as I,pa as xe,pi as L,ri as Se,ti as Ce,ui as we,xa as R,xi as Te,yi as z}from"./extension-hook-B-ufQ44r.js";import{a as Ee,c as De,d as B,i as Oe,l as ke,n as Ae,o as je,r as Me,s as Ne,u as Pe}from"./parakeet-DDqWjFXC.js";import{_ as Fe,g as V,h as Ie,m as Le,p as Re,t as ze,v as Be,y as Ve}from"./index-CVzMdSlI.js";var He=(e,t)=>{if(e.length<=t)return e;let n=Math.max(1,Math.floor((t-1)/2));return`${e.slice(0,n)}…${e.slice(-(t-n-1))}`},Ue=(e,t)=>e.length<=t?e:`${e.slice(0,t-1)}…`,We=e=>e.map(([e,t])=>({label:e,value:t}));function Ge(e,t){let{record:n}=e,r=Math.max(0,n.expiresAt-t);return[[`Agent`,`${n.requester.displayName} · ${n.requester.agentId??`none`}`],[`Session`,n.requester.sessionId??`none`],[`Requester`,n.requester.principalId],[`Request`,`${n.module}.${n.operation} · ${n.access}`],[`Input`,`${n.description.inputBytes.toLocaleString()} bytes · SHA-256 ${n.description.inputSha256.slice(0,8)}…${n.description.inputSha256.slice(-6)}`],[`Expires`,`in ${String(Math.floor(r/36e5))} h ${String(Math.floor(r%36e5/6e4))} m`],[`Record`,`${n.recordId} · revision ${String(n.revision)}`]]}function Ke(e){return[`Undo`,e.record.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}function qe(e,t){let{record:n}=e;return{content:{title:`Allow ${n.module} · ${n.operation}?`,summary:`${n.requester.displayName} wants to use a connected tool.`,facts:[{label:`Effect`,value:(n.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`)+(n.reversibility===`irreversible-external`?` · can't be undone`:``)}],details:We([Ke(e),...Ge(e,t)])}}}function Je(e,t,n,r,i){let a=t.prefix?.join(` `),o=a!==void 0&&t.alwaysAllowUnavailableReason===void 0,s=t.command,c=`Allow \`${s}\`?`.length<=n?`Allow \`${s}\`?`:`Allow this command?`,l=t.cwd===r?`~`:t.cwd.startsWith(`${r}/`)?`~${t.cwd.slice(r.length)}`:t.cwd,u=Math.max(8,(n-8)*2-2),d=t.justification.length<=u?`“${t.justification}”`:`“${t.justification.slice(0,u-1)}…”`,f=[[`Folder`,He(l,Math.max(8,n-10))],[`Why`,d]];t.kind===`extension-install`&&f.push([`Note`,`Extensions run inside Fungi with access to every Agent.`]),o&&t.alwaysAllowCoverage!==void 0&&f.push([`Scope`,Ue(t.alwaysAllowCoverage,Math.max(8,n-12))]),!o&&t.warning!==void 0&&f.push([`Warning`,t.warning]);let p=o?`Always allow “${He(a,Math.max(8,n-5-32))}” in this project…`:void 0,m=[[`Command`,s]];return t.argv!==void 0&&m.push([`Arguments`,JSON.stringify(t.argv)]),m.push([`Folder`,t.cwd],[`Runs`,`Outside the sandbox, as you`],Ke(e)),!o&&t.alwaysAllowUnavailableReason!==void 0?m.push([`Rule`,t.alwaysAllowUnavailableReason]):t.form===`shell`?m.push([`Rule`,`Shell command: no Always-allow rule can match it.`]):o&&(m.push([`Rule`,`“${a}” would match \`${a} …\` in this project`]),t.alwaysAllowCoverage!==void 0&&m.push([`Coverage`,t.alwaysAllowCoverage]),t.risk!==void 0&&m.push([`Risk`,t.risk.detail])),!o&&t.warning!==void 0&&m.push([`Warning`,t.warning]),m.push(...Ge(e,i)),{content:{title:c,body:c===`Allow this command?`?s:void 0,bodyLabel:c===`Allow this command?`?`Command`:void 0,summary:`${e.record.requester.displayName} wants to run this outside the sandbox, as you.`,facts:We(f),details:We(m)},always:p===void 0?void 0:Ue(p,Math.max(12,n-5)),confirmation:o?{title:`Always allow “${a}” in this project?`,body:Ue(t.alwaysAllowCoverage??`Any Workspace Agent here can then run \`${a} …\` without asking.`,Math.max(12,(n-8)*2-2))}:void 0,confirmWarning:o?t.risk?.summary:void 0,confirmYes:o?`Always allow “${a}” and run it now`:void 0}}function Ye(e,t,n){let r=Math.min(n.width,60);return t===void 0?qe(e,n.now):Je(e,t,r,n.home,n.now)}function Xe(e,t){switch(e){case`stale-revision`:case`already-answered`:return`This request changed. Look again before answering.`;case`expired`:return`This request expired. Nothing ran.`;case`not-eligible`:if(t===`always-allow`)return`Always allow isn't available for this command. Approve once or deny.`}return`Couldn't answer (${e}). Nothing ran.`}var Ze=`Couldn't send your answer. It may not have been recorded.`;async function Qe(e,t){let{view:n,source:r}=t,i=Ye(n,r.review,{width:t.width,home:t.home,now:t.now}),a=n.record;try{let n,o,s=!1;for(;n===void 0;){let c=await e.prompt({type:`decision`,message:i.content.title,summary:s?`Automatic approval is on for this family.`:i.content.summary,facts:i.content.facts?.map(e=>({...e})),body:i.content.body,bodyLabel:i.content.bodyLabel,details:i.content.details?.map(e=>({...e})),options:[{value:`approve`,label:`Approve once`},...i.always===void 0?[]:[{value:`always`,label:i.always}],...r.family===void 0||s?[]:[{value:`family`,label:r.family.label}],{value:`deny`,label:`Deny`}],other:{label:`Deny and say why…`,placeholder:`A short reason for the Agent (optional)`,maxLength:t.noteLimit,blank:`deny`}});if(!t.stillCurrent())return{kind:`abandoned`};if(c.text!==void 0)o=c.text.trim()||void 0,n=`deny`;else if(c.selected[0]===`always`){let r=i.confirmation,a=await e.prompt({type:`decision`,message:r?.title??i.content.title,summary:i.confirmWarning,body:r?.body,options:[{value:`back`,label:`Back`},{value:`always-allow`,label:i.confirmYes??`Always allow`}],escape:`back`});if(!t.stillCurrent())return{kind:`abandoned`};a.selected[0]===`always-allow`&&(n=`always-allow`)}else if(c.selected[0]===`family`&&r.family!==void 0){let n=await e.prompt({type:`decision`,message:`${r.family.label}?`,summary:`Later ${a.module} requests that ${a.access===`write`?`change data in Fungi`:`reach outside Fungi`} will run without asking.`,options:[{value:`back`,label:`Back`},{value:`family`,label:r.family.label}],escape:`back`});if(!t.stillCurrent()||n.selected[0]===`family`&&(s=await r.family.enable(),!t.stillCurrent()))return{kind:`abandoned`}}else c.selected[0]===`approve`?n=`approve`:c.selected[0]===`deny`&&(n=`deny`)}let c={recordId:a.recordId,decision:n,expectedRevision:a.revision},l=await r.answer(o===void 0?c:{...c,denialNote:o});return t.stillCurrent()?l.kind===`refused`?{kind:`refused`,message:Xe(l.reason??`unknown`,n)}:{kind:`answered`}:{kind:`abandoned`}}catch(n){return e.signal.aborted?{kind:`abandoned`}:(t.onFailure(n),{kind:`refused`,message:Ze})}}var H=e(l(),1),$e=()=>void 0,et=()=>()=>void 0;function tt(e){let{source:t,store:n,enabled:r,home:i,width:a,noteLimit:o,onFailure:s}=e,c=(0,H.useRef)(s);c.current=s;let l=(0,H.useRef)({home:i,width:a,noteLimit:o});l.current={home:i,width:a,noteLimit:o};let u=(0,H.useSyncExternalStore)(t?.subscribe??et,t?.snapshot??$e),d=(0,H.useRef)(u);d.current=u;let f=u===void 0?void 0:JSON.stringify([`approval`,u.record.recordId,u.record.revision,u.canAnswer]);(0,H.useEffect)(()=>{let e=d.current;if(!r||t===void 0||e===void 0||!e.canAnswer||f===void 0)return;let{home:i,width:a,noteLimit:o}=l.current,s=ke({title:`Approval`}),u=s.begin(),p=()=>{let n=t.snapshot();return!u.interaction.signal.aborted&&n?.record.recordId===e.record.recordId&&n.record.revision===e.record.revision&&n.canAnswer},m=n.awaiting.add({key:f,kind:`approval`,arrivedAt:Date.now(),host:s});return Qe(u.interaction,{view:e,source:t,home:i,width:a,now:Date.now(),noteLimit:o,stillCurrent:p,onFailure:e=>{c.current(e)}}).then(e=>{e.kind===`refused`?u.settle({status:`failed`,message:e.message}):(m(),u.settle(e.kind===`answered`?{status:`handled`}:{status:`cancelled`}))}),()=>{m(),s.cancel()}},[t,f,r,n])}var U=d(),W=D.check(O(1),R(256)),nt=F.check(P(1),k(2**53-1)),rt=F.check(P(0),k(2**53-1)),it=L([`write`,`external`]),at=x({module:z(W),access:it}),ot=x({agentId:z(W)}),st=x({principalId:W,agentId:z(W),sessionId:z(W),displayName:W}),ct=x({title:D.check(O(1),R(512)),inputBytes:F.check(P(0)),inputSha256:D.check(N(/^[a-f0-9]{64}$/))}),lt=x({kind:A(`pending_approval`),recordId:W,description:ct}),ut=L([`requested`,`pending`,`approved`,`claimed`,`applied`,`denied`,`expired`,`outcome_unknown`]),dt=L([`not-found`,`not-eligible`,`already-answered`,`stale-revision`,`expired`,`declined`,`fenced`,`not-granted`,`read-only`,`pending`,`in-flight`,`outcome-unknown`,`identity-conflict`]),ft=D.check(O(1),R(512),N(/^(?=.*\S)[^\p{Cc}\u2028\u2029]*$/u)),pt=M(x({kind:A(`artifact`),ref:D.check(N(/^sha256:[a-f0-9]{64}$/)),mediaType:A(`image/png`),bytes:F.check(P(1),k(5242880))})).check(R(4)),mt=x({recordId:W,requester:st,module:W,operation:W,access:it,description:ct,evidence:E(pt),authorityFence:W,reversibility:L([`reversible`,`irreversible-external`]),state:ut,by:z(b([x({kind:A(`human`),memberId:W}),x({kind:A(`policy`)})])),reason:z(dt),denialNote:E(ft),requestedAt:rt,expiresAt:rt,updatedAt:rt,revision:nt}),ht=x({record:mt,canAnswer:I,canSetAutoApprove:I});x({state:E(ut),cursor:E(W),limit:E(F.check(P(1),k(100)))}),x({recordId:W}),x({recordId:W,decision:L([`approve`,`deny`]),expectedRevision:nt,denialNote:E(ft)});var gt=x({scope:ot,family:at,enabled:I}),_t=x({kind:A(`refused`),reason:dt,denialNote:E(ft)});S(C(mt),{onExcessProperty:`error`}),me(C(mt)),S(x({record_json:D})),S(C(we)),me(C(we)),S(x({input_json:D,output_json:z(D)}));var vt=_t,yt=x({items:M(ht),nextCursor:z(D)}),bt=b([x({kind:A(`answered`),view:ht}),vt]),xt=b([x({kind:A(`updated`),rule:gt}),vt]),G=e=>Le(ne().transform(t=>S(e,{onExcessProperty:`error`})(t))),St=Be(`approvals`,1,ae(()=>Ie({list:V(G(yt)),get:V(G(z(ht))),answer:V(G(bt)),setAutoApprove:V(G(xt))}))),K=pe(e=>Pe.safeParse(e).success,{representation:{id:`@fungi.computer/whistle/catalog-step/v1`,payload:null}});oe(()=>Se());var q=D.pipe(T(O(1)),T(R(4e3)),T(N(/\S/u,{message:`Goal objective is blank`}))),Ct=D.pipe(T(O(1)),T(R(1e3)),T(N(/\S/u))),wt=D.pipe(T(O(1)),T(R(256))),Tt=F.check(P(0)),Et=x({kind:L([`person`,`delegator`,`blocked`,`stalled`,`cancelled`,`failed`,`no-terminal`]),detail:z(D)}),J=x({revision:D,objective:q,state:L([`active`,`paused`]),startedAt:Tt,pauseCause:z(Et)}),Dt=x({sequence:F.check(be(0)),objective:q,outcome:L([`achieved`,`cleared`]),reason:z(Ct),clearedBy:E(ge.check(R(256))),endedAt:Tt,afterSequence:F.check(P(0))}),Ot=b([x({action:A(`set`),objective:q,requestId:wt,expectedRevision:w(z(D)),confirmed:w(I)}),x({action:L([`pause`,`resume`,`replace`,`clear`,`clear-ask`]),confirmed:w(I)}),x({})]),kt=x({goal:z(J),ended:M(Dt).check(R(16)),omitted:F.check(P(0))}),At={id:j.make(`botanical-session-goal`),commands:{controlAgent:{scope:`session`,input:x({action:L([`pause`,`resume`,`clear`]),reason:Ct}),output:b([x({result:A(`paused`),goal:J}),x({result:A(`resumed`),goal:J}),x({result:A(`cleared`)}),x({result:A(`no_goal`)}),x({result:A(`refused`),reason:L([`not_delegator`,`not_paused_by_delegator`])})])},goal:{scope:`session`,input:Ot,output:K},pause:{scope:`session`,input:x({}),output:J},resume:{scope:`session`,input:x({}),output:J},clear:{scope:`session`,input:x({}),output:x({})},set:{scope:`session`,input:x({objective:q,expectedRevision:z(D),requestId:wt,adoptCommandId:E(wt)}),output:x({goal:J,accepted:x({status:A(`accepted`),commandId:D})})}},projection:{schema:kt}},Y=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=80?t:`${t.slice(0,79)}…`},jt=e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`};function Mt(e){let t=e.state===`active`,n=t?`Pursuing goal since ${jt(e.startedAt)}`:e.pauseCause?.kind===`delegator`?`Goal paused by ${Y(e.pauseCause.detail??`delegator`)} (/goal resume)`:`Goal paused (/goal resume)`,r=!t&&e.pauseCause?.kind!==`delegator`&&e.pauseCause?.detail!=null?[Y(e.pauseCause.detail)]:[],i={id:`goal`,title:[n,Y(e.objective),...r].join(` · `),tone:t?`running`:`muted`,actions:[{id:`goal`,label:t?`Pause goal`:`Resume goal`,input:{action:t?`pause`:`resume`}}]};return Y(e.objective)===e.objective?i:{...i,detail:e.objective.slice(0,1024)}}function Nt(e){let t={id:`goal-ended`,title:`${e.outcome===`achieved`?`Goal achieved`:`Goal cleared`} · ${Y(e.objective)}`,tone:e.outcome===`achieved`?`settled`:`muted`},n=e.reason===null?t:{...t,detail:e.reason};return{id:String(e.sequence),sequence:e.sequence,at:e.endedAt,commandId:null,afterSequence:e.afterSequence,rows:[n]}}var Pt=B(At,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{goal:t,ended:n,omitted:r}=e.value;return{chips:[],panel:t===null?[]:[Mt(t)],timeline:{cells:n.map(Nt),omitted:r},waiting:null}}}),Ft=D.pipe(T(O(1)),T(R(256))),It=D.pipe(T(O(1)),T(R(262144))),Lt=x({expression:D.pipe(T(O(1)),T(R(256))),timeZone:D.pipe(T(O(1)),T(R(128)))}),X=x({loopId:D,origin:L([`human`,`model`]),expiresAt:z(F),prompt:It,mode:L([`self_paced`,`fixed_interval`]),cron:z(Lt),state:L([`active`,`paused`,`finished`,`failed`,`cancelled`]),commandId:D,reason:z(D),nextDueAt:z(F),lastError:z(D),consecutiveFailures:F.pipe(T(P(0)))}),Rt=x({after:E(Ft),limit:E(F.pipe(T(he({minimum:1,maximum:64}))))}),zt=D.pipe(T(O(1)),T(R(200))),Bt=x({loop:X,accepted:x({status:A(`accepted`),commandId:D})}),Vt=b([x({action:A(`start`),text:It,requestId:zt}),x({action:L([`status`,`pause`,`resume`,`stop`,`stop-ask`,`new`]),confirmed:w(I)}),x({})]),Ht=x({loop:X}),Ut=x({sessionId:Ft,loopId:X.fields.loopId}),Wt={id:j.make(`botanical-session-loop`),commands:{list:{scope:`agent`,input:Rt,output:M(x({...X.fields,sessionId:Ft})).pipe(T(R(64)))},pauseLoop:{scope:`agent`,input:Ut,output:X},resumeLoop:{scope:`agent`,input:Ut,output:X},stopLoop:{scope:`agent`,input:Ut,output:X},loop:{scope:`session`,input:Vt,output:K},startSelfPaced:{scope:`session`,input:x({prompt:It,requestId:zt}),output:Bt},startFixedInterval:{scope:`session`,input:x({prompt:It,requestId:zt,...Lt.fields}),output:Bt},pause:{scope:`session`,input:x({}),output:X},resume:{scope:`session`,input:x({}),output:X},stop:{scope:`session`,input:x({}),output:X}},projection:{schema:Ht}},Gt=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=60?t:`${t.slice(0,59)}…`},Kt=e=>e.state===`failed`?`error`:e.state===`active`?`running`:e.state===`paused`?`muted`:`settled`,qt=e=>new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZoneName:`short`}).format(e),Jt=B(Wt,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{loop:t}=e.value,n=t.state===`active`&&t.nextDueAt!==null;return{chips:t.state!==`active`&&t.state!==`paused`?[]:[{id:`loop`,order:2,row:{id:`loop`,title:`Loop ${t.mode===`self_paced`?`self-paced`:`fixed`}${n?` (waiting)`:``}`,tone:Kt(t)}}],panel:[{id:`loop`,title:`Loop · ${t.state} · ${t.mode===`self_paced`?`self-paced`:`${t.cron?.expression??`fixed`} ${t.cron?.timeZone??``}`}${t.nextDueAt===null?``:` · Next ${qt(t.nextDueAt)}`} · ${Gt(t.prompt)}`,detail:[t.reason,t.prompt].filter(e=>e!==null).join(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ar as t,Dr as n,Ei as r,Er as i,Fr as a,Or as o,br as s,c,ki as l,kr as u,mi as d,mr as f,p,tn as m,u as ee,w as te}from"./sigil-CumoCbKe.js";import{Ea as h,Ta as ne,Zi as g,_a as _,ar as v,ba as re,da as ie,fa as ae,ht as oe,ra as se,sr as ce,xa as y,ya as le}from"./Effect-CsknxyoC.js";import{Ai as b,Bi as ue,Ci as x,Dr as de,Hi as S,Ji as C,Ma as fe,Na as w,Ni as T,Pa as E,Pi as pe,Si as D,Ta as O,Wi as me,Zi as he,_a as k,_i as ge,bi as _e,fi as A,i as j,ii as M,ji as ve,ka as N,kr as ye,la as P,li as F,oa as be,oi as I,pa as xe,pi as L,ri as Se,ti as Ce,ui as we,xa as R,xi as Te,yi as z}from"./extension-hook-TXWlsyri.js";import{a as Ee,c as De,d as B,i as Oe,l as ke,n as Ae,o as je,r as Me,s as Ne,u as Pe}from"./parakeet-DSXcEA6r.js";import{_ as Fe,g as V,h as Ie,m as Le,p as Re,t as ze,v as Be,y as Ve}from"./index-D1_UIO2Y.js";var He=(e,t)=>{if(e.length<=t)return e;let n=Math.max(1,Math.floor((t-1)/2));return`${e.slice(0,n)}…${e.slice(-(t-n-1))}`},Ue=(e,t)=>e.length<=t?e:`${e.slice(0,t-1)}…`,We=e=>e.map(([e,t])=>({label:e,value:t}));function Ge(e,t){let{record:n}=e,r=Math.max(0,n.expiresAt-t);return[[`Agent`,`${n.requester.displayName} · ${n.requester.agentId??`none`}`],[`Session`,n.requester.sessionId??`none`],[`Requester`,n.requester.principalId],[`Request`,`${n.module}.${n.operation} · ${n.access}`],[`Input`,`${n.description.inputBytes.toLocaleString()} bytes · SHA-256 ${n.description.inputSha256.slice(0,8)}…${n.description.inputSha256.slice(-6)}`],[`Expires`,`in ${String(Math.floor(r/36e5))} h ${String(Math.floor(r%36e5/6e4))} m`],[`Record`,`${n.recordId} · revision ${String(n.revision)}`]]}function Ke(e){return[`Undo`,e.record.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}function qe(e,t){let{record:n}=e;return{content:{title:`Allow ${n.module} · ${n.operation}?`,summary:`${n.requester.displayName} wants to use a connected tool.`,facts:[{label:`Effect`,value:(n.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`)+(n.reversibility===`irreversible-external`?` · can't be undone`:``)}],details:We([Ke(e),...Ge(e,t)])}}}function Je(e,t,n,r,i){let a=t.prefix?.join(` `),o=a!==void 0&&t.alwaysAllowUnavailableReason===void 0,s=t.command,c=`Allow \`${s}\`?`.length<=n?`Allow \`${s}\`?`:`Allow this command?`,l=t.cwd===r?`~`:t.cwd.startsWith(`${r}/`)?`~${t.cwd.slice(r.length)}`:t.cwd,u=Math.max(8,(n-8)*2-2),d=t.justification.length<=u?`“${t.justification}”`:`“${t.justification.slice(0,u-1)}…”`,f=[[`Folder`,He(l,Math.max(8,n-10))],[`Why`,d]];t.kind===`extension-install`&&f.push([`Note`,`Extensions run inside Fungi with access to every Agent.`]),o&&t.alwaysAllowCoverage!==void 0&&f.push([`Scope`,Ue(t.alwaysAllowCoverage,Math.max(8,n-12))]),!o&&t.warning!==void 0&&f.push([`Warning`,t.warning]);let p=o?`Always allow “${He(a,Math.max(8,n-5-32))}” in this project…`:void 0,m=[[`Command`,s]];return t.argv!==void 0&&m.push([`Arguments`,JSON.stringify(t.argv)]),m.push([`Folder`,t.cwd],[`Runs`,`Outside the sandbox, as you`],Ke(e)),!o&&t.alwaysAllowUnavailableReason!==void 0?m.push([`Rule`,t.alwaysAllowUnavailableReason]):t.form===`shell`?m.push([`Rule`,`Shell command: no Always-allow rule can match it.`]):o&&(m.push([`Rule`,`“${a}” would match \`${a} …\` in this project`]),t.alwaysAllowCoverage!==void 0&&m.push([`Coverage`,t.alwaysAllowCoverage]),t.risk!==void 0&&m.push([`Risk`,t.risk.detail])),!o&&t.warning!==void 0&&m.push([`Warning`,t.warning]),m.push(...Ge(e,i)),{content:{title:c,body:c===`Allow this command?`?s:void 0,bodyLabel:c===`Allow this command?`?`Command`:void 0,summary:`${e.record.requester.displayName} wants to run this outside the sandbox, as you.`,facts:We(f),details:We(m)},always:p===void 0?void 0:Ue(p,Math.max(12,n-5)),confirmation:o?{title:`Always allow “${a}” in this project?`,body:Ue(t.alwaysAllowCoverage??`Any Workspace Agent here can then run \`${a} …\` without asking.`,Math.max(12,(n-8)*2-2))}:void 0,confirmWarning:o?t.risk?.summary:void 0,confirmYes:o?`Always allow “${a}” and run it now`:void 0}}function Ye(e,t,n){let r=Math.min(n.width,60);return t===void 0?qe(e,n.now):Je(e,t,r,n.home,n.now)}function Xe(e,t){switch(e){case`stale-revision`:case`already-answered`:return`This request changed. Look again before answering.`;case`expired`:return`This request expired. Nothing ran.`;case`not-eligible`:if(t===`always-allow`)return`Always allow isn't available for this command. Approve once or deny.`}return`Couldn't answer (${e}). Nothing ran.`}var Ze=`Couldn't send your answer. It may not have been recorded.`;async function Qe(e,t){let{view:n,source:r}=t,i=Ye(n,r.review,{width:t.width,home:t.home,now:t.now}),a=n.record;try{let n,o,s=!1;for(;n===void 0;){let c=await e.prompt({type:`decision`,message:i.content.title,summary:s?`Automatic approval is on for this family.`:i.content.summary,facts:i.content.facts?.map(e=>({...e})),body:i.content.body,bodyLabel:i.content.bodyLabel,details:i.content.details?.map(e=>({...e})),options:[{value:`approve`,label:`Approve once`},...i.always===void 0?[]:[{value:`always`,label:i.always}],...r.family===void 0||s?[]:[{value:`family`,label:r.family.label}],{value:`deny`,label:`Deny`}],other:{label:`Deny and say why…`,placeholder:`A short reason for the Agent (optional)`,maxLength:t.noteLimit,blank:`deny`}});if(!t.stillCurrent())return{kind:`abandoned`};if(c.text!==void 0)o=c.text.trim()||void 0,n=`deny`;else if(c.selected[0]===`always`){let r=i.confirmation,a=await e.prompt({type:`decision`,message:r?.title??i.content.title,summary:i.confirmWarning,body:r?.body,options:[{value:`back`,label:`Back`},{value:`always-allow`,label:i.confirmYes??`Always allow`}],escape:`back`});if(!t.stillCurrent())return{kind:`abandoned`};a.selected[0]===`always-allow`&&(n=`always-allow`)}else if(c.selected[0]===`family`&&r.family!==void 0){let n=await e.prompt({type:`decision`,message:`${r.family.label}?`,summary:`Later ${a.module} requests that ${a.access===`write`?`change data in Fungi`:`reach outside Fungi`} will run without asking.`,options:[{value:`back`,label:`Back`},{value:`family`,label:r.family.label}],escape:`back`});if(!t.stillCurrent()||n.selected[0]===`family`&&(s=await r.family.enable(),!t.stillCurrent()))return{kind:`abandoned`}}else c.selected[0]===`approve`?n=`approve`:c.selected[0]===`deny`&&(n=`deny`)}let c={recordId:a.recordId,decision:n,expectedRevision:a.revision},l=await r.answer(o===void 0?c:{...c,denialNote:o});return t.stillCurrent()?l.kind===`refused`?{kind:`refused`,message:Xe(l.reason??`unknown`,n)}:{kind:`answered`}:{kind:`abandoned`}}catch(n){return e.signal.aborted?{kind:`abandoned`}:(t.onFailure(n),{kind:`refused`,message:Ze})}}var H=e(l(),1),$e=()=>void 0,et=()=>()=>void 0;function tt(e){let{source:t,store:n,enabled:r,home:i,width:a,noteLimit:o,onFailure:s}=e,c=(0,H.useRef)(s);c.current=s;let l=(0,H.useRef)({home:i,width:a,noteLimit:o});l.current={home:i,width:a,noteLimit:o};let u=(0,H.useSyncExternalStore)(t?.subscribe??et,t?.snapshot??$e),d=(0,H.useRef)(u);d.current=u;let f=u===void 0?void 0:JSON.stringify([`approval`,u.record.recordId,u.record.revision,u.canAnswer]);(0,H.useEffect)(()=>{let e=d.current;if(!r||t===void 0||e===void 0||!e.canAnswer||f===void 0)return;let{home:i,width:a,noteLimit:o}=l.current,s=ke({title:`Approval`}),u=s.begin(),p=()=>{let n=t.snapshot();return!u.interaction.signal.aborted&&n?.record.recordId===e.record.recordId&&n.record.revision===e.record.revision&&n.canAnswer},m=n.awaiting.add({key:f,kind:`approval`,arrivedAt:Date.now(),host:s});return Qe(u.interaction,{view:e,source:t,home:i,width:a,now:Date.now(),noteLimit:o,stillCurrent:p,onFailure:e=>{c.current(e)}}).then(e=>{e.kind===`refused`?u.settle({status:`failed`,message:e.message}):(m(),u.settle(e.kind===`answered`?{status:`handled`}:{status:`cancelled`}))}),()=>{m(),s.cancel()}},[t,f,r,n])}var U=d(),W=D.check(O(1),R(256)),nt=F.check(P(1),k(2**53-1)),rt=F.check(P(0),k(2**53-1)),it=L([`write`,`external`]),at=x({module:z(W),access:it}),ot=x({agentId:z(W)}),st=x({principalId:W,agentId:z(W),sessionId:z(W),displayName:W}),ct=x({title:D.check(O(1),R(512)),inputBytes:F.check(P(0)),inputSha256:D.check(N(/^[a-f0-9]{64}$/))}),lt=x({kind:A(`pending_approval`),recordId:W,description:ct}),ut=L([`requested`,`pending`,`approved`,`claimed`,`applied`,`denied`,`expired`,`outcome_unknown`]),dt=L([`not-found`,`not-eligible`,`already-answered`,`stale-revision`,`expired`,`declined`,`fenced`,`not-granted`,`read-only`,`pending`,`in-flight`,`outcome-unknown`,`identity-conflict`]),ft=D.check(O(1),R(512),N(/^(?=.*\S)[^\p{Cc}\u2028\u2029]*$/u)),pt=M(x({kind:A(`artifact`),ref:D.check(N(/^sha256:[a-f0-9]{64}$/)),mediaType:A(`image/png`),bytes:F.check(P(1),k(5242880))})).check(R(4)),mt=x({recordId:W,requester:st,module:W,operation:W,access:it,description:ct,evidence:E(pt),authorityFence:W,reversibility:L([`reversible`,`irreversible-external`]),state:ut,by:z(b([x({kind:A(`human`),memberId:W}),x({kind:A(`policy`)})])),reason:z(dt),denialNote:E(ft),requestedAt:rt,expiresAt:rt,updatedAt:rt,revision:nt}),ht=x({record:mt,canAnswer:I,canSetAutoApprove:I});x({state:E(ut),cursor:E(W),limit:E(F.check(P(1),k(100)))}),x({recordId:W}),x({recordId:W,decision:L([`approve`,`deny`]),expectedRevision:nt,denialNote:E(ft)});var gt=x({scope:ot,family:at,enabled:I}),_t=x({kind:A(`refused`),reason:dt,denialNote:E(ft)});S(C(mt),{onExcessProperty:`error`}),me(C(mt)),S(x({record_json:D})),S(C(we)),me(C(we)),S(x({input_json:D,output_json:z(D)}));var vt=_t,yt=x({items:M(ht),nextCursor:z(D)}),bt=b([x({kind:A(`answered`),view:ht}),vt]),xt=b([x({kind:A(`updated`),rule:gt}),vt]),G=e=>Le(ne().transform(t=>S(e,{onExcessProperty:`error`})(t))),St=Be(`approvals`,1,ae(()=>Ie({list:V(G(yt)),get:V(G(z(ht))),answer:V(G(bt)),setAutoApprove:V(G(xt))}))),K=pe(e=>Pe.safeParse(e).success,{representation:{id:`@fungi.computer/whistle/catalog-step/v1`,payload:null}});oe(()=>Se());var q=D.pipe(T(O(1)),T(R(4e3)),T(N(/\S/u,{message:`Goal objective is blank`}))),Ct=D.pipe(T(O(1)),T(R(1e3)),T(N(/\S/u))),wt=D.pipe(T(O(1)),T(R(256))),Tt=F.check(P(0)),Et=x({kind:L([`person`,`delegator`,`blocked`,`stalled`,`cancelled`,`failed`,`no-terminal`]),detail:z(D)}),J=x({revision:D,objective:q,state:L([`active`,`paused`]),startedAt:Tt,pauseCause:z(Et)}),Dt=x({sequence:F.check(be(0)),objective:q,outcome:L([`achieved`,`cleared`]),reason:z(Ct),clearedBy:E(ge.check(R(256))),endedAt:Tt,afterSequence:F.check(P(0))}),Ot=b([x({action:A(`set`),objective:q,requestId:wt,expectedRevision:w(z(D)),confirmed:w(I)}),x({action:L([`pause`,`resume`,`replace`,`clear`,`clear-ask`]),confirmed:w(I)}),x({})]),kt=x({goal:z(J),ended:M(Dt).check(R(16)),omitted:F.check(P(0))}),At={id:j.make(`botanical-session-goal`),commands:{controlAgent:{scope:`session`,input:x({action:L([`pause`,`resume`,`clear`]),reason:Ct}),output:b([x({result:A(`paused`),goal:J}),x({result:A(`resumed`),goal:J}),x({result:A(`cleared`)}),x({result:A(`no_goal`)}),x({result:A(`refused`),reason:L([`not_delegator`,`not_paused_by_delegator`])})])},goal:{scope:`session`,input:Ot,output:K},pause:{scope:`session`,input:x({}),output:J},resume:{scope:`session`,input:x({}),output:J},clear:{scope:`session`,input:x({}),output:x({})},set:{scope:`session`,input:x({objective:q,expectedRevision:z(D),requestId:wt,adoptCommandId:E(wt)}),output:x({goal:J,accepted:x({status:A(`accepted`),commandId:D})})}},projection:{schema:kt}},Y=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=80?t:`${t.slice(0,79)}…`},jt=e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`};function Mt(e){let t=e.state===`active`,n=t?`Pursuing goal since ${jt(e.startedAt)}`:e.pauseCause?.kind===`delegator`?`Goal paused by ${Y(e.pauseCause.detail??`delegator`)} (/goal resume)`:`Goal paused (/goal resume)`,r=!t&&e.pauseCause?.kind!==`delegator`&&e.pauseCause?.detail!=null?[Y(e.pauseCause.detail)]:[],i={id:`goal`,title:[n,Y(e.objective),...r].join(` · `),tone:t?`running`:`muted`,actions:[{id:`goal`,label:t?`Pause goal`:`Resume goal`,input:{action:t?`pause`:`resume`}}]};return Y(e.objective)===e.objective?i:{...i,detail:e.objective.slice(0,1024)}}function Nt(e){let t={id:`goal-ended`,title:`${e.outcome===`achieved`?`Goal achieved`:`Goal cleared`} · ${Y(e.objective)}`,tone:e.outcome===`achieved`?`settled`:`muted`},n=e.reason===null?t:{...t,detail:e.reason};return{id:String(e.sequence),sequence:e.sequence,at:e.endedAt,commandId:null,afterSequence:e.afterSequence,rows:[n]}}var Pt=B(At,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{goal:t,ended:n,omitted:r}=e.value;return{chips:[],panel:t===null?[]:[Mt(t)],timeline:{cells:n.map(Nt),omitted:r},waiting:null}}}),Ft=D.pipe(T(O(1)),T(R(256))),It=D.pipe(T(O(1)),T(R(262144))),Lt=x({expression:D.pipe(T(O(1)),T(R(256))),timeZone:D.pipe(T(O(1)),T(R(128)))}),X=x({loopId:D,origin:L([`human`,`model`]),expiresAt:z(F),prompt:It,mode:L([`self_paced`,`fixed_interval`]),cron:z(Lt),state:L([`active`,`paused`,`finished`,`failed`,`cancelled`]),commandId:D,reason:z(D),nextDueAt:z(F),lastError:z(D),consecutiveFailures:F.pipe(T(P(0)))}),Rt=x({after:E(Ft),limit:E(F.pipe(T(he({minimum:1,maximum:64}))))}),zt=D.pipe(T(O(1)),T(R(200))),Bt=x({loop:X,accepted:x({status:A(`accepted`),commandId:D})}),Vt=b([x({action:A(`start`),text:It,requestId:zt}),x({action:L([`status`,`pause`,`resume`,`stop`,`stop-ask`,`new`]),confirmed:w(I)}),x({})]),Ht=x({loop:X}),Ut=x({sessionId:Ft,loopId:X.fields.loopId}),Wt={id:j.make(`botanical-session-loop`),commands:{list:{scope:`agent`,input:Rt,output:M(x({...X.fields,sessionId:Ft})).pipe(T(R(64)))},pauseLoop:{scope:`agent`,input:Ut,output:X},resumeLoop:{scope:`agent`,input:Ut,output:X},stopLoop:{scope:`agent`,input:Ut,output:X},loop:{scope:`session`,input:Vt,output:K},startSelfPaced:{scope:`session`,input:x({prompt:It,requestId:zt}),output:Bt},startFixedInterval:{scope:`session`,input:x({prompt:It,requestId:zt,...Lt.fields}),output:Bt},pause:{scope:`session`,input:x({}),output:X},resume:{scope:`session`,input:x({}),output:X},stop:{scope:`session`,input:x({}),output:X}},projection:{schema:Ht}},Gt=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=60?t:`${t.slice(0,59)}…`},Kt=e=>e.state===`failed`?`error`:e.state===`active`?`running`:e.state===`paused`?`muted`:`settled`,qt=e=>new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZoneName:`short`}).format(e),Jt=B(Wt,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{loop:t}=e.value,n=t.state===`active`&&t.nextDueAt!==null;return{chips:t.state!==`active`&&t.state!==`paused`?[]:[{id:`loop`,order:2,row:{id:`loop`,title:`Loop ${t.mode===`self_paced`?`self-paced`:`fixed`}${n?` (waiting)`:``}`,tone:Kt(t)}}],panel:[{id:`loop`,title:`Loop · ${t.state} · ${t.mode===`self_paced`?`self-paced`:`${t.cron?.expression??`fixed`} ${t.cron?.timeZone??``}`}${t.nextDueAt===null?``:` · Next ${qt(t.nextDueAt)}`} · ${Gt(t.prompt)}`,detail:[t.reason,t.prompt].filter(e=>e!==null).join(`
2
2
  `).slice(0,1024),tone:Kt(t)},...t.lastError===null?[]:[{id:`error`,title:t.lastError.slice(0,4096),tone:`error`}]],timeline:{cells:[],omitted:0},waiting:n?{summary:`Waiting until ${qt(t.nextDueAt)}`,cancel:{id:`loop`,label:`stop loop`,input:{action:`stop-ask`}}}:null}}});function Yt(e){return x({nextSequence:F.check(be(0)),omitted:F.check(P(0)),events:M(x({id:D,sequence:F,at:F,commandId:z(D),event:e}))})}new TextEncoder;var Xt=x({explanation:E(D.pipe(T(R(2e3)))),steps:M(x({step:D.pipe(T(O(1)),T(R(500))),status:L([`pending`,`in_progress`,`completed`])})).pipe(T(R(50)))});Xt.pipe(T(fe(e=>e.steps.filter(e=>e.status===`in_progress`).length<=1||`At most one plan step may be in progress`)));function Zt(e){return e.steps.some(e=>e.status!==`completed`)}var Qt=x({plan:Xt,history:Yt(Xt)}),$t=b([x({action:A(`clear`)}),x({})]),en={id:j.make(`botanical-session-plan`),commands:{plan:{scope:`session`,input:$t,output:K}},projection:{schema:Qt}},tn=e=>{let t=e.steps.findIndex(e=>e.status===`in_progress`),n=e.steps.filter(e=>e.status===`completed`).length;return{title:(t<0?e.steps.find(e=>e.status===`pending`):e.steps[t])?.step??`Plan complete`,detail:`${String(t<0?n:t+1)}/${String(e.steps.length)}`}},nn=e=>e.steps.map((e,t)=>({id:String(t),title:e.step,tone:e.status===`completed`?`settled`:e.status===`in_progress`?`running`:`muted`})),rn=B(en,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null||!Zt(e.value.plan)?[]:[{id:`plan`,...tn(e.value.plan),actions:[{id:`plan`,label:`Clear plan`,input:{action:`clear`}}],inspection:{commandId:`plan`,title:`Plan`,rows:nn(e.value.plan)}}],timeline:{cells:[],omitted:0},waiting:null})}),Z=e=>D.check(O(1),R(e),N(/\S/u)),an=x({id:Z(32).check(N(/^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/u)),header:Z(12),question:Z(1e3),options:M(x({label:Z(60),description:Z(300)})).check(O(2),R(4),fe(e=>new Set(e.map(e=>e.label)).size===e.length||`Option labels must be unique`,{representation:{id:`botanical/ask/unique-option-labels`,payload:null}})),multiple:E(I)}),on=M(an).check(O(1),R(4),fe(e=>new Set(e.map(e=>e.id)).size===e.length||`Question ids must be unique`,{representation:{id:`botanical/ask/unique-question-ids`,payload:null}})),sn=x({askId:D,waitingOn:E(ye),escalated:E(de),questions:on,status:L([`live`,`parked`]),createdAt:_e,expiresAt:z(_e)}),cn=x({asks:M(sn).check(R(4))}),ln=Z(256),un=Te(an.fields.id,x({selected:M(Z(60)).check(R(4)),text:E(D.check(R(4e3)))})),dn=x({askId:Z(256),requestId:ln,answers:un}),fn=x({askId:Z(256),requestId:ln,note:E(D.check(R(4e3)))}),pn=L([`answered`,`declined`,`withdrawn`,`expired`,`cancelled`,`undeliverable`]),mn=b([x({result:A(`accepted`),via:L([`in_turn`,`follow_up`]),commandId:E(Z(256))}),x({result:A(`closed`),status:pn}),x({result:A(`not_found`)})]),hn=x({result:A(`refused`),reason:A(`not_sender`)}),gn=b([mn,hn]),_n=x({kind:A(`agent`),agentId:Z(256)}),vn=b([x({result:A(`escalated`),to:A(`agent`),waitingOn:ye}),x({result:A(`escalated`),to:A(`person`)}),x({result:A(`closed`),status:pn}),x({result:A(`not_found`)}),hn]),yn=x({askId:Z(256),note:w(D.check(R(1e3)))}),bn={askId:dn.fields.askId,requestId:ln,index:_e.check(xe(),he({minimum:0,maximum:3})),answers:un},xn=b([x({stage:A(`decision`),...bn,answer:un.value}),x({askId:dn.fields.askId}),x({})]),Sn={id:j.make(`botanical-session-question`),commands:{answerFlow:{scope:`session`,input:xn,output:K},answer:{scope:`session`,input:dn,output:mn},answerAgent:{scope:`session`,input:dn,output:x({result:gn,answeredBy:_n})},escalateAgent:{scope:`session`,input:yn,output:vn},decline:{scope:`session`,input:fn,output:mn},list:{scope:`session`,input:x({}),output:cn}},projection:{schema:cn}},Cn=B(Sn,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null?[]:e.value.asks.map(e=>{let t=e.questions[0],n=`${t?.question??`Question`}${e.questions.length>1?` (+${String(e.questions.length-1)} more)`:``}`,r=t?.options.map(e=>e.label).join(` · `)??``;if(e.escalated!==void 0){let{by:t,reason:i,note:a}=e.escalated;n=`${i===`escalated`?`escalated by ${t.name}`:i===`sender_archived`?`${t.name} archived`:`${t.name} is gone`} · ${n}`,a!==void 0&&(r=`${r}\n${a}`)}return e.waitingOn===void 0?{id:e.askId,title:n,detail:r,tone:`attention`,actions:[{id:`answerFlow`,label:`Answer`,input:{askId:e.askId},awaiting:`question`}]}:{id:e.askId,title:`waiting on ${e.waitingOn.name} · ${n}`,detail:r,tone:`muted`,actions:[{id:`answerFlow`,label:`Answer`,input:{askId:e.askId}}]}}),timeline:{cells:[],omitted:0},waiting:null})}),Q=D.check(O(1),R(256)),wn=L([`escalated`,`sender_archived`,`sender_absent`]),Tn=L([`working`,`waiting_on_agent`,`needs_you`,`idle`,`failed`,`unavailable`]),En=x({agentId:Q,name:Q,sessionId:z(Q),state:Tn,attention:E(D.check(R(200))),waitingOn:E(Q),escalated:E(x({by:Q,reason:wn})),ask:E(x({askId:Q,questions:on}))}),Dn=x({agents:M(En).check(R(16)),more:F.check(P(0)),uncounted:F.check(P(0)),counts:x({working:F.check(P(0)),waiting_on_agent:F.check(P(0)),needs_you:F.check(P(0)),idle:F.check(P(0)),failed:F.check(P(0)),unavailable:F.check(P(0))}),escalated:F.check(P(0)),waitingOn:M(x({name:Q,count:F.check(be(0))})),escalatedBy:M(x({name:Q,reason:wn,count:F.check(be(0))})),expanded:I}),On={agentId:Q,sessionId:Q},kn=b(xn.members.map(e=>x({...e.fields,...On}))),An={agents:{scope:`session`,input:x({}),output:K},answerChild:{scope:`session`,input:kn,output:K}},jn={id:j.make(`botanical-session-subagents`),commands:An,projection:{schema:Dn}};function Mn(e){if(e!==void 0)return e.reason===`escalated`?`escalated by ${e.by}`:e.reason===`sender_archived`?`${e.by} archived`:`${e.by} is gone`}var $={working:{label:`working`,tone:`running`,status:`info`},waiting_on_agent:{label:`waiting`,tone:`muted`,status:`neutral`},needs_you:{label:`needs you`,tone:`attention`,status:`warning`},idle:{label:`idle`,tone:`settled`,status:`success`},failed:{label:`failed`,tone:`error`,status:`error`},unavailable:{label:`unavailable`,tone:`muted`,status:`neutral`}};function Nn(e){let t=e.state===`waiting_on_agent`?`waiting on ${e.waitingOn??`its parent`}`:$[e.state].label,n=Mn(e.escalated);return n===void 0?t:`${t} · ${n}`}function Pn(e){let t=$[e.state],n={id:e.agentId,title:`${e.name} · ${Nn(e)}`,tone:t.tone,status:{label:Nn(e),tone:t.status}},r=e.ask?.questions[0]?.question??e.attention,i=r===void 0?n:{...n,detail:r.slice(0,200)};if(e.sessionId===null)return{...i,detail:e.attention??`not messaged yet`};let a={...i,open:{params:[{key:`agent`,value:e.agentId},{key:`session`,value:e.sessionId}]}};if(e.ask===void 0)return a;let o={id:`answerChild`,label:`Answer`,input:{agentId:e.agentId,sessionId:e.sessionId,askId:e.ask.askId}};return{...a,actions:[e.state===`needs_you`?{...o,awaiting:`question`}:o]}}function Fn(e){let t=t=>e.counts[t],n=e.waitingOn.map(({name:e,count:t})=>`${String(t)} waiting on ${e}`),r=e.escalatedBy.map(({name:n,reason:r,count:i})=>{let a=Mn({by:n,reason:r});return e.escalated===t(`needs_you`)&&e.escalatedBy.length===1?a:`${String(i)} ${a}`}),i=r.length===0?`needs you`:`needs you (${r.join(`; `)})`,a=[...[`working`].map(e=>[e,t(e)]).filter(([,e])=>e>0).map(([e,t])=>`${String(t)} ${$[e].label}`),...n,...[`needs_you`,`failed`,`unavailable`].map(e=>[e,t(e)]).filter(([,e])=>e>0).map(([e,t])=>`${String(t)} ${e===`needs_you`?i:$[e].label}`)],o=t(`working`)+t(`needs_you`),s=t(`needs_you`)>0?`attention`:t(`failed`)>0?`error`:t(`working`)>0?`running`:`muted`;return{id:`summary`,title:[`${String(o)} sub-agent${o===1?``:`s`}`,...a,...e.uncounted>0?[`${String(e.uncounted)} not read`]:[],`/agents shows them`].join(` · `),tone:s}}var In=B(jn,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null?[]:e.value.agents.length>0&&!e.value.expanded?[Fn(e.value)]:[...e.value.agents.map(Pn),...e.value.more===0&&e.value.uncounted===0?[]:[{id:`more`,title:[...e.value.more===0?[]:[`${String(e.value.more)} more sub-agent${e.value.more===1?``:`s`}`],...e.value.uncounted===0?[]:[`${String(e.value.uncounted)} not read`]].join(` · `),tone:`muted`}]],timeline:{cells:[],omitted:0},waiting:null})});function Ln(e,t){if(e===null||!URL.canParse(t))return!1;let n=new URL(t);return n.protocol!==`https:`||n.hash!==`#team-billing`?!1:(e.openTeamBilling().catch(t=>(console.error(`Chat Billing navigation failed`,t),e.showToast({message:`Billing could not be opened. Please try again.`,tone:`error`}))),!0)}function Rn(e,t){e!==null&&e.showToast({message:t.message,tone:t.variant}).catch(e=>{console.error(`Chat toast failed`,e)})}function zn(e){if(e.name!==`execute`||e.status!==`completed`)return;let t=e.result?.content;if(t?.length!==1||t[0]?.type!==`text`)return;let n=ue(C(ve))(t[0].text);if(v(n))return;let r=m.safeParse(n.value);return r.success?r.data.file:void 0}function Bn({item:e,ui:t}){let n=zn(e),[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1);if(!n)return null;let s=async()=>{i(!0),o(!1);try{await t.openNavigation(n)}catch(e){console.error(`Chat file navigation failed`,e),o(!0)}finally{i(!1)}};return(0,U.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,U.jsx)(f,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void s(),type:`button`,children:r?`Opening file…`:`Open ${n.path} in Inkcap`}),a?(0,U.jsx)(`p`,{role:`alert`,children:`The file could not be opened. Try again.`}):null]})}var Vn=b([x({kind:A(`compose`),text:D.pipe(T(O(1)),T(R(2e3)))}),x({kind:A(`navigate`),params:M(x({key:D.pipe(T(O(1)),T(R(64))),value:D.pipe(T(R(1024)))})).pipe(T(R(16)))})]);b([x({role:D.pipe(T(O(1)),T(R(80))),intent:Vn}),x({appId:D.pipe(T(O(1)),T(R(128))),intent:Vn})],{mode:`oneOf`});var Hn=re({displayName:y().min(1).max(80).nullable()}).nullable(),Un=Be(`apps.open`,1,ae(()=>Ie({open:Fe,role:V(Le(Hn))}))),Wn=(e,t)=>e.require(Un).open(t);Be(`apps.call`,1,ae(()=>Ie({call:V(Le(ne().transform(e=>r(e))))})));var Gn=_({printId:y().min(1).max(256),destination:re({computerId:y().min(1),path:y().min(1)}),format:g([`png`,`jpeg`,`gif`,`webp`])}),Kn=ie(),qn=se(Kn).or(le(y(),Kn).transform(e=>Object.values(e)));function Jn(e,t){let n=Gn.safeParse(e);if(n.success)return[n.data];if(t>=3)return[];let r=qn.safeParse(e);return r.success?r.data.flatMap(e=>Jn(e,t+1)):[]}var Yn=Kn.transform(e=>Jn(e,0)).pipe(se(Gn).min(1).max(8));function Xn(e){if(e.name!==`execute`||e.status!==`completed`||e.result===void 0)return;let t=e.result.content,n=t.at(0);if(n?.type!==`text`||t.slice(1).some(e=>e.type!==`image`))return;let r=ue(C(ve))(n.text);if(v(r))return;let i=Yn.safeParse(r.value);return i.success?i.data:void 0}function Zn(e){return Xn(e)!==void 0}function Qn({printId:e,pictures:t,capabilities:n}){let[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1),s=async()=>{i(!0),o(!1);try{await Wn(n,{role:`media`,intent:{kind:`navigate`,params:[{key:`print`,value:e}]}})}catch(e){console.error(`Chat print navigation failed`,e),o(!0)}finally{i(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-3 py-2`,children:[t.map((e,t)=>(0,U.jsx)(`img`,{alt:`Panel saved in Prints`,className:`max-w-full rounded-box`,src:`data:${e.mimeType};base64,${e.data}`,style:{maxHeight:320}},t)),(0,U.jsx)(f,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>void s(),type:`button`,children:r?`Opening Prints…`:`Open in Prints`}),a?(0,U.jsx)(`p`,{role:`alert`,children:`Prints could not be opened. Try again.`}):null]})}function $n({item:e,capabilities:t}){let n=Xn(e);if(n&&t){let r=(e.result?.content??[]).flatMap(e=>e.type===`image`?[e]:[]),i=r.length===n.length;return(0,U.jsx)(U.Fragment,{children:n.map((e,n)=>(0,U.jsx)(Qn,{printId:e.printId,pictures:i?r.slice(n,n+1):n===0?r:[],capabilities:t},e.printId))})}return null}var er=ue(C(lt),{onExcessProperty:`error`});function tr(e){if(!(e.status!==`completed`||e.result?.isError))for(let t of e.result?.content??[]){if(t.type!==`text`)continue;let e=er(t.text);if(ce(e))return e.value.recordId}}var nr=(0,H.createContext)(void 0);function rr(){return(0,H.useContext)(nr)}var ir=`Couldn't send your answer. It may not have been recorded.`;function ar({recordId:e,attempt:t,capabilities:n,agentId:r,publish:i}){let a=Ne(),[o,s]=(0,H.useState)(),c=(0,H.useRef)(void 0),l=(0,H.useRef)(new Set),u=(0,H.useCallback)(t=>{c.current=t??void 0,s(t),i(e,{view:t,failed:!1});for(let e of l.current)e()},[i,e]);(0,H.useEffect)(()=>{c.current=void 0,s(void 0)},[n]),(0,H.useEffect)(()=>{let t=!0;async function r(){try{let r=await n.require(St).get({recordId:e});t&&u(r)}catch(n){console.warn(`Grove could not read the approval`,n),t&&i(e,{view:null,failed:!0})}}return r(),()=>{t=!1}},[n,e,t,u,i]);let d=o?.canAnswer===!0&&o.record.state===`pending`,f=o?.canSetAutoApprove===!0,p=o?.record.module,m=o?.record.access;return tt({source:(0,H.useMemo)(()=>{if(d)return{snapshot:()=>c.current,subscribe:e=>(l.current.add(e),()=>{l.current.delete(e)}),answer:async e=>{let t=n.require(St),r=e.decision===`always-allow`?void 0:{recordId:e.recordId,decision:e.decision,expectedRevision:e.expectedRevision};if(r===void 0)return{kind:`refused`,reason:`not-eligible`};let i=await t.answer(e.denialNote===void 0?r:{...r,denialNote:e.denialNote});return i.kind===`answered`&&u(i.view),i},family:!f||p===void 0||m===void 0?void 0:{label:`Always approve this family`,enable:async()=>(await n.require(St).setAutoApprove({scope:{agentId:r},family:{module:p,access:m},enabled:!0})).kind===`updated`}}},[d,n,r,f,p,m,u]),store:a,enabled:!0,home:``,width:72,noteLimit:512,onFailure:or}),null}function or(e){console.warn(ir,e)}function sr({capabilities:e,agentId:t,children:n}){let r=De(),i=(0,H.useMemo)(()=>{let e=new Set;for(let t of[...r.settled,...r.tail])if(t.kind===`tool_group`)for(let n of t.tools){let t=tr(n);t!==void 0&&e.add(t)}return[...e]},[r.settled,r.tail]),[a,o]=(0,H.useState)(new Map),[s,c]=(0,H.useState)(new Map),l=(0,H.useCallback)((e,t)=>{o(n=>new Map(n).set(e,t))},[]),u=(0,H.useMemo)(()=>({entry:e=>a.get(e),refresh:e=>{c(t=>new Map(t).set(e,(t.get(e)??0)+1))},agentId:t}),[a,t]);return(0,U.jsxs)(nr.Provider,{value:e===void 0?void 0:u,children:[e===void 0?null:i.map(n=>(0,U.jsx)(ar,{recordId:n,attempt:s.get(n)??0,capabilities:e,agentId:t,publish:l},n)),n]})}var cr={requested:`Approval requested.`,pending:`Pending approval.`,approved:`Approved. Waiting to run.`,applied:`Done.`,denied:`Denied.`,expired:`Expired. Nothing ran.`,claimed:`Dispatch in progress.`,outcome_unknown:`Outcome unknown. Check before trying again.`};function lr({view:e,scope:r,onRefresh:a,onAnswer:s}){let{record:c}=e,l=e.canAnswer&&c.state===`pending`;return(0,U.jsxs)(i,{role:`group`,"aria-label":`Approval request`,density:`compact`,children:[(0,U.jsxs)(u,{children:[(0,U.jsxs)(t,{children:[l?`Allow `:``,c.module,` · `,c.operation,l?`?`:``]}),(0,U.jsxs)(`p`,{children:[c.requester.displayName,` wants to use a connected tool.`]})]}),(0,U.jsxs)(n,{className:`min-w-0 space-y-2`,children:[(0,U.jsxs)(`p`,{children:[`Effect`,` `,c.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`,c.reversibility===`irreversible-external`?` · can't be undone`:``]}),(0,U.jsx)(`p`,{role:`status`,children:l?`Waiting for your answer.`:cr[c.state]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`Details`}),(0,U.jsxs)(`p`,{children:[`Requester: `,c.requester.principalId]}),(0,U.jsxs)(`p`,{children:[`Agent: `,c.requester.displayName,` ·`,` `,c.requester.agentId??`none`]}),(0,U.jsxs)(`p`,{children:[`Session: `,c.requester.sessionId??`none`]}),(0,U.jsxs)(`p`,{children:[`Request: `,c.module,`.`,c.operation,` · `,c.access]}),(0,U.jsxs)(`p`,{children:[`Undo:`,` `,c.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}),(0,U.jsxs)(`p`,{children:[`Can answer: `,e.canAnswer?`Yes`:`No`]}),(0,U.jsxs)(`p`,{children:[`Can set auto-approve: `,e.canSetAutoApprove?`Yes`:`No`]}),c.by?.kind===`policy`?(0,U.jsx)(`p`,{children:`Auto-approved by policy`}):null,(0,U.jsx)(`p`,{children:c.description.title}),(0,U.jsxs)(`p`,{className:`break-all`,children:[`Input: `,c.description.inputBytes,` bytes · SHA-256`,` `,c.description.inputSha256]}),(0,U.jsxs)(`p`,{children:[`Record: `,c.recordId,` · revision `,c.revision]}),e.canSetAutoApprove?(0,U.jsxs)(`p`,{children:[`Policy scope:`,` `,r.agentId===null?`whole home`:`agent ${r.agentId}`]}):null]})]}),(0,U.jsxs)(o,{className:`flex flex-wrap gap-2`,children:[l?(0,U.jsx)(f,{variant:`outline`,onClick:s,children:`Answer`}):null,(0,U.jsx)(f,{variant:`ghost`,onClick:a,children:`Refresh approval`})]})]})}function ur({recordId:e}){let t=rr(),n=Ne(),r=t?.entry(e);return t===void 0||r===void 0?null:r.failed?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{role:`alert`,children:`Couldn't load this approval. Try again.`}),(0,U.jsx)(f,{variant:`ghost`,onClick:()=>{t.refresh(e)},children:`Refresh approval`})]}):r.view===null||r.view.record.state===`expired`?null:(0,U.jsx)(lr,{view:r.view,scope:{agentId:t.agentId},onRefresh:()=>{t.refresh(e)},onAnswer:()=>{n.awaiting.focus()}})}var dr=(0,H.forwardRef)(function({heading:e,eyebrow:t,cover:r,action:s,children:c,className:l,...d},p){return(0,U.jsxs)(i,{...d,className:a(`caps-game-share`,l),ref:p,children:[r?(0,U.jsx)(`div`,{className:`caps-game-share-cover`,children:r}):null,(0,U.jsxs)(u,{children:[t,(0,U.jsx)(`h3`,{className:`caps-game-share-heading`,children:e})]}),(0,U.jsx)(n,{className:`gap-sm`,children:c}),(0,U.jsx)(o,{children:(0,U.jsx)(f,{asChild:!0,variant:`primary`,className:`caps-game-share-action`,children:s})})]})});function fr(e){let t=0;return e.map(e=>{let n={...e,offset:t};return t+=e.text.length,n})}function pr({value:e,label:t,fieldLabel:n,displayValue:r,layout:i,title:o,tokens:l,className:u,...d}){let m=(0,H.useId)(),[h,ne]=(0,H.useState)({kind:`ready`}),g=l?l.map(e=>e.text).join(``):e,_=async()=>{ne(await navigator.clipboard.writeText(g).then(()=>({kind:`copied`}),e=>({kind:`failed`,cause:e})))};if(n!==void 0)return(0,U.jsxs)(`div`,{...d,className:a(`caps-copy-field-input`,u),children:[(0,U.jsx)(ee,{htmlFor:m,children:n}),(0,U.jsxs)(c,{children:[(0,U.jsx)(p,{className:`caps-copy-field-control`,"aria-label":n,id:m,onFocus:e=>{e.currentTarget.select()},readOnly:!0,value:r??g}),(0,U.jsx)(f,{onClick:()=>void _(),size:`sm`,variant:`outline`,children:h.kind===`copied`?`Copied`:t??`Copy`})]}),h.kind===`failed`?(0,U.jsx)(`span`,{role:`status`,children:`Could not copy. Select the text to copy it.`}):null]});let v=h.kind===`copied`?`Copied`:h.kind===`failed`?`Copy failed`:t??`Copy`;return i===`block`?(0,U.jsxs)(`figure`,{...d,className:a(`caps-copy-field-block`,u),"data-state":h.kind,children:[(0,U.jsxs)(`figcaption`,{className:`caps-copy-field-header`,children:[(0,U.jsx)(`span`,{className:`caps-copy-field-title`,children:o}),(0,U.jsxs)(f,{onClick:()=>void _(),size:`sm`,variant:h.kind===`copied`?`ghost`:`outline`,children:[h.kind===`copied`?(0,U.jsx)(te,{"aria-hidden":`true`,size:15}):(0,U.jsx)(Oe,{"aria-hidden":`true`,size:15}),v]}),(0,U.jsx)(s,{role:`status`,children:h.kind===`copied`?`Copied to the clipboard`:h.kind===`failed`?`Could not copy. Select the code to copy it.`:``})]}),(0,U.jsx)(`pre`,{className:`caps-copy-field-code`,tabIndex:0,children:(0,U.jsx)(`code`,{children:l?fr(l).map(e=>(0,U.jsx)(`span`,{className:`caps-copy-field-token`,"data-kind":e.kind,children:e.text},e.offset)):g})})]}):(0,U.jsxs)(`div`,{...d,className:a(`caps-copy-field`,u),children:[(0,U.jsx)(`code`,{className:`caps-copy-field-value`,children:g}),(0,U.jsxs)(f,{"aria-label":`${v}: ${g}`,onClick:()=>void _(),size:`sm`,variant:`outline`,children:[h.kind===`copied`?(0,U.jsx)(te,{size:15}):(0,U.jsx)(Oe,{size:15}),v]})]})}var mr=_({game:_({title:y().min(1),summary:y(),coverUrl:h().nullable(),shareUrl:h()})});function hr(e){let t=/(?:^|\n)\s*Share:\s*(https?:\/\/[^\s<>]+)/iu.exec(e);if(!t?.[1])return null;let n=t[1].replace(/[.,;!?]+$/u,``);if(!URL.canParse(n))return null;let r=new URL(n);return r.username||r.password||r.hash||r.protocol===`http:`&&![`localhost`,`127.0.0.1`].includes(r.hostname)?null:r.href}function gr(e){return hr(e)?e.split(`
3
3
  `).filter(e=>!/^\s*Share:\s*/iu.test(e)).join(`
4
4
  `).trim():e}function _r(e){let t=new URL(e),n=/^\/([a-z0-9]+(?:-[a-z0-9]+)*)\/?$/u.exec(t.pathname)?.[1];return!n||t.search?null:new URL(`/api/games/${n}`,t.origin)}function vr({reply:e,previewGame:t}){let n=hr(e),r=n?_r(n):null,{data:i}=Ve({queryKey:Re.of(null,`game-share`,n),enabled:r!==null&&t===void 0,queryFn:async({signal:e})=>{if(!r)return null;let t=await fetch(r,{signal:e});if(!t.ok)return null;let i=mr.safeParse(await t.json());return i.success&&i.data.game.shareUrl===n?i.data.game:null}}),a=t??i;if(!n)return null;let o=new URL(n),s=`${o.host}${o.pathname.replace(/\/$/u,``)}`,c=a?.coverUrl&&r?t?a.coverUrl:new URL(`${r.pathname}/cover`,r.origin).href:null;return(0,U.jsxs)(dr,{"data-game-share-card":`true`,"data-theme":`vishnu`,heading:a?.title??`Your game is ready`,eyebrow:(0,U.jsx)(Me,{tone:`secondary`,variant:`quiet`,children:`Made with your Agent`}),cover:c?(0,U.jsx)(`img`,{alt:`A scene from ${a?.title??`your game`}`,src:c}):null,action:(0,U.jsx)(`a`,{href:n,rel:`noopener noreferrer`,target:`_blank`,children:`Play ↗`}),children:[a?.summary?(0,U.jsx)(`p`,{className:`text-sm`,children:a.summary}):null,(0,U.jsx)(pr,{displayValue:s,fieldLabel:`Share link`,label:`Copy link`,value:n})]})}var yr=[Pt,Jt,rn,Cn,In],br=e=>(0,U.jsx)(vr,{reply:e});function xr({prefill:e,onPrefilled:t}){let n=je(),r=(0,H.useRef)(null);return(0,H.useEffect)(()=>{!e||r.current===e.requestId||(r.current=e.requestId,n.setDraft(e.text),e.send===!0&&n.send(),t())},[n.setDraft,n.send,t,e]),null}function Sr({session:e,draftIdentity:t,connection:n,commands:r,prefill:i=null,onPrefilled:a=()=>void 0,onOpen:o,models:s,autoFocus:c}){let l=n?.ui??null,u=n?.capabilities,d=(0,H.useMemo)(()=>({modelSetup:s===void 0?void 0:{state:s,fix:{label:`Add a model key`,onSelect:()=>{l?.openSetup(`model`).catch(e=>{console.error(`Grove could not open model setup`,e)})}}},starters:ze}),[s,l]),f=(0,H.useCallback)(e=>Ln(l,e),[l]),p=(0,H.useCallback)(e=>{let t=tr(e);return t!==void 0&&u!==void 0?(0,U.jsx)(ur,{recordId:t},t):l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Bn,{item:e,ui:l}),(0,U.jsx)($n,{item:e,capabilities:u})]}):null},[l,u]),m=(0,H.useCallback)(e=>u!==void 0&&Zn(e),[u]),ee=(0,H.useCallback)(e=>{Rn(l,e)},[l]);return(0,U.jsxs)(Ee,{session:e,draftIdentity:t,clients:yr,authorOf:Ce,onToast:ee,children:[(0,U.jsx)(xr,{prefill:i,onPrefilled:a}),(0,U.jsx)(sr,{capabilities:u,agentId:t.agentId,children:(0,U.jsx)(Ae,{onLink:f,onOpen:o,hostFacts:d,autoFocus:c,composerActionVariant:`outline`,commands:r,renderAssistantAttachment:br,formatAssistantText:gr,renderToolActions:p,claimsToolMedia:m})})]})}export{Sr as ParakeetConversation};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Ct as n,D as r,F as i,G as a,I as o,J as s,K as c,N as l,O as u,P as d,Qr as f,R as p,St as m,V as h,Y as g,Z as _,Zi as v,_ as ee,_a as y,_t as te,a as b,ar as ne,ba as x,bt as re,c as ie,ct as ae,d as oe,da as se,dr as S,dt as ce,et as le,f as C,fa as w,ft as T,g as E,ga as ue,gt as D,h as O,ht as k,i as de,ir as fe,j as A,lt as pe,m as j,mr as me,mt as M,n as he,nr as ge,o as N,ot as _e,p as ve,pa as ye,pr as P,pt as F,qn as be,r as xe,ra as Se,rr as Ce,s as I,sr as we,st as Te,t as Ee,tr as De,tt as Oe,vt as ke,w as Ae,wa as je,wt as L,xa as R,xi as Me,xt as z,y as B}from"./Effect-CsknxyoC.js";import{$ as Ne,$n as Pe,$t as Fe,A as Ie,Ai as Le,An as Re,Ao as ze,Ar as Be,At as Ve,B as He,Ba as Ue,Bn as We,Br as Ge,Bt as Ke,C as qe,Ci as V,Cn as Je,Cr as H,Ct as Ye,D as Xe,Dn as Ze,Do as Qe,Dt as $e,E as et,Ei as tt,En as nt,Eo as rt,Et as it,F as at,Fo as ot,Fr as st,Ft as ct,G as lt,Gi as ut,Gn as dt,Gr as ft,Gt as pt,H as mt,Hi as ht,Hn as gt,Hr as _t,Ht as vt,I as yt,Ia as bt,Ii as xt,In as St,Io as Ct,It as wt,J as Tt,Ja as Et,Ji as Dt,Jn as Ot,Jt as kt,K as At,Kn as jt,Kr as Mt,Kt as Nt,L as Pt,La as U,Li as Ft,Ln as It,Lr as Lt,Lt as Rt,M as zt,Ma as Bt,Mn as Vt,Mo as Ht,Mt as Ut,N as Wt,Na as Gt,Ni as W,Nn as Kt,No as qt,Nt as Jt,O as Yt,On as Xt,Or as Zt,Ot as Qt,P as $t,Pa as G,Pn as en,Po as tn,Pr as nn,Pt as rn,Q as an,Qn as on,Qt as sn,R as cn,Ra as ln,Rn as un,Ro as dn,Rt as fn,S as pn,Si as mn,Sn as hn,Sr as gn,St as _n,T as vn,Ta as yn,Tn as bn,To as xn,Tr as Sn,Tt as Cn,U as wn,Ui as Tn,Un as En,Ut as Dn,V as On,Vi as K,Vn as kn,Vr as An,Vt as jn,W as Mn,Wi as Nn,Wn as Pn,Wt as Fn,X as In,Xn as Ln,Xr as Rn,Xt as zn,Y as Bn,Yn as Vn,Yt as Hn,Z as Un,Zn as Wn,Zt as Gn,_ as Kn,_a as qn,_i as Jn,_n as Yn,_o as Xn,_r as Zn,_t as Qn,a as $n,ai as er,an as tr,at as nr,b as rr,bi as ir,bn as ar,br as or,bt as sr,c as cr,ci as lr,cn as ur,co as dr,ct as fr,di as pr,dn as mr,do as hr,dr as gr,dt as _r,ei as vr,en as yr,er as br,et as xr,fi as Sr,fn as Cr,fo as wr,ft as Tr,g as Er,gi as Dr,gn as Or,go as kr,gr as Ar,gt as jr,h as Mr,hn as Nr,ho as Pr,hr as Fr,ht as Ir,i as Lr,ii as Rr,in as zr,ir as Br,it as Vr,j as Hr,ji as Ur,jn as Wr,jo as Gr,jr as Kr,jt as qr,k as Jr,ka as Yr,ki as Xr,kn as Zr,ko as Qr,kt as $r,la as ei,li as ti,ln as ni,lo as ri,lt as ii,mn as ai,mo as oi,mt as si,n as ci,ni as li,nn as ui,nr as di,nt as fi,o as pi,oa as mi,oi as hi,on as q,ot as gi,pi as _i,pn as vi,po as yi,pt as bi,q as xi,qi as Si,qn as Ci,qr as wi,qt as Ti,r as Ei,ri as Di,rn as Oi,rr as ki,rt as Ai,s as ji,sn as Mi,so as Ni,sr as Pi,st as Fi,t as Ii,ti as Li,tn as Ri,tr as zi,tt as Bi,ui as Vi,un as Hi,ur as Ui,ut as Wi,v as Gi,vn as Ki,vr as qi,vt as Ji,w as Yi,wi as Xi,wn as Zi,wo as Qi,wt as $i,x as ea,xa as ta,xi as na,xn as ra,xr as ia,xt as aa,y as oa,yn as sa,yr as J,yt as ca,z as la,zn as ua,zr as da,zt as fa}from"./extension-hook-B-ufQ44r.js";import{l as pa,m as ma,p as ha}from"./preload-helper-DY31Aviq.js";import{a as ga,c as _a,d as va,f as ya,i as ba,l as xa,o as Sa,s as Ca,u as wa}from"./index-CVzMdSlI.js";var Ta=bt(()=>Xa),Ea=Rr(Ta),Da=V({id:Jn,payload:Vi}),Oa=V({...Da.fields,schemas:Gt(Ea)});function ka(e){let t={};for(let[n,r]of Object.entries(e))Et(r)&&f(t,n,r);return Object.keys(t).length===0?S():P(t)}var Aa=Gt(na(mn,Ur)).pipe(ut(G(pr),{decode:Ni(),encode:ri(e=>ne(e)||e.value===void 0?S():ka(e.value))})),ja=bt(()=>Pa),Ma=Rr(ja),Na={annotations:Aa,checks:Ma},Pa=Le([V({_tag:U(`Filter`),representation:Oa,annotations:Aa,aborted:hi}),V({_tag:U(`FilterGroup`),representation:Gt(Oa),annotations:Aa,checks:Dr(ja)})]);function Y(e){return V({_tag:U(e),...Na})}var Fa=V({_tag:U(`Declaration`),representation:Da,annotations:Aa,typeParameters:Ea,checks:Ma}),Ia=V({_tag:U(`Suspend`),annotations:Aa,checks:tt([]),thunk:Ta});function La(e,t){return t.pipe(ut(V({type:U(e),value:t}),{decode:dr(e=>e.value),encode:dr(t=>({type:e,value:t}))}))}var Ra=La(`string`,mn),za=La(`number`,ir),Ba=V({_tag:U(`Literal`),...Na,literal:Le([Ra,La(`number`,lr),La(`bigint`,er),La(`boolean`,hi)])}),Va=V({_tag:U(`UniqueSymbol`),...Na,symbol:Xi}),Ha=V({_tag:U(`Enum`),...Na,enums:Rr(tt([mn,Le([Ra,za])]))}),Ua=V({_tag:U(`TemplateLiteral`),...Na,parts:Ea}),Wa=V({isOptional:hi,type:Ta,annotations:Aa}),Ga=V({_tag:U(`Arrays`),...Na,elements:Rr(Wa),rest:Ea}),Ka=V({name:Le([Ra,za,La(`symbol`,Xi)]),type:Ta,isOptional:hi,isMutable:hi,annotations:Aa}),qa=V({parameter:Ta,type:Ta}),Ja=V({_tag:U(`Objects`),...Na,propertySignatures:Rr(Ka),indexSignatures:Rr(qa)}),Ya=V({_tag:U(`Union`),...Na,types:Ea,options:G(V({mode:G(_i([`anyOf`,`oneOf`]))}))}),Xa=Le([Fa,V({_tag:U(`Reference`),$ref:Jn}),Ia,Y(`Null`),Y(`Undefined`),Y(`Void`),Y(`Never`),Y(`Unknown`),Y(`Any`),Y(`String`),Y(`Number`),Y(`Boolean`),Y(`BigInt`),Y(`Symbol`),Y(`ObjectKeyword`),Ba,Va,Ha,Ua,Ga,Ja,Ya]),Za=Nn(ln(V({representation:Ta,references:na(mn,Ta)})));function Qa(e){return Za(e)}function $a(e){return e.sql.exec(`CREATE TABLE IF NOT EXISTS shiitake_fleet_delegations (
1
+ import{n as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Ct as n,D as r,F as i,G as a,I as o,J as s,K as c,N as l,O as u,P as d,Qr as f,R as p,St as m,V as h,Y as g,Z as _,Zi as v,_ as ee,_a as y,_t as te,a as b,ar as ne,ba as x,bt as re,c as ie,ct as ae,d as oe,da as se,dr as S,dt as ce,et as le,f as C,fa as w,ft as T,g as E,ga as ue,gt as D,h as O,ht as k,i as de,ir as fe,j as A,lt as pe,m as j,mr as me,mt as M,n as he,nr as ge,o as N,ot as _e,p as ve,pa as ye,pr as P,pt as F,qn as be,r as xe,ra as Se,rr as Ce,s as I,sr as we,st as Te,t as Ee,tr as De,tt as Oe,vt as ke,w as Ae,wa as je,wt as L,xa as R,xi as Me,xt as z,y as B}from"./Effect-CsknxyoC.js";import{$ as Ne,$n as Pe,$t as Fe,A as Ie,Ai as Le,An as Re,Ao as ze,Ar as Be,At as Ve,B as He,Ba as Ue,Bn as We,Br as Ge,Bt as Ke,C as qe,Ci as V,Cn as Je,Cr as H,Ct as Ye,D as Xe,Dn as Ze,Do as Qe,Dt as $e,E as et,Ei as tt,En as nt,Eo as rt,Et as it,F as at,Fo as ot,Fr as st,Ft as ct,G as lt,Gi as ut,Gn as dt,Gr as ft,Gt as pt,H as mt,Hi as ht,Hn as gt,Hr as _t,Ht as vt,I as yt,Ia as bt,Ii as xt,In as St,Io as Ct,It as wt,J as Tt,Ja as Et,Ji as Dt,Jn as Ot,Jt as kt,K as At,Kn as jt,Kr as Mt,Kt as Nt,L as Pt,La as U,Li as Ft,Ln as It,Lr as Lt,Lt as Rt,M as zt,Ma as Bt,Mn as Vt,Mo as Ht,Mt as Ut,N as Wt,Na as Gt,Ni as W,Nn as Kt,No as qt,Nt as Jt,O as Yt,On as Xt,Or as Zt,Ot as Qt,P as $t,Pa as G,Pn as en,Po as tn,Pr as nn,Pt as rn,Q as an,Qn as on,Qt as sn,R as cn,Ra as ln,Rn as un,Ro as dn,Rt as fn,S as pn,Si as mn,Sn as hn,Sr as gn,St as _n,T as vn,Ta as yn,Tn as bn,To as xn,Tr as Sn,Tt as Cn,U as wn,Ui as Tn,Un as En,Ut as Dn,V as On,Vi as K,Vn as kn,Vr as An,Vt as jn,W as Mn,Wi as Nn,Wn as Pn,Wt as Fn,X as In,Xn as Ln,Xr as Rn,Xt as zn,Y as Bn,Yn as Vn,Yt as Hn,Z as Un,Zn as Wn,Zt as Gn,_ as Kn,_a as qn,_i as Jn,_n as Yn,_o as Xn,_r as Zn,_t as Qn,a as $n,ai as er,an as tr,at as nr,b as rr,bi as ir,bn as ar,br as or,bt as sr,c as cr,ci as lr,cn as ur,co as dr,ct as fr,di as pr,dn as mr,do as hr,dr as gr,dt as _r,ei as vr,en as yr,er as br,et as xr,fi as Sr,fn as Cr,fo as wr,ft as Tr,g as Er,gi as Dr,gn as Or,go as kr,gr as Ar,gt as jr,h as Mr,hn as Nr,ho as Pr,hr as Fr,ht as Ir,i as Lr,ii as Rr,in as zr,ir as Br,it as Vr,j as Hr,ji as Ur,jn as Wr,jo as Gr,jr as Kr,jt as qr,k as Jr,ka as Yr,ki as Xr,kn as Zr,ko as Qr,kt as $r,la as ei,li as ti,ln as ni,lo as ri,lt as ii,mn as ai,mo as oi,mt as si,n as ci,ni as li,nn as ui,nr as di,nt as fi,o as pi,oa as mi,oi as hi,on as q,ot as gi,pi as _i,pn as vi,po as yi,pt as bi,q as xi,qi as Si,qn as Ci,qr as wi,qt as Ti,r as Ei,ri as Di,rn as Oi,rr as ki,rt as Ai,s as ji,sn as Mi,so as Ni,sr as Pi,st as Fi,t as Ii,ti as Li,tn as Ri,tr as zi,tt as Bi,ui as Vi,un as Hi,ur as Ui,ut as Wi,v as Gi,vn as Ki,vr as qi,vt as Ji,w as Yi,wi as Xi,wn as Zi,wo as Qi,wt as $i,x as ea,xa as ta,xi as na,xn as ra,xr as ia,xt as aa,y as oa,yn as sa,yr as J,yt as ca,z as la,zn as ua,zr as da,zt as fa}from"./extension-hook-TXWlsyri.js";import{l as pa,m as ma,p as ha}from"./preload-helper-DY31Aviq.js";import{a as ga,c as _a,d as va,f as ya,i as ba,l as xa,o as Sa,s as Ca,u as wa}from"./index-D1_UIO2Y.js";var Ta=bt(()=>Xa),Ea=Rr(Ta),Da=V({id:Jn,payload:Vi}),Oa=V({...Da.fields,schemas:Gt(Ea)});function ka(e){let t={};for(let[n,r]of Object.entries(e))Et(r)&&f(t,n,r);return Object.keys(t).length===0?S():P(t)}var Aa=Gt(na(mn,Ur)).pipe(ut(G(pr),{decode:Ni(),encode:ri(e=>ne(e)||e.value===void 0?S():ka(e.value))})),ja=bt(()=>Pa),Ma=Rr(ja),Na={annotations:Aa,checks:Ma},Pa=Le([V({_tag:U(`Filter`),representation:Oa,annotations:Aa,aborted:hi}),V({_tag:U(`FilterGroup`),representation:Gt(Oa),annotations:Aa,checks:Dr(ja)})]);function Y(e){return V({_tag:U(e),...Na})}var Fa=V({_tag:U(`Declaration`),representation:Da,annotations:Aa,typeParameters:Ea,checks:Ma}),Ia=V({_tag:U(`Suspend`),annotations:Aa,checks:tt([]),thunk:Ta});function La(e,t){return t.pipe(ut(V({type:U(e),value:t}),{decode:dr(e=>e.value),encode:dr(t=>({type:e,value:t}))}))}var Ra=La(`string`,mn),za=La(`number`,ir),Ba=V({_tag:U(`Literal`),...Na,literal:Le([Ra,La(`number`,lr),La(`bigint`,er),La(`boolean`,hi)])}),Va=V({_tag:U(`UniqueSymbol`),...Na,symbol:Xi}),Ha=V({_tag:U(`Enum`),...Na,enums:Rr(tt([mn,Le([Ra,za])]))}),Ua=V({_tag:U(`TemplateLiteral`),...Na,parts:Ea}),Wa=V({isOptional:hi,type:Ta,annotations:Aa}),Ga=V({_tag:U(`Arrays`),...Na,elements:Rr(Wa),rest:Ea}),Ka=V({name:Le([Ra,za,La(`symbol`,Xi)]),type:Ta,isOptional:hi,isMutable:hi,annotations:Aa}),qa=V({parameter:Ta,type:Ta}),Ja=V({_tag:U(`Objects`),...Na,propertySignatures:Rr(Ka),indexSignatures:Rr(qa)}),Ya=V({_tag:U(`Union`),...Na,types:Ea,options:G(V({mode:G(_i([`anyOf`,`oneOf`]))}))}),Xa=Le([Fa,V({_tag:U(`Reference`),$ref:Jn}),Ia,Y(`Null`),Y(`Undefined`),Y(`Void`),Y(`Never`),Y(`Unknown`),Y(`Any`),Y(`String`),Y(`Number`),Y(`Boolean`),Y(`BigInt`),Y(`Symbol`),Y(`ObjectKeyword`),Ba,Va,Ha,Ua,Ga,Ja,Ya]),Za=Nn(ln(V({representation:Ta,references:na(mn,Ta)})));function Qa(e){return Za(e)}function $a(e){return e.sql.exec(`CREATE TABLE IF NOT EXISTS shiitake_fleet_delegations (
2
2
  request_id TEXT PRIMARY KEY, input TEXT NOT NULL, mail TEXT NOT NULL,
3
3
  receipt TEXT
4
4
  ) STRICT`),e.sql.exec(`CREATE TABLE IF NOT EXISTS shiitake_fleet_held_delegations (
@@ -1,4 +1,4 @@
1
- import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$a as n,Ba as r,Ea as i,Ga as a,Ha as o,Ia as s,Ja as c,Ka as l,La as u,Ma as d,Pa as f,Qa as p,Ra as m,Ua as h,Va as g,Wa as _,Xa as v,Ya as y,Zi as b,_a as x,ba as S,ca as C,da as w,fa as T,ga as E,ia as D,ja as O,la as k,ma as A,no as j,oa as M,pa as N,qa as P,ra as F,to as I,wa as L,xa as R,ya as ee,za as te}from"./Effect-CsknxyoC.js";import{Ai as ne,Ci as z,Ei as re,Fn as ie,Hi as B,Ir as ae,Ma as oe,Mr as se,Na as V,Ni as ce,Rr as le,Si as ue,Ta as de,Ur as fe,Wr as pe,do as me,fi as he,ii as ge,l as _e,oi as ve,pi as ye,xa as be,xi as xe}from"./extension-hook-B-ufQ44r.js";import{A as Se,D as Ce,F as we,I as Te,M as Ee,N as De,R as Oe,b as ke,d as Ae,f as je,g as Me,h as Ne,j as Pe,n as Fe,p as Ie,v as Le,y as Re,z as ze}from"./animation-Ca8A_H2p.js";var Be=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},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function L(){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=I,e.act=L,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=L,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`})),Ve=t(((e,t)=>{t.exports=Be()})),He=w(),Ue=T(()=>C(`status`,[x({status:N(`available`)}).strict(),x({status:N(`unavailable`),reason:R()}).strict()])),We=He,Ge=T(()=>ee(R(),We)),Ke=e=>We.parse(e),qe=e=>Ge.parse(e),Je=T(()=>x({code:R().min(1).max(160),message:R().min(1).max(512),details:We.optional()}).strict()),Ye=e=>Je.parse(e),Xe=Ge,Ze=T(()=>R().refine(e=>e.trim().length>0)),Qe=Ue,$e=T(()=>L([x({type:N(`action`)}).strict(),x({type:N(`custom`),data:Ge}).strict(),x({type:N(`choice`),options:F(x({value:We,label:Ze,description:Ze.optional()}))}).strict(),x({type:N(`form`),submitLabel:Ze.optional()}).strict(),x({type:N(`confirmation`),message:Ze,confirmLabel:Ze.optional(),cancelLabel:Ze.optional()}).strict()])),et=T(()=>x({inputSchema:Xe.optional(),outputSchema:Xe.optional(),presentation:$e.optional()}).strict()),tt=T(()=>E().int().refine(e=>Number.isSafeInteger(e))),nt=T(()=>x({hint:Ze.pipe(R().max(120)),words:F(x({word:R().regex(/^\S{1,64}$/u),description:Ze.pipe(R().max(512)).optional(),arguments:Ge}).strict()).max(32).optional(),text:x({field:Ze.pipe(R().max(120)),arguments:Ge,requestIdField:Ze.pipe(R().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),rt=T(()=>x({order:tt.optional()}).strict()),it=T(()=>x({bindings:x({order:tt.optional(),values:F(Ze).max(16)}).strict().optional(),agent:x({keybind:Ze.optional(),order:tt.optional()}).strict().optional(),help:rt.optional(),menu:rt.optional(),palette:rt.optional(),slash:x({aliases:F(Ze).max(16),consumesDraft:M().optional(),order:tt.optional(),arguments:nt.optional()}).strict().optional()}).strict()),at=T(()=>x({id:Ze.refine(e=>!e.includes(`:`)),title:Ze,category:Ze,description:Ze.optional(),projections:it.optional(),action:et.optional(),availability:Qe.optional()}).strict()),ot=e=>at.parse(e),st=T(()=>x({inputSchema:Xe.optional(),outputSchema:Xe.optional()}).strict()),ct=R().min(1).brand(),lt=T(()=>x({commandId:ct,command:x({namespace:R(),id:R()}).strict(),sourceId:R(),scope:R().optional(),title:R(),category:R(),description:R().optional(),order:E(),availability:Ue,action:st.optional(),keybind:R().optional()}).strict());F(lt);var ut=8192,H=Ze.pipe(R().max(ut)),dt=Ze.pipe(R().max(60)),ft=i({protocol:/^https?$/u}),pt=x({label:H,value:H}).strict(),mt={summary:H.optional(),facts:F(pt).max(4).optional(),body:H.optional(),bodyLabel:H.optional(),details:F(pt).max(24).optional()},ht=C(`type`,[x({type:N(`choice`),message:dt,...mt,current:H.optional(),collapsedGroup:H.optional(),options:F(x({value:H,label:H,description:H.optional(),group:H.optional(),destructive:N(!0).optional()}).strict()).min(1).max(256)}).strict(),x({type:N(`text`),message:dt,...mt,placeholder:H.optional(),secret:M().optional()}).strict(),x({type:N(`confirmation`),message:dt,...mt,confirmLabel:H.optional(),cancelLabel:H.optional(),destructive:N(!0).optional()}).strict(),x({type:N(`decision`),message:dt,...mt,options:F(x({value:H,label:H,description:H.optional(),destructive:N(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(e=>e.value)).size===e.length,`Decision option values must be unique`),multiple:M().optional(),other:x({label:H,placeholder:H.optional(),maxLength:E().int().min(1).max(ut),blank:H.optional()}).strict().optional(),escape:H.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(e=>e.value===t)),`A decision's escape and blank answers must be offered options`)]),gt=T(()=>C(`type`,[x({type:N(`info`),message:H,links:F(x({url:ft,label:H.optional()}).strict()).max(16).optional()}).strict(),x({type:N(`progress`),message:H}).strict(),x({type:N(`handoff`),url:ft,code:H.optional(),message:H.optional()}).strict(),x({type:N(`success`),message:H}).strict()])),_t=e=>ht.parse(e),vt=e=>gt.parse(e),yt={decision:e=>{let t=ht.options[3].parse(e),n=new Set(t.options.map(e=>e.value));return x({selected:F(R()).max(t.options.length),text:k(Ze.pipe(R().max(t.other?.maxLength??1)))}).strict().superRefine((e,r)=>{let i=e=>{r.addIssue({code:`custom`,message:e})};(e.selected.some(e=>!n.has(e))||new Set(e.selected).size!==e.selected.length)&&i(`Pick each offered option at most once`),t.multiple!==!0&&e.selected.length>1&&i(`Pick one option`),e.selected.length===0&&e.text===void 0&&i(`Pick an option or write an answer`),t.other===void 0&&e.text!==void 0&&i(`This decision takes no written answer`),t.multiple!==!0&&e.selected.length>0&&e.text!==void 0&&i(`Pick an option or write an answer, not both`)})},confirmation:e=>(ht.options[2].parse(e),M()),text:e=>(ht.options[1].parse(e),R().max(ut)),choice:e=>{let t=ht.options[0].parse(e);return R().refine(e=>t.options.some(t=>t.value===e))}};function bt(e){let t=yt[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}var xt=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},St=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Ct(){let e=!1,t=tn,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=tn,s(),o.clear())},contribute:t=>{if(Mt(t),e)throw new St;Nt(t,n),Pt(t,n);let r=Symbol(`whistle-contribution`);jt(t)||(n=[...n,{contribution:Ft(t),generation:r}],i=!0,s());let a=!0;return $t(o=>{if(!a||e)return;let c={...t,commands:o};Mt(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Nt(c,u),Pt(c,u);let d=Ft(c);if(jt(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(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=At(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=rn(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&wt.has(r.origin)&&(o=n({commandId:kt(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=on(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.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 tn;let a=n.flatMap(e=>e.contribution.commands.map(rn));return(i||a.some((e,t)=>!an(e,r[t])))&&(t=sn(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var wt=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Tt=16,Et=32,Dt=64,Ot=256;function kt(e,t){return ct.parse(`${e}:${t}`)}function At(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function jt(e){return e.commands.length===0}function Mt(e){Zt(e.sourceId,`source ID`),Zt(e.namespace,`namespace`),e.scope!==void 0&&Zt(e.scope,`scope`);for(let t of e.commands)Kt(t)}function Nt(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&en(`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(kt(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=kt(e.namespace,t.id);n.has(i)&&en(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&en(`Slash alias is already registered`),r.add(e)}}function Pt(e,t){t.length>=Dt&&en(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>Ot&&en(`Live command capacity exceeded`)}function Ft(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(It)};return e.scope===void 0?t:{...t,scope:e.scope}}function It(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=Lt(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Bt(e.projections)),t}function Lt(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=U(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=U(e.outputSchema)),e.presentation!==void 0&&(t.presentation=zt(e.presentation)),Object.freeze(t)}function U(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Rt(t)])))}function Rt(e){return Array.isArray(e)?Object.freeze(e.map(Rt)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Rt(t)]))):e}function zt(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:U(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:Rt(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Bt(e){let t={};return e.bindings!==void 0&&(t.bindings=Vt(e.bindings)),e.agent!==void 0&&(t.agent=Ht(e.agent)),e.help!==void 0&&(t.help=Ut(e.help.order)),e.menu!==void 0&&(t.menu=Ut(e.menu.order)),e.palette!==void 0&&(t.palette=Ut(e.palette.order)),e.slash!==void 0&&(t.slash=Wt(e.slash)),t}function Vt(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Ht(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Ut(e){let t={};return e!==void 0&&(t.order=e),t}function Wt(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=Gt(e.arguments)),t}function Gt(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:U(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:U(e.text.arguments)})),Object.freeze(t)}function Kt(e){Zt(e.id,`command ID`,!0),Zt(e.title,`title`),Zt(e.category,`category`),qt(e.action),Jt(e.projections)}function qt(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Zt(t.label,`choice label`),t.description!==void 0&&Zt(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Zt(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Zt(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Zt(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Zt(e.presentation.cancelLabel,`cancellation label`)}}function Jt(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&Qt(t.order);if(e.bindings!==void 0&&Xt(e.bindings.values,`binding`),e.slash!==void 0){Xt(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&en(`slash alias must not contain whitespace`);Yt(e.slash.arguments)}e.agent?.keybind!==void 0&&Zt(e.agent.keybind,`agent keybind`)}}function Yt(e){if(e===void 0)return;Zt(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&en(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Zt(n.word,`argument word`),/\s/u.test(n.word)&&en(`argument word must not contain whitespace`),t.has(n.word)&&en(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Zt(n.description,`argument word description`);t.size>Et&&en(`argument word count exceeds 32`),e.text!==void 0&&(Zt(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Zt(e.text.requestIdField,`request id field`))}function Xt(e,t){e.length>Tt&&en(`${t} count exceeds 16`);for(let n of e)Zt(n,t)}function Zt(e,t,n=!1){e.trim().length===0&&en(`${t} must not be blank`),n&&e.includes(`:`)&&en(`${t} must not contain a colon`)}function Qt(e){e!==void 0&&!Number.isSafeInteger(e)&&en(`order must be a safe integer`)}function $t(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function en(e){throw Error(e)}var tn=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),nn=Object.freeze({status:`available`});function rn(e){let t=e.availability?.()??nn;return t.status===`available`?nn:Object.freeze({status:`unavailable`,reason:t.reason})}function an(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function on(e){if(e instanceof xt){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:Rt(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function sn(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++]??nn;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...mn(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...mn(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...mn(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...mn(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...mn(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(gn(e,l,u.agent,d))}}return dn(n),fn(i),un(r),un(a),un(o),un(s),Object.freeze({bindings:pn(n),palette:pn(r),slash:pn(i),help:pn(a),menu:pn(o),agent:pn(s)})}var cn=new TextEncoder;function ln(e,t){let n=cn.encode(e),r=cn.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 un(e){e.sort((e,t)=>e.order-t.order||ln(e.commandId,t.commandId))}function dn(e){e.sort((e,t)=>e.order-t.order||ln(e.commandId,t.commandId)||ln(e.binding,t.binding))}function fn(e){e.sort((e,t)=>e.order-t.order||ln(e.commandId,t.commandId)||ln(e.alias,t.alias))}function pn(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function mn(e,t,n,r){let i=hn(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function hn(e,t,n,r){let i={commandId:kt(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id: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 gn(e,t,n,r){let i=mn(e,t,n.order,r),a=i.action===void 0?i:{...i,action:_n(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function _n(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var vn=t((e=>{var t=Ve(),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})),yn=t(((e,t)=>{t.exports=vn()})),W=e(Ve(),1),G=yn(),bn=W.createContext(void 0),xn=e=>{let t=W.useContext(bn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Sn=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,G.jsx)(bn.Provider,{value:e,children:t})),Cn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},wn=new class{#e=Cn;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 Tn(e){setTimeout(e,0)}var En=typeof window>`u`||`Deno`in globalThis;function Dn(){}function On(e,t){return typeof e==`function`?e(t):e}function kn(e){return typeof e==`number`&&e>=0&&e!==1/0}function An(e,t){return Math.max(e+(t||0)-Date.now(),0)}function jn(e,t){return typeof e==`function`?e(t):e}function Mn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Pn(o,t.options))return!1}else if(!In(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 Nn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Fn(t.options.mutationKey)!==Fn(a))return!1}else if(!In(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Pn(e,t){return(t?.queryKeyHashFn||Fn)(e)}function Fn(e){return JSON.stringify(e,(e,t)=>Vn(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function In(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(!In(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!In(e[r],t[r]))return!1;return!0}return!1}var Ln=Object.prototype.hasOwnProperty;function Rn(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Bn(e)&&Bn(t);if(!r&&!(Vn(e)&&Vn(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:Ln.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Rn(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function zn(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 Bn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vn(e){if(!Hn(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Hn(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Hn(e){return Object.prototype.toString.call(e)===`[object Object]`}function Un(e){return new Promise(t=>{wn.setTimeout(t,e)})}function Wn(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Rn(e,t)}function Gn(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Kn(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var qn=Symbol();function Jn(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===qn?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Yn(e,t){return typeof e==`function`?e(...t):!!e}function Xn(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 Zn=()=>En,Qn=()=>Zn(),$n=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(){}},er=new class extends $n{#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`}},tr=Tn;function nr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=tr,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 rr=nr(),ir=new class extends $n{#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 ar(e){return Math.min(1e3*2**e,3e4)}function or(e){return(e??`online`)!==`online`||ir.isOnline()}var sr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function cr(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Dn);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new sr(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>er.isFocused()&&(e.networkMode===`always`||ir.isOnline())&&e.canRun(),p=()=>or(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??(Qn()?0:3),a=e.retryDelay??ar,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),Un(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 lr=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),kn(this.gcTime)&&(this.#e=wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Qn()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(wn.clearTimeout(this.#e),this.#e=void 0)}};function ur(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=>{Xn(e,()=>t.signal,()=>n=!0)},u=Jn(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?Kn:Gn;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?fr:dr,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:dr(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 dr(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 fr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function pr(e,t){return t?dr(e,t)!=null:!1}function mr(e,t){return!t||!e.getPreviousPageParam?!1:fr(e,t)!=null}var hr=class extends lr{#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=vr(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=vr(this.options);e.data!==void 0&&(this.setState(_r(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Wn(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(Dn).catch(Dn):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=>jn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>jn(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:!An(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=Jn(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`?ur(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=cr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof sr&&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 sr){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,...gr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,..._r(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),rr.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function gr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:or(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function _r(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function vr(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 yr=class extends $n{#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),xr(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Sr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Sr(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 jn(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&&!zn(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Cr(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||jn(this.options.enabled,this.#t)!==jn(t.enabled,this.#t)||jn(this.options.staleTime,this.#t)!==jn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||jn(this.options.enabled,this.#t)!==jn(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 zn(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(Dn)),t}#h(e){return!Qn()&&jn(this.options.enabled,this.#t)!==!1&&kn(e)}#g(){this.#b();let e=jn(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=An(this.#r.dataUpdatedAt,e)+1;this.#u=wn.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=wn.setInterval(()=>{(this.options.refetchIntervalInBackground||er.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(wn.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(wn.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&&xr(e,t),o=i&&Cr(e,n,t,r);(a||o)&&(l={...l,...gr(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=Wn(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=Wn(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:wr(e,t),refetch:this.refetch,isEnabled:jn(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),zn(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)})})();rr.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 br(e,t){return jn(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||jn(t.retryOnMount,e)!==!1)}function xr(e,t){return br(e,t)||e.state.data!==void 0&&Sr(e,t,t.refetchOnMount)}function Sr(e,t,n){if(jn(t.enabled,e)!==!1&&jn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&wr(e,t)}return!1}function Cr(e,t,n,r){return(e!==t||jn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&wr(e,n)}function wr(e,t){return jn(t.enabled,e)!==!1&&e.isStaleByTime(jn(t.staleTime,e))}var Tr=class extends lr{#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||Er(),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=cr({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),rr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Er(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Dr=class extends $n{#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 Tr({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=Or(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=Or(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=Or(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=Or(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){rr.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=>Nn(t,e))}findAll(e={}){return this.getAll().filter(t=>Nn(e,t))}notify(e){rr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return rr.batch(()=>Promise.all(e.map(e=>e.continue().catch(Dn))))}};function Or(e){return e.options.scope?.id}var kr=class extends $n{#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),zn(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Fn(t.mutationKey)!==Fn(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??Er();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){rr.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)})})}},Ar=class extends $n{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Pn(r,t),a=this.get(i);return a||(a=new hr({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(){rr.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=>Mn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Mn(e,t)):t}notify(e){rr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){rr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){rr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},jr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ar,this.#t=e.mutationCache||new Dr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=er.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ir.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(jn(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=On(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return rr.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;rr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return rr.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=rr.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Dn).catch(Dn)}invalidateQueries(e,t={}){return rr.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=rr.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(Dn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Dn)}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(jn(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(jn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dn).catch(Dn)}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(Dn).catch(Dn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ir.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(Fn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{In(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Fn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{In(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||=Pn(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===qn&&(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 Mr({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Gn(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(Xn({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}}function Nr(e){return e}function Pr(e){return e}var Fr=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}}}})),Ir=t(((e,t)=>{t.exports=Fr()})),Lr=t((e=>{var t=Ve(),n=Ir();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 I(e){return typeof e!=`object`||!e?null:(e=F&&e[F]||e[`@@iterator`],typeof e==`function`?e:null)}var L=Object.assign,R;function ee(e){if(R===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);R=t&&t[1]||``}return`
1
+ import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$a as n,Ba as r,Ea as i,Ga as a,Ha as o,Ia as s,Ja as c,Ka as l,La as u,Ma as d,Pa as f,Qa as p,Ra as m,Ua as h,Va as g,Wa as _,Xa as v,Ya as y,Zi as b,_a as x,ba as S,ca as C,da as w,fa as T,ga as E,ia as D,ja as O,la as k,ma as A,no as j,oa as M,pa as N,qa as P,ra as F,to as I,wa as L,xa as R,ya as ee,za as te}from"./Effect-CsknxyoC.js";import{Ai as ne,Ci as z,Ei as re,Fn as ie,Hi as B,Ir as ae,Ma as oe,Mr as se,Na as V,Ni as ce,Rr as le,Si as ue,Ta as de,Ur as fe,Wr as pe,do as me,fi as he,ii as ge,l as _e,oi as ve,pi as ye,xa as be,xi as xe}from"./extension-hook-TXWlsyri.js";import{A as Se,D as Ce,F as we,I as Te,M as Ee,N as De,R as Oe,b as ke,d as Ae,f as je,g as Me,h as Ne,j as Pe,n as Fe,p as Ie,v as Le,y as Re,z as ze}from"./animation-Ca8A_H2p.js";var Be=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},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function L(){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=I,e.act=L,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=L,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`})),Ve=t(((e,t)=>{t.exports=Be()})),He=w(),Ue=T(()=>C(`status`,[x({status:N(`available`)}).strict(),x({status:N(`unavailable`),reason:R()}).strict()])),We=He,Ge=T(()=>ee(R(),We)),Ke=e=>We.parse(e),qe=e=>Ge.parse(e),Je=T(()=>x({code:R().min(1).max(160),message:R().min(1).max(512),details:We.optional()}).strict()),Ye=e=>Je.parse(e),Xe=Ge,Ze=T(()=>R().refine(e=>e.trim().length>0)),Qe=Ue,$e=T(()=>L([x({type:N(`action`)}).strict(),x({type:N(`custom`),data:Ge}).strict(),x({type:N(`choice`),options:F(x({value:We,label:Ze,description:Ze.optional()}))}).strict(),x({type:N(`form`),submitLabel:Ze.optional()}).strict(),x({type:N(`confirmation`),message:Ze,confirmLabel:Ze.optional(),cancelLabel:Ze.optional()}).strict()])),et=T(()=>x({inputSchema:Xe.optional(),outputSchema:Xe.optional(),presentation:$e.optional()}).strict()),tt=T(()=>E().int().refine(e=>Number.isSafeInteger(e))),nt=T(()=>x({hint:Ze.pipe(R().max(120)),words:F(x({word:R().regex(/^\S{1,64}$/u),description:Ze.pipe(R().max(512)).optional(),arguments:Ge}).strict()).max(32).optional(),text:x({field:Ze.pipe(R().max(120)),arguments:Ge,requestIdField:Ze.pipe(R().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),rt=T(()=>x({order:tt.optional()}).strict()),it=T(()=>x({bindings:x({order:tt.optional(),values:F(Ze).max(16)}).strict().optional(),agent:x({keybind:Ze.optional(),order:tt.optional()}).strict().optional(),help:rt.optional(),menu:rt.optional(),palette:rt.optional(),slash:x({aliases:F(Ze).max(16),consumesDraft:M().optional(),order:tt.optional(),arguments:nt.optional()}).strict().optional()}).strict()),at=T(()=>x({id:Ze.refine(e=>!e.includes(`:`)),title:Ze,category:Ze,description:Ze.optional(),projections:it.optional(),action:et.optional(),availability:Qe.optional()}).strict()),ot=e=>at.parse(e),st=T(()=>x({inputSchema:Xe.optional(),outputSchema:Xe.optional()}).strict()),ct=R().min(1).brand(),lt=T(()=>x({commandId:ct,command:x({namespace:R(),id:R()}).strict(),sourceId:R(),scope:R().optional(),title:R(),category:R(),description:R().optional(),order:E(),availability:Ue,action:st.optional(),keybind:R().optional()}).strict());F(lt);var ut=8192,H=Ze.pipe(R().max(ut)),dt=Ze.pipe(R().max(60)),ft=i({protocol:/^https?$/u}),pt=x({label:H,value:H}).strict(),mt={summary:H.optional(),facts:F(pt).max(4).optional(),body:H.optional(),bodyLabel:H.optional(),details:F(pt).max(24).optional()},ht=C(`type`,[x({type:N(`choice`),message:dt,...mt,current:H.optional(),collapsedGroup:H.optional(),options:F(x({value:H,label:H,description:H.optional(),group:H.optional(),destructive:N(!0).optional()}).strict()).min(1).max(256)}).strict(),x({type:N(`text`),message:dt,...mt,placeholder:H.optional(),secret:M().optional()}).strict(),x({type:N(`confirmation`),message:dt,...mt,confirmLabel:H.optional(),cancelLabel:H.optional(),destructive:N(!0).optional()}).strict(),x({type:N(`decision`),message:dt,...mt,options:F(x({value:H,label:H,description:H.optional(),destructive:N(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(e=>e.value)).size===e.length,`Decision option values must be unique`),multiple:M().optional(),other:x({label:H,placeholder:H.optional(),maxLength:E().int().min(1).max(ut),blank:H.optional()}).strict().optional(),escape:H.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(e=>e.value===t)),`A decision's escape and blank answers must be offered options`)]),gt=T(()=>C(`type`,[x({type:N(`info`),message:H,links:F(x({url:ft,label:H.optional()}).strict()).max(16).optional()}).strict(),x({type:N(`progress`),message:H}).strict(),x({type:N(`handoff`),url:ft,code:H.optional(),message:H.optional()}).strict(),x({type:N(`success`),message:H}).strict()])),_t=e=>ht.parse(e),vt=e=>gt.parse(e),yt={decision:e=>{let t=ht.options[3].parse(e),n=new Set(t.options.map(e=>e.value));return x({selected:F(R()).max(t.options.length),text:k(Ze.pipe(R().max(t.other?.maxLength??1)))}).strict().superRefine((e,r)=>{let i=e=>{r.addIssue({code:`custom`,message:e})};(e.selected.some(e=>!n.has(e))||new Set(e.selected).size!==e.selected.length)&&i(`Pick each offered option at most once`),t.multiple!==!0&&e.selected.length>1&&i(`Pick one option`),e.selected.length===0&&e.text===void 0&&i(`Pick an option or write an answer`),t.other===void 0&&e.text!==void 0&&i(`This decision takes no written answer`),t.multiple!==!0&&e.selected.length>0&&e.text!==void 0&&i(`Pick an option or write an answer, not both`)})},confirmation:e=>(ht.options[2].parse(e),M()),text:e=>(ht.options[1].parse(e),R().max(ut)),choice:e=>{let t=ht.options[0].parse(e);return R().refine(e=>t.options.some(t=>t.value===e))}};function bt(e){let t=yt[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}var xt=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},St=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Ct(){let e=!1,t=tn,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=tn,s(),o.clear())},contribute:t=>{if(Mt(t),e)throw new St;Nt(t,n),Pt(t,n);let r=Symbol(`whistle-contribution`);jt(t)||(n=[...n,{contribution:Ft(t),generation:r}],i=!0,s());let a=!0;return $t(o=>{if(!a||e)return;let c={...t,commands:o};Mt(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Nt(c,u),Pt(c,u);let d=Ft(c);if(jt(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(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=At(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=rn(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&wt.has(r.origin)&&(o=n({commandId:kt(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=on(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.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 tn;let a=n.flatMap(e=>e.contribution.commands.map(rn));return(i||a.some((e,t)=>!an(e,r[t])))&&(t=sn(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var wt=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Tt=16,Et=32,Dt=64,Ot=256;function kt(e,t){return ct.parse(`${e}:${t}`)}function At(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function jt(e){return e.commands.length===0}function Mt(e){Zt(e.sourceId,`source ID`),Zt(e.namespace,`namespace`),e.scope!==void 0&&Zt(e.scope,`scope`);for(let t of e.commands)Kt(t)}function Nt(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&en(`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(kt(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=kt(e.namespace,t.id);n.has(i)&&en(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&en(`Slash alias is already registered`),r.add(e)}}function Pt(e,t){t.length>=Dt&&en(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>Ot&&en(`Live command capacity exceeded`)}function Ft(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(It)};return e.scope===void 0?t:{...t,scope:e.scope}}function It(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=Lt(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Bt(e.projections)),t}function Lt(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=U(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=U(e.outputSchema)),e.presentation!==void 0&&(t.presentation=zt(e.presentation)),Object.freeze(t)}function U(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Rt(t)])))}function Rt(e){return Array.isArray(e)?Object.freeze(e.map(Rt)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Rt(t)]))):e}function zt(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:U(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:Rt(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Bt(e){let t={};return e.bindings!==void 0&&(t.bindings=Vt(e.bindings)),e.agent!==void 0&&(t.agent=Ht(e.agent)),e.help!==void 0&&(t.help=Ut(e.help.order)),e.menu!==void 0&&(t.menu=Ut(e.menu.order)),e.palette!==void 0&&(t.palette=Ut(e.palette.order)),e.slash!==void 0&&(t.slash=Wt(e.slash)),t}function Vt(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Ht(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Ut(e){let t={};return e!==void 0&&(t.order=e),t}function Wt(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=Gt(e.arguments)),t}function Gt(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:U(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:U(e.text.arguments)})),Object.freeze(t)}function Kt(e){Zt(e.id,`command ID`,!0),Zt(e.title,`title`),Zt(e.category,`category`),qt(e.action),Jt(e.projections)}function qt(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Zt(t.label,`choice label`),t.description!==void 0&&Zt(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Zt(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Zt(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Zt(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Zt(e.presentation.cancelLabel,`cancellation label`)}}function Jt(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&Qt(t.order);if(e.bindings!==void 0&&Xt(e.bindings.values,`binding`),e.slash!==void 0){Xt(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&en(`slash alias must not contain whitespace`);Yt(e.slash.arguments)}e.agent?.keybind!==void 0&&Zt(e.agent.keybind,`agent keybind`)}}function Yt(e){if(e===void 0)return;Zt(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&en(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Zt(n.word,`argument word`),/\s/u.test(n.word)&&en(`argument word must not contain whitespace`),t.has(n.word)&&en(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Zt(n.description,`argument word description`);t.size>Et&&en(`argument word count exceeds 32`),e.text!==void 0&&(Zt(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Zt(e.text.requestIdField,`request id field`))}function Xt(e,t){e.length>Tt&&en(`${t} count exceeds 16`);for(let n of e)Zt(n,t)}function Zt(e,t,n=!1){e.trim().length===0&&en(`${t} must not be blank`),n&&e.includes(`:`)&&en(`${t} must not contain a colon`)}function Qt(e){e!==void 0&&!Number.isSafeInteger(e)&&en(`order must be a safe integer`)}function $t(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function en(e){throw Error(e)}var tn=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),nn=Object.freeze({status:`available`});function rn(e){let t=e.availability?.()??nn;return t.status===`available`?nn:Object.freeze({status:`unavailable`,reason:t.reason})}function an(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function on(e){if(e instanceof xt){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:Rt(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function sn(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++]??nn;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...mn(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...mn(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...mn(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...mn(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...mn(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(gn(e,l,u.agent,d))}}return dn(n),fn(i),un(r),un(a),un(o),un(s),Object.freeze({bindings:pn(n),palette:pn(r),slash:pn(i),help:pn(a),menu:pn(o),agent:pn(s)})}var cn=new TextEncoder;function ln(e,t){let n=cn.encode(e),r=cn.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 un(e){e.sort((e,t)=>e.order-t.order||ln(e.commandId,t.commandId))}function dn(e){e.sort((e,t)=>e.order-t.order||ln(e.commandId,t.commandId)||ln(e.binding,t.binding))}function fn(e){e.sort((e,t)=>e.order-t.order||ln(e.commandId,t.commandId)||ln(e.alias,t.alias))}function pn(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function mn(e,t,n,r){let i=hn(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function hn(e,t,n,r){let i={commandId:kt(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id: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 gn(e,t,n,r){let i=mn(e,t,n.order,r),a=i.action===void 0?i:{...i,action:_n(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function _n(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var vn=t((e=>{var t=Ve(),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})),yn=t(((e,t)=>{t.exports=vn()})),W=e(Ve(),1),G=yn(),bn=W.createContext(void 0),xn=e=>{let t=W.useContext(bn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Sn=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,G.jsx)(bn.Provider,{value:e,children:t})),Cn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},wn=new class{#e=Cn;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 Tn(e){setTimeout(e,0)}var En=typeof window>`u`||`Deno`in globalThis;function Dn(){}function On(e,t){return typeof e==`function`?e(t):e}function kn(e){return typeof e==`number`&&e>=0&&e!==1/0}function An(e,t){return Math.max(e+(t||0)-Date.now(),0)}function jn(e,t){return typeof e==`function`?e(t):e}function Mn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Pn(o,t.options))return!1}else if(!In(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 Nn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Fn(t.options.mutationKey)!==Fn(a))return!1}else if(!In(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Pn(e,t){return(t?.queryKeyHashFn||Fn)(e)}function Fn(e){return JSON.stringify(e,(e,t)=>Vn(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function In(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(!In(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!In(e[r],t[r]))return!1;return!0}return!1}var Ln=Object.prototype.hasOwnProperty;function Rn(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Bn(e)&&Bn(t);if(!r&&!(Vn(e)&&Vn(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:Ln.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Rn(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function zn(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 Bn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vn(e){if(!Hn(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Hn(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Hn(e){return Object.prototype.toString.call(e)===`[object Object]`}function Un(e){return new Promise(t=>{wn.setTimeout(t,e)})}function Wn(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Rn(e,t)}function Gn(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Kn(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var qn=Symbol();function Jn(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===qn?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Yn(e,t){return typeof e==`function`?e(...t):!!e}function Xn(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 Zn=()=>En,Qn=()=>Zn(),$n=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(){}},er=new class extends $n{#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`}},tr=Tn;function nr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=tr,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 rr=nr(),ir=new class extends $n{#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 ar(e){return Math.min(1e3*2**e,3e4)}function or(e){return(e??`online`)!==`online`||ir.isOnline()}var sr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function cr(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Dn);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new sr(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>er.isFocused()&&(e.networkMode===`always`||ir.isOnline())&&e.canRun(),p=()=>or(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??(Qn()?0:3),a=e.retryDelay??ar,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),Un(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 lr=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),kn(this.gcTime)&&(this.#e=wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Qn()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(wn.clearTimeout(this.#e),this.#e=void 0)}};function ur(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=>{Xn(e,()=>t.signal,()=>n=!0)},u=Jn(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?Kn:Gn;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?fr:dr,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:dr(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 dr(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 fr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function pr(e,t){return t?dr(e,t)!=null:!1}function mr(e,t){return!t||!e.getPreviousPageParam?!1:fr(e,t)!=null}var hr=class extends lr{#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=vr(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=vr(this.options);e.data!==void 0&&(this.setState(_r(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Wn(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(Dn).catch(Dn):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=>jn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>jn(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:!An(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=Jn(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`?ur(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=cr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof sr&&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 sr){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,...gr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,..._r(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),rr.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function gr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:or(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function _r(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function vr(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 yr=class extends $n{#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),xr(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Sr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Sr(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 jn(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&&!zn(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Cr(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||jn(this.options.enabled,this.#t)!==jn(t.enabled,this.#t)||jn(this.options.staleTime,this.#t)!==jn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||jn(this.options.enabled,this.#t)!==jn(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 zn(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(Dn)),t}#h(e){return!Qn()&&jn(this.options.enabled,this.#t)!==!1&&kn(e)}#g(){this.#b();let e=jn(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=An(this.#r.dataUpdatedAt,e)+1;this.#u=wn.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=wn.setInterval(()=>{(this.options.refetchIntervalInBackground||er.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(wn.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(wn.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&&xr(e,t),o=i&&Cr(e,n,t,r);(a||o)&&(l={...l,...gr(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=Wn(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=Wn(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:wr(e,t),refetch:this.refetch,isEnabled:jn(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),zn(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)})})();rr.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 br(e,t){return jn(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||jn(t.retryOnMount,e)!==!1)}function xr(e,t){return br(e,t)||e.state.data!==void 0&&Sr(e,t,t.refetchOnMount)}function Sr(e,t,n){if(jn(t.enabled,e)!==!1&&jn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&wr(e,t)}return!1}function Cr(e,t,n,r){return(e!==t||jn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&wr(e,n)}function wr(e,t){return jn(t.enabled,e)!==!1&&e.isStaleByTime(jn(t.staleTime,e))}var Tr=class extends lr{#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||Er(),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=cr({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),rr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Er(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Dr=class extends $n{#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 Tr({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=Or(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=Or(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=Or(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=Or(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){rr.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=>Nn(t,e))}findAll(e={}){return this.getAll().filter(t=>Nn(e,t))}notify(e){rr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return rr.batch(()=>Promise.all(e.map(e=>e.continue().catch(Dn))))}};function Or(e){return e.options.scope?.id}var kr=class extends $n{#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),zn(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Fn(t.mutationKey)!==Fn(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??Er();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){rr.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)})})}},Ar=class extends $n{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Pn(r,t),a=this.get(i);return a||(a=new hr({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(){rr.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=>Mn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Mn(e,t)):t}notify(e){rr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){rr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){rr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},jr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ar,this.#t=e.mutationCache||new Dr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=er.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ir.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(jn(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=On(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return rr.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;rr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return rr.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=rr.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Dn).catch(Dn)}invalidateQueries(e,t={}){return rr.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=rr.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(Dn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Dn)}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(jn(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(jn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dn).catch(Dn)}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(Dn).catch(Dn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ir.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(Fn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{In(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Fn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{In(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||=Pn(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===qn&&(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 Mr({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Gn(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(Xn({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}}function Nr(e){return e}function Pr(e){return e}var Fr=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}}}})),Ir=t(((e,t)=>{t.exports=Fr()})),Lr=t((e=>{var t=Ve(),n=Ir();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 I(e){return typeof e!=`object`||!e?null:(e=F&&e[F]||e[`@@iterator`],typeof e==`function`?e:null)}var L=Object.assign,R;function ee(e){if(R===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);R=t&&t[1]||``}return`
2
2
  `+R+e}var te=!1;function ne(e,t){if(!e||te)return``;te=!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(`
3
3
  `),a=r.stack.split(`
4
4
  `),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=`
@@ -1 +1 @@
1
- import{n as e}from"./models-BM_0GHMS.js";import{r as t}from"./runtime-core-DZaDilzo.js";function n(){return typeof process>`u`||!(process.versions?.node||process.versions?.bun)?null:process.getBuiltinModule?.(`node:os`)??null}var r=n();function i(){return r?`pi (${r.platform()} ${r.release()}; ${r.arch()})`:`pi (browser)`}var a=class extends Error{},o=[`$ref`,`$defs`,`definitions`,`allOf`,`oneOf`,`patternProperties`,`dependentSchemas`,`dependencies`,`unevaluatedProperties`,`propertyNames`,`contains`,`prefixItems`,`not`,`if`,`then`,`else`];function s(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function c(e){if(!s(e))return!1;let t=typeof e.type==`string`?[e.type]:Array.isArray(e.type)?e.type:[];return t.includes(`object`)||t.includes(`array`)||e.properties!==void 0||e.items!==void 0}function l(e){return s(e)?e.type===`null`||Array.isArray(e.type)&&e.type.includes(`null`)||e.const===null||Array.isArray(e.enum)&&e.enum.includes(null)?!0:Array.isArray(e.anyOf)&&e.anyOf.some(e=>l(e)):!1}function u(e,t){if(!s(e))throw new a(`boolean schemas are unsupported`);for(let t of o)if(e[t]!==void 0)throw new a(`${t} schemas are unsupported`);if(t){for(let[n,r]of Object.entries(e))if(t(n,r))throw new a(`${n}: ${JSON.stringify(r)} is unsupported`)}if(e.anyOf!==void 0){if(!Array.isArray(e.anyOf)||e.anyOf.length===0)throw new a(`anyOf must contain at least one schema`);for(let n of e.anyOf){if(c(n))throw new a(`object and array unions are unsupported`);u(n,t)}}if(e.items!==void 0){if(Array.isArray(e.items))throw new a(`tuple schemas are unsupported`);u(e.items,t)}let n=e.type===`object`;if(e.properties!==void 0&&!n)throw new a(`properties require type object`);if(!n)return;if(e.additionalProperties!==void 0&&e.additionalProperties!==!1)throw new a(`schema-valued or true additionalProperties is unsupported`);if(e.properties!==void 0&&!s(e.properties))throw new a(`object properties must be a schema map`);if(e.required!==void 0&&(!Array.isArray(e.required)||e.required.some(e=>typeof e!=`string`)))throw new a(`object required must be a string array`);let r=e.properties??{},i=Object.keys(r),d=new Set(Array.isArray(e.required)?e.required:[]);if([...d].some(e=>!i.includes(e)))throw new a(`required contains an unknown property`);for(let[e,n]of Object.entries(r))u(n,t),!d.has(e)&&!l(n)&&(r[e]={anyOf:[n,{type:`null`}]});e.required=i,e.additionalProperties=!1}function d(e,t){let n=structuredClone(e);if(!s(n)||(u(n,t),n.type!==`object`))throw new a(`root schema must have type object`);return n}function f(e,t){return t===!0?d(e.parameters):e.parameters}function p(e,t,n){let r=t[n];if(typeof r!=`string`)throw Error(`Grammar tool call "${e}" requires argument "${n}" to be a string.`);return r}function m(e,t,n,r){if(e.closed){if(r&&n===e.input)return;throw Error(`grammar tool input for property "${t}" changed after it was closed`)}if(!n.startsWith(e.input))throw Error(`grammar tool input for property "${t}" changed non-monotonically`);let i=n.slice(e.input.length);if(!r&&i.length===0)return;let a=``;return e.started||=(a+=`{${JSON.stringify(t)}:"`,!0),a+=JSON.stringify(i).slice(1,-1),e.input=n,r&&(a+=`"}`,e.closed=!0),a}function h(e){let t=e.parameters;if(t.type!==`object`)throw Error(`grammar constrained sampling requires an object parameter schema`);if(!Array.isArray(t.required)||t.required.length!==1||typeof t.required[0]!=`string`)throw Error(`grammar constrained sampling requires exactly one required string property`);let n=t.required[0];if(!t.properties?.[n])throw Error(`grammar constrained sampling requires a properties entry for ${n}`);if(t.properties[n]?.type!==`string`)throw Error(`grammar constrained sampling property ${n} must have type string`);return n}function g(e,t,n){let r=e.constrainedSampling;if(!(!r||r.type!==`json_schema`)){if(t)try{return d(e.parameters,n),!0}catch(t){if(!(t instanceof a))throw t;if(r.strict!==`require`)return;throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but ${t.message}.`)}if(r.strict===`require`)throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`)}}function _(e,t){let n=e.constrainedSampling;if(!n||n.type!==`grammar`||!t)return;let r=n.variants.openai_lark,i=n.variants.openai_regex,a=typeof r==`string`&&r.trim().length>0,o=typeof i==`string`&&i.trim().length>0;if(!a&&!o)throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);try{return{format:a?`lark`:`regex`,definition:a?r:i,inputProperty:h(e)}}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: ${n}.`)}}function v(e,t){let n=new Map;for(let r of e??[]){let e=_(r,t);e&&n.set(r.name,e.inputProperty)}return n}var y=4096,b=1;function x(e,n,r){if(e.contextWindow<=0)return Math.max(b,r);let i=e.contextWindow-t(n).tokens-y;return Math.min(r,Math.max(b,i))}function S(t,n,r){let i=e(t,n),a=t.samplingParamsByThinkingLevel?.[i];return t.samplingParams||a||r?{...t.samplingParams,...a,...r}:void 0}function C(e,t,n,r){let i=S(e,n?.reasoning??`off`,n?.samplingParams);return{temperature:n?.temperature,samplingParams:i,maxTokens:x(e,t,n?.maxTokens??e.maxTokens),signal:n?.signal,telemetryContext:n?.telemetryContext,apiKey:r||n?.apiKey,fetch:n?.fetch,transport:n?.transport,cacheRetention:n?.cacheRetention,sessionId:n?.sessionId,headers:n?.headers,onPayload:n?.onPayload,onResponse:n?.onResponse,onProviderStreamEvent:n?.onProviderStreamEvent,timeoutMs:n?.timeoutMs,websocketConnectTimeoutMs:n?.websocketConnectTimeoutMs,maxRetries:n?.maxRetries,maxRetryDelayMs:n?.maxRetryDelayMs,metadata:n?.metadata,env:n?.env}}var w=1024,T={minimal:1024,low:2048,medium:8192,high:16384};function E(e){return e===`xhigh`||e===`max`?`high`:e}function D(e,t){return{...T,...t}[E(e)]}function O(e,t){return Math.min(e,Math.max(0,t-w))}function k(e,t,n,r){let i=D(n,r),a=e===void 0?t:Math.min(e+i,t);return a<=i&&(i=O(i,a)),{maxTokens:a,thinkingBudget:i}}var A=`(image omitted: model does not support images)`,j=`(tool image omitted: model does not support images)`,M=`(image attached after the tool results)`;function N(e){if(!e.isError)return;let t=e.content.filter(e=>e.type===`image`);if(t.length!==0)return{content:P(e.content,M),caption:`Images from the error result of tool call ${e.toolCallId} (${e.toolName}):`,images:t}}function P(e,t){let n=[],r=!1;for(let i of e){if(i.type===`image`){r||n.push({type:`text`,text:t}),r=!0;continue}n.push(i),r=i.text===t}return n}function F(e,t){return t.input.includes(`image`)?e:e.map(e=>e.role===`user`&&Array.isArray(e.content)?{...e,content:P(e.content,A)}:e.role===`toolResult`?{...e,content:P(e.content,j)}:e)}function I(e,t,n){let r=new Map,i=F(e.map(e=>e.content==null?{...e,content:[]}:e),t).map(e=>{if(e.role===`system`||e.role===`user`)return e;if(e.role===`toolResult`){let t=r.get(e.toolCallId);return t&&t!==e.toolCallId?{...e,toolCallId:t}:e}if(e.role===`assistant`){let i=e,a=i.provider===t.provider&&i.api===t.api&&i.model===t.id,o=i.content.flatMap(e=>{if(e.type===`thinking`)return a?e.redacted||e.thinkingSignature?e:!e.thinking||e.thinking.trim()===``?[]:e:[];if(e.type===`text`)return a?e:{type:`text`,text:e.text};if(e.type===`toolCall`){let o=e,s=o;if(!a&&o.thoughtSignature&&(s={...o},delete s.thoughtSignature),!a&&n){let e=n(o.id,t,i);e!==o.id&&(r.set(o.id,e),s={...s,id:e})}return s}return e});return{...i,content:o}}return e}),a=[],o=[],s=new Set,c=[],l=()=>{if(o.length>0){for(let e of o)s.has(e.id)||a.push({role:`toolResult`,toolCallId:e.id,toolName:e.name,content:[{type:`text`,text:`No result provided`}],isError:!0,timestamp:Date.now()});o=[],s=new Set}a.push(...c),c.length=0};for(let e=0;e<i.length;e++){let t=i[e];if(t.role===`assistant`){l();let e=t;if(e.stopReason===`error`||e.stopReason===`aborted`)continue;let n=e.content.filter(e=>e.type===`toolCall`);n.length>0&&(o=n,s=new Set),a.push(t)}else t.role===`toolResult`?(s.add(t.toolCallId),a.push(t)):t.role===`system`?o.length>0?c.push(t):a.push(t):(t.role===`user`&&l(),a.push(t))}return l(),a}export{x as a,D as c,p as d,f,i as h,C as i,m as l,g as m,I as n,O as o,_ as p,k as r,S as s,N as t,v as u};
1
+ import{n as e}from"./models-BM_0GHMS.js";import{r as t}from"./runtime-core-BDds1RWk.js";function n(){return typeof process>`u`||!(process.versions?.node||process.versions?.bun)?null:process.getBuiltinModule?.(`node:os`)??null}var r=n();function i(){return r?`pi (${r.platform()} ${r.release()}; ${r.arch()})`:`pi (browser)`}var a=class extends Error{},o=[`$ref`,`$defs`,`definitions`,`allOf`,`oneOf`,`patternProperties`,`dependentSchemas`,`dependencies`,`unevaluatedProperties`,`propertyNames`,`contains`,`prefixItems`,`not`,`if`,`then`,`else`];function s(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function c(e){if(!s(e))return!1;let t=typeof e.type==`string`?[e.type]:Array.isArray(e.type)?e.type:[];return t.includes(`object`)||t.includes(`array`)||e.properties!==void 0||e.items!==void 0}function l(e){return s(e)?e.type===`null`||Array.isArray(e.type)&&e.type.includes(`null`)||e.const===null||Array.isArray(e.enum)&&e.enum.includes(null)?!0:Array.isArray(e.anyOf)&&e.anyOf.some(e=>l(e)):!1}function u(e,t){if(!s(e))throw new a(`boolean schemas are unsupported`);for(let t of o)if(e[t]!==void 0)throw new a(`${t} schemas are unsupported`);if(t){for(let[n,r]of Object.entries(e))if(t(n,r))throw new a(`${n}: ${JSON.stringify(r)} is unsupported`)}if(e.anyOf!==void 0){if(!Array.isArray(e.anyOf)||e.anyOf.length===0)throw new a(`anyOf must contain at least one schema`);for(let n of e.anyOf){if(c(n))throw new a(`object and array unions are unsupported`);u(n,t)}}if(e.items!==void 0){if(Array.isArray(e.items))throw new a(`tuple schemas are unsupported`);u(e.items,t)}let n=e.type===`object`;if(e.properties!==void 0&&!n)throw new a(`properties require type object`);if(!n)return;if(e.additionalProperties!==void 0&&e.additionalProperties!==!1)throw new a(`schema-valued or true additionalProperties is unsupported`);if(e.properties!==void 0&&!s(e.properties))throw new a(`object properties must be a schema map`);if(e.required!==void 0&&(!Array.isArray(e.required)||e.required.some(e=>typeof e!=`string`)))throw new a(`object required must be a string array`);let r=e.properties??{},i=Object.keys(r),d=new Set(Array.isArray(e.required)?e.required:[]);if([...d].some(e=>!i.includes(e)))throw new a(`required contains an unknown property`);for(let[e,n]of Object.entries(r))u(n,t),!d.has(e)&&!l(n)&&(r[e]={anyOf:[n,{type:`null`}]});e.required=i,e.additionalProperties=!1}function d(e,t){let n=structuredClone(e);if(!s(n)||(u(n,t),n.type!==`object`))throw new a(`root schema must have type object`);return n}function f(e,t){return t===!0?d(e.parameters):e.parameters}function p(e,t,n){let r=t[n];if(typeof r!=`string`)throw Error(`Grammar tool call "${e}" requires argument "${n}" to be a string.`);return r}function m(e,t,n,r){if(e.closed){if(r&&n===e.input)return;throw Error(`grammar tool input for property "${t}" changed after it was closed`)}if(!n.startsWith(e.input))throw Error(`grammar tool input for property "${t}" changed non-monotonically`);let i=n.slice(e.input.length);if(!r&&i.length===0)return;let a=``;return e.started||=(a+=`{${JSON.stringify(t)}:"`,!0),a+=JSON.stringify(i).slice(1,-1),e.input=n,r&&(a+=`"}`,e.closed=!0),a}function h(e){let t=e.parameters;if(t.type!==`object`)throw Error(`grammar constrained sampling requires an object parameter schema`);if(!Array.isArray(t.required)||t.required.length!==1||typeof t.required[0]!=`string`)throw Error(`grammar constrained sampling requires exactly one required string property`);let n=t.required[0];if(!t.properties?.[n])throw Error(`grammar constrained sampling requires a properties entry for ${n}`);if(t.properties[n]?.type!==`string`)throw Error(`grammar constrained sampling property ${n} must have type string`);return n}function g(e,t,n){let r=e.constrainedSampling;if(!(!r||r.type!==`json_schema`)){if(t)try{return d(e.parameters,n),!0}catch(t){if(!(t instanceof a))throw t;if(r.strict!==`require`)return;throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but ${t.message}.`)}if(r.strict===`require`)throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`)}}function _(e,t){let n=e.constrainedSampling;if(!n||n.type!==`grammar`||!t)return;let r=n.variants.openai_lark,i=n.variants.openai_regex,a=typeof r==`string`&&r.trim().length>0,o=typeof i==`string`&&i.trim().length>0;if(!a&&!o)throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);try{return{format:a?`lark`:`regex`,definition:a?r:i,inputProperty:h(e)}}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: ${n}.`)}}function v(e,t){let n=new Map;for(let r of e??[]){let e=_(r,t);e&&n.set(r.name,e.inputProperty)}return n}var y=4096,b=1;function x(e,n,r){if(e.contextWindow<=0)return Math.max(b,r);let i=e.contextWindow-t(n).tokens-y;return Math.min(r,Math.max(b,i))}function S(t,n,r){let i=e(t,n),a=t.samplingParamsByThinkingLevel?.[i];return t.samplingParams||a||r?{...t.samplingParams,...a,...r}:void 0}function C(e,t,n,r){let i=S(e,n?.reasoning??`off`,n?.samplingParams);return{temperature:n?.temperature,samplingParams:i,maxTokens:x(e,t,n?.maxTokens??e.maxTokens),signal:n?.signal,telemetryContext:n?.telemetryContext,apiKey:r||n?.apiKey,fetch:n?.fetch,transport:n?.transport,cacheRetention:n?.cacheRetention,sessionId:n?.sessionId,headers:n?.headers,onPayload:n?.onPayload,onResponse:n?.onResponse,onProviderStreamEvent:n?.onProviderStreamEvent,timeoutMs:n?.timeoutMs,websocketConnectTimeoutMs:n?.websocketConnectTimeoutMs,maxRetries:n?.maxRetries,maxRetryDelayMs:n?.maxRetryDelayMs,metadata:n?.metadata,env:n?.env}}var w=1024,T={minimal:1024,low:2048,medium:8192,high:16384};function E(e){return e===`xhigh`||e===`max`?`high`:e}function D(e,t){return{...T,...t}[E(e)]}function O(e,t){return Math.min(e,Math.max(0,t-w))}function k(e,t,n,r){let i=D(n,r),a=e===void 0?t:Math.min(e+i,t);return a<=i&&(i=O(i,a)),{maxTokens:a,thinkingBudget:i}}var A=`(image omitted: model does not support images)`,j=`(tool image omitted: model does not support images)`,M=`(image attached after the tool results)`;function N(e){if(!e.isError)return;let t=e.content.filter(e=>e.type===`image`);if(t.length!==0)return{content:P(e.content,M),caption:`Images from the error result of tool call ${e.toolCallId} (${e.toolName}):`,images:t}}function P(e,t){let n=[],r=!1;for(let i of e){if(i.type===`image`){r||n.push({type:`text`,text:t}),r=!0;continue}n.push(i),r=i.text===t}return n}function F(e,t){return t.input.includes(`image`)?e:e.map(e=>e.role===`user`&&Array.isArray(e.content)?{...e,content:P(e.content,A)}:e.role===`toolResult`?{...e,content:P(e.content,j)}:e)}function I(e,t,n){let r=new Map,i=F(e.map(e=>e.content==null?{...e,content:[]}:e),t).map(e=>{if(e.role===`system`||e.role===`user`)return e;if(e.role===`toolResult`){let t=r.get(e.toolCallId);return t&&t!==e.toolCallId?{...e,toolCallId:t}:e}if(e.role===`assistant`){let i=e,a=i.provider===t.provider&&i.api===t.api&&i.model===t.id,o=i.content.flatMap(e=>{if(e.type===`thinking`)return a?e.redacted||e.thinkingSignature?e:!e.thinking||e.thinking.trim()===``?[]:e:[];if(e.type===`text`)return a?e:{type:`text`,text:e.text};if(e.type===`toolCall`){let o=e,s=o;if(!a&&o.thoughtSignature&&(s={...o},delete s.thoughtSignature),!a&&n){let e=n(o.id,t,i);e!==o.id&&(r.set(o.id,e),s={...s,id:e})}return s}return e});return{...i,content:o}}return e}),a=[],o=[],s=new Set,c=[],l=()=>{if(o.length>0){for(let e of o)s.has(e.id)||a.push({role:`toolResult`,toolCallId:e.id,toolName:e.name,content:[{type:`text`,text:`No result provided`}],isError:!0,timestamp:Date.now()});o=[],s=new Set}a.push(...c),c.length=0};for(let e=0;e<i.length;e++){let t=i[e];if(t.role===`assistant`){l();let e=t;if(e.stopReason===`error`||e.stopReason===`aborted`)continue;let n=e.content.filter(e=>e.type===`toolCall`);n.length>0&&(o=n,s=new Set),a.push(t)}else t.role===`toolResult`?(s.add(t.toolCallId),a.push(t)):t.role===`system`?o.length>0?c.push(t):a.push(t):(t.role===`user`&&l(),a.push(t))}return l(),a}export{x as a,D as c,p as d,f,i as h,C as i,m as l,g as m,I as n,O as o,_ as p,k as r,S as s,N as t,v as u};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,E as n,F as r,M as i,O as a,j as o,k as s,ki as c,mi as l,mr as u}from"./sigil-DP7aTMwF.js";import{ti as d}from"./extension-hook-B-ufQ44r.js";import{t as f}from"./parakeet-DDqWjFXC.js";var p=e(c(),1),m=l();function h({inbox:e}){let{selected:c,session:l,action:h,canManage:g,openingError:_}=e,[v,y]=(0,p.useState)(null);if((0,p.useEffect)(()=>{y(null)},[c?.bindingId,c?.conversation.sessionId,g]),c===void 0)return null;let b=c.conversation;return(0,m.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":`Website conversation`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-base-300 p-2`,children:[(0,m.jsx)(`span`,{className:`min-w-0 flex-1 text-sm`,children:b.heldByYou?`You're replying. The Agent is paused.`:b.held?`${b.heldByName??`A teammate`} is replying.`:`The Agent is replying. Take over to answer as yourself.`}),g?(0,m.jsx)(u,{size:`sm`,disabled:h.isPending,onClick:()=>{let e={bindingId:c.bindingId,sessionId:b.sessionId};b.heldByYou?h.mutate({kind:`release`,...e,expectedVersion:b.holdVersion,confirm:!1}):b.held?y({...e,version:b.holdVersion,name:b.heldByName??`A teammate`}):h.mutate({kind:`hold`,...e,expectedVersion:b.holdVersion,confirm:!1})},children:b.heldByYou?`Hand back to Agent`:`Take over`}):null]}),(0,m.jsx)(n,{open:v!==null,onOpenChange:e=>{e||y(null)},children:(0,m.jsxs)(s,{children:[(0,m.jsxs)(i,{children:[(0,m.jsxs)(r,{children:[v?.name,` is replying — take over?`]}),(0,m.jsx)(t,{children:`You will reply as yourself. Their replies stop until they take over again.`})]}),(0,m.jsxs)(o,{children:[(0,m.jsx)(a,{render:(0,m.jsx)(u,{variant:`outline`}),children:`Cancel`}),(0,m.jsx)(u,{disabled:h.isPending||!g,onClick:()=>{v!==null&&(h.mutate({kind:`hold`,bindingId:v.bindingId,sessionId:v.sessionId,expectedVersion:v.version,confirm:!0}),y(null))},children:`Take over`})]})]})}),g?null:(0,m.jsx)(`p`,{className:`p-3 text-sm`,children:`Allow takeover in Grove's App permissions to reply. Your Team permissions still apply.`}),h.isError?(0,m.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,_?(0,m.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:_}):null,l?(0,m.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,m.jsx)(f,{authorOf:d,disambiguateAuthors:!0,session:l,markdownPolicy:`visitor`,composerActionVariant:`outline`},`${c.bindingId}:${b.sessionId}`)}):null]})}export{h as WebsiteConversation};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,E as n,F as r,M as i,O as a,j as o,k as s,ki as c,mi as l,mr as u}from"./sigil-CumoCbKe.js";import{ti as d}from"./extension-hook-TXWlsyri.js";import{t as f}from"./parakeet-DSXcEA6r.js";var p=e(c(),1),m=l();function h({inbox:e}){let{selected:c,session:l,action:h,canManage:g,openingError:_}=e,[v,y]=(0,p.useState)(null);if((0,p.useEffect)(()=>{y(null)},[c?.bindingId,c?.conversation.sessionId,g]),c===void 0)return null;let b=c.conversation;return(0,m.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":`Website conversation`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-base-300 p-2`,children:[(0,m.jsx)(`span`,{className:`min-w-0 flex-1 text-sm`,children:b.heldByYou?`You're replying. The Agent is paused.`:b.held?`${b.heldByName??`A teammate`} is replying.`:`The Agent is replying. Take over to answer as yourself.`}),g?(0,m.jsx)(u,{size:`sm`,disabled:h.isPending,onClick:()=>{let e={bindingId:c.bindingId,sessionId:b.sessionId};b.heldByYou?h.mutate({kind:`release`,...e,expectedVersion:b.holdVersion,confirm:!1}):b.held?y({...e,version:b.holdVersion,name:b.heldByName??`A teammate`}):h.mutate({kind:`hold`,...e,expectedVersion:b.holdVersion,confirm:!1})},children:b.heldByYou?`Hand back to Agent`:`Take over`}):null]}),(0,m.jsx)(n,{open:v!==null,onOpenChange:e=>{e||y(null)},children:(0,m.jsxs)(s,{children:[(0,m.jsxs)(i,{children:[(0,m.jsxs)(r,{children:[v?.name,` is replying — take over?`]}),(0,m.jsx)(t,{children:`You will reply as yourself. Their replies stop until they take over again.`})]}),(0,m.jsxs)(o,{children:[(0,m.jsx)(a,{render:(0,m.jsx)(u,{variant:`outline`}),children:`Cancel`}),(0,m.jsx)(u,{disabled:h.isPending||!g,onClick:()=>{v!==null&&(h.mutate({kind:`hold`,bindingId:v.bindingId,sessionId:v.sessionId,expectedVersion:v.version,confirm:!0}),y(null))},children:`Take over`})]})]})}),g?null:(0,m.jsx)(`p`,{className:`p-3 text-sm`,children:`Allow takeover in Grove's App permissions to reply. Your Team permissions still apply.`}),h.isError?(0,m.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,_?(0,m.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:_}):null,l?(0,m.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,m.jsx)(f,{authorOf:d,disambiguateAuthors:!0,session:l,markdownPolicy:`visitor`,composerActionVariant:`outline`},`${c.bindingId}:${b.sessionId}`)}):null]})}export{h as WebsiteConversation};
package/dist/index.html CHANGED
@@ -4,13 +4,13 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Inbox</title>
7
- <script type="module" crossorigin src="/assets/index-CVzMdSlI.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-D1_UIO2Y.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
9
9
  <link rel="modulepreload" crossorigin href="/assets/Effect-CsknxyoC.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-DY31Aviq.js">
11
- <link rel="modulepreload" crossorigin href="/assets/extension-hook-B-ufQ44r.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/extension-hook-TXWlsyri.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/animation-Ca8A_H2p.js">
13
- <link rel="modulepreload" crossorigin href="/assets/sigil-DP7aTMwF.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/sigil-CumoCbKe.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/document-Bq-ilh6h.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/base-face-BYNJAADF.js">
16
16
  <link rel="stylesheet" crossorigin href="/assets/index-DBOh8_JS.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/grove",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "type": "module",
6
6
  "description": "Grove: conversations with agents that call your other Apps, for Oyster",
@@ -11,7 +11,7 @@
11
11
  "@fungi.computer/caps": "0.10.1",
12
12
  "@fungi.computer/knapsack": "0.4.9",
13
13
  "@fungi.computer/maosaico": "0.1.1",
14
- "@fungi.computer/parakeet": "0.11.2",
14
+ "@fungi.computer/parakeet": "0.11.3",
15
15
  "@fungi.computer/shiitake": "0.12.3",
16
16
  "@fungi.computer/sigils": "0.3.0",
17
17
  "@fungi.computer/sprite": "0.2.2",