@aws/agentcore 1.0.0-preview.1 → 1.0.0-preview.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 (32) hide show
  1. package/dist/agent-inspector/index.js +3 -4
  2. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +43 -15
  3. package/dist/assets/cdk/bin/cdk.ts +6 -1
  4. package/dist/assets/cdk/cdk.json +1 -1
  5. package/dist/assets/cdk/lib/cdk-stack.ts +18 -10
  6. package/dist/assets/evaluators/python-lambda/execution-role-policy.json +1 -1
  7. package/dist/assets/python/a2a/strands/capabilities/memory/session.py +6 -1
  8. package/dist/assets/python/agui/strands/capabilities/memory/session.py +6 -1
  9. package/dist/assets/python/http/strands/capabilities/memory/session.py +6 -1
  10. package/dist/cli/index.mjs +401 -395
  11. package/dist/schema/schemas/agent-env.d.ts +13 -0
  12. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  13. package/dist/schema/schemas/agent-env.js +20 -1
  14. package/dist/schema/schemas/agent-env.js.map +1 -1
  15. package/dist/schema/schemas/agentcore-project.d.ts +6 -0
  16. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  17. package/dist/schema/schemas/agentcore-project.js +1 -9
  18. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  19. package/dist/schema/schemas/aws-targets.d.ts +3 -0
  20. package/dist/schema/schemas/aws-targets.d.ts.map +1 -1
  21. package/dist/schema/schemas/aws-targets.js +1 -0
  22. package/dist/schema/schemas/aws-targets.js.map +1 -1
  23. package/dist/schema/schemas/deployed-state.d.ts +26 -0
  24. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  25. package/dist/schema/schemas/deployed-state.js +11 -1
  26. package/dist/schema/schemas/deployed-state.js.map +1 -1
  27. package/dist/schema/schemas/mcp.d.ts +2 -0
  28. package/dist/schema/schemas/mcp.d.ts.map +1 -1
  29. package/dist/schema/schemas/mcp.js +9 -1
  30. package/dist/schema/schemas/mcp.js.map +1 -1
  31. package/package.json +11 -6
  32. package/dist/agent-inspector/index.js.map +0 -1
@@ -231,7 +231,7 @@ Error generating stack: `+s.message+`
231
231
  *
232
232
  * This source code is licensed under the ISC license.
233
233
  * See the LICENSE file in the root directory of this source tree.
234
- */const Ox=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fy=ut("zap",Ox),Dx="_panel_1gqyj_1",Lx="_resizeHandle_1gqyj_11",Bx="_header_1gqyj_22",Ux="_headerLeft_1gqyj_32",Hx="_headerTitle_1gqyj_38",Ix="_headerActions_1gqyj_44",qx="_collapseToggle_1gqyj_50",Vx="_iconBtn_1gqyj_66",Gx="_spinning_1gqyj_86",Zx="_status_1gqyj_98",Yx="_body_1gqyj_103",Yn={panel:Dx,resizeHandle:Lx,header:Bx,headerLeft:Ux,headerTitle:Hx,headerActions:Ix,collapseToggle:qx,iconBtn:Vx,spinning:Gx,status:Zx,body:Yx},$x=300,Xx=150;function Lu({title:n,status:a,onRefresh:i,isRefreshing:r,titleExtra:u,defaultCollapsed:o=!1,defaultHeight:c=$x,children:h}){const[m,p]=B.useState(o),[v,y]=B.useState(c),x=B.useRef(o);B.useEffect(()=>{o!==x.current&&(x.current=o,p(o))},[o]);const b=B.useRef(null),E=B.useCallback(j=>{j.preventDefault();const O=j.clientY,S=v,R=J=>{const te=O-J.clientY;y(Math.max(Xx,S+te))},M=()=>{b.current=null,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",M),document.body.style.cursor="",document.body.style.userSelect=""};b.current={move:R,up:M},document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",R),document.addEventListener("mouseup",M)},[v]);return B.useEffect(()=>()=>{b.current&&(document.removeEventListener("mousemove",b.current.move),document.removeEventListener("mouseup",b.current.up),document.body.style.cursor="",document.body.style.userSelect="")},[]),g.jsxs("div",{className:Yn.panel,style:{height:m?"auto":v},children:[!m&&g.jsx("div",{className:Yn.resizeHandle,onMouseDown:E,role:"separator","aria-label":"Resize panel"}),g.jsxs("div",{className:Yn.header,children:[g.jsxs("div",{className:Yn.headerLeft,children:[g.jsxs("button",{className:Yn.collapseToggle,onClick:()=>p(j=>!j),"aria-label":"Toggle panel",children:[m?g.jsx(Al,{size:14}):g.jsx(il,{size:14}),g.jsx("span",{className:Yn.headerTitle,children:n}),u]}),a&&g.jsx("span",{className:Yn.status,children:a})]}),g.jsx("div",{className:Yn.headerActions,children:i&&g.jsx("button",{className:Yn.iconBtn,onClick:i,disabled:r,title:"Refresh","aria-label":`Refresh ${n}`,children:g.jsx(ud,{size:12,className:r?Yn.spinning:""})})})]}),!m&&g.jsx("div",{className:Yn.body,children:h})]})}const Qx="_error_1di92_1",Fx="_version_1di92_7",Kx="_body_1di92_13",Jx="_cardName_1di92_17",Px="_cardDesc_1di92_24",Wx="_section_1di92_30",eb="_sectionLabel_1di92_34",tb="_tags_1di92_43",nb="_tag_1di92_43",ab="_skillList_1di92_58",lb="_skillItem_1di92_64",ib="_skillName_1di92_73",rb="_skillDesc_1di92_80",sb="_skillTags_1di92_85",zt={error:Qx,version:Fx,body:Kx,cardName:Jx,cardDesc:Px,section:Wx,sectionLabel:eb,tags:tb,tag:nb,skillList:ab,skillItem:lb,skillName:ib,skillDesc:rb,skillTags:sb};function ub({card:n,isLoading:a,error:i,onRefresh:r}){var u,o,c;return!n&&!i&&!a?null:g.jsxs(Lu,{title:"A2A Agent Card",titleExtra:n!=null&&n.version?g.jsxs("span",{className:zt.version,children:["v",n.version]}):void 0,onRefresh:r,isRefreshing:a,children:[i&&g.jsx("div",{className:zt.error,children:i}),n&&g.jsxs("div",{className:zt.body,children:[n.name&&g.jsx("div",{className:zt.cardName,children:n.name}),n.description&&g.jsx("div",{className:zt.cardDesc,children:n.description}),g.jsxs("div",{className:zt.section,children:[g.jsx("div",{className:zt.sectionLabel,children:"Capabilities"}),g.jsxs("div",{className:zt.tags,children:[((u=n.capabilities)==null?void 0:u.streaming)&&g.jsx("span",{className:zt.tag,children:"streaming"}),(o=n.defaultInputModes)==null?void 0:o.map(h=>g.jsxs("span",{className:zt.tag,children:["input: ",h]},`in-${h}`)),(c=n.defaultOutputModes)==null?void 0:c.map(h=>g.jsxs("span",{className:zt.tag,children:["output: ",h]},`out-${h}`))]})]}),n.skills&&n.skills.length>0&&g.jsxs("div",{className:zt.section,children:[g.jsxs("div",{className:zt.sectionLabel,children:["Skills (",n.skills.length,")"]}),g.jsx("div",{className:zt.skillList,children:n.skills.map((h,m)=>g.jsxs("div",{className:zt.skillItem,children:[g.jsx("span",{className:zt.skillName,children:h.name??h.id??`Skill ${m+1}`}),h.description&&g.jsx("span",{className:zt.skillDesc,children:h.description}),h.tags&&h.tags.length>0&&g.jsx("div",{className:zt.skillTags,children:h.tags.map(p=>g.jsx("span",{className:zt.tag,children:p},p))})]},h.id??m))})]})]})]})}const ob="_area_1u9gx_1",cb="_row_1u9gx_8",fb="_textarea_1u9gx_16",db="_sendBtn_1u9gx_45",su={area:ob,row:cb,textarea:fb,sendBtn:db};function hb({isStreaming:n,isStarting:a,onSend:i}){const[r,u]=B.useState(""),o=B.useRef(null),c=!n&&!!r.trim(),h=v=>{u(v.target.value);const y=v.target;y.style.height="auto",y.style.height=Math.min(y.scrollHeight,160)+"px"},m=()=>{if(!c)return;const v=r.trim();u(""),o.current&&(o.current.style.height="auto"),i(v)},p=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),m())};return g.jsx("div",{className:su.area,children:g.jsxs("div",{className:su.row,children:[g.jsx("textarea",{className:su.textarea,ref:o,value:r,onChange:h,onKeyDown:p,placeholder:a?"Agent is starting...":"Enter a test prompt...",disabled:a,rows:1,autoFocus:!0}),g.jsx("button",{className:su.sendBtn,onClick:m,disabled:!c,"aria-label":"Send message",children:g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),g.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})})}const mb="_toolbar_1v9hb_1",pb="_agentSection_1v9hb_11",gb="_agentPicker_1v9hb_18",yb="_clickable_1v9hb_30",vb="_agentLabel_1v9hb_44",_b="_agentName_1v9hb_49",xb="_starting_1v9hb_53",bb="_chevron_1v9hb_59",Sb="_dropdown_1v9hb_64",kb="_dropdownItem_1v9hb_77",Tb="_active_1v9hb_101",Eb="_hasError_1v9hb_105",Nb="_dropdownName_1v9hb_110",Cb="_statusBadge_1v9hb_115",Ab="_status_running_1v9hb_125",wb="_status_starting_1v9hb_130",jb="_status_error_1v9hb_135",Mb="_status_idle_1v9hb_140",Rb="_dropdownMeta_1v9hb_145",zb="_rightSection_1v9hb_150",Ob="_errorText_1v9hb_157",Db="_sessionBadge_1v9hb_162",Lb="_newSessionBtn_1v9hb_183",Bb="_confirmOverlay_1v9hb_201",Ub="_confirmModal_1v9hb_211",Hb="_confirmTitle_1v9hb_220",Ib="_confirmMessage_1v9hb_227",qb="_confirmActions_1v9hb_234",Vb="_confirmBtn_1v9hb_240",Gb="_confirmBtnPrimary_1v9hb_255",Zb="_dropdownSeparator_1v9hb_265",Yb="_status_deployed_1v9hb_271",Ze={toolbar:mb,agentSection:pb,agentPicker:gb,clickable:yb,agentLabel:vb,agentName:_b,starting:xb,chevron:bb,dropdown:Sb,dropdownItem:kb,active:Tb,hasError:Eb,dropdownName:Nb,statusBadge:Cb,status_running:Ab,status_starting:wb,status_error:jb,status_idle:Mb,dropdownMeta:Rb,rightSection:zb,errorText:Ob,sessionBadge:Db,newSessionBtn:Lb,confirmOverlay:Bb,confirmModal:Ub,confirmTitle:Hb,confirmMessage:Ib,confirmActions:qb,confirmBtn:Vb,confirmBtnPrimary:Gb,dropdownSeparator:Zb,status_deployed:Yb};function $b(n,a,i,r,u){return u.has(n)?"error":n===a&&i?"starting":n===a&&r?"running":"idle"}const Xb={running:"Running",starting:"Starting",error:"Error",idle:"Idle"};function Qb({agents:n,harnesses:a,errors:i,selectedAgentName:r,selectedHarnessName:u,isStarting:o,isReady:c,startError:h,sessionId:m,onSelectAgent:p,onSelectHarness:v,onResetChat:y}){const[x,b]=B.useState(!1),[E,j]=B.useState(null),[O,S]=B.useState(null),[R,M]=B.useState(!1),J=B.useRef(null),te=new Map(i.map(W=>[W.name,W.message]));B.useEffect(()=>{if(!x)return;const W=ee=>{J.current&&!J.current.contains(ee.target)&&b(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[x]);const q=W=>{b(!1),(W!==r||u)&&(j(W),S(null))},ae=W=>{b(!1),W!==u&&(S(W),j(null))},de=E??O,ve=()=>{E?(p(E),j(null)):O&&(v(O),S(null))},L=()=>{j(null),S(null)},P=()=>{m&&navigator.clipboard.writeText(m).then(()=>{M(!0),setTimeout(()=>M(!1),1500)}).catch(()=>{})},$=u??r??(n.length===0&&a.length===0?"No agents":"Starting…"),fe=n.length+a.length>1;return g.jsxs("div",{className:Ze.toolbar,children:[g.jsxs("div",{className:Ze.agentSection,ref:J,children:[g.jsxs("button",{className:`${Ze.agentPicker} ${fe?Ze.clickable:""}`,onClick:fe?()=>b(W=>!W):void 0,disabled:!fe,title:fe?"Switch agent":void 0,children:[g.jsx("span",{className:Ze.agentLabel,children:"Chat with"}),g.jsx("span",{className:Ze.agentName,children:$}),o&&g.jsx("span",{className:Ze.starting,children:"starting…"}),fe&&g.jsx(il,{size:14,className:Ze.chevron})]}),x&&g.jsxs("div",{className:Ze.dropdown,children:[n.map(W=>{const ee=te.get(W.name),D=W.name===r&&!u,F=$b(W.name,r,o,c,te);return g.jsxs("button",{className:`${Ze.dropdownItem} ${D?Ze.active:""} ${ee?Ze.hasError:""}`,onClick:()=>q(W.name),disabled:!!ee||o,title:ee??void 0,children:[g.jsx("span",{className:Ze.dropdownName,children:W.name}),g.jsx("span",{className:`${Ze.statusBadge} ${Ze[`status_${F}`]}`,children:Xb[F]}),g.jsx("span",{className:Ze.dropdownMeta,children:W.buildType}),W.protocol&&g.jsx("span",{className:Ze.dropdownMeta,children:W.protocol})]},W.name)}),a.length>0&&n.length>0&&g.jsx("div",{className:Ze.dropdownSeparator}),a.map(W=>{const ee=W.name===u;return g.jsxs("button",{className:`${Ze.dropdownItem} ${ee?Ze.active:""}`,onClick:()=>ae(W.name),disabled:o,children:[g.jsx("span",{className:Ze.dropdownName,children:W.name}),g.jsx("span",{className:`${Ze.statusBadge} ${Ze.status_deployed}`,children:"Deployed"}),g.jsx("span",{className:Ze.dropdownMeta,children:"Harness"})]},`harness-${W.name}`)})]})]}),g.jsxs("div",{className:Ze.rightSection,children:[h&&g.jsx("span",{className:Ze.errorText,children:h}),m&&g.jsxs("button",{className:Ze.sessionBadge,onClick:P,title:`Session: ${m} (click to copy)`,children:["session: ",m.length>12?m.slice(0,12)+"…":m,R?g.jsx(Yy,{size:10}):g.jsx($y,{size:10})]}),m&&g.jsx("button",{className:Ze.newSessionBtn,onClick:y,title:"New session","aria-label":"Start new session",children:g.jsx(Cx,{size:12})})]}),de&&g.jsx("div",{className:Ze.confirmOverlay,onClick:L,children:g.jsxs("div",{className:Ze.confirmModal,onClick:W=>W.stopPropagation(),children:[g.jsx("div",{className:Ze.confirmTitle,children:"Switch agent?"}),g.jsxs("div",{className:Ze.confirmMessage,children:["Switching to ",g.jsx("strong",{children:de})," will clear your current conversation history."]}),g.jsxs("div",{className:Ze.confirmActions,children:[g.jsx("button",{className:Ze.confirmBtn,onClick:L,children:"Cancel"}),g.jsx("button",{className:`${Ze.confirmBtn} ${Ze.confirmBtnPrimary}`,onClick:ve,children:"Switch"})]})]})})]})}const Fb="_fields_pg374_1",Kb="_field_pg374_1",Jb="_fieldLabel_pg374_15",Pb="_fieldDescription_pg374_21",Wb="_fieldHint_pg374_27",eS="_sectionLabel_pg374_32",tS="_modelRow_pg374_41",nS="_input_pg374_46",aS="_select_pg374_47",lS="_textarea_pg374_58",Qe={fields:Fb,field:Kb,fieldLabel:Jb,fieldDescription:Pb,fieldHint:Wb,sectionLabel:eS,modelRow:tS,input:nS,select:aS,textarea:lS},iS=n=>n==="openai"||n==="gemini";function rS({overrides:n,onChange:a}){const[i,r]=B.useState("bedrock"),[u,o]=B.useState(""),[c,h]=B.useState(""),m=(v,y,x)=>{if(r(v),o(y),h(x),!y){a({...n,model:void 0});return}const b={};v==="bedrock"?b.bedrockModelConfig={modelId:y}:v==="openai"?b.openAiModelConfig={modelId:y,apiKeyArn:x||void 0}:v==="gemini"&&(b.geminiModelConfig={modelId:y,apiKeyArn:x||void 0}),a({...n,model:b})},p=(n.skills??[]).join(", ");return g.jsx(Lu,{title:"Harness Settings",defaultCollapsed:!0,children:g.jsxs("div",{className:Qe.fields,children:[g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Model Provider"}),g.jsxs("div",{className:Qe.modelRow,children:[g.jsxs("select",{className:Qe.select,value:i,onChange:v=>m(v.target.value,u,c),children:[g.jsx("option",{value:"bedrock",children:"Bedrock"}),g.jsx("option",{value:"openai",children:"OpenAI"}),g.jsx("option",{value:"gemini",children:"Gemini"})]}),g.jsx("input",{className:Qe.input,placeholder:"Optional — leave empty to use harness default",value:u,onChange:v=>m(i,v.target.value,c)})]}),iS(i)&&g.jsx("input",{className:Qe.input,placeholder:"Credential Provider ARN (API key)",value:c,onChange:v=>m(i,u,v.target.value)})]}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"System Prompt"}),g.jsx("textarea",{className:Qe.textarea,placeholder:"You are a helpful assistant.",value:n.systemPrompt??"",onChange:v=>a({...n,systemPrompt:v.target.value||void 0}),rows:3})]}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Skills"}),g.jsx("span",{className:Qe.fieldDescription,children:"Comma-separated skill paths"}),g.jsx("input",{className:Qe.input,placeholder:"E.g. .agent/skills/my-skill.md",value:p,onChange:v=>{const y=v.target.value,x=y?y.split(",").map(b=>b.trim()).filter(Boolean):[];a({...n,skills:x.length>0?x:void 0})}})]}),g.jsx("div",{className:Qe.sectionLabel,children:"Memory"}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Actor ID"}),g.jsx("span",{className:Qe.fieldDescription,children:"Override the actor ID used for memory retrieval in this session"}),g.jsx("input",{className:Qe.input,placeholder:"E.g. user-123",value:n.actorId??"",onChange:v=>a({...n,actorId:v.target.value||void 0})})]}),g.jsx("div",{className:Qe.sectionLabel,children:"Invocation limits"}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Max iterations"}),g.jsx("span",{className:Qe.fieldDescription,children:"Maximum number of iterations the harness can perform"}),g.jsx("input",{className:Qe.input,type:"number",placeholder:"Default: 75",value:n.maxIterations??"",onChange:v=>a({...n,maxIterations:v.target.value?Number(v.target.value):void 0})})]}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Timeout duration (seconds)"}),g.jsx("span",{className:Qe.fieldDescription,children:"Maximum time allowed for the harness to complete an invocation"}),g.jsx("input",{className:Qe.input,type:"number",placeholder:"Default: 3600",value:n.timeoutSeconds??"",onChange:v=>a({...n,timeoutSeconds:v.target.value?Number(v.target.value):void 0})}),g.jsx("span",{className:Qe.fieldHint,children:"Maximum: 86400 seconds"})]}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Max tokens"}),g.jsx("span",{className:Qe.fieldDescription,children:"Maximum number of output tokens per invocation"}),g.jsx("input",{className:Qe.input,type:"number",placeholder:"E.g. 16384",value:n.maxTokens??"",onChange:v=>a({...n,maxTokens:v.target.value?Number(v.target.value):void 0})})]})]})})}const sS="_header_lggp3_1",uS="_title_lggp3_11",oS="_badge_lggp3_16",cS="_ready_lggp3_24",fS="_error_lggp3_29",dS="_rightGroup_lggp3_34",hS="_iconBtn_lggp3_41",mS="_iconBtnActive_lggp3_61",Wn={header:sS,title:uS,badge:oS,ready:cS,error:fS,rightGroup:dS,iconBtn:hS,iconBtnActive:mS};function pS({isConnected:n,hasConnected:a,hasError:i,onToggleResources:r,isResourcesOpen:u}){return g.jsxs("header",{className:Wn.header,children:[g.jsx("div",{className:Wn.title,children:"AgentCore agent inspector"}),g.jsx("div",{className:`${Wn.badge} ${i?Wn.error:n?Wn.ready:a?Wn.error:""}`,children:i?"Error":n?"Connected":a?"Disconnected":"Connecting"}),g.jsxs("div",{className:Wn.rightGroup,children:[g.jsx("a",{className:Wn.iconBtn,href:"https://github.com/aws/agentcore-cli/issues/new?template=bug_report.yml",target:"_blank",rel:"noopener noreferrer",title:"Report an issue","aria-label":"Report an issue",children:g.jsx(F0,{size:14})}),r&&g.jsx("button",{className:`${Wn.iconBtn} ${u?Wn.iconBtnActive:""}`,onClick:r,title:"Toggle resources","aria-label":"Toggle resource panel",children:g.jsx(yx,{size:14})})]})]})}const gS="_errorMessage_1up60_1",yS="_truncated_1up60_7",vS="_full_1up60_12",_S="_toggle_1up60_17",uu={errorMessage:gS,truncated:yS,full:vS,toggle:_S},Bg=300;function If({content:n}){const[a,i]=B.useState(!1),r=n.length>Bg;return g.jsxs("div",{className:uu.errorMessage,children:[g.jsx("span",{className:a||!r?uu.full:uu.truncated,children:a||!r?n:n.slice(0,Bg)+"…"}),r&&g.jsx("button",{className:uu.toggle,onClick:()=>i(u=>!u),children:a?"Show less":"Show more"})]})}const xS="_root_1x2ve_1",bS="_pill_1x2ve_5",SS="_cards_1x2ve_18",kS="_card_1x2ve_18",TS="_cardError_1x2ve_33",ES="_cardHeader_1x2ve_37",NS="_toolIcon_1x2ve_43",CS="_errorIcon_1x2ve_48",AS="_toolName_1x2ve_53",wS="_preview_1x2ve_60",jS="_spinner_1x2ve_70",MS="_toggle_1x2ve_84",RS="_json_1x2ve_100",zS="_jsonError_1x2ve_115",Gt={root:xS,pill:bS,cards:SS,card:kS,cardError:TS,cardHeader:ES,toolIcon:NS,errorIcon:CS,toolName:AS,preview:wS,spinner:jS,toggle:MS,json:RS,jsonError:zS};function Ug(n){if(!n)return null;try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}function OS(n,a=60){if(!n)return null;try{const i=JSON.parse(n),r=Object.values(i)[0];if(typeof r=="string")return r.length>a?r.slice(0,a)+"...":r}catch{}return n.length>a?n.slice(0,a)+"...":n}function DS({tool:n}){const[a,i]=B.useState(!1),[r,u]=B.useState(!1),o=n.resultStatus==="error",c=n.serverName?`${n.serverName}/${n.toolName}`:n.toolName,h=OS(n.input),m=Ug(n.input),p=Ug(n.result);return g.jsxs("div",{className:`${Gt.card} ${o?Gt.cardError:""}`,children:[g.jsxs("div",{className:Gt.cardHeader,children:[o?g.jsx(nx,{size:12,className:Gt.errorIcon}):g.jsx(wa,{size:12,className:Gt.toolIcon}),g.jsx("span",{className:Gt.toolName,children:c}),h&&g.jsx("span",{className:Gt.preview,children:h}),!n.result&&g.jsx(Xy,{size:12,className:Gt.spinner})]}),m&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{className:Gt.toggle,onClick:()=>i(v=>!v),children:[a?g.jsx(il,{size:12}):g.jsx(Al,{size:12}),"Input"]}),a&&g.jsx("pre",{className:Gt.json,children:m})]}),p&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{className:Gt.toggle,onClick:()=>u(v=>!v),children:[r?g.jsx(il,{size:12}):g.jsx(Al,{size:12}),"Result"]}),r&&g.jsx("pre",{className:`${Gt.json} ${o?Gt.jsonError:""}`,children:p})]})]})}function LS({toolExecutions:n}){const a=Object.entries(n);return a.length===0?null:g.jsxs("div",{className:Gt.root,children:[g.jsxs("div",{className:Gt.pill,children:[g.jsx(wa,{size:12}),a.length," tool",a.length===1?"":"s"," used"]}),g.jsx("div",{className:Gt.cards,children:a.map(([i,r])=>g.jsx(DS,{tool:r},i))})]})}function BS(n,a){const i={};return(n[n.length-1]===""?[...n,""]:n).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const US=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,IS={};function Hg(n,a){return(IS.jsx?HS:US).test(n)}const qS=/[ \t\n\f\r]/g;function VS(n){return typeof n=="object"?n.type==="text"?Ig(n.value):!1:Ig(n)}function Ig(n){return n.replace(qS,"")===""}class qr{constructor(a,i,r){this.normal=i,this.property=a,r&&(this.space=r)}}qr.prototype.normal={};qr.prototype.property={};qr.prototype.space=void 0;function Ky(n,a){const i={},r={};for(const u of n)Object.assign(i,u.property),Object.assign(r,u.normal);return new qr(i,r,a)}function qf(n){return n.toLowerCase()}class cn{constructor(a,i){this.attribute=i,this.property=a}}cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;let GS=0;const De=Ol(),wt=Ol(),Vf=Ol(),se=Ol(),gt=Ol(),Ei=Ol(),_n=Ol();function Ol(){return 2**++GS}const Gf=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:wt,commaOrSpaceSeparated:_n,commaSeparated:Ei,number:se,overloadedBoolean:Vf,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),yf=Object.keys(Gf);class cd extends cn{constructor(a,i,r,u){let o=-1;if(super(a,i),qg(this,"space",u),typeof r=="number")for(;++o<yf.length;){const c=yf[o];qg(this,yf[o],(r&Gf[c])===Gf[c])}}}cd.prototype.defined=!0;function qg(n,a,i){i&&(n[a]=i)}function Mi(n){const a={},i={};for(const[r,u]of Object.entries(n.properties)){const o=new cd(r,n.transform(n.attributes||{},r),u,n.space);n.mustUseProperty&&n.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),a[r]=o,i[qf(r)]=r,i[qf(o.attribute)]=r}return new qr(a,i,n.space)}const Jy=Mi({properties:{ariaActiveDescendant:null,ariaAtomic:wt,ariaAutoComplete:null,ariaBusy:wt,ariaChecked:wt,ariaColCount:se,ariaColIndex:se,ariaColSpan:se,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:wt,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:wt,ariaFlowTo:gt,ariaGrabbed:wt,ariaHasPopup:null,ariaHidden:wt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:se,ariaLive:null,ariaModal:wt,ariaMultiLine:wt,ariaMultiSelectable:wt,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:se,ariaPressed:wt,ariaReadOnly:wt,ariaRelevant:null,ariaRequired:wt,ariaRoleDescription:gt,ariaRowCount:se,ariaRowIndex:se,ariaRowSpan:se,ariaSelected:wt,ariaSetSize:se,ariaSort:null,ariaValueMax:se,ariaValueMin:se,ariaValueNow:se,ariaValueText:null,role:null},transform(n,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function Py(n,a){return a in n?n[a]:a}function Wy(n,a){return Py(n,a.toLowerCase())}const ZS=Mi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ei,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:De,allowPaymentRequest:De,allowUserMedia:De,alt:null,as:null,async:De,autoCapitalize:null,autoComplete:gt,autoFocus:De,autoPlay:De,blocking:gt,capture:null,charSet:null,checked:De,cite:null,className:gt,cols:se,colSpan:null,content:null,contentEditable:wt,controls:De,controlsList:gt,coords:se|Ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:De,defer:De,dir:null,dirName:null,disabled:De,download:Vf,draggable:wt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:De,formTarget:null,headers:gt,height:se,hidden:Vf,high:se,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:De,inputMode:null,integrity:null,is:null,isMap:De,itemId:null,itemProp:gt,itemRef:gt,itemScope:De,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:De,low:se,manifest:null,max:null,maxLength:se,media:null,method:null,min:null,minLength:se,multiple:De,muted:De,name:null,nonce:null,noModule:De,noValidate:De,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:De,optimum:se,pattern:null,ping:gt,placeholder:null,playsInline:De,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:De,referrerPolicy:null,rel:gt,required:De,reversed:De,rows:se,rowSpan:se,sandbox:gt,scope:null,scoped:De,seamless:De,selected:De,shadowRootClonable:De,shadowRootDelegatesFocus:De,shadowRootMode:null,shape:null,size:se,sizes:null,slot:null,span:se,spellCheck:wt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:se,step:null,style:null,tabIndex:se,target:null,title:null,translate:null,type:null,typeMustMatch:De,useMap:null,value:wt,width:se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:se,borderColor:null,bottomMargin:se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:De,declare:De,event:null,face:null,frame:null,frameBorder:null,hSpace:se,leftMargin:se,link:null,longDesc:null,lowSrc:null,marginHeight:se,marginWidth:se,noResize:De,noHref:De,noShade:De,noWrap:De,object:null,profile:null,prompt:null,rev:null,rightMargin:se,rules:null,scheme:null,scrolling:wt,standby:null,summary:null,text:null,topMargin:se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:De,disableRemotePlayback:De,prefix:null,property:null,results:se,security:null,unselectable:null},space:"html",transform:Wy}),YS=Mi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:_n,accentHeight:se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:se,amplitude:se,arabicForm:null,ascent:se,attributeName:null,attributeType:null,azimuth:se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:se,by:null,calcMode:null,capHeight:se,className:gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:se,diffuseConstant:se,direction:null,display:null,dur:null,divisor:se,dominantBaseline:null,download:De,dx:null,dy:null,edgeMode:null,editable:null,elevation:se,enableBackground:null,end:null,event:null,exponent:se,externalResourcesRequired:null,fill:null,fillOpacity:se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ei,g2:Ei,glyphName:Ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:se,horizOriginX:se,horizOriginY:se,id:null,ideographic:se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:se,k:se,k1:se,k2:se,k3:se,k4:se,kernelMatrix:_n,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:se,overlineThickness:se,paintOrder:null,panose1:null,path:null,pathLength:se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:se,pointsAtY:se,pointsAtZ:se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_n,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_n,rev:_n,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_n,requiredFeatures:_n,requiredFonts:_n,requiredFormats:_n,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:se,specularExponent:se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:se,strikethroughThickness:se,string:null,stroke:null,strokeDashArray:_n,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:se,strokeOpacity:se,strokeWidth:null,style:null,surfaceScale:se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_n,tabIndex:se,tableValues:null,target:null,targetX:se,targetY:se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_n,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:se,underlineThickness:se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:se,values:null,vAlphabetic:se,vMathematical:se,vectorEffect:null,vHanging:se,vIdeographic:se,version:null,vertAdvY:se,vertOriginX:se,vertOriginY:se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Py}),e1=Mi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,a){return"xlink:"+a.slice(5).toLowerCase()}}),t1=Mi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Wy}),n1=Mi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,a){return"xml:"+a.slice(3).toLowerCase()}}),$S={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},XS=/[A-Z]/g,Vg=/-[a-z]/g,QS=/^data[-\w.:]+$/i;function FS(n,a){const i=qf(a);let r=a,u=cn;if(i in n.normal)return n.property[n.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&QS.test(a)){if(a.charAt(4)==="-"){const o=a.slice(5).replace(Vg,JS);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=a.slice(4);if(!Vg.test(o)){let c=o.replace(XS,KS);c.charAt(0)!=="-"&&(c="-"+c),a="data"+c}}u=cd}return new u(r,a)}function KS(n){return"-"+n.toLowerCase()}function JS(n){return n.charAt(1).toUpperCase()}const PS=Ky([Jy,ZS,e1,t1,n1],"html"),fd=Ky([Jy,YS,e1,t1,n1],"svg");function WS(n){return n.join(" ").trim()}var bi={},vf,Gg;function e2(){if(Gg)return vf;Gg=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,i=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,u=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,h=/^\s+|\s+$/g,m=`
234
+ */const Ox=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fy=ut("zap",Ox),Dx="_panel_1gqyj_1",Lx="_resizeHandle_1gqyj_11",Bx="_header_1gqyj_22",Ux="_headerLeft_1gqyj_32",Hx="_headerTitle_1gqyj_38",Ix="_headerActions_1gqyj_44",qx="_collapseToggle_1gqyj_50",Vx="_iconBtn_1gqyj_66",Gx="_spinning_1gqyj_86",Zx="_status_1gqyj_98",Yx="_body_1gqyj_103",Yn={panel:Dx,resizeHandle:Lx,header:Bx,headerLeft:Ux,headerTitle:Hx,headerActions:Ix,collapseToggle:qx,iconBtn:Vx,spinning:Gx,status:Zx,body:Yx},$x=300,Xx=150;function Lu({title:n,status:a,onRefresh:i,isRefreshing:r,titleExtra:u,defaultCollapsed:o=!1,defaultHeight:c=$x,children:h}){const[m,p]=B.useState(o),[v,y]=B.useState(c),x=B.useRef(o);B.useEffect(()=>{o!==x.current&&(x.current=o,p(o))},[o]);const b=B.useRef(null),E=B.useCallback(j=>{j.preventDefault();const O=j.clientY,S=v,R=J=>{const te=O-J.clientY;y(Math.max(Xx,S+te))},M=()=>{b.current=null,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",M),document.body.style.cursor="",document.body.style.userSelect=""};b.current={move:R,up:M},document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",R),document.addEventListener("mouseup",M)},[v]);return B.useEffect(()=>()=>{b.current&&(document.removeEventListener("mousemove",b.current.move),document.removeEventListener("mouseup",b.current.up),document.body.style.cursor="",document.body.style.userSelect="")},[]),g.jsxs("div",{className:Yn.panel,style:{height:m?"auto":v},children:[!m&&g.jsx("div",{className:Yn.resizeHandle,onMouseDown:E,role:"separator","aria-label":"Resize panel"}),g.jsxs("div",{className:Yn.header,children:[g.jsxs("div",{className:Yn.headerLeft,children:[g.jsxs("button",{className:Yn.collapseToggle,onClick:()=>p(j=>!j),"aria-label":"Toggle panel",children:[m?g.jsx(Al,{size:14}):g.jsx(il,{size:14}),g.jsx("span",{className:Yn.headerTitle,children:n}),u]}),a&&g.jsx("span",{className:Yn.status,children:a})]}),g.jsx("div",{className:Yn.headerActions,children:i&&g.jsx("button",{className:Yn.iconBtn,onClick:i,disabled:r,title:"Refresh","aria-label":`Refresh ${n}`,children:g.jsx(ud,{size:12,className:r?Yn.spinning:""})})})]}),!m&&g.jsx("div",{className:Yn.body,children:h})]})}const Qx="_error_1di92_1",Fx="_version_1di92_7",Kx="_body_1di92_13",Jx="_cardName_1di92_17",Px="_cardDesc_1di92_24",Wx="_section_1di92_30",eb="_sectionLabel_1di92_34",tb="_tags_1di92_43",nb="_tag_1di92_43",ab="_skillList_1di92_58",lb="_skillItem_1di92_64",ib="_skillName_1di92_73",rb="_skillDesc_1di92_80",sb="_skillTags_1di92_85",zt={error:Qx,version:Fx,body:Kx,cardName:Jx,cardDesc:Px,section:Wx,sectionLabel:eb,tags:tb,tag:nb,skillList:ab,skillItem:lb,skillName:ib,skillDesc:rb,skillTags:sb};function ub({card:n,isLoading:a,error:i,onRefresh:r}){var u,o,c;return!n&&!i&&!a?null:g.jsxs(Lu,{title:"A2A Agent Card",titleExtra:n!=null&&n.version?g.jsxs("span",{className:zt.version,children:["v",n.version]}):void 0,onRefresh:r,isRefreshing:a,children:[i&&g.jsx("div",{className:zt.error,children:i}),n&&g.jsxs("div",{className:zt.body,children:[n.name&&g.jsx("div",{className:zt.cardName,children:n.name}),n.description&&g.jsx("div",{className:zt.cardDesc,children:n.description}),g.jsxs("div",{className:zt.section,children:[g.jsx("div",{className:zt.sectionLabel,children:"Capabilities"}),g.jsxs("div",{className:zt.tags,children:[((u=n.capabilities)==null?void 0:u.streaming)&&g.jsx("span",{className:zt.tag,children:"streaming"}),(o=n.defaultInputModes)==null?void 0:o.map(h=>g.jsxs("span",{className:zt.tag,children:["input: ",h]},`in-${h}`)),(c=n.defaultOutputModes)==null?void 0:c.map(h=>g.jsxs("span",{className:zt.tag,children:["output: ",h]},`out-${h}`))]})]}),n.skills&&n.skills.length>0&&g.jsxs("div",{className:zt.section,children:[g.jsxs("div",{className:zt.sectionLabel,children:["Skills (",n.skills.length,")"]}),g.jsx("div",{className:zt.skillList,children:n.skills.map((h,m)=>g.jsxs("div",{className:zt.skillItem,children:[g.jsx("span",{className:zt.skillName,children:h.name??h.id??`Skill ${m+1}`}),h.description&&g.jsx("span",{className:zt.skillDesc,children:h.description}),h.tags&&h.tags.length>0&&g.jsx("div",{className:zt.skillTags,children:h.tags.map(p=>g.jsx("span",{className:zt.tag,children:p},p))})]},h.id??m))})]})]})]})}const ob="_area_1u9gx_1",cb="_row_1u9gx_8",fb="_textarea_1u9gx_16",db="_sendBtn_1u9gx_45",su={area:ob,row:cb,textarea:fb,sendBtn:db};function hb({isStreaming:n,isStarting:a,onSend:i}){const[r,u]=B.useState(""),o=B.useRef(null),c=!n&&!!r.trim(),h=v=>{u(v.target.value);const y=v.target;y.style.height="auto",y.style.height=Math.min(y.scrollHeight,160)+"px"},m=()=>{if(!c)return;const v=r.trim();u(""),o.current&&(o.current.style.height="auto"),i(v)},p=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),m())};return g.jsx("div",{className:su.area,children:g.jsxs("div",{className:su.row,children:[g.jsx("textarea",{className:su.textarea,ref:o,value:r,onChange:h,onKeyDown:p,placeholder:a?"Agent is starting...":"Enter a test prompt...",disabled:a,rows:1,autoFocus:!0,"aria-label":"Chat input","data-testid":"chat-input"}),g.jsx("button",{className:su.sendBtn,onClick:m,disabled:!c,"aria-label":"Send message",children:g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),g.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})})}const mb="_toolbar_1v9hb_1",pb="_agentSection_1v9hb_11",gb="_agentPicker_1v9hb_18",yb="_clickable_1v9hb_30",vb="_agentLabel_1v9hb_44",_b="_agentName_1v9hb_49",xb="_starting_1v9hb_53",bb="_chevron_1v9hb_59",Sb="_dropdown_1v9hb_64",kb="_dropdownItem_1v9hb_77",Tb="_active_1v9hb_101",Eb="_hasError_1v9hb_105",Nb="_dropdownName_1v9hb_110",Cb="_statusBadge_1v9hb_115",Ab="_status_running_1v9hb_125",wb="_status_starting_1v9hb_130",jb="_status_error_1v9hb_135",Mb="_status_idle_1v9hb_140",Rb="_dropdownMeta_1v9hb_145",zb="_rightSection_1v9hb_150",Ob="_errorText_1v9hb_157",Db="_sessionBadge_1v9hb_162",Lb="_newSessionBtn_1v9hb_183",Bb="_confirmOverlay_1v9hb_201",Ub="_confirmModal_1v9hb_211",Hb="_confirmTitle_1v9hb_220",Ib="_confirmMessage_1v9hb_227",qb="_confirmActions_1v9hb_234",Vb="_confirmBtn_1v9hb_240",Gb="_confirmBtnPrimary_1v9hb_255",Zb="_dropdownSeparator_1v9hb_265",Yb="_status_deployed_1v9hb_271",Ze={toolbar:mb,agentSection:pb,agentPicker:gb,clickable:yb,agentLabel:vb,agentName:_b,starting:xb,chevron:bb,dropdown:Sb,dropdownItem:kb,active:Tb,hasError:Eb,dropdownName:Nb,statusBadge:Cb,status_running:Ab,status_starting:wb,status_error:jb,status_idle:Mb,dropdownMeta:Rb,rightSection:zb,errorText:Ob,sessionBadge:Db,newSessionBtn:Lb,confirmOverlay:Bb,confirmModal:Ub,confirmTitle:Hb,confirmMessage:Ib,confirmActions:qb,confirmBtn:Vb,confirmBtnPrimary:Gb,dropdownSeparator:Zb,status_deployed:Yb};function $b(n,a,i,r,u){return u.has(n)?"error":n===a&&i?"starting":n===a&&r?"running":"idle"}const Xb={running:"Running",starting:"Starting",error:"Error",idle:"Idle"};function Qb({agents:n,harnesses:a,errors:i,selectedAgentName:r,selectedHarnessName:u,isStarting:o,isReady:c,startError:h,sessionId:m,onSelectAgent:p,onSelectHarness:v,onResetChat:y}){const[x,b]=B.useState(!1),[E,j]=B.useState(null),[O,S]=B.useState(null),[R,M]=B.useState(!1),J=B.useRef(null),te=new Map(i.map(W=>[W.name,W.message]));B.useEffect(()=>{if(!x)return;const W=ee=>{J.current&&!J.current.contains(ee.target)&&b(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[x]);const q=W=>{b(!1),(W!==r||u)&&(j(W),S(null))},ae=W=>{b(!1),W!==u&&(S(W),j(null))},de=E??O,ve=()=>{E?(p(E),j(null)):O&&(v(O),S(null))},L=()=>{j(null),S(null)},P=()=>{m&&navigator.clipboard.writeText(m).then(()=>{M(!0),setTimeout(()=>M(!1),1500)}).catch(()=>{})},$=u??r??(n.length===0&&a.length===0?"No agents":"Starting…"),fe=n.length+a.length>1;return g.jsxs("div",{className:Ze.toolbar,children:[g.jsxs("div",{className:Ze.agentSection,ref:J,children:[g.jsxs("button",{className:`${Ze.agentPicker} ${fe?Ze.clickable:""}`,onClick:fe?()=>b(W=>!W):void 0,disabled:!fe,title:fe?"Switch agent":void 0,"data-testid":"agent-selector",children:[g.jsx("span",{className:Ze.agentLabel,children:"Chat with"}),g.jsx("span",{className:Ze.agentName,"data-testid":"agent-status",children:$}),o&&g.jsx("span",{className:Ze.starting,children:"starting…"}),fe&&g.jsx(il,{size:14,className:Ze.chevron})]}),x&&g.jsxs("div",{className:Ze.dropdown,"data-testid":"agent-dropdown",children:[n.map(W=>{const ee=te.get(W.name),D=W.name===r&&!u,F=$b(W.name,r,o,c,te);return g.jsxs("button",{className:`${Ze.dropdownItem} ${D?Ze.active:""} ${ee?Ze.hasError:""}`,onClick:()=>q(W.name),disabled:!!ee||o,title:ee??void 0,"data-testid":`agent-option-${W.name}`,children:[g.jsx("span",{className:Ze.dropdownName,children:W.name}),g.jsx("span",{className:`${Ze.statusBadge} ${Ze[`status_${F}`]}`,children:Xb[F]}),g.jsx("span",{className:Ze.dropdownMeta,children:W.buildType}),W.protocol&&g.jsx("span",{className:Ze.dropdownMeta,children:W.protocol})]},W.name)}),a.length>0&&n.length>0&&g.jsx("div",{className:Ze.dropdownSeparator}),a.map(W=>{const ee=W.name===u;return g.jsxs("button",{className:`${Ze.dropdownItem} ${ee?Ze.active:""}`,onClick:()=>ae(W.name),disabled:o,children:[g.jsx("span",{className:Ze.dropdownName,children:W.name}),g.jsx("span",{className:`${Ze.statusBadge} ${Ze.status_deployed}`,children:"Deployed"}),g.jsx("span",{className:Ze.dropdownMeta,children:"Harness"})]},`harness-${W.name}`)})]})]}),g.jsxs("div",{className:Ze.rightSection,children:[h&&g.jsx("span",{className:Ze.errorText,children:h}),m&&g.jsxs("button",{className:Ze.sessionBadge,onClick:P,title:`Session: ${m} (click to copy)`,children:["session: ",m.length>12?m.slice(0,12)+"…":m,R?g.jsx(Yy,{size:10}):g.jsx($y,{size:10})]}),m&&g.jsx("button",{className:Ze.newSessionBtn,onClick:y,title:"New session","aria-label":"Start new session",children:g.jsx(Cx,{size:12})})]}),de&&g.jsx("div",{className:Ze.confirmOverlay,onClick:L,children:g.jsxs("div",{className:Ze.confirmModal,onClick:W=>W.stopPropagation(),children:[g.jsx("div",{className:Ze.confirmTitle,children:"Switch agent?"}),g.jsxs("div",{className:Ze.confirmMessage,children:["Switching to ",g.jsx("strong",{children:de})," will clear your current conversation history."]}),g.jsxs("div",{className:Ze.confirmActions,children:[g.jsx("button",{className:Ze.confirmBtn,onClick:L,children:"Cancel"}),g.jsx("button",{className:`${Ze.confirmBtn} ${Ze.confirmBtnPrimary}`,onClick:ve,children:"Switch"})]})]})})]})}const Fb="_fields_pg374_1",Kb="_field_pg374_1",Jb="_fieldLabel_pg374_15",Pb="_fieldDescription_pg374_21",Wb="_fieldHint_pg374_27",eS="_sectionLabel_pg374_32",tS="_modelRow_pg374_41",nS="_input_pg374_46",aS="_select_pg374_47",lS="_textarea_pg374_58",Qe={fields:Fb,field:Kb,fieldLabel:Jb,fieldDescription:Pb,fieldHint:Wb,sectionLabel:eS,modelRow:tS,input:nS,select:aS,textarea:lS},iS=n=>n==="openai"||n==="gemini";function rS({overrides:n,onChange:a}){const[i,r]=B.useState("bedrock"),[u,o]=B.useState(""),[c,h]=B.useState(""),m=(v,y,x)=>{if(r(v),o(y),h(x),!y){a({...n,model:void 0});return}const b={};v==="bedrock"?b.bedrockModelConfig={modelId:y}:v==="openai"?b.openAiModelConfig={modelId:y,apiKeyArn:x||void 0}:v==="gemini"&&(b.geminiModelConfig={modelId:y,apiKeyArn:x||void 0}),a({...n,model:b})},p=(n.skills??[]).join(", ");return g.jsx(Lu,{title:"Harness Settings",defaultCollapsed:!0,children:g.jsxs("div",{className:Qe.fields,children:[g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Model Provider"}),g.jsxs("div",{className:Qe.modelRow,children:[g.jsxs("select",{className:Qe.select,value:i,onChange:v=>m(v.target.value,u,c),children:[g.jsx("option",{value:"bedrock",children:"Bedrock"}),g.jsx("option",{value:"openai",children:"OpenAI"}),g.jsx("option",{value:"gemini",children:"Gemini"})]}),g.jsx("input",{className:Qe.input,placeholder:"Optional — leave empty to use harness default",value:u,onChange:v=>m(i,v.target.value,c)})]}),iS(i)&&g.jsx("input",{className:Qe.input,placeholder:"Credential Provider ARN (API key)",value:c,onChange:v=>m(i,u,v.target.value)})]}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"System Prompt"}),g.jsx("textarea",{className:Qe.textarea,placeholder:"You are a helpful assistant.",value:n.systemPrompt??"",onChange:v=>a({...n,systemPrompt:v.target.value||void 0}),rows:3})]}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Skills"}),g.jsx("span",{className:Qe.fieldDescription,children:"Comma-separated skill paths"}),g.jsx("input",{className:Qe.input,placeholder:"E.g. .agent/skills/my-skill.md",value:p,onChange:v=>{const y=v.target.value,x=y?y.split(",").map(b=>b.trim()).filter(Boolean):[];a({...n,skills:x.length>0?x:void 0})}})]}),g.jsx("div",{className:Qe.sectionLabel,children:"Memory"}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Actor ID"}),g.jsx("span",{className:Qe.fieldDescription,children:"Override the actor ID used for memory retrieval in this session"}),g.jsx("input",{className:Qe.input,placeholder:"E.g. user-123",value:n.actorId??"",onChange:v=>a({...n,actorId:v.target.value||void 0})})]}),g.jsx("div",{className:Qe.sectionLabel,children:"Invocation limits"}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Max iterations"}),g.jsx("span",{className:Qe.fieldDescription,children:"Maximum number of iterations the harness can perform"}),g.jsx("input",{className:Qe.input,type:"number",placeholder:"Default: 75",value:n.maxIterations??"",onChange:v=>a({...n,maxIterations:v.target.value?Number(v.target.value):void 0})})]}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Timeout duration (seconds)"}),g.jsx("span",{className:Qe.fieldDescription,children:"Maximum time allowed for the harness to complete an invocation"}),g.jsx("input",{className:Qe.input,type:"number",placeholder:"Default: 3600",value:n.timeoutSeconds??"",onChange:v=>a({...n,timeoutSeconds:v.target.value?Number(v.target.value):void 0})}),g.jsx("span",{className:Qe.fieldHint,children:"Maximum: 86400 seconds"})]}),g.jsxs("div",{className:Qe.field,children:[g.jsx("label",{className:Qe.fieldLabel,children:"Max tokens"}),g.jsx("span",{className:Qe.fieldDescription,children:"Maximum number of output tokens per invocation"}),g.jsx("input",{className:Qe.input,type:"number",placeholder:"E.g. 16384",value:n.maxTokens??"",onChange:v=>a({...n,maxTokens:v.target.value?Number(v.target.value):void 0})})]})]})})}const sS="_header_lggp3_1",uS="_title_lggp3_11",oS="_badge_lggp3_16",cS="_ready_lggp3_24",fS="_error_lggp3_29",dS="_rightGroup_lggp3_34",hS="_iconBtn_lggp3_41",mS="_iconBtnActive_lggp3_61",Wn={header:sS,title:uS,badge:oS,ready:cS,error:fS,rightGroup:dS,iconBtn:hS,iconBtnActive:mS};function pS({isConnected:n,hasConnected:a,hasError:i,onToggleResources:r,isResourcesOpen:u}){return g.jsxs("header",{className:Wn.header,children:[g.jsx("div",{className:Wn.title,children:"AgentCore agent inspector"}),g.jsx("div",{className:`${Wn.badge} ${i?Wn.error:n?Wn.ready:a?Wn.error:""}`,children:i?"Error":n?"Connected":a?"Disconnected":"Connecting"}),g.jsxs("div",{className:Wn.rightGroup,children:[g.jsx("a",{className:Wn.iconBtn,href:"https://github.com/aws/agentcore-cli/issues/new?template=bug_report.yml",target:"_blank",rel:"noopener noreferrer",title:"Report an issue","aria-label":"Report an issue",children:g.jsx(F0,{size:14})}),r&&g.jsx("button",{className:`${Wn.iconBtn} ${u?Wn.iconBtnActive:""}`,onClick:r,title:"Toggle resources","aria-label":"Toggle resource panel",children:g.jsx(yx,{size:14})})]})]})}const gS="_errorMessage_1up60_1",yS="_truncated_1up60_7",vS="_full_1up60_12",_S="_toggle_1up60_17",uu={errorMessage:gS,truncated:yS,full:vS,toggle:_S},Bg=300;function If({content:n}){const[a,i]=B.useState(!1),r=n.length>Bg;return g.jsxs("div",{className:uu.errorMessage,children:[g.jsx("span",{className:a||!r?uu.full:uu.truncated,children:a||!r?n:n.slice(0,Bg)+"…"}),r&&g.jsx("button",{className:uu.toggle,onClick:()=>i(u=>!u),children:a?"Show less":"Show more"})]})}const xS="_root_1x2ve_1",bS="_pill_1x2ve_5",SS="_cards_1x2ve_18",kS="_card_1x2ve_18",TS="_cardError_1x2ve_33",ES="_cardHeader_1x2ve_37",NS="_toolIcon_1x2ve_43",CS="_errorIcon_1x2ve_48",AS="_toolName_1x2ve_53",wS="_preview_1x2ve_60",jS="_spinner_1x2ve_70",MS="_toggle_1x2ve_84",RS="_json_1x2ve_100",zS="_jsonError_1x2ve_115",Gt={root:xS,pill:bS,cards:SS,card:kS,cardError:TS,cardHeader:ES,toolIcon:NS,errorIcon:CS,toolName:AS,preview:wS,spinner:jS,toggle:MS,json:RS,jsonError:zS};function Ug(n){if(!n)return null;try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}function OS(n,a=60){if(!n)return null;try{const i=JSON.parse(n),r=Object.values(i)[0];if(typeof r=="string")return r.length>a?r.slice(0,a)+"...":r}catch{}return n.length>a?n.slice(0,a)+"...":n}function DS({tool:n}){const[a,i]=B.useState(!1),[r,u]=B.useState(!1),o=n.resultStatus==="error",c=n.serverName?`${n.serverName}/${n.toolName}`:n.toolName,h=OS(n.input),m=Ug(n.input),p=Ug(n.result);return g.jsxs("div",{className:`${Gt.card} ${o?Gt.cardError:""}`,children:[g.jsxs("div",{className:Gt.cardHeader,children:[o?g.jsx(nx,{size:12,className:Gt.errorIcon}):g.jsx(wa,{size:12,className:Gt.toolIcon}),g.jsx("span",{className:Gt.toolName,children:c}),h&&g.jsx("span",{className:Gt.preview,children:h}),!n.result&&g.jsx(Xy,{size:12,className:Gt.spinner})]}),m&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{className:Gt.toggle,onClick:()=>i(v=>!v),children:[a?g.jsx(il,{size:12}):g.jsx(Al,{size:12}),"Input"]}),a&&g.jsx("pre",{className:Gt.json,children:m})]}),p&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{className:Gt.toggle,onClick:()=>u(v=>!v),children:[r?g.jsx(il,{size:12}):g.jsx(Al,{size:12}),"Result"]}),r&&g.jsx("pre",{className:`${Gt.json} ${o?Gt.jsonError:""}`,children:p})]})]})}function LS({toolExecutions:n}){const a=Object.entries(n);return a.length===0?null:g.jsxs("div",{className:Gt.root,children:[g.jsxs("div",{className:Gt.pill,children:[g.jsx(wa,{size:12}),a.length," tool",a.length===1?"":"s"," used"]}),g.jsx("div",{className:Gt.cards,children:a.map(([i,r])=>g.jsx(DS,{tool:r},i))})]})}function BS(n,a){const i={};return(n[n.length-1]===""?[...n,""]:n).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const US=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,IS={};function Hg(n,a){return(IS.jsx?HS:US).test(n)}const qS=/[ \t\n\f\r]/g;function VS(n){return typeof n=="object"?n.type==="text"?Ig(n.value):!1:Ig(n)}function Ig(n){return n.replace(qS,"")===""}class qr{constructor(a,i,r){this.normal=i,this.property=a,r&&(this.space=r)}}qr.prototype.normal={};qr.prototype.property={};qr.prototype.space=void 0;function Ky(n,a){const i={},r={};for(const u of n)Object.assign(i,u.property),Object.assign(r,u.normal);return new qr(i,r,a)}function qf(n){return n.toLowerCase()}class cn{constructor(a,i){this.attribute=i,this.property=a}}cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;let GS=0;const De=Ol(),wt=Ol(),Vf=Ol(),se=Ol(),gt=Ol(),Ei=Ol(),_n=Ol();function Ol(){return 2**++GS}const Gf=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:wt,commaOrSpaceSeparated:_n,commaSeparated:Ei,number:se,overloadedBoolean:Vf,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),yf=Object.keys(Gf);class cd extends cn{constructor(a,i,r,u){let o=-1;if(super(a,i),qg(this,"space",u),typeof r=="number")for(;++o<yf.length;){const c=yf[o];qg(this,yf[o],(r&Gf[c])===Gf[c])}}}cd.prototype.defined=!0;function qg(n,a,i){i&&(n[a]=i)}function Mi(n){const a={},i={};for(const[r,u]of Object.entries(n.properties)){const o=new cd(r,n.transform(n.attributes||{},r),u,n.space);n.mustUseProperty&&n.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),a[r]=o,i[qf(r)]=r,i[qf(o.attribute)]=r}return new qr(a,i,n.space)}const Jy=Mi({properties:{ariaActiveDescendant:null,ariaAtomic:wt,ariaAutoComplete:null,ariaBusy:wt,ariaChecked:wt,ariaColCount:se,ariaColIndex:se,ariaColSpan:se,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:wt,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:wt,ariaFlowTo:gt,ariaGrabbed:wt,ariaHasPopup:null,ariaHidden:wt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:se,ariaLive:null,ariaModal:wt,ariaMultiLine:wt,ariaMultiSelectable:wt,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:se,ariaPressed:wt,ariaReadOnly:wt,ariaRelevant:null,ariaRequired:wt,ariaRoleDescription:gt,ariaRowCount:se,ariaRowIndex:se,ariaRowSpan:se,ariaSelected:wt,ariaSetSize:se,ariaSort:null,ariaValueMax:se,ariaValueMin:se,ariaValueNow:se,ariaValueText:null,role:null},transform(n,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function Py(n,a){return a in n?n[a]:a}function Wy(n,a){return Py(n,a.toLowerCase())}const ZS=Mi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ei,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:De,allowPaymentRequest:De,allowUserMedia:De,alt:null,as:null,async:De,autoCapitalize:null,autoComplete:gt,autoFocus:De,autoPlay:De,blocking:gt,capture:null,charSet:null,checked:De,cite:null,className:gt,cols:se,colSpan:null,content:null,contentEditable:wt,controls:De,controlsList:gt,coords:se|Ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:De,defer:De,dir:null,dirName:null,disabled:De,download:Vf,draggable:wt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:De,formTarget:null,headers:gt,height:se,hidden:Vf,high:se,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:De,inputMode:null,integrity:null,is:null,isMap:De,itemId:null,itemProp:gt,itemRef:gt,itemScope:De,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:De,low:se,manifest:null,max:null,maxLength:se,media:null,method:null,min:null,minLength:se,multiple:De,muted:De,name:null,nonce:null,noModule:De,noValidate:De,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:De,optimum:se,pattern:null,ping:gt,placeholder:null,playsInline:De,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:De,referrerPolicy:null,rel:gt,required:De,reversed:De,rows:se,rowSpan:se,sandbox:gt,scope:null,scoped:De,seamless:De,selected:De,shadowRootClonable:De,shadowRootDelegatesFocus:De,shadowRootMode:null,shape:null,size:se,sizes:null,slot:null,span:se,spellCheck:wt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:se,step:null,style:null,tabIndex:se,target:null,title:null,translate:null,type:null,typeMustMatch:De,useMap:null,value:wt,width:se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:se,borderColor:null,bottomMargin:se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:De,declare:De,event:null,face:null,frame:null,frameBorder:null,hSpace:se,leftMargin:se,link:null,longDesc:null,lowSrc:null,marginHeight:se,marginWidth:se,noResize:De,noHref:De,noShade:De,noWrap:De,object:null,profile:null,prompt:null,rev:null,rightMargin:se,rules:null,scheme:null,scrolling:wt,standby:null,summary:null,text:null,topMargin:se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:De,disableRemotePlayback:De,prefix:null,property:null,results:se,security:null,unselectable:null},space:"html",transform:Wy}),YS=Mi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:_n,accentHeight:se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:se,amplitude:se,arabicForm:null,ascent:se,attributeName:null,attributeType:null,azimuth:se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:se,by:null,calcMode:null,capHeight:se,className:gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:se,diffuseConstant:se,direction:null,display:null,dur:null,divisor:se,dominantBaseline:null,download:De,dx:null,dy:null,edgeMode:null,editable:null,elevation:se,enableBackground:null,end:null,event:null,exponent:se,externalResourcesRequired:null,fill:null,fillOpacity:se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ei,g2:Ei,glyphName:Ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:se,horizOriginX:se,horizOriginY:se,id:null,ideographic:se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:se,k:se,k1:se,k2:se,k3:se,k4:se,kernelMatrix:_n,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:se,overlineThickness:se,paintOrder:null,panose1:null,path:null,pathLength:se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:se,pointsAtY:se,pointsAtZ:se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_n,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_n,rev:_n,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_n,requiredFeatures:_n,requiredFonts:_n,requiredFormats:_n,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:se,specularExponent:se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:se,strikethroughThickness:se,string:null,stroke:null,strokeDashArray:_n,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:se,strokeOpacity:se,strokeWidth:null,style:null,surfaceScale:se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_n,tabIndex:se,tableValues:null,target:null,targetX:se,targetY:se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_n,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:se,underlineThickness:se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:se,values:null,vAlphabetic:se,vMathematical:se,vectorEffect:null,vHanging:se,vIdeographic:se,version:null,vertAdvY:se,vertOriginX:se,vertOriginY:se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Py}),e1=Mi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,a){return"xlink:"+a.slice(5).toLowerCase()}}),t1=Mi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Wy}),n1=Mi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,a){return"xml:"+a.slice(3).toLowerCase()}}),$S={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},XS=/[A-Z]/g,Vg=/-[a-z]/g,QS=/^data[-\w.:]+$/i;function FS(n,a){const i=qf(a);let r=a,u=cn;if(i in n.normal)return n.property[n.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&QS.test(a)){if(a.charAt(4)==="-"){const o=a.slice(5).replace(Vg,JS);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=a.slice(4);if(!Vg.test(o)){let c=o.replace(XS,KS);c.charAt(0)!=="-"&&(c="-"+c),a="data"+c}}u=cd}return new u(r,a)}function KS(n){return"-"+n.toLowerCase()}function JS(n){return n.charAt(1).toUpperCase()}const PS=Ky([Jy,ZS,e1,t1,n1],"html"),fd=Ky([Jy,YS,e1,t1,n1],"svg");function WS(n){return n.join(" ").trim()}var bi={},vf,Gg;function e2(){if(Gg)return vf;Gg=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,i=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,u=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,h=/^\s+|\s+$/g,m=`
235
235
  `,p="/",v="*",y="",x="comment",b="declaration";function E(O,S){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];S=S||{};var R=1,M=1;function J(W){var ee=W.match(a);ee&&(R+=ee.length);var D=W.lastIndexOf(m);M=~D?W.length-D:M+W.length}function te(){var W={line:R,column:M};return function(ee){return ee.position=new q(W),ve(),ee}}function q(W){this.start=W,this.end={line:R,column:M},this.source=S.source}q.prototype.content=O;function ae(W){var ee=new Error(S.source+":"+R+":"+M+": "+W);if(ee.reason=W,ee.filename=S.source,ee.line=R,ee.column=M,ee.source=O,!S.silent)throw ee}function de(W){var ee=W.exec(O);if(ee){var D=ee[0];return J(D),O=O.slice(D.length),ee}}function ve(){de(i)}function L(W){var ee;for(W=W||[];ee=P();)ee!==!1&&W.push(ee);return W}function P(){var W=te();if(!(p!=O.charAt(0)||v!=O.charAt(1))){for(var ee=2;y!=O.charAt(ee)&&(v!=O.charAt(ee)||p!=O.charAt(ee+1));)++ee;if(ee+=2,y===O.charAt(ee-1))return ae("End of comment missing");var D=O.slice(2,ee-2);return M+=2,J(D),O=O.slice(ee),M+=2,W({type:x,comment:D})}}function $(){var W=te(),ee=de(r);if(ee){if(P(),!de(u))return ae("property missing ':'");var D=de(o),F=W({type:b,property:j(ee[0].replace(n,y)),value:D?j(D[0].replace(n,y)):y});return de(c),F}}function fe(){var W=[];L(W);for(var ee;ee=$();)ee!==!1&&(W.push(ee),L(W));return W}return ve(),fe()}function j(O){return O?O.replace(h,y):y}return vf=E,vf}var Zg;function t2(){if(Zg)return bi;Zg=1;var n=bi&&bi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(bi,"__esModule",{value:!0}),bi.default=i;const a=n(e2());function i(r,u){let o=null;if(!r||typeof r!="string")return o;const c=(0,a.default)(r),h=typeof u=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:p,value:v}=m;h?u(p,v,m):v&&(o=o||{},o[p]=v)}),o}return bi}var Ar={},Yg;function n2(){if(Yg)return Ar;Yg=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,a=/-([a-z])/g,i=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,u=/^-(ms)-/,o=function(p){return!p||i.test(p)||n.test(p)},c=function(p,v){return v.toUpperCase()},h=function(p,v){return"".concat(v,"-")},m=function(p,v){return v===void 0&&(v={}),o(p)?p:(p=p.toLowerCase(),v.reactCompat?p=p.replace(u,h):p=p.replace(r,h),p.replace(a,c))};return Ar.camelCase=m,Ar}var wr,$g;function a2(){if($g)return wr;$g=1;var n=wr&&wr.__importDefault||function(u){return u&&u.__esModule?u:{default:u}},a=n(t2()),i=n2();function r(u,o){var c={};return!u||typeof u!="string"||(0,a.default)(u,function(h,m){h&&m&&(c[(0,i.camelCase)(h,o)]=m)}),c}return r.default=r,wr=r,wr}var l2=a2();const i2=Ou(l2),a1=l1("end"),dd=l1("start");function l1(n){return a;function a(i){const r=i&&i.position&&i.position[n]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function r2(n){const a=dd(n),i=a1(n);if(a&&i)return{start:a,end:i}}function Or(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?Xg(n.position):"start"in n||"end"in n?Xg(n):"line"in n||"column"in n?Zf(n):""}function Zf(n){return Qg(n&&n.line)+":"+Qg(n&&n.column)}function Xg(n){return Zf(n&&n.start)+"-"+Zf(n&&n.end)}function Qg(n){return n&&typeof n=="number"?n:1}class $t extends Error{constructor(a,i,r){super(),typeof i=="string"&&(r=i,i=void 0);let u="",o={},c=!1;if(i&&("line"in i&&"column"in i?o={place:i}:"start"in i&&"end"in i?o={place:i}:"type"in i?o={ancestors:[i],place:i.position}:o={...i}),typeof a=="string"?u=a:!o.cause&&a&&(c=!0,u=a.message,o.cause=a),!o.ruleId&&!o.source&&typeof r=="string"){const m=r.indexOf(":");m===-1?o.ruleId=r:(o.source=r.slice(0,m),o.ruleId=r.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const h=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=u,this.line=h?h.line:void 0,this.name=Or(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$t.prototype.file="";$t.prototype.name="";$t.prototype.reason="";$t.prototype.message="";$t.prototype.stack="";$t.prototype.column=void 0;$t.prototype.line=void 0;$t.prototype.ancestors=void 0;$t.prototype.cause=void 0;$t.prototype.fatal=void 0;$t.prototype.place=void 0;$t.prototype.ruleId=void 0;$t.prototype.source=void 0;const hd={}.hasOwnProperty,s2=new Map,u2=/[A-Z]/g,o2=new Set(["table","tbody","thead","tfoot","tr"]),c2=new Set(["td","th"]),i1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function f2(n,a){if(!a||a.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=a.filePath||void 0;let r;if(a.development){if(typeof a.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=_2(i,a.jsxDEV)}else{if(typeof a.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof a.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=v2(i,a.jsx,a.jsxs)}const u={Fragment:a.Fragment,ancestors:[],components:a.components||{},create:r,elementAttributeNameCase:a.elementAttributeNameCase||"react",evaluater:a.createEvaluater?a.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:a.ignoreInvalidStyle||!1,passKeys:a.passKeys!==!1,passNode:a.passNode||!1,schema:a.space==="svg"?fd:PS,stylePropertyNameCase:a.stylePropertyNameCase||"dom",tableCellAlignToStyle:a.tableCellAlignToStyle!==!1},o=r1(u,n,void 0);return o&&typeof o!="string"?o:u.create(n,u.Fragment,{children:o||void 0},void 0)}function r1(n,a,i){if(a.type==="element")return d2(n,a,i);if(a.type==="mdxFlowExpression"||a.type==="mdxTextExpression")return h2(n,a);if(a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement")return p2(n,a,i);if(a.type==="mdxjsEsm")return m2(n,a);if(a.type==="root")return g2(n,a,i);if(a.type==="text")return y2(n,a)}function d2(n,a,i){const r=n.schema;let u=r;a.tagName.toLowerCase()==="svg"&&r.space==="html"&&(u=fd,n.schema=u),n.ancestors.push(a);const o=u1(n,a.tagName,!1),c=x2(n,a);let h=pd(n,a);return o2.has(a.tagName)&&(h=h.filter(function(m){return typeof m=="string"?!VS(m):!0})),s1(n,c,o,a),md(c,h),n.ancestors.pop(),n.schema=r,n.create(a,o,c,i)}function h2(n,a){if(a.data&&a.data.estree&&n.evaluater){const r=a.data.estree.body[0];return r.type,n.evaluater.evaluateExpression(r.expression)}Br(n,a.position)}function m2(n,a){if(a.data&&a.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(a.data.estree);Br(n,a.position)}function p2(n,a,i){const r=n.schema;let u=r;a.name==="svg"&&r.space==="html"&&(u=fd,n.schema=u),n.ancestors.push(a);const o=a.name===null?n.Fragment:u1(n,a.name,!0),c=b2(n,a),h=pd(n,a);return s1(n,c,o,a),md(c,h),n.ancestors.pop(),n.schema=r,n.create(a,o,c,i)}function g2(n,a,i){const r={};return md(r,pd(n,a)),n.create(a,n.Fragment,r,i)}function y2(n,a){return a.value}function s1(n,a,i,r){typeof i!="string"&&i!==n.Fragment&&n.passNode&&(a.node=r)}function md(n,a){if(a.length>0){const i=a.length>1?a:a[0];i&&(n.children=i)}}function v2(n,a,i){return r;function r(u,o,c,h){const p=Array.isArray(c.children)?i:a;return h?p(o,c,h):p(o,c)}}function _2(n,a){return i;function i(r,u,o,c){const h=Array.isArray(o.children),m=dd(r);return a(u,o,c,h,{columnNumber:m?m.column-1:void 0,fileName:n,lineNumber:m?m.line:void 0},void 0)}}function x2(n,a){const i={};let r,u;for(u in a.properties)if(u!=="children"&&hd.call(a.properties,u)){const o=S2(n,u,a.properties[u]);if(o){const[c,h]=o;n.tableCellAlignToStyle&&c==="align"&&typeof h=="string"&&c2.has(a.tagName)?r=h:i[c]=h}}if(r){const o=i.style||(i.style={});o[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return i}function b2(n,a){const i={};for(const r of a.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&n.evaluater){const o=r.data.estree.body[0];o.type;const c=o.expression;c.type;const h=c.properties[0];h.type,Object.assign(i,n.evaluater.evaluateExpression(h.argument))}else Br(n,a.position);else{const u=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&n.evaluater){const h=r.value.data.estree.body[0];h.type,o=n.evaluater.evaluateExpression(h.expression)}else Br(n,a.position);else o=r.value===null?!0:r.value;i[u]=o}return i}function pd(n,a){const i=[];let r=-1;const u=n.passKeys?new Map:s2;for(;++r<a.children.length;){const o=a.children[r];let c;if(n.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const p=u.get(m)||0;c=m+"-"+p,u.set(m,p+1)}}const h=r1(n,o,c);h!==void 0&&i.push(h)}return i}function S2(n,a,i){const r=FS(n.schema,a);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=r.commaSeparated?BS(i):WS(i)),r.property==="style"){let u=typeof i=="object"?i:k2(n,String(i));return n.stylePropertyNameCase==="css"&&(u=T2(u)),["style",u]}return[n.elementAttributeNameCase==="react"&&r.space?$S[r.property]||r.property:r.attribute,i]}}function k2(n,a){try{return i2(a,{reactCompat:!0})}catch(i){if(n.ignoreInvalidStyle)return{};const r=i,u=new $t("Cannot parse `style` attribute",{ancestors:n.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw u.file=n.filePath||void 0,u.url=i1+"#cannot-parse-style-attribute",u}}function u1(n,a,i){let r;if(!i)r={type:"Literal",value:a};else if(a.includes(".")){const u=a.split(".");let o=-1,c;for(;++o<u.length;){const h=Hg(u[o])?{type:"Identifier",name:u[o]}:{type:"Literal",value:u[o]};c=c?{type:"MemberExpression",object:c,property:h,computed:!!(o&&h.type==="Literal"),optional:!1}:h}r=c}else r=Hg(a)&&!/^[a-z]/.test(a)?{type:"Identifier",name:a}:{type:"Literal",value:a};if(r.type==="Literal"){const u=r.value;return hd.call(n.components,u)?n.components[u]:u}if(n.evaluater)return n.evaluater.evaluateExpression(r);Br(n)}function Br(n,a){const i=new $t("Cannot handle MDX estrees without `createEvaluater`",{ancestors:n.ancestors,place:a,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=n.filePath||void 0,i.url=i1+"#cannot-handle-mdx-estrees-without-createevaluater",i}function T2(n){const a={};let i;for(i in n)hd.call(n,i)&&(a[E2(i)]=n[i]);return a}function E2(n){let a=n.replace(u2,N2);return a.slice(0,3)==="ms-"&&(a="-"+a),a}function N2(n){return"-"+n.toLowerCase()}const _f={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},C2={};function gd(n,a){const i=C2,r=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,u=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return o1(n,r,u)}function o1(n,a,i){if(A2(n)){if("value"in n)return n.type==="html"&&!i?"":n.value;if(a&&"alt"in n&&n.alt)return n.alt;if("children"in n)return Fg(n.children,a,i)}return Array.isArray(n)?Fg(n,a,i):""}function Fg(n,a,i){const r=[];let u=-1;for(;++u<n.length;)r[u]=o1(n[u],a,i);return r.join("")}function A2(n){return!!(n&&typeof n=="object")}const Kg=document.createElement("i");function yd(n){const a="&"+n+";";Kg.innerHTML=a;const i=Kg.textContent;return i.charCodeAt(i.length-1)===59&&n!=="semi"||i===a?!1:i}function bn(n,a,i,r){const u=n.length;let o=0,c;if(a<0?a=-a>u?0:u+a:a=a>u?u:a,i=i>0?i:0,r.length<1e4)c=Array.from(r),c.unshift(a,i),n.splice(...c);else for(i&&n.splice(a,i);o<r.length;)c=r.slice(o,o+1e4),c.unshift(a,0),n.splice(...c),o+=1e4,a+=1e4}function Un(n,a){return n.length>0?(bn(n,n.length,0,a),n):a}const Jg={}.hasOwnProperty;function c1(n){const a={};let i=-1;for(;++i<n.length;)w2(a,n[i]);return a}function w2(n,a){let i;for(i in a){const u=(Jg.call(n,i)?n[i]:void 0)||(n[i]={}),o=a[i];let c;if(o)for(c in o){Jg.call(u,c)||(u[c]=[]);const h=o[c];j2(u[c],Array.isArray(h)?h:h?[h]:[])}}}function j2(n,a){let i=-1;const r=[];for(;++i<a.length;)(a[i].add==="after"?n:r).push(a[i]);bn(n,0,0,r)}function f1(n,a){const i=Number.parseInt(n,a);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function $n(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Jt=sl(/[A-Za-z]/),Yt=sl(/[\dA-Za-z]/),M2=sl(/[#-'*+\--9=?A-Z^-~]/);function _u(n){return n!==null&&(n<32||n===127)}const Yf=sl(/\d/),R2=sl(/[\dA-Fa-f]/),z2=sl(/[!-/:-@[-`{-~]/);function ke(n){return n!==null&&n<-2}function pt(n){return n!==null&&(n<0||n===32)}function Ie(n){return n===-2||n===-1||n===32}const Bu=sl(new RegExp("\\p{P}|\\p{S}","u")),wl=sl(/\s/);function sl(n){return a;function a(i){return i!==null&&i>-1&&n.test(String.fromCharCode(i))}}function Ri(n){const a=[];let i=-1,r=0,u=0;for(;++i<n.length;){const o=n.charCodeAt(i);let c="";if(o===37&&Yt(n.charCodeAt(i+1))&&Yt(n.charCodeAt(i+2)))u=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const h=n.charCodeAt(i+1);o<56320&&h>56319&&h<57344?(c=String.fromCharCode(o,h),u=1):c="�"}else c=String.fromCharCode(o);c&&(a.push(n.slice(r,i),encodeURIComponent(c)),r=i+u+1,c=""),u&&(i+=u,u=0)}return a.join("")+n.slice(r)}function Xe(n,a,i,r){const u=r?r-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return Ie(m)?(n.enter(i),h(m)):a(m)}function h(m){return Ie(m)&&o++<u?(n.consume(m),h):(n.exit(i),a(m))}}const O2={tokenize:D2};function D2(n){const a=n.attempt(this.parser.constructs.contentInitial,r,u);let i;return a;function r(h){if(h===null){n.consume(h);return}return n.enter("lineEnding"),n.consume(h),n.exit("lineEnding"),Xe(n,a,"linePrefix")}function u(h){return n.enter("paragraph"),o(h)}function o(h){const m=n.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=m),i=m,c(h)}function c(h){if(h===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(h);return}return ke(h)?(n.consume(h),n.exit("chunkText"),o):(n.consume(h),c)}}const L2={tokenize:B2},Pg={tokenize:U2};function B2(n){const a=this,i=[];let r=0,u,o,c;return h;function h(M){if(r<i.length){const J=i[r];return a.containerState=J[1],n.attempt(J[0].continuation,m,p)(M)}return p(M)}function m(M){if(r++,a.containerState._closeFlow){a.containerState._closeFlow=void 0,u&&R();const J=a.events.length;let te=J,q;for(;te--;)if(a.events[te][0]==="exit"&&a.events[te][1].type==="chunkFlow"){q=a.events[te][1].end;break}S(r);let ae=J;for(;ae<a.events.length;)a.events[ae][1].end={...q},ae++;return bn(a.events,te+1,0,a.events.slice(J)),a.events.length=ae,p(M)}return h(M)}function p(M){if(r===i.length){if(!u)return x(M);if(u.currentConstruct&&u.currentConstruct.concrete)return E(M);a.interrupt=!!(u.currentConstruct&&!u._gfmTableDynamicInterruptHack)}return a.containerState={},n.check(Pg,v,y)(M)}function v(M){return u&&R(),S(r),x(M)}function y(M){return a.parser.lazy[a.now().line]=r!==i.length,c=a.now().offset,E(M)}function x(M){return a.containerState={},n.attempt(Pg,b,E)(M)}function b(M){return r++,i.push([a.currentConstruct,a.containerState]),x(M)}function E(M){if(M===null){u&&R(),S(0),n.consume(M);return}return u=u||a.parser.flow(a.now()),n.enter("chunkFlow",{_tokenizer:u,contentType:"flow",previous:o}),j(M)}function j(M){if(M===null){O(n.exit("chunkFlow"),!0),S(0),n.consume(M);return}return ke(M)?(n.consume(M),O(n.exit("chunkFlow")),r=0,a.interrupt=void 0,h):(n.consume(M),j)}function O(M,J){const te=a.sliceStream(M);if(J&&te.push(null),M.previous=o,o&&(o.next=M),o=M,u.defineSkip(M.start),u.write(te),a.parser.lazy[M.start.line]){let q=u.events.length;for(;q--;)if(u.events[q][1].start.offset<c&&(!u.events[q][1].end||u.events[q][1].end.offset>c))return;const ae=a.events.length;let de=ae,ve,L;for(;de--;)if(a.events[de][0]==="exit"&&a.events[de][1].type==="chunkFlow"){if(ve){L=a.events[de][1].end;break}ve=!0}for(S(r),q=ae;q<a.events.length;)a.events[q][1].end={...L},q++;bn(a.events,de+1,0,a.events.slice(ae)),a.events.length=q}}function S(M){let J=i.length;for(;J-- >M;){const te=i[J];a.containerState=te[1],te[0].exit.call(a,n)}i.length=M}function R(){u.write([null]),o=void 0,u=void 0,a.containerState._closeFlow=void 0}}function U2(n,a,i){return Xe(n,n.attempt(this.parser.constructs.document,a,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ci(n){if(n===null||pt(n)||wl(n))return 1;if(Bu(n))return 2}function Uu(n,a,i){const r=[];let u=-1;for(;++u<n.length;){const o=n[u].resolveAll;o&&!r.includes(o)&&(a=o(a,i),r.push(o))}return a}const $f={name:"attention",resolveAll:H2,tokenize:I2};function H2(n,a){let i=-1,r,u,o,c,h,m,p,v;for(;++i<n.length;)if(n[i][0]==="enter"&&n[i][1].type==="attentionSequence"&&n[i][1]._close){for(r=i;r--;)if(n[r][0]==="exit"&&n[r][1].type==="attentionSequence"&&n[r][1]._open&&a.sliceSerialize(n[r][1]).charCodeAt(0)===a.sliceSerialize(n[i][1]).charCodeAt(0)){if((n[r][1]._close||n[i][1]._open)&&(n[i][1].end.offset-n[i][1].start.offset)%3&&!((n[r][1].end.offset-n[r][1].start.offset+n[i][1].end.offset-n[i][1].start.offset)%3))continue;m=n[r][1].end.offset-n[r][1].start.offset>1&&n[i][1].end.offset-n[i][1].start.offset>1?2:1;const y={...n[r][1].end},x={...n[i][1].start};Wg(y,-m),Wg(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:y,end:{...n[r][1].end}},h={type:m>1?"strongSequence":"emphasisSequence",start:{...n[i][1].start},end:x},o={type:m>1?"strongText":"emphasisText",start:{...n[r][1].end},end:{...n[i][1].start}},u={type:m>1?"strong":"emphasis",start:{...c.start},end:{...h.end}},n[r][1].end={...c.start},n[i][1].start={...h.end},p=[],n[r][1].end.offset-n[r][1].start.offset&&(p=Un(p,[["enter",n[r][1],a],["exit",n[r][1],a]])),p=Un(p,[["enter",u,a],["enter",c,a],["exit",c,a],["enter",o,a]]),p=Un(p,Uu(a.parser.constructs.insideSpan.null,n.slice(r+1,i),a)),p=Un(p,[["exit",o,a],["enter",h,a],["exit",h,a],["exit",u,a]]),n[i][1].end.offset-n[i][1].start.offset?(v=2,p=Un(p,[["enter",n[i][1],a],["exit",n[i][1],a]])):v=0,bn(n,r-1,i-r+3,p),i=r+p.length-v-2;break}}for(i=-1;++i<n.length;)n[i][1].type==="attentionSequence"&&(n[i][1].type="data");return n}function I2(n,a){const i=this.parser.constructs.attentionMarkers.null,r=this.previous,u=Ci(r);let o;return c;function c(m){return o=m,n.enter("attentionSequence"),h(m)}function h(m){if(m===o)return n.consume(m),h;const p=n.exit("attentionSequence"),v=Ci(m),y=!v||v===2&&u||i.includes(m),x=!u||u===2&&v||i.includes(r);return p._open=!!(o===42?y:y&&(u||!x)),p._close=!!(o===42?x:x&&(v||!y)),a(m)}}function Wg(n,a){n.column+=a,n.offset+=a,n._bufferIndex+=a}const q2={name:"autolink",tokenize:V2};function V2(n,a,i){let r=0;return u;function u(b){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(b),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),o}function o(b){return Jt(b)?(n.consume(b),c):b===64?i(b):p(b)}function c(b){return b===43||b===45||b===46||Yt(b)?(r=1,h(b)):p(b)}function h(b){return b===58?(n.consume(b),r=0,m):(b===43||b===45||b===46||Yt(b))&&r++<32?(n.consume(b),h):(r=0,p(b))}function m(b){return b===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(b),n.exit("autolinkMarker"),n.exit("autolink"),a):b===null||b===32||b===60||_u(b)?i(b):(n.consume(b),m)}function p(b){return b===64?(n.consume(b),v):M2(b)?(n.consume(b),p):i(b)}function v(b){return Yt(b)?y(b):i(b)}function y(b){return b===46?(n.consume(b),r=0,v):b===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(b),n.exit("autolinkMarker"),n.exit("autolink"),a):x(b)}function x(b){if((b===45||Yt(b))&&r++<63){const E=b===45?x:y;return n.consume(b),E}return i(b)}}const Vr={partial:!0,tokenize:G2};function G2(n,a,i){return r;function r(o){return Ie(o)?Xe(n,u,"linePrefix")(o):u(o)}function u(o){return o===null||ke(o)?a(o):i(o)}}const d1={continuation:{tokenize:Y2},exit:$2,name:"blockQuote",tokenize:Z2};function Z2(n,a,i){const r=this;return u;function u(c){if(c===62){const h=r.containerState;return h.open||(n.enter("blockQuote",{_container:!0}),h.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(c),n.exit("blockQuoteMarker"),o}return i(c)}function o(c){return Ie(c)?(n.enter("blockQuotePrefixWhitespace"),n.consume(c),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),a):(n.exit("blockQuotePrefix"),a(c))}}function Y2(n,a,i){const r=this;return u;function u(c){return Ie(c)?Xe(n,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return n.attempt(d1,a,i)(c)}}function $2(n){n.exit("blockQuote")}const h1={name:"characterEscape",tokenize:X2};function X2(n,a,i){return r;function r(o){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(o),n.exit("escapeMarker"),u}function u(o){return z2(o)?(n.enter("characterEscapeValue"),n.consume(o),n.exit("characterEscapeValue"),n.exit("characterEscape"),a):i(o)}}const m1={name:"characterReference",tokenize:Q2};function Q2(n,a,i){const r=this;let u=0,o,c;return h;function h(y){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(y),n.exit("characterReferenceMarker"),m}function m(y){return y===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(y),n.exit("characterReferenceMarkerNumeric"),p):(n.enter("characterReferenceValue"),o=31,c=Yt,v(y))}function p(y){return y===88||y===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(y),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),o=6,c=R2,v):(n.enter("characterReferenceValue"),o=7,c=Yf,v(y))}function v(y){if(y===59&&u){const x=n.exit("characterReferenceValue");return c===Yt&&!yd(r.sliceSerialize(x))?i(y):(n.enter("characterReferenceMarker"),n.consume(y),n.exit("characterReferenceMarker"),n.exit("characterReference"),a)}return c(y)&&u++<o?(n.consume(y),v):i(y)}}const ey={partial:!0,tokenize:K2},ty={concrete:!0,name:"codeFenced",tokenize:F2};function F2(n,a,i){const r=this,u={partial:!0,tokenize:te};let o=0,c=0,h;return m;function m(q){return p(q)}function p(q){const ae=r.events[r.events.length-1];return o=ae&&ae[1].type==="linePrefix"?ae[2].sliceSerialize(ae[1],!0).length:0,h=q,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),v(q)}function v(q){return q===h?(c++,n.consume(q),v):c<3?i(q):(n.exit("codeFencedFenceSequence"),Ie(q)?Xe(n,y,"whitespace")(q):y(q))}function y(q){return q===null||ke(q)?(n.exit("codeFencedFence"),r.interrupt?a(q):n.check(ey,j,J)(q)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),x(q))}function x(q){return q===null||ke(q)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),y(q)):Ie(q)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),Xe(n,b,"whitespace")(q)):q===96&&q===h?i(q):(n.consume(q),x)}function b(q){return q===null||ke(q)?y(q):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),E(q))}function E(q){return q===null||ke(q)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),y(q)):q===96&&q===h?i(q):(n.consume(q),E)}function j(q){return n.attempt(u,J,O)(q)}function O(q){return n.enter("lineEnding"),n.consume(q),n.exit("lineEnding"),S}function S(q){return o>0&&Ie(q)?Xe(n,R,"linePrefix",o+1)(q):R(q)}function R(q){return q===null||ke(q)?n.check(ey,j,J)(q):(n.enter("codeFlowValue"),M(q))}function M(q){return q===null||ke(q)?(n.exit("codeFlowValue"),R(q)):(n.consume(q),M)}function J(q){return n.exit("codeFenced"),a(q)}function te(q,ae,de){let ve=0;return L;function L(ee){return q.enter("lineEnding"),q.consume(ee),q.exit("lineEnding"),P}function P(ee){return q.enter("codeFencedFence"),Ie(ee)?Xe(q,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ee):$(ee)}function $(ee){return ee===h?(q.enter("codeFencedFenceSequence"),fe(ee)):de(ee)}function fe(ee){return ee===h?(ve++,q.consume(ee),fe):ve>=c?(q.exit("codeFencedFenceSequence"),Ie(ee)?Xe(q,W,"whitespace")(ee):W(ee)):de(ee)}function W(ee){return ee===null||ke(ee)?(q.exit("codeFencedFence"),ae(ee)):de(ee)}}}function K2(n,a,i){const r=this;return u;function u(c){return c===null?i(c):(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),o)}function o(c){return r.parser.lazy[r.now().line]?i(c):a(c)}}const xf={name:"codeIndented",tokenize:P2},J2={partial:!0,tokenize:W2};function P2(n,a,i){const r=this;return u;function u(p){return n.enter("codeIndented"),Xe(n,o,"linePrefix",5)(p)}function o(p){const v=r.events[r.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?c(p):i(p)}function c(p){return p===null?m(p):ke(p)?n.attempt(J2,c,m)(p):(n.enter("codeFlowValue"),h(p))}function h(p){return p===null||ke(p)?(n.exit("codeFlowValue"),c(p)):(n.consume(p),h)}function m(p){return n.exit("codeIndented"),a(p)}}function W2(n,a,i){const r=this;return u;function u(c){return r.parser.lazy[r.now().line]?i(c):ke(c)?(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),u):Xe(n,o,"linePrefix",5)(c)}function o(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(c):ke(c)?u(c):i(c)}}const ek={name:"codeText",previous:nk,resolve:tk,tokenize:ak};function tk(n){let a=n.length-4,i=3,r,u;if((n[i][1].type==="lineEnding"||n[i][1].type==="space")&&(n[a][1].type==="lineEnding"||n[a][1].type==="space")){for(r=i;++r<a;)if(n[r][1].type==="codeTextData"){n[i][1].type="codeTextPadding",n[a][1].type="codeTextPadding",i+=2,a-=2;break}}for(r=i-1,a++;++r<=a;)u===void 0?r!==a&&n[r][1].type!=="lineEnding"&&(u=r):(r===a||n[r][1].type==="lineEnding")&&(n[u][1].type="codeTextData",r!==u+2&&(n[u][1].end=n[r-1][1].end,n.splice(u+2,r-u-2),a-=r-u-2,r=u+2),u=void 0);return n}function nk(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ak(n,a,i){let r=0,u,o;return c;function c(y){return n.enter("codeText"),n.enter("codeTextSequence"),h(y)}function h(y){return y===96?(n.consume(y),r++,h):(n.exit("codeTextSequence"),m(y))}function m(y){return y===null?i(y):y===32?(n.enter("space"),n.consume(y),n.exit("space"),m):y===96?(o=n.enter("codeTextSequence"),u=0,v(y)):ke(y)?(n.enter("lineEnding"),n.consume(y),n.exit("lineEnding"),m):(n.enter("codeTextData"),p(y))}function p(y){return y===null||y===32||y===96||ke(y)?(n.exit("codeTextData"),m(y)):(n.consume(y),p)}function v(y){return y===96?(n.consume(y),u++,v):u===r?(n.exit("codeTextSequence"),n.exit("codeText"),a(y)):(o.type="codeTextData",p(y))}}class lk{constructor(a){this.left=a?[...a]:[],this.right=[]}get(a){if(a<0||a>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+a+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return a<this.left.length?this.left[a]:this.right[this.right.length-a+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(a,i){const r=i??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(a,r):a>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-a+this.left.length).reverse():this.left.slice(a).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(a,i,r){const u=i||0;this.setCursor(Math.trunc(a));const o=this.right.splice(this.right.length-u,Number.POSITIVE_INFINITY);return r&&jr(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(a){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(a)}pushMany(a){this.setCursor(Number.POSITIVE_INFINITY),jr(this.left,a)}unshift(a){this.setCursor(0),this.right.push(a)}unshiftMany(a){this.setCursor(0),jr(this.right,a.reverse())}setCursor(a){if(!(a===this.left.length||a>this.left.length&&this.right.length===0||a<0&&this.left.length===0))if(a<this.left.length){const i=this.left.splice(a,Number.POSITIVE_INFINITY);jr(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-a,Number.POSITIVE_INFINITY);jr(this.left,i.reverse())}}}function jr(n,a){let i=0;if(a.length<1e4)n.push(...a);else for(;i<a.length;)n.push(...a.slice(i,i+1e4)),i+=1e4}function p1(n){const a={};let i=-1,r,u,o,c,h,m,p;const v=new lk(n);for(;++i<v.length;){for(;i in a;)i=a[i];if(r=v.get(i),i&&r[1].type==="chunkFlow"&&v.get(i-1)[1].type==="listItemPrefix"&&(m=r[1]._tokenizer.events,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(a,ik(v,i)),i=a[i],p=!0);else if(r[1]._container){for(o=i,u=void 0;o--;)if(c=v.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(u&&(v.get(u)[1].type="lineEndingBlank"),c[1].type="lineEnding",u=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;u&&(r[1].end={...v.get(u)[1].start},h=v.slice(u,i),h.unshift(r),v.splice(u,i-u+1,h))}}return bn(n,0,Number.POSITIVE_INFINITY,v.slice(0)),!p}function ik(n,a){const i=n.get(a)[1],r=n.get(a)[2];let u=a-1;const o=[];let c=i._tokenizer;c||(c=r.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const h=c.events,m=[],p={};let v,y,x=-1,b=i,E=0,j=0;const O=[j];for(;b;){for(;n.get(++u)[1]!==b;);o.push(u),b._tokenizer||(v=r.sliceStream(b),b.next||v.push(null),y&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(v),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),y=b,b=b.next}for(b=i;++x<h.length;)h[x][0]==="exit"&&h[x-1][0]==="enter"&&h[x][1].type===h[x-1][1].type&&h[x][1].start.line!==h[x][1].end.line&&(j=x+1,O.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):O.pop(),x=O.length;x--;){const S=h.slice(O[x],O[x+1]),R=o.pop();m.push([R,R+S.length-1]),n.splice(R,2,S)}for(m.reverse(),x=-1;++x<m.length;)p[E+m[x][0]]=E+m[x][1],E+=m[x][1]-m[x][0]-1;return p}const rk={resolve:uk,tokenize:ok},sk={partial:!0,tokenize:ck};function uk(n){return p1(n),n}function ok(n,a){let i;return r;function r(h){return n.enter("content"),i=n.enter("chunkContent",{contentType:"content"}),u(h)}function u(h){return h===null?o(h):ke(h)?n.check(sk,c,o)(h):(n.consume(h),u)}function o(h){return n.exit("chunkContent"),n.exit("content"),a(h)}function c(h){return n.consume(h),n.exit("chunkContent"),i.next=n.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,u}}function ck(n,a,i){const r=this;return u;function u(c){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),Xe(n,o,"linePrefix")}function o(c){if(c===null||ke(c))return i(c);const h=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(c):n.interrupt(r.parser.constructs.flow,i,a)(c)}}function g1(n,a,i,r,u,o,c,h,m){const p=m||Number.POSITIVE_INFINITY;let v=0;return y;function y(S){return S===60?(n.enter(r),n.enter(u),n.enter(o),n.consume(S),n.exit(o),x):S===null||S===32||S===41||_u(S)?i(S):(n.enter(r),n.enter(c),n.enter(h),n.enter("chunkString",{contentType:"string"}),j(S))}function x(S){return S===62?(n.enter(o),n.consume(S),n.exit(o),n.exit(u),n.exit(r),a):(n.enter(h),n.enter("chunkString",{contentType:"string"}),b(S))}function b(S){return S===62?(n.exit("chunkString"),n.exit(h),x(S)):S===null||S===60||ke(S)?i(S):(n.consume(S),S===92?E:b)}function E(S){return S===60||S===62||S===92?(n.consume(S),b):b(S)}function j(S){return!v&&(S===null||S===41||pt(S))?(n.exit("chunkString"),n.exit(h),n.exit(c),n.exit(r),a(S)):v<p&&S===40?(n.consume(S),v++,j):S===41?(n.consume(S),v--,j):S===null||S===32||S===40||_u(S)?i(S):(n.consume(S),S===92?O:j)}function O(S){return S===40||S===41||S===92?(n.consume(S),j):j(S)}}function y1(n,a,i,r,u,o){const c=this;let h=0,m;return p;function p(b){return n.enter(r),n.enter(u),n.consume(b),n.exit(u),n.enter(o),v}function v(b){return h>999||b===null||b===91||b===93&&!m||b===94&&!h&&"_hiddenFootnoteSupport"in c.parser.constructs?i(b):b===93?(n.exit(o),n.enter(u),n.consume(b),n.exit(u),n.exit(r),a):ke(b)?(n.enter("lineEnding"),n.consume(b),n.exit("lineEnding"),v):(n.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===null||b===91||b===93||ke(b)||h++>999?(n.exit("chunkString"),v(b)):(n.consume(b),m||(m=!Ie(b)),b===92?x:y)}function x(b){return b===91||b===92||b===93?(n.consume(b),h++,y):y(b)}}function v1(n,a,i,r,u,o){let c;return h;function h(x){return x===34||x===39||x===40?(n.enter(r),n.enter(u),n.consume(x),n.exit(u),c=x===40?41:x,m):i(x)}function m(x){return x===c?(n.enter(u),n.consume(x),n.exit(u),n.exit(r),a):(n.enter(o),p(x))}function p(x){return x===c?(n.exit(o),m(c)):x===null?i(x):ke(x)?(n.enter("lineEnding"),n.consume(x),n.exit("lineEnding"),Xe(n,p,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),v(x))}function v(x){return x===c||x===null||ke(x)?(n.exit("chunkString"),p(x)):(n.consume(x),x===92?y:v)}function y(x){return x===c||x===92?(n.consume(x),v):v(x)}}function Dr(n,a){let i;return r;function r(u){return ke(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),i=!0,r):Ie(u)?Xe(n,r,i?"linePrefix":"lineSuffix")(u):a(u)}}const fk={name:"definition",tokenize:hk},dk={partial:!0,tokenize:mk};function hk(n,a,i){const r=this;let u;return o;function o(b){return n.enter("definition"),c(b)}function c(b){return y1.call(r,n,h,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function h(b){return u=$n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(n.enter("definitionMarker"),n.consume(b),n.exit("definitionMarker"),m):i(b)}function m(b){return pt(b)?Dr(n,p)(b):p(b)}function p(b){return g1(n,v,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function v(b){return n.attempt(dk,y,y)(b)}function y(b){return Ie(b)?Xe(n,x,"whitespace")(b):x(b)}function x(b){return b===null||ke(b)?(n.exit("definition"),r.parser.defined.push(u),a(b)):i(b)}}function mk(n,a,i){return r;function r(h){return pt(h)?Dr(n,u)(h):i(h)}function u(h){return v1(n,o,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function o(h){return Ie(h)?Xe(n,c,"whitespace")(h):c(h)}function c(h){return h===null||ke(h)?a(h):i(h)}}const pk={name:"hardBreakEscape",tokenize:gk};function gk(n,a,i){return r;function r(o){return n.enter("hardBreakEscape"),n.consume(o),u}function u(o){return ke(o)?(n.exit("hardBreakEscape"),a(o)):i(o)}}const yk={name:"headingAtx",resolve:vk,tokenize:_k};function vk(n,a){let i=n.length-2,r=3,u,o;return n[r][1].type==="whitespace"&&(r+=2),i-2>r&&n[i][1].type==="whitespace"&&(i-=2),n[i][1].type==="atxHeadingSequence"&&(r===i-1||i-4>r&&n[i-2][1].type==="whitespace")&&(i-=r+1===i?2:4),i>r&&(u={type:"atxHeadingText",start:n[r][1].start,end:n[i][1].end},o={type:"chunkText",start:n[r][1].start,end:n[i][1].end,contentType:"text"},bn(n,r,i-r+1,[["enter",u,a],["enter",o,a],["exit",o,a],["exit",u,a]])),n}function _k(n,a,i){let r=0;return u;function u(v){return n.enter("atxHeading"),o(v)}function o(v){return n.enter("atxHeadingSequence"),c(v)}function c(v){return v===35&&r++<6?(n.consume(v),c):v===null||pt(v)?(n.exit("atxHeadingSequence"),h(v)):i(v)}function h(v){return v===35?(n.enter("atxHeadingSequence"),m(v)):v===null||ke(v)?(n.exit("atxHeading"),a(v)):Ie(v)?Xe(n,h,"whitespace")(v):(n.enter("atxHeadingText"),p(v))}function m(v){return v===35?(n.consume(v),m):(n.exit("atxHeadingSequence"),h(v))}function p(v){return v===null||v===35||pt(v)?(n.exit("atxHeadingText"),h(v)):(n.consume(v),p)}}const xk=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ny=["pre","script","style","textarea"],bk={concrete:!0,name:"htmlFlow",resolveTo:Tk,tokenize:Ek},Sk={partial:!0,tokenize:Ck},kk={partial:!0,tokenize:Nk};function Tk(n){let a=n.length;for(;a--&&!(n[a][0]==="enter"&&n[a][1].type==="htmlFlow"););return a>1&&n[a-2][1].type==="linePrefix"&&(n[a][1].start=n[a-2][1].start,n[a+1][1].start=n[a-2][1].start,n.splice(a-2,2)),n}function Ek(n,a,i){const r=this;let u,o,c,h,m;return p;function p(T){return v(T)}function v(T){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(T),y}function y(T){return T===33?(n.consume(T),x):T===47?(n.consume(T),o=!0,j):T===63?(n.consume(T),u=3,r.interrupt?a:N):Jt(T)?(n.consume(T),c=String.fromCharCode(T),O):i(T)}function x(T){return T===45?(n.consume(T),u=2,b):T===91?(n.consume(T),u=5,h=0,E):Jt(T)?(n.consume(T),u=4,r.interrupt?a:N):i(T)}function b(T){return T===45?(n.consume(T),r.interrupt?a:N):i(T)}function E(T){const U="CDATA[";return T===U.charCodeAt(h++)?(n.consume(T),h===U.length?r.interrupt?a:$:E):i(T)}function j(T){return Jt(T)?(n.consume(T),c=String.fromCharCode(T),O):i(T)}function O(T){if(T===null||T===47||T===62||pt(T)){const U=T===47,ie=c.toLowerCase();return!U&&!o&&ny.includes(ie)?(u=1,r.interrupt?a(T):$(T)):xk.includes(c.toLowerCase())?(u=6,U?(n.consume(T),S):r.interrupt?a(T):$(T)):(u=7,r.interrupt&&!r.parser.lazy[r.now().line]?i(T):o?R(T):M(T))}return T===45||Yt(T)?(n.consume(T),c+=String.fromCharCode(T),O):i(T)}function S(T){return T===62?(n.consume(T),r.interrupt?a:$):i(T)}function R(T){return Ie(T)?(n.consume(T),R):L(T)}function M(T){return T===47?(n.consume(T),L):T===58||T===95||Jt(T)?(n.consume(T),J):Ie(T)?(n.consume(T),M):L(T)}function J(T){return T===45||T===46||T===58||T===95||Yt(T)?(n.consume(T),J):te(T)}function te(T){return T===61?(n.consume(T),q):Ie(T)?(n.consume(T),te):M(T)}function q(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(n.consume(T),m=T,ae):Ie(T)?(n.consume(T),q):de(T)}function ae(T){return T===m?(n.consume(T),m=null,ve):T===null||ke(T)?i(T):(n.consume(T),ae)}function de(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||pt(T)?te(T):(n.consume(T),de)}function ve(T){return T===47||T===62||Ie(T)?M(T):i(T)}function L(T){return T===62?(n.consume(T),P):i(T)}function P(T){return T===null||ke(T)?$(T):Ie(T)?(n.consume(T),P):i(T)}function $(T){return T===45&&u===2?(n.consume(T),D):T===60&&u===1?(n.consume(T),F):T===62&&u===4?(n.consume(T),A):T===63&&u===3?(n.consume(T),N):T===93&&u===5?(n.consume(T),ne):ke(T)&&(u===6||u===7)?(n.exit("htmlFlowData"),n.check(Sk,Z,fe)(T)):T===null||ke(T)?(n.exit("htmlFlowData"),fe(T)):(n.consume(T),$)}function fe(T){return n.check(kk,W,Z)(T)}function W(T){return n.enter("lineEnding"),n.consume(T),n.exit("lineEnding"),ee}function ee(T){return T===null||ke(T)?fe(T):(n.enter("htmlFlowData"),$(T))}function D(T){return T===45?(n.consume(T),N):$(T)}function F(T){return T===47?(n.consume(T),c="",ue):$(T)}function ue(T){if(T===62){const U=c.toLowerCase();return ny.includes(U)?(n.consume(T),A):$(T)}return Jt(T)&&c.length<8?(n.consume(T),c+=String.fromCharCode(T),ue):$(T)}function ne(T){return T===93?(n.consume(T),N):$(T)}function N(T){return T===62?(n.consume(T),A):T===45&&u===2?(n.consume(T),N):$(T)}function A(T){return T===null||ke(T)?(n.exit("htmlFlowData"),Z(T)):(n.consume(T),A)}function Z(T){return n.exit("htmlFlow"),a(T)}}function Nk(n,a,i){const r=this;return u;function u(c){return ke(c)?(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),o):i(c)}function o(c){return r.parser.lazy[r.now().line]?i(c):a(c)}}function Ck(n,a,i){return r;function r(u){return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),n.attempt(Vr,a,i)}}const Ak={name:"htmlText",tokenize:wk};function wk(n,a,i){const r=this;let u,o,c;return h;function h(N){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(N),m}function m(N){return N===33?(n.consume(N),p):N===47?(n.consume(N),te):N===63?(n.consume(N),M):Jt(N)?(n.consume(N),de):i(N)}function p(N){return N===45?(n.consume(N),v):N===91?(n.consume(N),o=0,E):Jt(N)?(n.consume(N),R):i(N)}function v(N){return N===45?(n.consume(N),b):i(N)}function y(N){return N===null?i(N):N===45?(n.consume(N),x):ke(N)?(c=y,F(N)):(n.consume(N),y)}function x(N){return N===45?(n.consume(N),b):y(N)}function b(N){return N===62?D(N):N===45?x(N):y(N)}function E(N){const A="CDATA[";return N===A.charCodeAt(o++)?(n.consume(N),o===A.length?j:E):i(N)}function j(N){return N===null?i(N):N===93?(n.consume(N),O):ke(N)?(c=j,F(N)):(n.consume(N),j)}function O(N){return N===93?(n.consume(N),S):j(N)}function S(N){return N===62?D(N):N===93?(n.consume(N),S):j(N)}function R(N){return N===null||N===62?D(N):ke(N)?(c=R,F(N)):(n.consume(N),R)}function M(N){return N===null?i(N):N===63?(n.consume(N),J):ke(N)?(c=M,F(N)):(n.consume(N),M)}function J(N){return N===62?D(N):M(N)}function te(N){return Jt(N)?(n.consume(N),q):i(N)}function q(N){return N===45||Yt(N)?(n.consume(N),q):ae(N)}function ae(N){return ke(N)?(c=ae,F(N)):Ie(N)?(n.consume(N),ae):D(N)}function de(N){return N===45||Yt(N)?(n.consume(N),de):N===47||N===62||pt(N)?ve(N):i(N)}function ve(N){return N===47?(n.consume(N),D):N===58||N===95||Jt(N)?(n.consume(N),L):ke(N)?(c=ve,F(N)):Ie(N)?(n.consume(N),ve):D(N)}function L(N){return N===45||N===46||N===58||N===95||Yt(N)?(n.consume(N),L):P(N)}function P(N){return N===61?(n.consume(N),$):ke(N)?(c=P,F(N)):Ie(N)?(n.consume(N),P):ve(N)}function $(N){return N===null||N===60||N===61||N===62||N===96?i(N):N===34||N===39?(n.consume(N),u=N,fe):ke(N)?(c=$,F(N)):Ie(N)?(n.consume(N),$):(n.consume(N),W)}function fe(N){return N===u?(n.consume(N),u=void 0,ee):N===null?i(N):ke(N)?(c=fe,F(N)):(n.consume(N),fe)}function W(N){return N===null||N===34||N===39||N===60||N===61||N===96?i(N):N===47||N===62||pt(N)?ve(N):(n.consume(N),W)}function ee(N){return N===47||N===62||pt(N)?ve(N):i(N)}function D(N){return N===62?(n.consume(N),n.exit("htmlTextData"),n.exit("htmlText"),a):i(N)}function F(N){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(N),n.exit("lineEnding"),ue}function ue(N){return Ie(N)?Xe(n,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):ne(N)}function ne(N){return n.enter("htmlTextData"),c(N)}}const vd={name:"labelEnd",resolveAll:zk,resolveTo:Ok,tokenize:Dk},jk={tokenize:Lk},Mk={tokenize:Bk},Rk={tokenize:Uk};function zk(n){let a=-1;const i=[];for(;++a<n.length;){const r=n[a][1];if(i.push(n[a]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const u=r.type==="labelImage"?4:2;r.type="data",a+=u}}return n.length!==i.length&&bn(n,0,n.length,i),n}function Ok(n,a){let i=n.length,r=0,u,o,c,h;for(;i--;)if(u=n[i][1],o){if(u.type==="link"||u.type==="labelLink"&&u._inactive)break;n[i][0]==="enter"&&u.type==="labelLink"&&(u._inactive=!0)}else if(c){if(n[i][0]==="enter"&&(u.type==="labelImage"||u.type==="labelLink")&&!u._balanced&&(o=i,u.type!=="labelLink")){r=2;break}}else u.type==="labelEnd"&&(c=i);const m={type:n[o][1].type==="labelLink"?"link":"image",start:{...n[o][1].start},end:{...n[n.length-1][1].end}},p={type:"label",start:{...n[o][1].start},end:{...n[c][1].end}},v={type:"labelText",start:{...n[o+r+2][1].end},end:{...n[c-2][1].start}};return h=[["enter",m,a],["enter",p,a]],h=Un(h,n.slice(o+1,o+r+3)),h=Un(h,[["enter",v,a]]),h=Un(h,Uu(a.parser.constructs.insideSpan.null,n.slice(o+r+4,c-3),a)),h=Un(h,[["exit",v,a],n[c-2],n[c-1],["exit",p,a]]),h=Un(h,n.slice(c+1)),h=Un(h,[["exit",m,a]]),bn(n,o,n.length,h),n}function Dk(n,a,i){const r=this;let u=r.events.length,o,c;for(;u--;)if((r.events[u][1].type==="labelImage"||r.events[u][1].type==="labelLink")&&!r.events[u][1]._balanced){o=r.events[u][1];break}return h;function h(x){return o?o._inactive?y(x):(c=r.parser.defined.includes($n(r.sliceSerialize({start:o.end,end:r.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(x),n.exit("labelMarker"),n.exit("labelEnd"),m):i(x)}function m(x){return x===40?n.attempt(jk,v,c?v:y)(x):x===91?n.attempt(Mk,v,c?p:y)(x):c?v(x):y(x)}function p(x){return n.attempt(Rk,v,y)(x)}function v(x){return a(x)}function y(x){return o._balanced=!0,i(x)}}function Lk(n,a,i){return r;function r(y){return n.enter("resource"),n.enter("resourceMarker"),n.consume(y),n.exit("resourceMarker"),u}function u(y){return pt(y)?Dr(n,o)(y):o(y)}function o(y){return y===41?v(y):g1(n,c,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function c(y){return pt(y)?Dr(n,m)(y):v(y)}function h(y){return i(y)}function m(y){return y===34||y===39||y===40?v1(n,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):v(y)}function p(y){return pt(y)?Dr(n,v)(y):v(y)}function v(y){return y===41?(n.enter("resourceMarker"),n.consume(y),n.exit("resourceMarker"),n.exit("resource"),a):i(y)}}function Bk(n,a,i){const r=this;return u;function u(h){return y1.call(r,n,o,c,"reference","referenceMarker","referenceString")(h)}function o(h){return r.parser.defined.includes($n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?a(h):i(h)}function c(h){return i(h)}}function Uk(n,a,i){return r;function r(o){return n.enter("reference"),n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),u}function u(o){return o===93?(n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),n.exit("reference"),a):i(o)}}const Hk={name:"labelStartImage",resolveAll:vd.resolveAll,tokenize:Ik};function Ik(n,a,i){const r=this;return u;function u(h){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(h),n.exit("labelImageMarker"),o}function o(h){return h===91?(n.enter("labelMarker"),n.consume(h),n.exit("labelMarker"),n.exit("labelImage"),c):i(h)}function c(h){return h===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(h):a(h)}}const qk={name:"labelStartLink",resolveAll:vd.resolveAll,tokenize:Vk};function Vk(n,a,i){const r=this;return u;function u(c){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(c),n.exit("labelMarker"),n.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(c):a(c)}}const bf={name:"lineEnding",tokenize:Gk};function Gk(n,a){return i;function i(r){return n.enter("lineEnding"),n.consume(r),n.exit("lineEnding"),Xe(n,a,"linePrefix")}}const yu={name:"thematicBreak",tokenize:Zk};function Zk(n,a,i){let r=0,u;return o;function o(p){return n.enter("thematicBreak"),c(p)}function c(p){return u=p,h(p)}function h(p){return p===u?(n.enter("thematicBreakSequence"),m(p)):r>=3&&(p===null||ke(p))?(n.exit("thematicBreak"),a(p)):i(p)}function m(p){return p===u?(n.consume(p),r++,m):(n.exit("thematicBreakSequence"),Ie(p)?Xe(n,h,"whitespace")(p):h(p))}}const on={continuation:{tokenize:Qk},exit:Kk,name:"list",tokenize:Xk},Yk={partial:!0,tokenize:Jk},$k={partial:!0,tokenize:Fk};function Xk(n,a,i){const r=this,u=r.events[r.events.length-1];let o=u&&u[1].type==="linePrefix"?u[2].sliceSerialize(u[1],!0).length:0,c=0;return h;function h(b){const E=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:Yf(b)){if(r.containerState.type||(r.containerState.type=E,n.enter(E,{_container:!0})),E==="listUnordered")return n.enter("listItemPrefix"),b===42||b===45?n.check(yu,i,p)(b):p(b);if(!r.interrupt||b===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),m(b)}return i(b)}function m(b){return Yf(b)&&++c<10?(n.consume(b),m):(!r.interrupt||c<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(n.exit("listItemValue"),p(b)):i(b)}function p(b){return n.enter("listItemMarker"),n.consume(b),n.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,n.check(Vr,r.interrupt?i:v,n.attempt(Yk,x,y))}function v(b){return r.containerState.initialBlankLine=!0,o++,x(b)}function y(b){return Ie(b)?(n.enter("listItemPrefixWhitespace"),n.consume(b),n.exit("listItemPrefixWhitespace"),x):i(b)}function x(b){return r.containerState.size=o+r.sliceSerialize(n.exit("listItemPrefix"),!0).length,a(b)}}function Qk(n,a,i){const r=this;return r.containerState._closeFlow=void 0,n.check(Vr,u,o);function u(h){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Xe(n,a,"listItemIndent",r.containerState.size+1)(h)}function o(h){return r.containerState.furtherBlankLines||!Ie(h)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(h)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,n.attempt($k,a,c)(h))}function c(h){return r.containerState._closeFlow=!0,r.interrupt=void 0,Xe(n,n.attempt(on,a,i),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function Fk(n,a,i){const r=this;return Xe(n,u,"listItemIndent",r.containerState.size+1);function u(o){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?a(o):i(o)}}function Kk(n){n.exit(this.containerState.type)}function Jk(n,a,i){const r=this;return Xe(n,u,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function u(o){const c=r.events[r.events.length-1];return!Ie(o)&&c&&c[1].type==="listItemPrefixWhitespace"?a(o):i(o)}}const ay={name:"setextUnderline",resolveTo:Pk,tokenize:Wk};function Pk(n,a){let i=n.length,r,u,o;for(;i--;)if(n[i][0]==="enter"){if(n[i][1].type==="content"){r=i;break}n[i][1].type==="paragraph"&&(u=i)}else n[i][1].type==="content"&&n.splice(i,1),!o&&n[i][1].type==="definition"&&(o=i);const c={type:"setextHeading",start:{...n[r][1].start},end:{...n[n.length-1][1].end}};return n[u][1].type="setextHeadingText",o?(n.splice(u,0,["enter",c,a]),n.splice(o+1,0,["exit",n[r][1],a]),n[r][1].end={...n[o][1].end}):n[r][1]=c,n.push(["exit",c,a]),n}function Wk(n,a,i){const r=this;let u;return o;function o(p){let v=r.events.length,y;for(;v--;)if(r.events[v][1].type!=="lineEnding"&&r.events[v][1].type!=="linePrefix"&&r.events[v][1].type!=="content"){y=r.events[v][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||y)?(n.enter("setextHeadingLine"),u=p,c(p)):i(p)}function c(p){return n.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===u?(n.consume(p),h):(n.exit("setextHeadingLineSequence"),Ie(p)?Xe(n,m,"lineSuffix")(p):m(p))}function m(p){return p===null||ke(p)?(n.exit("setextHeadingLine"),a(p)):i(p)}}const eT={tokenize:tT};function tT(n){const a=this,i=n.attempt(Vr,r,n.attempt(this.parser.constructs.flowInitial,u,Xe(n,n.attempt(this.parser.constructs.flow,u,n.attempt(rk,u)),"linePrefix")));return i;function r(o){if(o===null){n.consume(o);return}return n.enter("lineEndingBlank"),n.consume(o),n.exit("lineEndingBlank"),a.currentConstruct=void 0,i}function u(o){if(o===null){n.consume(o);return}return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),a.currentConstruct=void 0,i}}const nT={resolveAll:x1()},aT=_1("string"),lT=_1("text");function _1(n){return{resolveAll:x1(n==="text"?iT:void 0),tokenize:a};function a(i){const r=this,u=this.parser.constructs[n],o=i.attempt(u,c,h);return c;function c(v){return p(v)?o(v):h(v)}function h(v){if(v===null){i.consume(v);return}return i.enter("data"),i.consume(v),m}function m(v){return p(v)?(i.exit("data"),o(v)):(i.consume(v),m)}function p(v){if(v===null)return!0;const y=u[v];let x=-1;if(y)for(;++x<y.length;){const b=y[x];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function x1(n){return a;function a(i,r){let u=-1,o;for(;++u<=i.length;)o===void 0?i[u]&&i[u][1].type==="data"&&(o=u,u++):(!i[u]||i[u][1].type!=="data")&&(u!==o+2&&(i[o][1].end=i[u-1][1].end,i.splice(o+2,u-o-2),u=o+2),o=void 0);return n?n(i,r):i}}function iT(n,a){let i=0;for(;++i<=n.length;)if((i===n.length||n[i][1].type==="lineEnding")&&n[i-1][1].type==="data"){const r=n[i-1][1],u=a.sliceStream(r);let o=u.length,c=-1,h=0,m;for(;o--;){const p=u[o];if(typeof p=="string"){for(c=p.length;p.charCodeAt(c-1)===32;)h++,c--;if(c)break;c=-1}else if(p===-2)m=!0,h++;else if(p!==-1){o++;break}}if(a._contentTypeTextTrailing&&i===n.length&&(h=0),h){const p={type:i===n.length||m||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:r.start._bufferIndex+c,_index:r.start._index+o,line:r.end.line,column:r.end.column-h,offset:r.end.offset-h},end:{...r.end}};r.end={...p.start},r.start.offset===r.end.offset?Object.assign(r,p):(n.splice(i,0,["enter",p,a],["exit",p,a]),i+=2)}i++}return n}const rT={42:on,43:on,45:on,48:on,49:on,50:on,51:on,52:on,53:on,54:on,55:on,56:on,57:on,62:d1},sT={91:fk},uT={[-2]:xf,[-1]:xf,32:xf},oT={35:yk,42:yu,45:[ay,yu],60:bk,61:ay,95:yu,96:ty,126:ty},cT={38:m1,92:h1},fT={[-5]:bf,[-4]:bf,[-3]:bf,33:Hk,38:m1,42:$f,60:[q2,Ak],91:qk,92:[pk,h1],93:vd,95:$f,96:ek},dT={null:[$f,nT]},hT={null:[42,95]},mT={null:[]},pT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:hT,contentInitial:sT,disable:mT,document:rT,flow:oT,flowInitial:uT,insideSpan:dT,string:cT,text:fT},Symbol.toStringTag,{value:"Module"}));function gT(n,a,i){let r={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const u={},o=[];let c=[],h=[];const m={attempt:ae(te),check:ae(q),consume:R,enter:M,exit:J,interrupt:ae(q,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:E,parser:n,previous:null,sliceSerialize:x,sliceStream:b,write:y};let v=a.tokenize.call(p,m);return a.resolveAll&&o.push(a),p;function y(P){return c=Un(c,P),O(),c[c.length-1]!==null?[]:(de(a,0),p.events=Uu(o,p.events,p),p.events)}function x(P,$){return vT(b(P),$)}function b(P){return yT(c,P)}function E(){const{_bufferIndex:P,_index:$,line:fe,column:W,offset:ee}=r;return{_bufferIndex:P,_index:$,line:fe,column:W,offset:ee}}function j(P){u[P.line]=P.column,L()}function O(){let P;for(;r._index<c.length;){const $=c[r._index];if(typeof $=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<$.length;)S($.charCodeAt(r._bufferIndex));else S($)}}function S(P){v=v(P)}function R(P){ke(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,L()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===c[r._index].length&&(r._bufferIndex=-1,r._index++)),p.previous=P}function M(P,$){const fe=$||{};return fe.type=P,fe.start=E(),p.events.push(["enter",fe,p]),h.push(fe),fe}function J(P){const $=h.pop();return $.end=E(),p.events.push(["exit",$,p]),$}function te(P,$){de(P,$.from)}function q(P,$){$.restore()}function ae(P,$){return fe;function fe(W,ee,D){let F,ue,ne,N;return Array.isArray(W)?Z(W):"tokenize"in W?Z([W]):A(W);function A(he){return je;function je(dt){const tt=dt!==null&&he[dt],Wt=dt!==null&&he.null,In=[...Array.isArray(tt)?tt:tt?[tt]:[],...Array.isArray(Wt)?Wt:Wt?[Wt]:[]];return Z(In)(dt)}}function Z(he){return F=he,ue=0,he.length===0?D:T(he[ue])}function T(he){return je;function je(dt){return N=ve(),ne=he,he.partial||(p.currentConstruct=he),he.name&&p.parser.constructs.disable.null.includes(he.name)?ie():he.tokenize.call($?Object.assign(Object.create(p),$):p,m,U,ie)(dt)}}function U(he){return P(ne,N),ee}function ie(he){return N.restore(),++ue<F.length?T(F[ue]):D}}}function de(P,$){P.resolveAll&&!o.includes(P)&&o.push(P),P.resolve&&bn(p.events,$,p.events.length-$,P.resolve(p.events.slice($),p)),P.resolveTo&&(p.events=P.resolveTo(p.events,p))}function ve(){const P=E(),$=p.previous,fe=p.currentConstruct,W=p.events.length,ee=Array.from(h);return{from:W,restore:D};function D(){r=P,p.previous=$,p.currentConstruct=fe,p.events.length=W,h=ee,L()}}function L(){r.line in u&&r.column<2&&(r.column=u[r.line],r.offset+=u[r.line]-1)}}function yT(n,a){const i=a.start._index,r=a.start._bufferIndex,u=a.end._index,o=a.end._bufferIndex;let c;if(i===u)c=[n[i].slice(r,o)];else{if(c=n.slice(i,u),r>-1){const h=c[0];typeof h=="string"?c[0]=h.slice(r):c.shift()}o>0&&c.push(n[u].slice(0,o))}return c}function vT(n,a){let i=-1;const r=[];let u;for(;++i<n.length;){const o=n[i];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
236
236
  `;break}case-3:{c=`\r
237
237
  `;break}case-2:{c=a?" ":" ";break}case-1:{if(!a&&u)continue;c=" ";break}default:c=String.fromCharCode(o)}u=o===-2,r.push(c)}return r.join("")}function _T(n){const r={constructs:c1([pT,...(n||{}).extensions||[]]),content:u(O2),defined:[],document:u(L2),flow:u(eT),lazy:{},string:u(aT),text:u(lT)};return r;function u(o){return c;function c(h){return gT(r,o,h)}}}function xT(n){for(;!p1(n););return n}const ly=/[\0\t\n\r]/g;function bT(){let n=1,a="",i=!0,r;return u;function u(o,c,h){const m=[];let p,v,y,x,b;for(o=a+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),y=0,a="",i&&(o.charCodeAt(0)===65279&&y++,i=void 0);y<o.length;){if(ly.lastIndex=y,p=ly.exec(o),x=p&&p.index!==void 0?p.index:o.length,b=o.charCodeAt(x),!p){a=o.slice(y);break}if(b===10&&y===x&&r)m.push(-3),r=void 0;else switch(r&&(m.push(-5),r=void 0),y<x&&(m.push(o.slice(y,x)),n+=x-y),b){case 0:{m.push(65533),n++;break}case 9:{for(v=Math.ceil(n/4)*4,m.push(-2);n++<v;)m.push(-1);break}case 10:{m.push(-4),n=1;break}default:r=!0,n=1}y=x+1}return h&&(r&&m.push(-5),a&&m.push(a),m.push(null)),m}}const ST=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function kT(n){return n.replace(ST,TT)}function TT(n,a,i){if(a)return a;if(i.charCodeAt(0)===35){const u=i.charCodeAt(1),o=u===120||u===88;return f1(i.slice(o?2:1),o?16:10)}return yd(i)||n}const b1={}.hasOwnProperty;function ET(n,a,i){return a&&typeof a=="object"&&(i=a,a=void 0),NT(i)(xT(_T(i).document().write(bT()(n,a,!0))))}function NT(n){const a={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Tn),autolinkProtocol:ve,autolinkEmail:ve,atxHeading:o(ia),blockQuote:o(Wt),characterEscape:ve,characterReference:ve,codeFenced:o(In),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(In,c),codeText:o(ul,c),codeTextData:ve,data:ve,codeFlowValue:ve,definition:o(Dl),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(qt),hardBreakEscape:o(Qn),hardBreakTrailing:o(Qn),htmlFlow:o(at,c),htmlFlowData:ve,htmlText:o(at,c),htmlTextData:ve,image:o(Xt),label:c,link:o(Tn),listItem:o(Oi),listItemValue:x,listOrdered:o(Ll,y),listUnordered:o(Ll),paragraph:o(Qu),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(ia),strong:o(Fu),thematicBreak:o(Ku)},exit:{atxHeading:m(),atxHeadingSequence:te,autolink:m(),autolinkEmail:tt,autolinkProtocol:dt,blockQuote:m(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:he,characterReference:je,codeFenced:m(O),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:E,codeFlowValue:L,codeIndented:m(S),codeText:m(ee),codeTextData:L,data:L,definition:m(),definitionDestinationString:J,definitionLabelString:R,definitionTitleString:M,emphasis:m(),hardBreakEscape:m($),hardBreakTrailing:m($),htmlFlow:m(fe),htmlFlowData:L,htmlText:m(W),htmlTextData:L,image:m(F),label:ne,labelText:ue,lineEnding:P,link:m(D),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:U,resourceDestinationString:N,resourceTitleString:A,resource:Z,setextHeading:m(de),setextHeadingLineSequence:ae,setextHeadingText:q,strong:m(),thematicBreak:m()}};S1(a,(n||{}).mdastExtensions||[]);const i={};return r;function r(X){let oe={type:"root",children:[]};const Ne={stack:[oe],tokenStack:[],config:a,enter:h,exit:p,buffer:c,resume:v,data:i},Be=[];let lt=-1;for(;++lt<X.length;)if(X[lt][1].type==="listOrdered"||X[lt][1].type==="listUnordered")if(X[lt][0]==="enter")Be.push(lt);else{const fn=Be.pop();lt=u(X,fn,lt)}for(lt=-1;++lt<X.length;){const fn=a[X[lt][0]];b1.call(fn,X[lt][1].type)&&fn[X[lt][1].type].call(Object.assign({sliceSerialize:X[lt][2].sliceSerialize},Ne),X[lt][1])}if(Ne.tokenStack.length>0){const fn=Ne.tokenStack[Ne.tokenStack.length-1];(fn[1]||iy).call(Ne,void 0,fn[0])}for(oe.position={start:nl(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:nl(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},lt=-1;++lt<a.transforms.length;)oe=a.transforms[lt](oe)||oe;return oe}function u(X,oe,Ne){let Be=oe-1,lt=-1,fn=!1,ra,Ft,Mt,en;for(;++Be<=Ne;){const ht=X[Be];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?lt++:lt--,en=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(ra&&!en&&!lt&&!Mt&&(Mt=Be),en=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:en=void 0}if(!lt&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||lt===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(ra){let Ma=Be;for(Ft=void 0;Ma--;){const qn=X[Ma];if(qn[1].type==="lineEnding"||qn[1].type==="lineEndingBlank"){if(qn[0]==="exit")continue;Ft&&(X[Ft][1].type="lineEndingBlank",fn=!0),qn[1].type="lineEnding",Ft=Ma}else if(!(qn[1].type==="linePrefix"||qn[1].type==="blockQuotePrefix"||qn[1].type==="blockQuotePrefixWhitespace"||qn[1].type==="blockQuoteMarker"||qn[1].type==="listItemIndent"))break}Mt&&(!Ft||Mt<Ft)&&(ra._spread=!0),ra.end=Object.assign({},Ft?X[Ft][1].start:ht[1].end),X.splice(Ft||Be,0,["exit",ra,ht[2]]),Be++,Ne++}if(ht[1].type==="listItemPrefix"){const Ma={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};ra=Ma,X.splice(Be,0,["enter",Ma,ht[2]]),Be++,Ne++,Mt=void 0,en=!0}}}return X[oe][1]._spread=fn,Ne}function o(X,oe){return Ne;function Ne(Be){h.call(this,X(Be),Be),oe&&oe.call(this,Be)}}function c(){this.stack.push({type:"fragment",children:[]})}function h(X,oe,Ne){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([oe,Ne||void 0]),X.position={start:nl(oe.start),end:void 0}}function m(X){return oe;function oe(Ne){X&&X.call(this,Ne),p.call(this,Ne)}}function p(X,oe){const Ne=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==X.type&&(oe?oe.call(this,X,Be[0]):(Be[1]||iy).call(this,X,Be[0]));else throw new Error("Cannot close `"+X.type+"` ("+Or({start:X.start,end:X.end})+"): it’s not open");Ne.position.end=nl(X.end)}function v(){return gd(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function x(X){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function b(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=X}function E(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=X}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function O(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.value=X.replace(/(\r?\n|\r)$/g,"")}function R(X){const oe=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=oe,Ne.identifier=$n(this.sliceSerialize(X)).toLowerCase()}function M(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.title=X}function J(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.url=X}function te(X){const oe=this.stack[this.stack.length-1];if(!oe.depth){const Ne=this.sliceSerialize(X).length;oe.depth=Ne}}function q(){this.data.setextHeadingSlurpLineEnding=!0}function ae(X){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function de(){this.data.setextHeadingSlurpLineEnding=void 0}function ve(X){const Ne=this.stack[this.stack.length-1].children;let Be=Ne[Ne.length-1];(!Be||Be.type!=="text")&&(Be=Qt(),Be.position={start:nl(X.start),end:void 0},Ne.push(Be)),this.stack.push(Be)}function L(X){const oe=this.stack.pop();oe.value+=this.sliceSerialize(X),oe.position.end=nl(X.end)}function P(X){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=oe.children[oe.children.length-1];Ne.position.end=nl(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&a.canContainEols.includes(oe.type)&&(ve.call(this,X),L.call(this,X))}function $(){this.data.atHardBreak=!0}function fe(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.value=X}function W(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.value=X}function ee(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.value=X}function D(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=oe,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function F(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=oe,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function ue(X){const oe=this.sliceSerialize(X),Ne=this.stack[this.stack.length-2];Ne.label=kT(oe),Ne.identifier=$n(oe).toLowerCase()}function ne(){const X=this.stack[this.stack.length-1],oe=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const Be=X.children;Ne.children=Be}else Ne.alt=oe}function N(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.url=X}function A(){const X=this.resume(),oe=this.stack[this.stack.length-1];oe.title=X}function Z(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function U(X){const oe=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=oe,Ne.identifier=$n(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function ie(X){this.data.characterReferenceType=X.type}function he(X){const oe=this.sliceSerialize(X),Ne=this.data.characterReferenceType;let Be;Ne?(Be=f1(oe,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=yd(oe);const lt=this.stack[this.stack.length-1];lt.value+=Be}function je(X){const oe=this.stack.pop();oe.position.end=nl(X.end)}function dt(X){L.call(this,X);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(X)}function tt(X){L.call(this,X);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(X)}function Wt(){return{type:"blockquote",children:[]}}function In(){return{type:"code",lang:null,meta:null,value:""}}function ul(){return{type:"inlineCode",value:""}}function Dl(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qt(){return{type:"emphasis",children:[]}}function ia(){return{type:"heading",depth:0,children:[]}}function Qn(){return{type:"break"}}function at(){return{type:"html",value:""}}function Xt(){return{type:"image",title:null,url:"",alt:null}}function Tn(){return{type:"link",title:null,url:"",children:[]}}function Ll(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function Oi(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function Qu(){return{type:"paragraph",children:[]}}function Fu(){return{type:"strong",children:[]}}function Qt(){return{type:"text",value:""}}function Ku(){return{type:"thematicBreak"}}}function nl(n){return{line:n.line,column:n.column,offset:n.offset}}function S1(n,a){let i=-1;for(;++i<a.length;){const r=a[i];Array.isArray(r)?S1(n,r):CT(n,r)}}function CT(n,a){let i;for(i in a)if(b1.call(a,i))switch(i){case"canContainEols":{const r=a[i];r&&n[i].push(...r);break}case"transforms":{const r=a[i];r&&n[i].push(...r);break}case"enter":case"exit":{const r=a[i];r&&Object.assign(n[i],r);break}}}function iy(n,a){throw n?new Error("Cannot close `"+n.type+"` ("+Or({start:n.start,end:n.end})+"): a different token (`"+a.type+"`, "+Or({start:a.start,end:a.end})+") is open"):new Error("Cannot close document, a token (`"+a.type+"`, "+Or({start:a.start,end:a.end})+") is still open")}function AT(n){const a=this;a.parser=i;function i(r){return ET(r,{...a.data("settings"),...n,extensions:a.data("micromarkExtensions")||[],mdastExtensions:a.data("fromMarkdownExtensions")||[]})}}function wT(n,a){const i={type:"element",tagName:"blockquote",properties:{},children:n.wrap(n.all(a),!0)};return n.patch(a,i),n.applyData(a,i)}function jT(n,a){const i={type:"element",tagName:"br",properties:{},children:[]};return n.patch(a,i),[n.applyData(a,i),{type:"text",value:`
@@ -261,7 +261,7 @@ Error generating stack: `+s.message+`
261
261
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:h}};function c(b,E,j,O){return p(v(b,j,O),b.align)}function h(b,E,j,O){const S=y(b,j,O),R=p([S]);return R.slice(0,R.indexOf(`
262
262
  `))}function m(b,E,j,O){const S=j.enter("tableCell"),R=j.enter("phrasing"),M=j.containerPhrasing(b,{...O,before:o,after:o});return R(),S(),M}function p(b,E){return ON(b,{align:E,alignDelimiters:r,padding:i,stringLength:u})}function v(b,E,j){const O=b.children;let S=-1;const R=[],M=E.enter("table");for(;++S<O.length;)R[S]=y(O[S],E,j);return M(),R}function y(b,E,j){const O=b.children;let S=-1;const R=[],M=E.enter("tableRow");for(;++S<O.length;)R[S]=m(O[S],b,E,j);return M(),R}function x(b,E,j){let O=Y1.inlineCode(b,E,j);return j.stack.includes("tableCell")&&(O=O.replace(/\|/g,"\\$&")),O}}function bC(){return{exit:{taskListCheckValueChecked:Ny,taskListCheckValueUnchecked:Ny,paragraph:kC}}}function SC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:TC}}}function Ny(n){const a=this.stack[this.stack.length-2];a.type,a.checked=n.type==="taskListCheckValueChecked"}function kC(n){const a=this.stack[this.stack.length-2];if(a&&a.type==="listItem"&&typeof a.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const r=i.children[0];if(r&&r.type==="text"){const u=a.children;let o=-1,c;for(;++o<u.length;){const h=u[o];if(h.type==="paragraph"){c=h;break}}c===i&&(r.value=r.value.slice(1),r.value.length===0?i.children.shift():i.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,i.position.start=Object.assign({},r.position.start)))}}this.exit(n)}function TC(n,a,i,r){const u=n.children[0],o=typeof n.checked=="boolean"&&u&&u.type==="paragraph",c="["+(n.checked?"x":" ")+"] ",h=i.createTracker(r);o&&h.move(c);let m=Y1.listItem(n,a,i,{...r,...h.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),m;function p(v){return v+c}}function EC(){return[aN(),TN(),AN(),mC(),bC()]}function NC(n){return{extensions:[lN(),EN(n),wN(),xC(n),SC()]}}const CC={tokenize:zC,partial:!0},$1={tokenize:OC,partial:!0},X1={tokenize:DC,partial:!0},Q1={tokenize:LC,partial:!0},AC={tokenize:BC,partial:!0},F1={name:"wwwAutolink",tokenize:MC,previous:J1},K1={name:"protocolAutolink",tokenize:RC,previous:P1},ja={name:"emailAutolink",tokenize:jC,previous:W1},la={};function wC(){return{text:la}}let Cl=48;for(;Cl<123;)la[Cl]=ja,Cl++,Cl===58?Cl=65:Cl===91&&(Cl=97);la[43]=ja;la[45]=ja;la[46]=ja;la[95]=ja;la[72]=[ja,K1];la[104]=[ja,K1];la[87]=[ja,F1];la[119]=[ja,F1];function jC(n,a,i){const r=this;let u,o;return c;function c(y){return!Jf(y)||!W1.call(r,r.previous)||Cd(r.events)?i(y):(n.enter("literalAutolink"),n.enter("literalAutolinkEmail"),h(y))}function h(y){return Jf(y)?(n.consume(y),h):y===64?(n.consume(y),m):i(y)}function m(y){return y===46?n.check(AC,v,p)(y):y===45||y===95||Yt(y)?(o=!0,n.consume(y),m):v(y)}function p(y){return n.consume(y),u=!0,m}function v(y){return o&&u&&Jt(r.previous)?(n.exit("literalAutolinkEmail"),n.exit("literalAutolink"),a(y)):i(y)}}function MC(n,a,i){const r=this;return u;function u(c){return c!==87&&c!==119||!J1.call(r,r.previous)||Cd(r.events)?i(c):(n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check(CC,n.attempt($1,n.attempt(X1,o),i),i)(c))}function o(c){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),a(c)}}function RC(n,a,i){const r=this;let u="",o=!1;return c;function c(y){return(y===72||y===104)&&P1.call(r,r.previous)&&!Cd(r.events)?(n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),u+=String.fromCodePoint(y),n.consume(y),h):i(y)}function h(y){if(Jt(y)&&u.length<5)return u+=String.fromCodePoint(y),n.consume(y),h;if(y===58){const x=u.toLowerCase();if(x==="http"||x==="https")return n.consume(y),m}return i(y)}function m(y){return y===47?(n.consume(y),o?p:(o=!0,m)):i(y)}function p(y){return y===null||_u(y)||pt(y)||wl(y)||Bu(y)?i(y):n.attempt($1,n.attempt(X1,v),i)(y)}function v(y){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),a(y)}}function zC(n,a,i){let r=0;return u;function u(c){return(c===87||c===119)&&r<3?(r++,n.consume(c),u):c===46&&r===3?(n.consume(c),o):i(c)}function o(c){return c===null?i(c):a(c)}}function OC(n,a,i){let r,u,o;return c;function c(p){return p===46||p===95?n.check(Q1,m,h)(p):p===null||pt(p)||wl(p)||p!==45&&Bu(p)?m(p):(o=!0,n.consume(p),c)}function h(p){return p===95?r=!0:(u=r,r=void 0),n.consume(p),c}function m(p){return u||r||!o?i(p):a(p)}}function DC(n,a){let i=0,r=0;return u;function u(c){return c===40?(i++,n.consume(c),u):c===41&&r<i?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?n.check(Q1,a,o)(c):c===null||pt(c)||wl(c)?a(c):(n.consume(c),u)}function o(c){return c===41&&r++,n.consume(c),u}}function LC(n,a,i){return r;function r(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(n.consume(h),r):h===38?(n.consume(h),o):h===93?(n.consume(h),u):h===60||h===null||pt(h)||wl(h)?a(h):i(h)}function u(h){return h===null||h===40||h===91||pt(h)||wl(h)?a(h):r(h)}function o(h){return Jt(h)?c(h):i(h)}function c(h){return h===59?(n.consume(h),r):Jt(h)?(n.consume(h),c):i(h)}}function BC(n,a,i){return r;function r(o){return n.consume(o),u}function u(o){return Yt(o)?i(o):a(o)}}function J1(n){return n===null||n===40||n===42||n===95||n===91||n===93||n===126||pt(n)}function P1(n){return!Jt(n)}function W1(n){return!(n===47||Jf(n))}function Jf(n){return n===43||n===45||n===46||n===95||Yt(n)}function Cd(n){let a=n.length,i=!1;for(;a--;){const r=n[a][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){i=!0;break}if(r._gfmAutolinkLiteralWalkedInto){i=!1;break}}return n.length>0&&!i&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const UC={tokenize:$C,partial:!0};function HC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:GC,continuation:{tokenize:ZC},exit:YC}},text:{91:{name:"gfmFootnoteCall",tokenize:VC},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:IC,resolveTo:qC}}}}function IC(n,a,i){const r=this;let u=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;u--;){const m=r.events[u][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return h;function h(m){if(!c||!c._balanced)return i(m);const p=$n(r.sliceSerialize({start:c.end,end:r.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?i(m):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(m),n.exit("gfmFootnoteCallLabelMarker"),a(m))}}function qC(n,a){let i=n.length;for(;i--;)if(n[i][1].type==="labelImage"&&n[i][0]==="enter"){n[i][1];break}n[i+1][1].type="data",n[i+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},n[i+3][1].start),end:Object.assign({},n[n.length-1][1].end)},u={type:"gfmFootnoteCallMarker",start:Object.assign({},n[i+3][1].end),end:Object.assign({},n[i+3][1].end)};u.end.column++,u.end.offset++,u.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},u.end),end:Object.assign({},n[n.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},h=[n[i+1],n[i+2],["enter",r,a],n[i+3],n[i+4],["enter",u,a],["exit",u,a],["enter",o,a],["enter",c,a],["exit",c,a],["exit",o,a],n[n.length-2],n[n.length-1],["exit",r,a]];return n.splice(i,n.length-i+1,...h),n}function VC(n,a,i){const r=this,u=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,c;return h;function h(y){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(y),n.exit("gfmFootnoteCallLabelMarker"),m}function m(y){return y!==94?i(y):(n.enter("gfmFootnoteCallMarker"),n.consume(y),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",p)}function p(y){if(o>999||y===93&&!c||y===null||y===91||pt(y))return i(y);if(y===93){n.exit("chunkString");const x=n.exit("gfmFootnoteCallString");return u.includes($n(r.sliceSerialize(x)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(y),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),a):i(y)}return pt(y)||(c=!0),o++,n.consume(y),y===92?v:p}function v(y){return y===91||y===92||y===93?(n.consume(y),o++,p):p(y)}}function GC(n,a,i){const r=this,u=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,c=0,h;return m;function m(E){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(E),n.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(E),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",v):i(E)}function v(E){if(c>999||E===93&&!h||E===null||E===91||pt(E))return i(E);if(E===93){n.exit("chunkString");const j=n.exit("gfmFootnoteDefinitionLabelString");return o=$n(r.sliceSerialize(j)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(E),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),x}return pt(E)||(h=!0),c++,n.consume(E),E===92?y:v}function y(E){return E===91||E===92||E===93?(n.consume(E),c++,v):v(E)}function x(E){return E===58?(n.enter("definitionMarker"),n.consume(E),n.exit("definitionMarker"),u.includes(o)||u.push(o),Xe(n,b,"gfmFootnoteDefinitionWhitespace")):i(E)}function b(E){return a(E)}}function ZC(n,a,i){return n.check(Vr,a,n.attempt(UC,a,i))}function YC(n){n.exit("gfmFootnoteDefinition")}function $C(n,a,i){const r=this;return Xe(n,u,"gfmFootnoteDefinitionIndent",5);function u(o){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?a(o):i(o)}}function XC(n){let i=(n||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:u};return i==null&&(i=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function u(c,h){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let p=m;for(;p--;)if(c[p][0]==="exit"&&c[p][1].type==="strikethroughSequenceTemporary"&&c[p][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[p][1].end.offset-c[p][1].start.offset){c[m][1].type="strikethroughSequence",c[p][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},c[p][1].start),end:Object.assign({},c[m][1].end)},y={type:"strikethroughText",start:Object.assign({},c[p][1].end),end:Object.assign({},c[m][1].start)},x=[["enter",v,h],["enter",c[p][1],h],["exit",c[p][1],h],["enter",y,h]],b=h.parser.constructs.insideSpan.null;b&&bn(x,x.length,0,Uu(b,c.slice(p+1,m),h)),bn(x,x.length,0,[["exit",y,h],["enter",c[m][1],h],["exit",c[m][1],h],["exit",v,h]]),bn(c,p-1,m-p+3,x),m=p+x.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function o(c,h,m){const p=this.previous,v=this.events;let y=0;return x;function x(E){return p===126&&v[v.length-1][1].type!=="characterEscape"?m(E):(c.enter("strikethroughSequenceTemporary"),b(E))}function b(E){const j=Ci(p);if(E===126)return y>1?m(E):(c.consume(E),y++,b);if(y<2&&!i)return m(E);const O=c.exit("strikethroughSequenceTemporary"),S=Ci(E);return O._open=!S||S===2&&!!j,O._close=!j||j===2&&!!S,h(E)}}}class QC{constructor(){this.map=[]}add(a,i,r){FC(this,a,i,r)}consume(a){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let i=this.map.length;const r=[];for(;i>0;)i-=1,r.push(a.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),a.length=this.map[i][0];r.push(a.slice()),a.length=0;let u=r.pop();for(;u;){for(const o of u)a.push(o);u=r.pop()}this.map.length=0}}function FC(n,a,i,r){let u=0;if(!(i===0&&r.length===0)){for(;u<n.map.length;){if(n.map[u][0]===a){n.map[u][1]+=i,n.map[u][2].push(...r);return}u+=1}n.map.push([a,i,r])}}function KC(n,a){let i=!1;const r=[];for(;a<n.length;){const u=n[a];if(i){if(u[0]==="enter")u[1].type==="tableContent"&&r.push(n[a+1][1].type==="tableDelimiterMarker"?"left":"none");else if(u[1].type==="tableContent"){if(n[a-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(u[1].type==="tableDelimiterRow")break}else u[0]==="enter"&&u[1].type==="tableDelimiterRow"&&(i=!0);a+=1}return r}function JC(){return{flow:{null:{name:"table",tokenize:PC,resolveAll:WC}}}}function PC(n,a,i){const r=this;let u=0,o=0,c;return h;function h(L){let P=r.events.length-1;for(;P>-1;){const W=r.events[P][1].type;if(W==="lineEnding"||W==="linePrefix")P--;else break}const $=P>-1?r.events[P][1].type:null,fe=$==="tableHead"||$==="tableRow"?q:m;return fe===q&&r.parser.lazy[r.now().line]?i(L):fe(L)}function m(L){return n.enter("tableHead"),n.enter("tableRow"),p(L)}function p(L){return L===124||(c=!0,o+=1),v(L)}function v(L){return L===null?i(L):ke(L)?o>1?(o=0,r.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(L),n.exit("lineEnding"),b):i(L):Ie(L)?Xe(n,v,"whitespace")(L):(o+=1,c&&(c=!1,u+=1),L===124?(n.enter("tableCellDivider"),n.consume(L),n.exit("tableCellDivider"),c=!0,v):(n.enter("data"),y(L)))}function y(L){return L===null||L===124||pt(L)?(n.exit("data"),v(L)):(n.consume(L),L===92?x:y)}function x(L){return L===92||L===124?(n.consume(L),y):y(L)}function b(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?i(L):(n.enter("tableDelimiterRow"),c=!1,Ie(L)?Xe(n,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):E(L))}function E(L){return L===45||L===58?O(L):L===124?(c=!0,n.enter("tableCellDivider"),n.consume(L),n.exit("tableCellDivider"),j):te(L)}function j(L){return Ie(L)?Xe(n,O,"whitespace")(L):O(L)}function O(L){return L===58?(o+=1,c=!0,n.enter("tableDelimiterMarker"),n.consume(L),n.exit("tableDelimiterMarker"),S):L===45?(o+=1,S(L)):L===null||ke(L)?J(L):te(L)}function S(L){return L===45?(n.enter("tableDelimiterFiller"),R(L)):te(L)}function R(L){return L===45?(n.consume(L),R):L===58?(c=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(L),n.exit("tableDelimiterMarker"),M):(n.exit("tableDelimiterFiller"),M(L))}function M(L){return Ie(L)?Xe(n,J,"whitespace")(L):J(L)}function J(L){return L===124?E(L):L===null||ke(L)?!c||u!==o?te(L):(n.exit("tableDelimiterRow"),n.exit("tableHead"),a(L)):te(L)}function te(L){return i(L)}function q(L){return n.enter("tableRow"),ae(L)}function ae(L){return L===124?(n.enter("tableCellDivider"),n.consume(L),n.exit("tableCellDivider"),ae):L===null||ke(L)?(n.exit("tableRow"),a(L)):Ie(L)?Xe(n,ae,"whitespace")(L):(n.enter("data"),de(L))}function de(L){return L===null||L===124||pt(L)?(n.exit("data"),ae(L)):(n.consume(L),L===92?ve:de)}function ve(L){return L===92||L===124?(n.consume(L),de):de(L)}}function WC(n,a){let i=-1,r=!0,u=0,o=[0,0,0,0],c=[0,0,0,0],h=!1,m=0,p,v,y;const x=new QC;for(;++i<n.length;){const b=n[i],E=b[1];b[0]==="enter"?E.type==="tableHead"?(h=!1,m!==0&&(Cy(x,a,m,p,v),v=void 0,m=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},x.add(i,0,[["enter",p,a]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(r=!0,y=void 0,o=[0,0,0,0],c=[0,i+1,0,0],h&&(h=!1,v={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},x.add(i,0,[["enter",v,a]])),u=E.type==="tableDelimiterRow"?2:v?3:1):u&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(r=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],y=du(x,a,o,u,void 0,y),o=[0,0,0,0]),c[2]=i)):E.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(c[0]=c[1],y=du(x,a,o,u,void 0,y)),o=c,c=[o[1],i,0,0])):E.type==="tableHead"?(h=!0,m=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(m=i,o[1]!==0?(c[0]=c[1],y=du(x,a,o,u,i,y)):c[1]!==0&&(y=du(x,a,c,u,i,y)),u=0):u&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(c[3]=i)}for(m!==0&&Cy(x,a,m,p,v),x.consume(a.events),i=-1;++i<a.events.length;){const b=a.events[i];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=KC(a.events,i))}return n}function du(n,a,i,r,u,o){const c=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",h="tableContent";i[0]!==0&&(o.end=Object.assign({},ki(a.events,i[0])),n.add(i[0],0,[["exit",o,a]]));const m=ki(a.events,i[1]);if(o={type:c,start:Object.assign({},m),end:Object.assign({},m)},n.add(i[1],0,[["enter",o,a]]),i[2]!==0){const p=ki(a.events,i[2]),v=ki(a.events,i[3]),y={type:h,start:Object.assign({},p),end:Object.assign({},v)};if(n.add(i[2],0,[["enter",y,a]]),r!==2){const x=a.events[i[2]],b=a.events[i[3]];if(x[1].end=Object.assign({},b[1].end),x[1].type="chunkText",x[1].contentType="text",i[3]>i[2]+1){const E=i[2]+1,j=i[3]-i[2]-1;n.add(E,j,[])}}n.add(i[3]+1,0,[["exit",y,a]])}return u!==void 0&&(o.end=Object.assign({},ki(a.events,u)),n.add(u,0,[["exit",o,a]]),o=void 0),o}function Cy(n,a,i,r,u){const o=[],c=ki(a.events,i);u&&(u.end=Object.assign({},c),o.push(["exit",u,a])),r.end=Object.assign({},c),o.push(["exit",r,a]),n.add(i+1,0,o)}function ki(n,a){const i=n[a],r=i[0]==="enter"?"start":"end";return i[1][r]}const eA={name:"tasklistCheck",tokenize:nA};function tA(){return{text:{91:eA}}}function nA(n,a,i){const r=this;return u;function u(m){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?i(m):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),o)}function o(m){return pt(m)?(n.enter("taskListCheckValueUnchecked"),n.consume(m),n.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(n.enter("taskListCheckValueChecked"),n.consume(m),n.exit("taskListCheckValueChecked"),c):i(m)}function c(m){return m===93?(n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),h):i(m)}function h(m){return ke(m)?a(m):Ie(m)?n.check({tokenize:aA},a,i)(m):i(m)}}function aA(n,a,i){return Xe(n,r,"whitespace");function r(u){return u===null?i(u):a(u)}}function lA(n){return c1([wC(),HC(),XC(n),JC(),tA()])}const iA={};function rA(n){const a=this,i=n||iA,r=a.data(),u=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);u.push(lA(i)),o.push(EC()),c.push(NC(i))}const sA="_root_1pdrb_1",uA="_codeBlockWrapper_1pdrb_49",oA="_codeBlockHeader_1pdrb_70",cA="_codeBlockLang_1pdrb_80",fA="_copyBtn_1pdrb_86",Rr={root:sA,codeBlockWrapper:uA,codeBlockHeader:oA,codeBlockLang:cA,copyBtn:fA};function dA({children:n,className:a,...i}){var c;if(!(/language-(\w+)/.test(a||"")||typeof n=="string"&&n.includes(`
263
263
  `)))return g.jsx("code",{className:a,...i,children:n});const u=String(n).replace(/\n$/,""),o=(c=a==null?void 0:a.match(/language-(\w+)/))==null?void 0:c[1];return g.jsx(hA,{code:u,lang:o})}function hA({code:n,lang:a}){const[i,r]=B.useState(!1),u=B.useCallback(()=>{navigator.clipboard.writeText(n).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)}).catch(()=>{})},[n]);return g.jsxs("div",{className:Rr.codeBlockWrapper,children:[g.jsxs("div",{className:Rr.codeBlockHeader,children:[a&&g.jsx("span",{className:Rr.codeBlockLang,children:a}),g.jsx("button",{className:Rr.copyBtn,onClick:u,"aria-label":"Copy code",children:i?g.jsx(Yy,{size:13}):g.jsx($y,{size:13})})]}),g.jsx("pre",{children:g.jsx("code",{children:n})})]})}const mA={code:dA,a:({children:n,...a})=>g.jsx("a",{...a,target:"_blank",rel:"noopener noreferrer",children:n})};function pA({content:n}){return g.jsx("div",{className:Rr.root,children:g.jsx(XE,{remarkPlugins:[rA],components:mA,children:n})})}const gA="_root_11p18_1",yA="_pill_11p18_8",vA="_icon_11p18_22",_A="_separator_11p18_27",xA="_dim_11p18_31",bA="_cache_11p18_36",al={root:gA,pill:yA,icon:vA,separator:_A,dim:xA,cache:bA};function Of(n){return n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}function SA({usage:n}){return g.jsx("div",{className:al.root,children:g.jsxs("span",{className:al.pill,children:[g.jsx(Fy,{size:10,className:al.icon}),Of(n.inputTokens)," ",g.jsx("span",{className:al.dim,children:"in"}),g.jsx("span",{className:al.separator,children:"/"}),Of(n.outputTokens)," ",g.jsx("span",{className:al.dim,children:"out"}),n.cacheReadInputTokens!==void 0&&n.cacheReadInputTokens>0&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:al.separator,children:"/"}),g.jsxs("span",{className:al.cache,children:[Of(n.cacheReadInputTokens)," cached"]})]})]})})}function xn(n){if(!n)return 0;try{return Number(BigInt(n)/1000000n)}catch{return Math.floor(Number(n)/1e6)}}function ev(n,a){const i=[];if(n)for(const r of n)for(const u of r.scopeSpans??[])for(const o of u.spans??[])i.push({type:"span",traceId:o.traceId,spanId:o.spanId,parentSpanId:o.parentSpanId,name:o.name,kind:o.kind,startTimeUnixNano:o.startTimeUnixNano,endTimeUnixNano:o.endTimeUnixNano,attributes:o.attributes,events:o.events,status:o.status,resource:r.resource,scope:u.scope,timestampMs:xn(o.startTimeUnixNano)||Date.now()});if(a)for(const r of a)for(const u of r.scopeLogs??[])for(const o of u.logRecords??[])i.push({type:"log",traceId:o.traceId,spanId:o.spanId,severityNumber:o.severityNumber,severityText:o.severityText,body:o.body,attributes:o.attributes,timeUnixNano:o.timeUnixNano,observedTimeUnixNano:o.observedTimeUnixNano,resource:r.resource,scope:u.scope,timestampMs:xn(o.timeUnixNano)||xn(o.observedTimeUnixNano)||Date.now()});return i.sort((r,u)=>r.timestampMs-u.timestampMs),i}function kA(n){const a=n.filter(o=>o.type==="span"&&o.spanId),i=new Map;for(const o of a)i.set(o.spanId,{span:o,children:[],depth:0,durationMs:xn(o.endTimeUnixNano)-xn(o.startTimeUnixNano)});const r=[];for(const o of i.values()){const c=o.span.parentSpanId,h=c?i.get(c):void 0;h?h.children.push(o):r.push(o)}const u=(o,c)=>{o.depth=c,o.children.sort((h,m)=>h.span.timestampMs-m.span.timestampMs);for(const h of o.children)u(h,c+1)};r.sort((o,c)=>o.span.timestampMs-c.span.timestampMs);for(const o of r)u(o,0);return r}function TA(n){const a=[],i=r=>{a.push(r);for(const u of r.children)i(u)};for(const r of n)i(r);return a}function EA(n){const a=TA(n);if(a.length===0)return[];let i=1/0,r=0;for(const o of a){const c=xn(o.span.startTimeUnixNano),h=xn(o.span.endTimeUnixNano);c>0&&c<i&&(i=c),h>r&&(r=h)}const u=r-i;return u<=0?a.map(o=>({node:o,offsetPercent:0,widthPercent:100})):a.map(o=>{const c=xn(o.span.startTimeUnixNano),h=xn(o.span.endTimeUnixNano),m=(c-i)/u*100,p=Math.max((h-c)/u*100,.5);return{node:o,offsetPercent:Math.max(0,m),widthPercent:Math.min(p,100-m)}})}function tv(n){return n<0?"—":n<1?"<1ms":n<1e3?`${Math.round(n)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(1)}m`}function NA(n){const a=(n.name??"").toLowerCase(),i=n.attributes??{};return a==="tool_use"||a==="tool_call"||a.startsWith("execute_tool")||i["tool.name"]||i["gen_ai.tool.name"]?"tool":n.parentSpanId?a.includes("invoke")||a.includes("agent")?"agent":Object.keys(i).some(r=>r.startsWith("gen_ai."))?"llm":"other":"invocation"}const CA="_root_ryrat_1",AA="_pill_ryrat_5",wA="_cards_ryrat_24",jA="_card_ryrat_24",MA="_cardHeader_ryrat_39",RA="_toolIcon_ryrat_45",zA="_toolName_ryrat_50",OA="_duration_ryrat_57",DA="_toggle_ryrat_64",LA="_json_ryrat_80",Ln={root:CA,pill:AA,cards:wA,card:jA,cardHeader:MA,toolIcon:RA,toolName:zA,duration:OA,toggle:DA,json:LA};function Ay(n){if(!n)return null;try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}function BA({tool:n}){const[a,i]=B.useState(!0),[r,u]=B.useState(!0),o=Ay(n.input),c=Ay(n.output);return g.jsxs("div",{className:Ln.card,children:[g.jsxs("div",{className:Ln.cardHeader,children:[g.jsx(wa,{size:12,className:Ln.toolIcon}),g.jsx("span",{className:Ln.toolName,children:n.name}),n.durationMs!==void 0&&g.jsx("span",{className:Ln.duration,children:tv(n.durationMs)})]}),o&&g.jsxs("button",{className:Ln.toggle,onClick:()=>i(h=>!h),children:[a?g.jsx(il,{size:12}):g.jsx(Al,{size:12}),"Input"]}),a&&o&&g.jsx("pre",{className:Ln.json,children:o}),c&&g.jsxs("button",{className:Ln.toggle,onClick:()=>u(h=>!h),children:[r?g.jsx(il,{size:12}):g.jsx(Al,{size:12}),"Output"]}),r&&c&&g.jsx("pre",{className:Ln.json,children:c})]})}function UA({toolCalls:n}){const[a,i]=B.useState(!1);return n.length===0?null:g.jsxs("div",{className:Ln.root,children:[g.jsxs("button",{className:Ln.pill,onClick:()=>i(r=>!r),children:[g.jsx(wa,{size:12}),n.length," tool",n.length===1?"":"s"," used",a?g.jsx(il,{size:14}):g.jsx(Al,{size:14})]}),a&&g.jsx("div",{className:Ln.cards,children:n.map((r,u)=>g.jsx(BA,{tool:r},`${r.spanId}-${u}`))})]})}const HA="_messages_nks4r_1",IA="_emptyState_nks4r_10",qA="_emptyStateIcon_nks4r_20",VA="_emptyStateAgent_nks4r_26",GA="_emptyStateDetails_nks4r_32",ZA="_emptyStateText_nks4r_37",YA="_msg_nks4r_42",$A="_msgUser_nks4r_48",XA="_bodyUser_nks4r_74 _body_nks4r_66",QA="_bodyAssistant_nks4r_81 _body_nks4r_66",FA="_bodyError_nks4r_87 _body_nks4r_66",KA="_thinking_nks4r_94",JA="_thinkingDot_nks4r_104",PA="_spinner_nks4r_127",WA="_startingText_nks4r_136",st={messages:HA,emptyState:IA,emptyStateIcon:qA,emptyStateAgent:VA,emptyStateDetails:GA,emptyStateText:ZA,msg:YA,msgUser:$A,bodyUser:XA,bodyAssistant:QA,bodyError:FA,thinking:KA,thinkingDot:JA,spinner:PA,startingText:WA};function ew(n){return n.replace(/\n?\n?```[^\n`]+\n\n```\n?\n?/g,`
264
- `)}function tw(n){return n.isError?st.bodyError:n.role==="user"?st.bodyUser:st.bodyAssistant}const nw=B.forwardRef(({messages:n,isStreaming:a,isStarting:i,agentName:r,agentBuildType:u,agentProtocol:o,hasAvailableTargets:c=!0},h)=>{if(i)return g.jsx("div",{className:st.messages,ref:h,children:g.jsxs("div",{className:st.emptyState,children:[g.jsx("div",{className:st.spinner}),g.jsxs("div",{className:st.startingText,children:["Setting up ",r||"agent",g.jsx("span",{className:st.thinkingDot,children:"."}),g.jsx("span",{className:st.thinkingDot,children:"."}),g.jsx("span",{className:st.thinkingDot,children:"."})]})]})});if(n.length===0){if(!c)return g.jsx("div",{className:st.messages,ref:h,children:g.jsxs("div",{className:st.emptyState,children:[g.jsx("div",{className:st.emptyStateIcon,children:g.jsx(Hf,{size:40,strokeWidth:1.5,color:"#6366f1"})}),g.jsx("div",{className:st.emptyStateAgent,children:"No agents found"}),g.jsxs("div",{className:st.emptyStateText,children:["Run ",g.jsx("code",{className:"cmd",children:"agentcore add"})," to add an agent or harness"]})]})});const p=[u==="CodeZip"?"Direct code deploy":u,o??"HTTP"].filter(Boolean).join(" · ");return g.jsx("div",{className:st.messages,ref:h,children:g.jsxs("div",{className:st.emptyState,children:[g.jsx("div",{className:st.emptyStateIcon,children:g.jsx(Hf,{size:40,strokeWidth:1.5,color:"#6366f1"})}),g.jsx("div",{className:st.emptyStateAgent,children:r||"Agent"}),p&&g.jsx("div",{className:st.emptyStateDetails,children:p}),g.jsx("div",{className:st.emptyStateText,children:"Send a prompt to test this agent"})]})})}return g.jsx("div",{className:st.messages,ref:h,children:n.map((m,p)=>a&&m.role==="assistant"&&m.content===""&&p===n.length-1?g.jsx("div",{className:st.msg,children:g.jsxs("div",{className:st.thinking,children:["Thinking",g.jsx("span",{className:st.thinkingDot,children:"."}),g.jsx("span",{className:st.thinkingDot,children:"."}),g.jsx("span",{className:st.thinkingDot,children:"."})]})},p):g.jsxs("div",{className:m.role==="user"?st.msgUser:st.msg,children:[g.jsx("div",{className:tw(m),children:m.isError?g.jsx(If,{content:m.content}):m.role==="assistant"?g.jsx(pA,{content:m.toolExecutions?ew(m.content):m.content}):m.content}),m.toolCalls&&m.toolCalls.length>0&&g.jsx(UA,{toolCalls:m.toolCalls}),m.toolExecutions&&Object.keys(m.toolExecutions).length>0&&g.jsx(LS,{toolExecutions:m.toolExecutions}),m.tokenUsage&&g.jsx(SA,{usage:m.tokenUsage})]},p))})});function aw(){const a=new URLSearchParams(window.location.search).get("port");return a&&/^\d+$/.test(a)?`http://localhost:${a}`:""}const Bn=aw();function Sn(n,a){if((a==null?void 0:a.method)==="POST"){const i=new Headers(a.headers);return i.set("X-Agentcore-Local","1"),fetch(n,{...a,headers:i})}return fetch(n,a)}function lw(){const[n,a]=B.useState([]),[i,r]=B.useState(!1),[u,o]=B.useState(null),[c,h]=B.useState(null),m=B.useCallback(async()=>{try{return(await Sn(`${Bn}/api/memory?memoryName=__probe__&namespace=__probe__`)).status===404?(h(!1),!1):(h(!0),!0)}catch{return h(!1),!1}},[]),p=B.useCallback(async(x,b)=>{r(!0),o(null),a([]);try{const E=new URLSearchParams({memoryName:x,namespace:b}),j=await Sn(`${Bn}/api/memory?${E.toString()}`);if(j.status===404){o("Memory browsing is only available in invoke mode."),h(!1);return}const O=await j.json();O.success&&O.records?a(O.records):o(O.error||"Failed to load memory records")}catch(E){o(E instanceof Error?E.message:"Failed to load memory records")}finally{r(!1)}},[]),v=B.useCallback(async(x,b,E)=>{r(!0),o(null),a([]);try{const j={memoryName:x,namespace:b,searchQuery:E},O=await Sn(`${Bn}/api/memory/search`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)});if(O.status===404){o("Memory browsing is only available in invoke mode."),h(!1);return}const S=await O.json();S.success&&S.records?a(S.records):o(S.error||"Failed to search memory records")}catch(j){o(j instanceof Error?j.message:"Failed to search memory records")}finally{r(!1)}},[]),y=B.useCallback(()=>{a([]),o(null)},[]);return{records:n,isLoading:i,error:u,isAvailable:c,checkAvailability:m,listRecords:p,searchRecords:v,clear:y}}function Vu(n){try{const a=Number(n),i=Number.isFinite(a)&&a>1e12?new Date(a):new Date(n);return isNaN(i.getTime())?n:i.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return n}}const iw="_notice_1isal_1",rw="_warning_1isal_12",sw="_retryBtn_1isal_16",Df={notice:iw,warning:rw,retryBtn:sw};function wy({children:n,variant:a="error",onRetry:i}){return g.jsxs("div",{className:`${Df.notice} ${a==="warning"?Df.warning:""}`,children:[n,i&&g.jsx("button",{className:Df.retryBtn,onClick:i,children:"Retry"})]})}const uw="_container_qogk5_1",ow="_content_qogk5_47",cw="_status_qogk5_55",fw="_error_qogk5_62",dw="_detail_qogk5_73",hw="_detailHeader_qogk5_80",mw="_detailTitle_qogk5_89",pw="_closeBtn_qogk5_95",gw="_controls_qogk5_118",yw="_field_qogk5_124",vw="_fieldLabel_qogk5_130",_w="_input_qogk5_138",xw="_select_qogk5_158",bw="_actions_qogk5_175",Sw="_actionBtn_qogk5_180",kw="_searchBtn_qogk5_202",Tw="_resultCount_qogk5_213",Ew="_recordList_qogk5_219",Nw="_recordRow_qogk5_228",Cw="_recordRowSelected_qogk5_248",Aw="_recordMain_qogk5_254",ww="_recordContent_qogk5_261",jw="_scoreBadge_qogk5_271",Mw="_recordMeta_qogk5_281",Rw="_strategyTag_qogk5_288",zw="_recordTime_qogk5_296",Ow="_detailBody_qogk5_302",Dw="_detailSection_qogk5_309",Lw="_detailLabel_qogk5_315",Bw="_detailContent_qogk5_322",Uw="_metadataGrid_qogk5_335",Hw="_metadataRow_qogk5_341",Iw="_metadataKey_qogk5_354",qw="_metadataValue_qogk5_361",Vw="_detailId_qogk5_370",Gw="_namespacesValue_qogk5_377",Zw="_noMetadata_qogk5_383",ge={container:uw,content:ow,status:cw,error:fw,detail:dw,detailHeader:hw,detailTitle:mw,closeBtn:pw,controls:gw,field:yw,fieldLabel:vw,input:_w,select:xw,actions:bw,actionBtn:Sw,searchBtn:kw,resultCount:Tw,recordList:Ew,recordRow:Nw,recordRowSelected:Cw,recordMain:Aw,recordContent:ww,scoreBadge:jw,recordMeta:Mw,strategyTag:Rw,recordTime:zw,detailBody:Ow,detailSection:Dw,detailLabel:Lw,detailContent:Bw,metadataGrid:Uw,metadataRow:Hw,metadataKey:Iw,metadataValue:qw,detailId:Vw,namespacesValue:Gw,noMetadata:Zw};function Yw({memories:n,sessionId:a,userId:i,isActive:r}){var T;const{records:u,isLoading:o,error:c,isAvailable:h,checkAvailability:m,listRecords:p,searchRecords:v,clear:y}=lw(),[x,b]=B.useState(((T=n[0])==null?void 0:T.name)??""),[E,j]=B.useState(""),[O,S]=B.useState({}),[R,M]=B.useState(""),[J,te]=B.useState(null),[q,ae]=B.useState(!1),[de,ve]=B.useState(!1);B.useEffect(()=>{!x&&n.length>0&&b(n[0].name)},[n,x]);const L=n.find(U=>U.name===x),P=(L==null?void 0:L.strategies)??[],$=P.find(U=>U.type===E),fe=B.useMemo(()=>$?[...new Set($.namespaces.flatMap(U=>(U.match(/\{(\w+)\}/g)||[]).map(he=>he.slice(1,-1))))]:[],[$]);B.useEffect(()=>{r&&h===null&&m()},[r,h,m]),B.useEffect(()=>{if(!$){S({});return}const U={};for(const ie of fe)ie==="actorId"?U[ie]=i||"default-user":ie==="sessionId"&&a?U[ie]=a:U[ie]="";S(U)},[$,fe,a,i]);const W=U=>{b(U),j(""),te(null),ve(!1),y()},ee=U=>{j(U),te(null),ve(!1),y()},D=(U,ie)=>{S(he=>({...he,[U]:ie}))},F=()=>$?$.namespaces.map(U=>U.replace(/\{(\w+)\}/g,(ie,he)=>{var je;return((je=O[he])==null?void 0:je.trim())||""})).join(","):"",ue=$!=null&&fe.every(U=>{var ie;return(ie=O[U])==null?void 0:ie.trim()}),ne=()=>{ue&&(ae(!1),te(null),ve(!0),p(x,F()))},N=()=>{!ue||!R.trim()||(ae(!0),te(null),ve(!0),v(x,F(),R.trim()))},A=U=>{U.key==="Enter"&&(R.trim()?N():ne())},Z=U=>{te(ie=>(ie==null?void 0:ie.memoryRecordId)===U.memoryRecordId?null:U)};return n.length===0?g.jsxs("div",{className:ge.status,children:[g.jsx("div",{children:"No AgentCore Memory found."}),g.jsxs("div",{children:["Run ",g.jsx("code",{className:"cmd",children:"agentcore add"})," to add Memory, then"," ",g.jsx("code",{className:"cmd",children:"agentcore deploy"})," to deploy it."]})]}):g.jsx("div",{className:ge.container,children:g.jsxs("div",{className:ge.content,children:[n.some(U=>U.deploymentStatus!=="deployed")&&g.jsxs(wy,{variant:"warning",children:[g.jsx("span",{children:"AgentCore Memory must be deployed before it can be used."}),g.jsxs("span",{children:["To test memory, run ",g.jsx("code",{className:"cmd",children:"agentcore deploy"})," and restart dev."]})]}),n.some(U=>U.deploymentStatus==="deployed")&&g.jsx(wy,{variant:"warning",children:"Memories may take 1-2 minutes to update after an invocation."}),h!==!1&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:ge.controls,children:[g.jsxs("div",{className:ge.field,children:[g.jsx("label",{className:ge.fieldLabel,htmlFor:"memory-selector",children:"Memory"}),g.jsx("select",{id:"memory-selector",className:ge.select,value:x,onChange:U=>W(U.target.value),children:n.map(U=>g.jsx("option",{value:U.name,children:U.name},U.name))})]}),g.jsxs("div",{className:ge.field,children:[g.jsx("label",{className:ge.fieldLabel,htmlFor:`strat-${x}`,children:"Strategy"}),g.jsxs("select",{id:`strat-${x}`,className:ge.select,value:E,onChange:U=>ee(U.target.value),children:[g.jsx("option",{value:"",disabled:!0,children:"Select a strategy…"}),P.map(U=>g.jsx("option",{value:U.type,children:U.type},U.type))]})]}),fe.map(U=>g.jsxs("div",{className:ge.field,children:[g.jsx("label",{className:ge.fieldLabel,htmlFor:`ns-${x}-${U}`,children:U}),g.jsx("input",{id:`ns-${x}-${U}`,className:ge.input,type:"text",placeholder:`Enter ${U}…`,value:O[U]||"",onChange:ie=>D(U,ie.target.value),onKeyDown:A})]},U)),$&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:ge.field,children:[g.jsx("label",{className:ge.fieldLabel,htmlFor:`search-${x}`,children:"Search (optional)"}),g.jsx("input",{id:`search-${x}`,className:ge.input,type:"text",placeholder:"Semantic search query…",value:R,onChange:U=>M(U.target.value),onKeyDown:A})]}),g.jsxs("div",{className:ge.actions,children:[g.jsx("button",{className:ge.actionBtn,onClick:ne,disabled:!ue||o,children:"List"}),g.jsx("button",{className:`${ge.actionBtn} ${ge.searchBtn}`,onClick:N,disabled:!ue||!R.trim()||o,children:"Search"})]})]})]}),o&&g.jsx("div",{className:ge.status,children:"Loading records…"}),c&&g.jsx("div",{className:ge.error,children:g.jsxs("span",{children:[g.jsx(od,{size:12})," ",c]})}),!o&&!c&&de&&u.length===0&&g.jsx("div",{className:ge.status,children:"No memory records found for this namespace."}),!o&&u.length>0&&g.jsxs("div",{className:ge.recordList,children:[g.jsxs("div",{className:ge.resultCount,children:[u.length," record",u.length!==1?"s":"",q?" (search results)":""]}),u.map(U=>g.jsx($w,{record:U,isSelected:(J==null?void 0:J.memoryRecordId)===U.memoryRecordId,showScore:q,onClick:()=>Z(U)},U.memoryRecordId))]}),J&&g.jsx(Xw,{record:J,onClose:()=>te(null)})]})]})})}function $w({record:n,isSelected:a,showScore:i,onClick:r}){const u=n.content?n.content.length>120?n.content.slice(0,120)+"…":n.content:"(no content)";return g.jsxs("button",{className:`${ge.recordRow} ${a?ge.recordRowSelected:""}`,onClick:r,"aria-label":`Memory record ${n.memoryRecordId}`,children:[g.jsxs("div",{className:ge.recordMain,children:[g.jsx("span",{className:ge.recordContent,children:u}),i&&n.score!==null&&n.score!==void 0&&g.jsx("span",{className:ge.scoreBadge,children:n.score.toFixed(3)})]}),g.jsxs("div",{className:ge.recordMeta,children:[g.jsx("span",{className:ge.strategyTag,children:n.memoryStrategyId}),g.jsx("span",{className:ge.recordTime,children:Vu(n.createdAt)})]})]})}function Xw({record:n,onClose:a}){const i=Object.entries(n.metadata||{});return g.jsxs("div",{className:ge.detail,children:[g.jsxs("div",{className:ge.detailHeader,children:[g.jsx("span",{className:ge.detailTitle,children:"Record Detail"}),g.jsx("button",{className:ge.closeBtn,onClick:a,"aria-label":"Close record detail",children:g.jsx(Du,{size:12})})]}),g.jsxs("div",{className:ge.detailBody,children:[g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"ID"}),g.jsx("span",{className:ge.detailId,children:n.memoryRecordId})]}),g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Content"}),g.jsx("div",{className:ge.detailContent,children:n.content||"(no content)"})]}),g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Strategy"}),g.jsx("span",{className:ge.strategyTag,children:n.memoryStrategyId})]}),g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Created"}),g.jsx("span",{className:ge.recordTime,children:Vu(n.createdAt)})]}),n.score!==null&&n.score!==void 0&&g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Relevance Score"}),g.jsx("span",{className:ge.scoreBadge,children:n.score.toFixed(4)})]}),n.namespaces.length>0&&g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Namespaces"}),g.jsx("span",{className:ge.namespacesValue,children:n.namespaces.join(", ")})]}),i.length>0&&g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Metadata"}),g.jsx("div",{className:ge.metadataGrid,children:i.map(([r,u])=>g.jsxs("div",{className:ge.metadataRow,children:[g.jsx("span",{className:ge.metadataKey,children:r}),g.jsx("span",{className:ge.metadataValue,children:u})]},r))})]}),i.length===0&&g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Metadata"}),g.jsx("span",{className:ge.noMetadata,children:"No metadata"})]})]})]})}const Qw="_panel_lfvg8_1",Fw="_resizeHandle_lfvg8_13",Kw="_header_lfvg8_30",Jw="_projectName_lfvg8_39",Pw="_headerActions_lfvg8_45",Ww="_iconBtn_lfvg8_50",ej="_tabBar_lfvg8_70",tj="_tab_lfvg8_70",nj="_tabActive_lfvg8_93",aj="_body_lfvg8_98",lj="_tabContent_lfvg8_104",ij="_status_lfvg8_114",rj="_error_lfvg8_121",sj="_retryBtn_lfvg8_132",uj="_graph_lfvg8_146",oj="_section_lfvg8_152",cj="_sectionTitle_lfvg8_158",fj="_childNode_lfvg8_167",dj="_node_lfvg8_183",hj="_nodeSelected_lfvg8_201",mj="_nodeIcon_lfvg8_206",pj="_agent_lfvg8_216",gj="_harness_lfvg8_220",yj="_memory_lfvg8_224",vj="_credential_lfvg8_228",_j="_gateway_lfvg8_232",xj="_gatewayTarget_lfvg8_236",bj="_mcpTool_lfvg8_240",Sj="_evaluator_lfvg8_244",kj="_onlineEval_lfvg8_248",Tj="_policyEngine_lfvg8_252",Ej="_policy_lfvg8_252",Nj="_unassignedTarget_lfvg8_260",Cj="_nodeContent_lfvg8_264",Aj="_nodeName_lfvg8_272",wj="_nodeNameRow_lfvg8_281",jj="_deployBadge_lfvg8_288",Mj="_deploy_deployed_lfvg8_298",Rj="_nodeSubtitle_lfvg8_313",zj="_nodeConnections_lfvg8_321",Oj="_connectionTag_lfvg8_328",Dj="_infoCard_lfvg8_386",Lj="_infoHeader_lfvg8_393",Bj="_kindBadge_lfvg8_402",Uj="_infoName_lfvg8_461",Hj="_infoBody_lfvg8_467",Ij="_infoSectionHeader_lfvg8_471",qj="_infoRow_lfvg8_481",Vj="_infoKey_lfvg8_494",Gj="_infoValue_lfvg8_499",Ce={panel:Qw,resizeHandle:Fw,header:Kw,projectName:Jw,headerActions:Pw,iconBtn:Ww,tabBar:ej,tab:tj,tabActive:nj,body:aj,tabContent:lj,status:ij,error:rj,retryBtn:sj,graph:uj,section:oj,sectionTitle:cj,childNode:fj,node:dj,nodeSelected:hj,nodeIcon:mj,agent:pj,harness:gj,memory:yj,credential:vj,gateway:_j,gatewayTarget:xj,mcpTool:bj,evaluator:Sj,onlineEval:kj,policyEngine:Tj,policy:Ej,unassignedTarget:Nj,nodeContent:Cj,nodeName:Aj,nodeNameRow:wj,deployBadge:jj,deploy_deployed:Mj,"deploy_local-only":"_deploy_local-only_lfvg8_303","deploy_pending-removal":"_deploy_pending-removal_lfvg8_308",nodeSubtitle:Rj,nodeConnections:zj,connectionTag:Oj,infoCard:Dj,infoHeader:Lj,kindBadge:Bj,infoName:Uj,infoBody:Hj,infoSectionHeader:Ij,infoRow:qj,infoKey:Vj,infoValue:Gj},Zj={agent:Hf,harness:J0,memory:X0,credential:_x,gateway:px,gatewayTarget:ox,mcpTool:wa,evaluator:rx,onlineEval:Z0,policyEngine:Ex,policy:hx,unassignedTarget:Qy},Yj={deployed:"Deployed","local-only":"Not deployed","pending-removal":"Removed locally"};function Dn({kind:n,name:a,subtitle:i,isSelected:r,onClick:u,connections:o,deploymentStatus:c}){const h=Zj[n];return g.jsxs("button",{className:`${Ce.node} ${Ce[n]} ${r?Ce.nodeSelected:""}`,onClick:u,"aria-label":`${n}: ${a}`,children:[g.jsx("span",{className:Ce.nodeIcon,children:g.jsx(h,{size:14})}),g.jsxs("div",{className:Ce.nodeContent,children:[g.jsxs("div",{className:Ce.nodeNameRow,children:[g.jsx("span",{className:Ce.nodeName,children:a}),c&&g.jsx("span",{className:`${Ce.deployBadge} ${Ce[`deploy_${c}`]}`,children:Yj[c]})]}),i&&g.jsx("span",{className:Ce.nodeSubtitle,children:i}),o&&o.length>0&&g.jsx("div",{className:Ce.nodeConnections,children:o.map(m=>g.jsx("span",{className:Ce.connectionTag,children:m},m))})]})]})}function $j(){const n=Bn,[a,i]=B.useState([]),[r,u]=B.useState([]),[o,c]=B.useState(!1),[h,m]=B.useState(!1),[p,v]=B.useState(null),[y,x]=B.useState(null),b=B.useCallback(async(O,S)=>{c(!0),v(null),u([]);try{const R=new URLSearchParams;O&&R.set("agentName",O),(S==null?void 0:S.startTime)!==void 0&&R.set("startTime",String(S.startTime)),(S==null?void 0:S.endTime)!==void 0&&R.set("endTime",String(S.endTime));const M=await Sn(`${n}/api/traces?${R.toString()}`);if(M.status===404){x(!1),i([]);return}x(!0);const J=await M.json();J.success?i(J.traces):(v(J.error),i([]))}catch(R){v(R instanceof Error?R.message:"Failed to load traces"),i([])}finally{c(!1)}},[n]),E=B.useCallback(async(O,S,R)=>{m(!0),v(null);try{const M=new URLSearchParams;S&&M.set("agentName",S),(R==null?void 0:R.startTime)!==void 0&&M.set("startTime",String(R.startTime)),(R==null?void 0:R.endTime)!==void 0&&M.set("endTime",String(R.endTime));const te=await(await Sn(`${n}/api/traces/${encodeURIComponent(O)}?${M.toString()}`)).json();te.success?u(ev(te.resourceSpans,te.resourceLogs)):(v(te.error),u([]))}catch(M){v(M instanceof Error?M.message:"Failed to load trace detail"),u([])}finally{m(!1)}},[n]),j=B.useCallback(()=>{u([]),v(null)},[]);return{traces:a,spans:r,isLoadingTraces:o,isLoadingSpans:h,error:p,isAvailable:y,fetchTraces:b,fetchTraceDetail:E,clearSpans:j}}function Ai(n){if(!n)return{};const a={};for(const i of n){if(!i.key||!i.value)continue;const r=i.value;r.stringValue!==void 0?a[i.key]=r.stringValue:r.intValue!==void 0?a[i.key]=r.intValue:r.doubleValue!==void 0?a[i.key]=r.doubleValue:r.boolValue!==void 0&&(a[i.key]=r.boolValue)}return a}function Zt(n){if(n!=null){if(typeof n!="string")return n;try{return JSON.parse(n)}catch{return n}}}function Xj(n){if(!n||!n.startsWith("["))return null;try{const a=JSON.parse(n);if(Array.isArray(a)&&a.length>0&&typeof a[0]=="object")return a}catch{}return null}function jy(n){if(!n||!n.startsWith("{")&&!n.startsWith("["))return null;try{return JSON.parse(n)}catch{return null}}const Qj="_dimText_1vmqq_1",Fj="_assistantMsg_1vmqq_5",Kj="_toolCalls_1vmqq_9",Jj="_toolCall_1vmqq_9",Pj="_toolIcon_1vmqq_22",Wj="_toolName_1vmqq_26",e4="_toolArgs_1vmqq_32",t4="_toolResult_1vmqq_45",n4="_toolResultStatus_1vmqq_51",a4="_finishReason_1vmqq_58",l4="_genAiContent_1vmqq_64",i4="_contentText_1vmqq_70",r4="_strandsEvent_1vmqq_74",s4="_strandsSection_1vmqq_80",u4="_strandsLabel_1vmqq_86",o4="_messageList_1vmqq_93",c4="_msgRow_1vmqq_99",f4="_roleBadge_1vmqq_105",d4="_role_user_1vmqq_116",h4="_role_assistant_1vmqq_121",m4="_role_system_1vmqq_126",p4="_role_tool_1vmqq_131",g4="_msgText_1vmqq_136",y4="_msgContent_1vmqq_142",v4="_parsedContent_1vmqq_147",_4="_spanScope_1vmqq_153",x4="_spanRaw_1vmqq_159",Ee={dimText:Qj,assistantMsg:Fj,toolCalls:Kj,toolCall:Jj,toolIcon:Pj,toolName:Wj,toolArgs:e4,toolResult:t4,toolResultStatus:n4,finishReason:a4,genAiContent:l4,contentText:i4,strandsEvent:r4,strandsSection:s4,strandsLabel:u4,messageList:o4,msgRow:c4,roleBadge:f4,role_user:d4,role_assistant:h4,role_system:m4,role_tool:p4,msgText:g4,msgContent:y4,parsedContent:v4,spanScope:_4,spanRaw:x4};function b4({span:n}){const a=n.events,i=n.attributes;if(a&&a.length>0)return g.jsx("div",{className:Ee.strandsEvent,children:a.map((r,u)=>g.jsx(S4,{event:r},u))});if(i){const r=Object.entries(i).filter(([u,o])=>o!=null&&(u.startsWith("gen_ai.")||u.startsWith("rpc.")||u==="tool.name"));if(r.length>0)return g.jsx("div",{className:Ee.strandsEvent,children:r.map(([u,o])=>g.jsxs("span",{className:Ee.spanScope,children:[u,": ",typeof o=="object"?JSON.stringify(o):String(o)]},u))})}return g.jsx("span",{className:Ee.dimText,children:"—"})}function S4({event:n}){const a=n.name,i=Ai(n.attributes);if(a==="gen_ai.user.message"||a==="gen_ai.system.message"){const r=Zt(i.content);if(Array.isArray(r))return g.jsx(Ni,{content:r});if(r)return g.jsx("span",{children:String(r)})}if(a==="gen_ai.choice"){const r=Zt(i.message);if(Array.isArray(r))return g.jsx(Ni,{content:r});if(r)return g.jsx(Gu,{body:{message:r,finish_reason:i.finish_reason}})}if(a==="gen_ai.tool.message"){const r=Zt(i.content);if(Array.isArray(r))return g.jsx(Ni,{content:r});if(r)return g.jsx("span",{children:String(r)})}return g.jsxs("span",{className:Ee.spanScope,children:[a||"event",i.content?`: ${String(i.content).slice(0,200)}`:""]})}function Gu({body:n}){if(n==null)return g.jsx("span",{className:Ee.dimText,children:"—"});if(typeof n=="string")return g.jsx("span",{children:n});if(typeof n!="object")return g.jsx("span",{children:String(n)});const a=n;if(typeof a.message=="string"&&!a.content&&!a.input&&!a.output)return g.jsx("span",{children:a.message});if(Array.isArray(a.content))return g.jsx(Ni,{content:a.content});if(a.message&&typeof a.message=="object"){const i=a.message;if(i.role==="assistant"&&Array.isArray(i.content)){const r=i.content.map(u=>u.text).filter(Boolean).join("");if(r)return g.jsx("div",{className:Ee.assistantMsg,children:r})}if(Array.isArray(i.tool_calls))return g.jsxs("div",{className:Ee.toolCalls,children:[i.tool_calls.map((r,u)=>{const o=r.function;return g.jsxs("div",{className:Ee.toolCall,children:[g.jsx("span",{className:Ee.toolIcon,children:g.jsx(wa,{size:12})}),g.jsx("span",{className:Ee.toolName,children:String((o==null?void 0:o.name)??"unknown")}),g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(o==null?void 0:o.arguments,null,2)})]},u)}),a.finish_reason!==null&&a.finish_reason!==void 0&&g.jsx("span",{className:Ee.finishReason,children:String(a.finish_reason)})]});if(i.role==="assistant"&&typeof i.content=="string")return g.jsx("div",{className:Ee.assistantMsg,children:i.content})}return a.input||a.output?g.jsx(k4,{input:a.input,output:a.output}):g.jsx("pre",{className:Ee.spanRaw,children:JSON.stringify(a,null,2)})}function Ni({content:n}){return g.jsx("div",{className:Ee.genAiContent,children:n.map((a,i)=>{const r=a;if(r.text)return g.jsx("div",{className:Ee.contentText,children:String(r.text)},i);if(r.toolUse){const u=r.toolUse;return g.jsxs("div",{className:Ee.toolCall,children:[g.jsx("span",{className:Ee.toolIcon,children:g.jsx(wa,{size:12})}),g.jsx("span",{className:Ee.toolName,children:String(u.name)}),g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(u.input,null,2)})]},i)}if(r.toolResult){const u=r.toolResult;return g.jsxs("div",{className:Ee.toolResult,children:[g.jsx("span",{className:Ee.toolResultStatus,children:String(u.status||"result")}),Array.isArray(u.content)&&u.content.map((o,c)=>g.jsx("pre",{className:Ee.toolArgs,children:String(o.text??JSON.stringify(o))},c))]},i)}return g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(r,null,2)},i)})})}function My(n){if(n&&typeof n=="object"&&!Array.isArray(n)){const a=n.messages;if(Array.isArray(a))return a}}function k4({input:n,output:a}){const i=My(n),r=My(a);return g.jsxs("div",{className:Ee.strandsEvent,children:[n!=null&&g.jsxs("div",{className:Ee.strandsSection,children:[g.jsx("span",{className:Ee.strandsLabel,children:"Input"}),i?g.jsx(Ry,{messages:i}):g.jsx("pre",{className:Ee.spanRaw,children:JSON.stringify(n,null,2)})]}),a!=null&&g.jsxs("div",{className:Ee.strandsSection,children:[g.jsx("span",{className:Ee.strandsLabel,children:"Output"}),r?g.jsx(Ry,{messages:r}):g.jsx("pre",{className:Ee.spanRaw,children:JSON.stringify(a,null,2)})]})]})}function Ry({messages:n}){return!n||!Array.isArray(n)?null:g.jsx("div",{className:Ee.messageList,children:n.map((a,i)=>{const r=a,u=String(r.role||""),o=r.content;let c="";typeof o=="string"?c=o:o&&typeof o=="object"&&(c=o.message||o.content||"");const h=Xj(c);return g.jsxs("div",{className:Ee.msgRow,children:[g.jsx("span",{className:`${Ee.roleBadge} ${Ee[`role_${u}`]||""}`,children:u}),g.jsx("div",{className:Ee.msgContent,children:h?g.jsx(T4,{items:h}):g.jsx("span",{className:Ee.msgText,children:c||JSON.stringify(o)})})]},i)})})}function T4({items:n}){return g.jsx("div",{className:Ee.parsedContent,children:n.map((a,i)=>{if(a.text){const r=String(a.text),u=jy(r);return u?g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(u,null,2)},i):g.jsx("div",{className:Ee.contentText,children:r},i)}if(a.toolUse){const r=a.toolUse;return g.jsxs("div",{className:Ee.toolCall,children:[g.jsx("span",{className:Ee.toolIcon,children:g.jsx(wa,{size:12})}),g.jsx("span",{className:Ee.toolName,children:String(r.name)}),r.input!==null&&r.input!==void 0&&Object.keys(r.input).length>0&&g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(r.input,null,2)})]},i)}if(a.toolResult){const r=a.toolResult,u=String(r.status||"result");return g.jsxs("div",{className:Ee.toolResult,children:[g.jsx("span",{className:Ee.toolResultStatus,children:u}),Array.isArray(r.content)&&r.content.map((o,c)=>{const h=String(o.text??""),m=jy(h);return m?g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(m,null,2)},c):g.jsx("pre",{className:Ee.toolArgs,children:h},c)})]},i)}return g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(a,null,2)},i)})})}const E4="_container_1hcbv_1",N4="_toggleRow_1hcbv_6",C4="_toggle_1hcbv_6",A4="_chevron_1hcbv_32",w4="_icon_1hcbv_38",j4="_label_1hcbv_43",M4="_content_1hcbv_47",R4="_status_1hcbv_55",z4="_error_1hcbv_62",O4="_detail_1hcbv_73",D4="_traceDetail_1hcbv_73",L4="_detailHeader_1hcbv_80",B4="_detailTitle_1hcbv_89",U4="_closeBtn_1hcbv_95",H4="_controls_1hcbv_111",I4="_controlRow_1hcbv_118",q4="_refreshBtn_1hcbv_124",V4="_retryBtn_1hcbv_144",G4="_timeFilter_1hcbv_158",Z4="_timeModeToggle_1hcbv_164",Y4="_timeModeBtn_1hcbv_173",$4="_timeModeBtnActive_1hcbv_188",X4="_dateRange_1hcbv_193",Q4="_dateField_1hcbv_200",F4="_dateLabel_1hcbv_208",K4="_dateInput_1hcbv_216",J4="_traceList_1hcbv_238",P4="_traceRow_1hcbv_247",W4="_traceRowSelected_1hcbv_267",e3="_traceMain_1hcbv_273",t3="_traceId_1hcbv_279",n3="_spanCount_1hcbv_286",a3="_traceMeta_1hcbv_294",l3="_traceTime_1hcbv_300",i3="_sessionId_1hcbv_305",r3="_spanList_1hcbv_319",s3="_spanRow_1hcbv_326",u3="_spanHeader_1hcbv_339",o3="_spanTimestamp_1hcbv_346",c3="_severityBadge_1hcbv_351",f3="_sevINFO_1hcbv_361",d3="_sevWARN_1hcbv_366",h3="_sevERROR_1hcbv_371",m3="_spanIdTag_1hcbv_376",p3="_spanScope_1hcbv_385",g3="_spanBody_1hcbv_391",y3="_rawToggle_1hcbv_397",v3="_spanRaw_1hcbv_412",be={container:E4,toggleRow:N4,toggle:C4,chevron:A4,icon:w4,label:j4,content:M4,status:R4,error:z4,detail:O4,traceDetail:D4,detailHeader:L4,detailTitle:B4,closeBtn:U4,controls:H4,controlRow:I4,refreshBtn:q4,retryBtn:V4,timeFilter:G4,timeModeToggle:Z4,timeModeBtn:Y4,timeModeBtnActive:$4,dateRange:X4,dateField:Q4,dateLabel:F4,dateInput:K4,traceList:J4,traceRow:P4,traceRowSelected:W4,traceMain:e3,traceId:t3,spanCount:n3,traceMeta:a3,traceTime:l3,sessionId:i3,spanList:r3,spanRow:s3,spanHeader:u3,spanTimestamp:o3,severityBadge:c3,sevINFO:f3,sevWARN:d3,sevERROR:h3,spanIdTag:m3,spanScope:p3,spanBody:g3,rawToggle:y3,spanRaw:v3},_3=[{label:"Last 1 hour",ms:3600*1e3},{label:"Last 6 hours",ms:360*60*1e3},{label:"Last 12 hours",ms:720*60*1e3},{label:"Last 24 hours",ms:1440*60*1e3},{label:"Last 3 days",ms:4320*60*1e3},{label:"Last 7 days",ms:10080*60*1e3}],x3=720*60*1e3;function hu(n,a){const i=n?new Date(n).getTime():void 0,r=a?new Date(a).getTime():void 0;if(!(i===void 0&&r===void 0))return{startTime:i,endTime:r}}function mu(n){const a=Date.now();return{startTime:a-n,endTime:a}}function Lf(n){return n||void 0}function b3({agents:n,isActive:a}){const{traces:i,spans:r,isLoadingTraces:u,isLoadingSpans:o,error:c,isAvailable:h,fetchTraces:m,fetchTraceDetail:p,clearSpans:v}=$j(),y=n.map(ne=>ne.name),x="",[b,E]=B.useState(x),[j,O]=B.useState(null),[S,R]=B.useState("relative"),[M,J]=B.useState(x3),[te,q]=B.useState(""),[ae,de]=B.useState(""),ve=B.useCallback(()=>S==="relative"?mu(M):hu(te,ae),[S,M,te,ae]),L=B.useCallback((ne,N)=>{O(null),v(),m(Lf(ne),N)},[v,m]),P=B.useRef(!1);B.useEffect(()=>{a&&!P.current&&L(b,mu(M)),P.current=!!a},[a,L,b,M]);const $=ne=>{E(ne),L(ne,ve())},fe=ne=>{j===ne.traceId?(O(null),v()):(O(ne.traceId),p(ne.traceId,Lf(b),ve()))},W=()=>{L(b,ve())},ee=ne=>{if(R(ne),ne==="relative")L(b,mu(M));else{const N=new Date,A=new Date(N.getTime()-M);q(pu(A)),de(pu(N)),L(b,hu(pu(A),pu(N)))}},D=ne=>{J(ne),L(b,mu(ne))},F=ne=>{q(ne),L(b,hu(ne,ae))},ue=ne=>{de(ne),L(b,hu(te,ne))};return y.length===0?g.jsx("div",{className:be.status,children:"No traces available."}):g.jsxs("div",{className:be.container,children:[g.jsx("div",{className:be.controls,children:g.jsxs("div",{className:be.controlRow,children:[g.jsxs("div",{className:be.dateField,children:[g.jsx("label",{className:be.dateLabel,htmlFor:"traces-agent",children:"Agent"}),g.jsxs("select",{id:"traces-agent",className:be.dateInput,value:b,onChange:ne=>$(ne.target.value),children:[g.jsx("option",{value:"",children:"All agents"}),y.map(ne=>g.jsx("option",{value:ne,children:ne},ne))]})]}),g.jsx("button",{className:be.refreshBtn,onClick:W,title:"Refresh traces","aria-label":"Refresh traces",children:g.jsx(ud,{size:12})})]})}),g.jsxs("div",{className:be.content,children:[h!==!1&&g.jsxs("div",{className:be.timeFilter,children:[g.jsxs("div",{className:be.timeModeToggle,children:[g.jsx("button",{className:`${be.timeModeBtn} ${S==="relative"?be.timeModeBtnActive:""}`,onClick:()=>ee("relative"),children:"Relative"}),g.jsx("button",{className:`${be.timeModeBtn} ${S==="absolute"?be.timeModeBtnActive:""}`,onClick:()=>ee("absolute"),children:"Absolute"})]}),S==="relative"?g.jsx("div",{className:be.dateField,children:g.jsx("select",{className:be.dateInput,value:M,onChange:ne=>D(Number(ne.target.value)),children:_3.map(ne=>g.jsx("option",{value:ne.ms,children:ne.label},ne.ms))})}):g.jsxs("div",{className:be.dateRange,children:[g.jsxs("div",{className:be.dateField,children:[g.jsx("label",{className:be.dateLabel,htmlFor:"traces-start",children:"Start"}),g.jsx("input",{id:"traces-start",className:be.dateInput,type:"datetime-local",value:te,onChange:ne=>F(ne.target.value)})]}),g.jsxs("div",{className:be.dateField,children:[g.jsx("label",{className:be.dateLabel,htmlFor:"traces-end",children:"End"}),g.jsx("input",{id:"traces-end",className:be.dateInput,type:"datetime-local",value:ae,onChange:ne=>ue(ne.target.value)})]})]})]}),u&&g.jsx("div",{className:be.status,children:"Loading traces…"}),c&&g.jsxs("div",{className:be.error,children:[g.jsxs("span",{children:[g.jsx(od,{size:12})," ",c]}),g.jsx("button",{className:be.retryBtn,onClick:()=>m(Lf(b),ve()),children:"Retry"})]}),!u&&!c&&h!==!1&&i.length===0&&g.jsx("div",{className:be.status,children:"No traces found."}),!u&&i.length>0&&g.jsx("div",{className:be.traceList,children:i.map(ne=>g.jsx(S3,{trace:ne,isSelected:j===ne.traceId,onClick:()=>fe(ne)},ne.traceId))}),j&&g.jsxs("div",{className:be.traceDetail,children:[g.jsxs("div",{className:be.detailHeader,children:[g.jsx("span",{className:be.detailTitle,children:"Spans"}),g.jsx("button",{className:be.closeBtn,onClick:()=>{O(null),v()},"aria-label":"Close span detail",children:g.jsx(Du,{size:12})})]}),o&&g.jsx("div",{className:be.status,children:"Loading spans…"}),!o&&r.length===0&&!c&&g.jsx("div",{className:be.status,children:"No spans found."}),!o&&r.length>0&&g.jsx("div",{className:be.spanList,children:r.map((ne,N)=>g.jsx(k3,{span:ne},N))})]})]})]})}function S3({trace:n,isSelected:a,onClick:i}){return g.jsxs("button",{className:`${be.traceRow} ${a?be.traceRowSelected:""}`,onClick:i,"aria-label":`Trace ${n.traceId}`,children:[g.jsxs("div",{className:be.traceMain,children:[g.jsxs("span",{className:be.traceId,children:[n.traceId.slice(0,12),"…"]}),g.jsxs("span",{className:be.spanCount,children:[n.spanCount," spans"]})]}),g.jsxs("div",{className:be.traceMeta,children:[g.jsx("span",{className:be.traceTime,children:Vu(n.timestamp)}),n.sessionId&&g.jsxs("span",{className:be.sessionId,children:["session: ",n.sessionId.slice(0,10),"…"]})]})]})}function k3({span:n}){var y;const a=n.severityText||"",i=(y=n.scope)==null?void 0:y.name,r=n.spanId||"",u=n.body,o=n.name||"",c=n.type==="span",[h,m]=B.useState(!1),p=n.timestampMs>0?new Date(n.timestampMs).toISOString():"",v=c?T3(n.kind):"";return g.jsxs("div",{className:be.spanRow,children:[g.jsxs("div",{className:be.spanHeader,children:[g.jsx("span",{className:be.spanTimestamp,children:p}),a&&g.jsx("span",{className:`${be.severityBadge} ${be[`sev${a.toUpperCase()}`]||""}`,children:a}),c&&v&&g.jsx("span",{className:be.severityBadge,children:v}),r&&g.jsx("span",{className:be.spanIdTag,children:r.slice(0,8)})]}),i&&g.jsx("div",{className:be.spanScope,children:i}),c&&o&&g.jsx("div",{className:be.spanScope,children:o}),g.jsx("div",{className:be.spanBody,children:c?g.jsx(b4,{span:n}):g.jsx(Gu,{body:u})}),g.jsx("button",{className:be.rawToggle,onClick:()=>m(x=>!x),children:h?g.jsxs(g.Fragment,{children:[g.jsx(il,{size:10})," Hide raw"]}):g.jsxs(g.Fragment,{children:[g.jsx(Al,{size:10})," Raw JSON"]})}),h&&g.jsx("pre",{className:be.spanRaw,children:JSON.stringify(n,null,2)})]})}function T3(n){switch(n){case 1:return"SERVER";case 2:return"CLIENT";case 3:return"PRODUCER";case 4:return"CONSUMER";default:return"INTERNAL"}}function pu(n){const a=i=>String(i).padStart(2,"0");return`${n.getFullYear()}-${a(n.getMonth()+1)}-${a(n.getDate())}T${a(n.getHours())}:${a(n.getMinutes())}`}function E3({resources:n,sessionId:a,userId:i,onClose:r}){const{data:u,isLoading:o,error:c,fetch:h}=n,[m,p]=B.useState(null),[v,y]=B.useState("resources"),[x,b]=B.useState(620),E=B.useRef(null),j=B.useCallback(S=>{S.preventDefault();const R=J=>{const te=window.innerWidth-J.clientX;b(Math.max(320,Math.min(te,window.innerWidth*.8)))},M=()=>{E.current=null,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",M),document.body.style.cursor="",document.body.style.userSelect=""};E.current={move:R,up:M},document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",R),document.addEventListener("mouseup",M)},[]);B.useEffect(()=>()=>{E.current&&(document.removeEventListener("mousemove",E.current.move),document.removeEventListener("mouseup",E.current.up),document.body.style.cursor="",document.body.style.userSelect="")},[]);const O=(S,R)=>{p(M=>(M==null?void 0:M.kind)===S&&M.resource.name===R.name?null:{kind:S,resource:R})};return g.jsxs("div",{className:Ce.panel,style:{width:x},children:[g.jsx("div",{className:Ce.resizeHandle,onMouseDown:j,role:"separator","aria-label":"Resize panel"}),g.jsxs("div",{className:Ce.header,children:[g.jsx("span",{className:Ce.projectName,children:(u==null?void 0:u.project)||"Resources"}),g.jsxs("div",{className:Ce.headerActions,children:[g.jsx("button",{className:Ce.iconBtn,onClick:h,title:"Refresh","aria-label":"Refresh resources",children:g.jsx(ud,{size:12})}),g.jsx("button",{className:Ce.iconBtn,onClick:r,title:"Close","aria-label":"Close resource panel",children:g.jsx(Du,{size:12})})]})]}),g.jsx("div",{className:Ce.tabBar,role:"tablist",children:["resources","traces","memories"].map(S=>g.jsx("button",{role:"tab","aria-selected":v===S,className:`${Ce.tab} ${v===S?Ce.tabActive:""}`,onClick:()=>y(S),children:S.charAt(0).toUpperCase()+S.slice(1)},S))}),g.jsxs("div",{className:Ce.body,children:[g.jsxs("div",{className:Ce.tabContent,hidden:v!=="resources",children:[o&&!u&&g.jsx("div",{className:Ce.status,children:"Loading resources…"}),c&&!u&&g.jsxs("div",{className:Ce.error,children:[g.jsxs("span",{children:[g.jsx(od,{size:12})," ",c]}),g.jsx("button",{className:Ce.retryBtn,onClick:h,children:"Retry"})]}),u&&g.jsxs("div",{className:Ce.graph,children:[u.agents.length>0&&g.jsx(ea,{title:"Agents",children:u.agents.map(S=>g.jsx(Dn,{kind:"agent",name:S.name,subtitle:S.build,isSelected:(m==null?void 0:m.kind)==="agent"&&m.resource.name===S.name,onClick:()=>O("agent",S),connections:N3(S,u.mcpRuntimeTools),deploymentStatus:S.deploymentStatus},S.name))}),(u.harnesses??[]).length>0&&g.jsx(ea,{title:"Harnesses",children:(u.harnesses??[]).map(S=>g.jsx(Dn,{kind:"harness",name:S.name,subtitle:S.model,isSelected:(m==null?void 0:m.kind)==="harness"&&m.resource.name===S.name,onClick:()=>O("harness",S),deploymentStatus:S.deploymentStatus},S.name))}),u.memories.length>0&&g.jsx(ea,{title:"Memories",children:u.memories.map(S=>g.jsx(Dn,{kind:"memory",name:S.name,subtitle:S.strategies.map(R=>R.type).join(", "),isSelected:(m==null?void 0:m.kind)==="memory"&&m.resource.name===S.name,onClick:()=>O("memory",S),deploymentStatus:S.deploymentStatus},S.name))}),u.credentials.length>0&&g.jsx(ea,{title:"Credentials",children:u.credentials.map(S=>g.jsx(Dn,{kind:"credential",name:S.name,subtitle:S.type,isSelected:(m==null?void 0:m.kind)==="credential"&&m.resource.name===S.name,onClick:()=>O("credential",S),deploymentStatus:S.deploymentStatus},S.name))}),u.gateways.length>0&&g.jsx(ea,{title:"Gateways",children:u.gateways.map(S=>g.jsxs("div",{children:[g.jsx(Dn,{kind:"gateway",name:S.name,subtitle:`${S.targets.length} target(s)`,isSelected:(m==null?void 0:m.kind)==="gateway"&&m.resource.name===S.name,onClick:()=>O("gateway",S),deploymentStatus:S.deploymentStatus}),S.targets.map(R=>g.jsx("div",{className:Ce.childNode,children:g.jsx(Dn,{kind:"gatewayTarget",name:R.name,subtitle:R.targetType,isSelected:(m==null?void 0:m.kind)==="gatewayTarget"&&m.resource.name===R.name,onClick:()=>O("gatewayTarget",R)})},R.name))]},S.name))}),u.mcpRuntimeTools.length>0&&g.jsx(ea,{title:"MCP Runtime Tools",children:u.mcpRuntimeTools.map(S=>g.jsx(Dn,{kind:"mcpTool",name:S.name,subtitle:S.bindings.map(R=>R.runtimeName).join(", "),isSelected:(m==null?void 0:m.kind)==="mcpTool"&&m.resource.name===S.name,onClick:()=>O("mcpTool",S),connections:S.bindings.map(R=>`→ ${R.runtimeName}`),deploymentStatus:S.deploymentStatus},S.name))}),u.evaluators.length>0&&g.jsx(ea,{title:"Evaluators",children:u.evaluators.map(S=>g.jsx(Dn,{kind:"evaluator",name:S.name,subtitle:`${S.level} — ${S.configType}`,isSelected:(m==null?void 0:m.kind)==="evaluator"&&m.resource.name===S.name,onClick:()=>O("evaluator",S),deploymentStatus:S.deploymentStatus},S.name))}),u.onlineEvalConfigs.length>0&&g.jsx(ea,{title:"Online Eval Configs",children:u.onlineEvalConfigs.map(S=>g.jsx(Dn,{kind:"onlineEval",name:S.name,subtitle:`${S.evaluators.length} evaluator(s), ${S.samplingRate}% sampling`,isSelected:(m==null?void 0:m.kind)==="onlineEval"&&m.resource.name===S.name,onClick:()=>O("onlineEval",S),connections:[`→ ${S.agent}`],deploymentStatus:S.deploymentStatus},S.name))}),u.policyEngines.length>0&&g.jsx(ea,{title:"Policy Engines",children:u.policyEngines.map(S=>g.jsxs("div",{children:[g.jsx(Dn,{kind:"policyEngine",name:S.name,subtitle:`${S.policies.length} polic${S.policies.length!==1?"ies":"y"}`,isSelected:(m==null?void 0:m.kind)==="policyEngine"&&m.resource.name===S.name,onClick:()=>O("policyEngine",S),deploymentStatus:S.deploymentStatus}),S.policies.map(R=>g.jsx("div",{className:Ce.childNode,children:g.jsx(Dn,{kind:"policy",name:R.name,subtitle:R.description,isSelected:(m==null?void 0:m.kind)==="policy"&&m.resource.name===R.name,onClick:()=>O("policy",R),deploymentStatus:R.deploymentStatus})},R.name))]},S.name))}),u.unassignedTargets.length>0&&g.jsx(ea,{title:"Unassigned Targets",children:u.unassignedTargets.map(S=>g.jsx(Dn,{kind:"unassignedTarget",name:S.name,subtitle:S.targetType,isSelected:(m==null?void 0:m.kind)==="unassignedTarget"&&m.resource.name===S.name,onClick:()=>O("unassignedTarget",S)},S.name))})]}),m&&g.jsxs("div",{className:Ce.infoCard,children:[g.jsxs("div",{className:Ce.infoHeader,children:[g.jsx("span",{className:`${Ce.kindBadge} ${Ce[m.kind]}`,children:A3(m.kind)}),g.jsx("span",{className:Ce.infoName,children:m.resource.name})]}),g.jsxs("div",{className:Ce.infoBody,children:[Object.entries(m.resource).filter(([S,R])=>S!=="deployed"&&!C3(R)).map(([S,R])=>g.jsxs("div",{className:Ce.infoRow,children:[g.jsx("span",{className:Ce.infoKey,children:S}),g.jsx("span",{className:Ce.infoValue,children:zy(R)})]},S)),"deployed"in m.resource&&m.resource.deployed!==null&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:Ce.infoSectionHeader,children:"Deployed State"}),Object.entries(m.resource.deployed).map(([S,R])=>g.jsxs("div",{className:Ce.infoRow,children:[g.jsx("span",{className:Ce.infoKey,children:S}),g.jsx("span",{className:Ce.infoValue,children:zy(R)})]},S))]})]})]})]}),g.jsx("div",{className:Ce.tabContent,hidden:v!=="traces",children:g.jsx(b3,{agents:(u==null?void 0:u.agents)??[],isActive:v==="traces"})}),g.jsx("div",{className:Ce.tabContent,hidden:v!=="memories",children:g.jsx(Yw,{memories:(u==null?void 0:u.memories)??[],sessionId:a,userId:i,isActive:v==="memories"})})]})]})}function ea({title:n,children:a}){return g.jsxs("div",{className:Ce.section,children:[g.jsx("div",{className:Ce.sectionTitle,children:n}),a]})}function N3(n,a){const i=[];for(const r of a)r.bindings.some(u=>u.runtimeName===n.name)&&i.push(`← ${r.name}`);return i}function C3(n){return!!(n===null||n===""||n===void 0||Array.isArray(n)&&n.length===0)}function zy(n){if(n==null)return"—";if(Array.isArray(n))return n.map(i=>typeof i=="object"?JSON.stringify(i):i).join(", ")||"—";const a=String(n);return a===""?"—":a}function A3(n){return{agent:"Agent",harness:"Harness",memory:"Memory",credential:"Credential",gateway:"Gateway",gatewayTarget:"Target",mcpTool:"MCP Tool",evaluator:"Evaluator",onlineEval:"Online Eval",policyEngine:"Policy Engine",policy:"Policy",unassignedTarget:"Unassigned Target"}[n]}const w3="_body_sadpk_1",j3="_interactionsList_sadpk_9",M3="_interactionItem_sadpk_17",R3="_interactionItemSelected_sadpk_36",z3="_interactionPrompt_sadpk_41",O3="_interactionMeta_sadpk_49",D3="_interactionTraceId_sadpk_55",L3="_interactionTime_sadpk_61",B3="_interactionSpanCount_sadpk_66",U3="_rightArea_sadpk_75",H3="_waterfall_sadpk_84",I3="_userPromptRow_sadpk_90",q3="_userPromptText_sadpk_101",V3="_waterfallRow_sadpk_108",G3="_waterfallRowSelected_sadpk_122",Z3="_spanIcon_sadpk_128",Y3="_spanLabel_sadpk_135",$3="_barContainer_sadpk_145",X3="_bar_sadpk_145",Q3="_barInvocation_sadpk_160",F3="_barAgent_sadpk_164",K3="_barLlm_sadpk_168",J3="_barTool_sadpk_172",P3="_barOther_sadpk_176",W3="_duration_sadpk_180",eM="_detailPane_sadpk_190",tM="_detailHeader_sadpk_197",nM="_iconBtn_sadpk_209",aM="_tabBar_sadpk_224",lM="_tab_sadpk_224",iM="_tabActive_sadpk_244",rM="_detailBody_sadpk_249",sM="_attrTable_sadpk_254",uM="_attrKey_sadpk_265",oM="_attrValue_sadpk_273",cM="_emptyState_sadpk_280",ze={body:w3,interactionsList:j3,interactionItem:M3,interactionItemSelected:R3,interactionPrompt:z3,interactionMeta:O3,interactionTraceId:D3,interactionTime:L3,interactionSpanCount:B3,rightArea:U3,waterfall:H3,userPromptRow:I3,userPromptText:q3,waterfallRow:V3,waterfallRowSelected:G3,spanIcon:Z3,spanLabel:Y3,barContainer:$3,bar:X3,barInvocation:Q3,barAgent:F3,barLlm:K3,barTool:J3,barOther:P3,duration:W3,detailPane:eM,detailHeader:tM,iconBtn:nM,tabBar:aM,tab:lM,tabActive:iM,detailBody:rM,attrTable:sM,attrKey:uM,attrValue:oM,emptyState:cM};function fM({invocations:n,selectedTraceId:a,onSelect:i}){return n.length===0?g.jsx("div",{className:ze.emptyState,children:"No interactions yet"}):g.jsx("div",{className:ze.interactionsList,children:n.map(r=>g.jsxs("button",{className:`${ze.interactionItem} ${a===r.traceId?ze.interactionItemSelected:""}`,onClick:()=>i(r.traceId),"aria-label":`Trace ${r.traceId}`,children:[r.userPrompt&&g.jsx("span",{className:ze.interactionPrompt,title:r.userPrompt,children:r.userPrompt}),g.jsxs("div",{className:ze.interactionMeta,children:[g.jsxs("span",{className:ze.interactionTraceId,children:[r.traceId.slice(0,12),"..."]}),g.jsx("span",{className:ze.interactionSpanCount,children:r.spanCount})]}),g.jsx("span",{className:ze.interactionTime,children:Vu(r.timestamp)})]},r.traceId))})}function vu(n){if(typeof n=="string"){const a=Zt(n);return typeof a!="string"?vu(a)??n:n}if(Array.isArray(n)){const a=n.filter(i=>i.text).map(i=>String(i.text));if(a.length>0)return a.join(" ")}return null}function dM(n){var i;for(const r of n){if(!((i=r.name)!=null&&i.startsWith("invoke_agent")))continue;const u=r.events;if(u)for(const o of u){if(o.name!=="gen_ai.user.message")continue;const c=Ai(o.attributes),h=vu(c.content);if(h)return h}}let a=null;for(const r of n){const u=r.events;if(u)for(const o of u){if(o.name!=="gen_ai.user.message")continue;const c=Ai(o.attributes),h=vu(c.content);h&&(a=h)}}if(a)return a;for(const r of n){const u=r.attributes??{};if(u["gen_ai.content.prompt"]){const o=vu(u["gen_ai.content.prompt"]);if(o)return o}}for(const r of n){const u=r.attributes??{};if(u["gen_ai.input.messages"]){const o=u["gen_ai.input.messages"],c=typeof o=="string"?Zt(o):o;if(Array.isArray(c)){const h=c.find(m=>m.role==="user");if(h!=null&&h.parts&&Array.isArray(h.parts)){const m=h.parts.filter(p=>p.type==="text"&&p.content).map(p=>String(p.content));if(m.length>0)return m.join(" ")}}}}return null}function hM(n){switch(n){case 1:return"SERVER";case 2:return"CLIENT";case 3:return"PRODUCER";case 4:return"CONSUMER";default:return"INTERNAL"}}function mM(n){var o;const a={...n.attributes??{}},i=xn(n.startTimeUnixNano),u=xn(n.endTimeUnixNano)-i;return{attributes:a,status:n.status,kind:n.type==="span"?hM(n.kind):void 0,scope:(o=n.scope)==null?void 0:o.name,duration:u>0?`${u}ms`:void 0}}function pM(n){const a=n.events;if(a){let r=null;for(const u of a){const o=u.name,c=Ai(u.attributes);o==="gen_ai.user.message"&&(r={type:"genai",content:Zt(c.content)??c.content})}if(r)return r}const i=n.attributes??{};return i["gen_ai.content.prompt"]?{type:"genai",content:Zt(i["gen_ai.content.prompt"])}:i["gen_ai.tool.call.arguments"]?{type:"tool",content:Zt(i["gen_ai.tool.call.arguments"])}:i["gen_ai.input.messages"]?{type:"genai",content:Zt(i["gen_ai.input.messages"])}:i["gen_ai.task.input"]?{type:"raw",content:Zt(i["gen_ai.task.input"])}:n.type==="log"&&n.body?{type:"raw",content:n.body}:null}function gM(n){const a=n.events;if(a){let r=null;for(const u of a){const o=u.name,c=Ai(u.attributes);o==="gen_ai.choice"&&(r={type:"genai",content:Zt(c.message)??c})}if(r)return r}const i=n.attributes??{};if(i["tool.name"]&&a){for(const r of a)if(r.name==="gen_ai.tool.message"){const o=Ai(r.attributes);return{type:"tool",content:Zt(o.content)??o.content}}}return i["gen_ai.content.completion"]?{type:"genai",content:Zt(i["gen_ai.content.completion"])}:i["gen_ai.tool.call.result"]?{type:"tool",content:Zt(i["gen_ai.tool.call.result"])}:i["gen_ai.output.messages"]?{type:"genai",content:Zt(i["gen_ai.output.messages"])}:i["gen_ai.task.output"]?{type:"raw",content:Zt(i["gen_ai.task.output"])}:null}function yM({span:n,onClose:a}){const[i,r]=B.useState("event");return g.jsxs("div",{className:ze.detailPane,children:[g.jsxs("div",{className:ze.detailHeader,children:[g.jsx("div",{className:ze.tabBar,children:["event","request","response"].map(u=>g.jsx("button",{className:`${ze.tab} ${i===u?ze.tabActive:""}`,onClick:()=>r(u),children:u.charAt(0).toUpperCase()+u.slice(1)},u))}),g.jsx("button",{className:ze.iconBtn,onClick:a,"aria-label":"Close detail",children:g.jsx(Du,{size:14})})]}),g.jsxs("div",{className:ze.detailBody,children:[i==="event"&&g.jsx(vM,{span:n}),i==="request"&&g.jsx(_M,{span:n}),i==="response"&&g.jsx(xM,{span:n})]})]})}function vM({span:n}){const a=mM(n),i=[];n.name&&i.push(["name",n.name]),a.kind&&i.push(["kind",a.kind]),a.scope&&i.push(["scope",a.scope]),a.duration&&i.push(["duration",a.duration]),a.status&&(i.push(["status.code",String(a.status.code??"OK")]),a.status.message&&i.push(["status.message",a.status.message]));const r=new Set(i.map(([u])=>u));for(const[u,o]of Object.entries(a.attributes))o!=null&&!r.has(u)&&i.push([u,typeof o=="object"?JSON.stringify(o):String(o)]);return i.length===0?g.jsx("div",{className:ze.emptyState,children:"No event data"}):g.jsx("table",{className:ze.attrTable,children:g.jsx("tbody",{children:i.map(([u,o])=>g.jsxs("tr",{children:[g.jsx("td",{className:ze.attrKey,children:u}),g.jsx("td",{className:ze.attrValue,children:o})]},u))})})}function _M({span:n}){const a=pM(n);return a?a.type==="genai"&&Array.isArray(a.content)?g.jsx(Ni,{content:a.content}):g.jsx(Gu,{body:a.content}):g.jsx("div",{className:ze.emptyState,children:"No request data"})}function xM({span:n}){const a=gM(n);return a?a.type==="genai"&&Array.isArray(a.content)?g.jsx(Ni,{content:a.content}):g.jsx(Gu,{body:a.content}):g.jsx("div",{className:ze.emptyState,children:"No response data"})}const bM=16,SM={invocation:g.jsx(Fy,{size:12}),agent:g.jsx(fx,{size:12}),llm:g.jsx(Sx,{size:12}),tool:g.jsx(wa,{size:12}),other:g.jsx(lx,{size:10})},kM={invocation:ze.barInvocation,agent:ze.barAgent,llm:ze.barLlm,tool:ze.barTool,other:ze.barOther};function TM({tree:n,selectedSpanId:a,onSelectSpan:i,userPrompt:r}){const u=EA(n);return u.length===0?g.jsx("div",{className:ze.emptyState,children:"No spans"}):g.jsxs("div",{className:ze.waterfall,children:[r&&g.jsxs("div",{className:ze.userPromptRow,children:[g.jsx("span",{className:ze.spanIcon,children:g.jsx(Mx,{size:12})}),g.jsx("span",{className:ze.userPromptText,title:r,children:r})]}),u.map((o,c)=>g.jsx(EM,{entry:o,isSelected:a===o.node.span.spanId,onSelect:()=>i(o.node.span)},o.node.span.spanId??c))]})}function EM({entry:n,isSelected:a,onSelect:i}){var v;const{node:r,offsetPercent:u,widthPercent:o}=n,c=NA(r.span),h=SM[c],m=kM[c],p=r.span.name||((v=r.span.scope)==null?void 0:v.name)||"span";return g.jsxs("div",{className:`${ze.waterfallRow} ${a?ze.waterfallRowSelected:""}`,style:{paddingLeft:`${10+r.depth*bM}px`},onClick:i,role:"button",tabIndex:0,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&i()},children:[g.jsx("span",{className:ze.spanIcon,children:h}),g.jsx("span",{className:ze.spanLabel,title:p,children:p}),g.jsx("div",{className:ze.barContainer,children:g.jsx("div",{className:`${ze.bar} ${m}`,style:{left:`${u}%`,width:`${o}%`}})}),g.jsx("span",{className:ze.duration,children:tv(r.durationMs)})]})}function NM({traces:n}){const{invocations:a,selectedInvocation:i,isLoading:r,selectTrace:u,refresh:o}=n,[c,h]=B.useState(null);return B.useEffect(()=>{h(null)},[i==null?void 0:i.traceId]),g.jsx(Lu,{title:"Timeline view",status:r?"Loading...":void 0,onRefresh:o,children:g.jsxs("div",{className:ze.body,children:[g.jsx(fM,{invocations:a,selectedTraceId:(i==null?void 0:i.traceId)??null,onSelect:u}),g.jsxs("div",{className:ze.rightArea,children:[!i&&g.jsx("div",{className:ze.emptyState,children:"Select an interaction to view"}),i&&g.jsxs(g.Fragment,{children:[g.jsx(TM,{tree:i.tree,selectedSpanId:(c==null?void 0:c.spanId)??null,onSelectSpan:h,userPrompt:i.userPrompt}),c&&g.jsx(yM,{span:c,onClose:()=>h(null)})]})]})]})})}const CM="_error_1vxci_1",AM="_toolListItems_1vxci_7",wM="_toolItem_1vxci_14",jM="_toolItemSelected_1vxci_34",MM="_toolName_1vxci_39",RM="_toolDesc_1vxci_45",zM="_toolForm_1vxci_53",OM="_toolFormHeader_1vxci_58",DM="_toolFormDesc_1vxci_66",LM="_noParams_1vxci_72",BM="_field_1vxci_78",UM="_fieldLabel_1vxci_82",HM="_fieldType_1vxci_92",IM="_fieldInput_1vxci_98",qM="_fieldTextarea_1vxci_115",VM="_fieldHint_1vxci_122",GM="_callBtn_1vxci_128",ZM="_spinning_1vxci_153",Tt={error:CM,toolListItems:AM,toolItem:wM,toolItemSelected:jM,toolName:MM,toolDesc:RM,toolForm:zM,toolFormHeader:OM,toolFormDesc:DM,noParams:LM,field:BM,fieldLabel:UM,fieldType:HM,fieldInput:IM,fieldTextarea:qM,fieldHint:VM,callBtn:GM,spinning:ZM};function YM(n,a){if(a.type==="integer"){const i=parseInt(n,10);return Number.isNaN(i)?0:i}if(a.type==="number"){const i=parseFloat(n);return Number.isNaN(i)?0:i}if(a.type==="boolean")return n==="true";if(a.type==="object"||a.type==="array")try{return JSON.parse(n)}catch{return n}return n}function $M(n){return n.type==="integer"||n.type==="number"?"number":"text"}function XM({tool:n,isCalling:a,onCall:i}){var p,v;const r=((p=n.inputSchema)==null?void 0:p.properties)??{},u=new Set(((v=n.inputSchema)==null?void 0:v.required)??[]),o=Object.keys(r),[c,h]=B.useState(()=>{const y={};for(const x of o){const b=r[x];y[x]=b.default!==void 0?String(b.default):""}return y}),m=y=>{y.preventDefault();const x={};for(const b of o){const E=c[b];E===""&&!u.has(b)||(x[b]=YM(E,r[b]))}i(n.name,x)};return g.jsxs("form",{className:Tt.toolForm,onSubmit:m,children:[g.jsx("div",{className:Tt.toolFormHeader,children:n.name}),n.description&&g.jsx("div",{className:Tt.toolFormDesc,children:n.description}),o.length===0&&g.jsx("div",{className:Tt.noParams,children:"No parameters"}),o.map(y=>{const x=r[y],b=u.has(y);return g.jsxs("div",{className:Tt.field,children:[g.jsxs("label",{className:Tt.fieldLabel,children:[y,g.jsxs("span",{className:Tt.fieldType,children:[x.type,b?", required":""]})]}),x.enum?g.jsxs("select",{className:Tt.fieldInput,value:c[y],onChange:E=>h(j=>({...j,[y]:E.target.value})),children:[g.jsx("option",{value:"",children:"Select..."}),x.enum.map(E=>g.jsx("option",{value:E,children:E},E))]}):x.type==="boolean"?g.jsxs("select",{className:Tt.fieldInput,value:c[y],onChange:E=>h(j=>({...j,[y]:E.target.value})),children:[g.jsx("option",{value:"",children:"Select..."}),g.jsx("option",{value:"true",children:"true"}),g.jsx("option",{value:"false",children:"false"})]}):x.type==="object"||x.type==="array"?g.jsx("textarea",{className:`${Tt.fieldInput} ${Tt.fieldTextarea}`,value:c[y],onChange:E=>h(j=>({...j,[y]:E.target.value})),placeholder:"JSON",rows:3}):g.jsx("input",{className:Tt.fieldInput,type:$M(x),value:c[y],onChange:E=>h(j=>({...j,[y]:E.target.value})),placeholder:x.description??""}),x.description&&g.jsx("div",{className:Tt.fieldHint,children:x.description})]},y)}),g.jsx("button",{type:"submit",className:Tt.callBtn,disabled:a,children:a?g.jsxs(g.Fragment,{children:[g.jsx(Xy,{size:14,className:Tt.spinning}),"Calling..."]}):"Call Tool"})]})}function QM({tools:n,isLoading:a,error:i,onRefresh:r,onCallTool:u,onToolCallMessage:o}){const[c,h]=B.useState(null),[m,p]=B.useState(!1),v=n.find(x=>x.name===c),y=async(x,b)=>{var O;p(!0);const E=Object.keys(b).length>0?`(${JSON.stringify(b)})`:"()",j=`Called ${x}${E}`;try{const S=await u(x,b),R=((O=S.content)==null?void 0:O.filter(J=>J.text!==void 0).map(J=>J.text))??[],M=R.length>0?R.join(`
264
+ `)}function tw(n){return n.isError?st.bodyError:n.role==="user"?st.bodyUser:st.bodyAssistant}const nw=B.forwardRef(({messages:n,isStreaming:a,isStarting:i,agentName:r,agentBuildType:u,agentProtocol:o,hasAvailableTargets:c=!0},h)=>{if(i)return g.jsx("div",{className:st.messages,ref:h,"data-testid":"message-list",children:g.jsxs("div",{className:st.emptyState,children:[g.jsx("div",{className:st.spinner}),g.jsxs("div",{className:st.startingText,children:["Setting up ",r||"agent",g.jsx("span",{className:st.thinkingDot,children:"."}),g.jsx("span",{className:st.thinkingDot,children:"."}),g.jsx("span",{className:st.thinkingDot,children:"."})]})]})});if(n.length===0){if(!c)return g.jsx("div",{className:st.messages,ref:h,"data-testid":"message-list",children:g.jsxs("div",{className:st.emptyState,children:[g.jsx("div",{className:st.emptyStateIcon,children:g.jsx(Hf,{size:40,strokeWidth:1.5,color:"#6366f1"})}),g.jsx("div",{className:st.emptyStateAgent,children:"No agents found"}),g.jsxs("div",{className:st.emptyStateText,children:["Run ",g.jsx("code",{className:"cmd",children:"agentcore add"})," to add an agent or harness"]})]})});const p=[u==="CodeZip"?"Direct code deploy":u,o??"HTTP"].filter(Boolean).join(" · ");return g.jsx("div",{className:st.messages,ref:h,"data-testid":"message-list",children:g.jsxs("div",{className:st.emptyState,children:[g.jsx("div",{className:st.emptyStateIcon,children:g.jsx(Hf,{size:40,strokeWidth:1.5,color:"#6366f1"})}),g.jsx("div",{className:st.emptyStateAgent,children:r||"Agent"}),p&&g.jsx("div",{className:st.emptyStateDetails,children:p}),g.jsx("div",{className:st.emptyStateText,children:"Send a prompt to test this agent"})]})})}return g.jsx("div",{className:st.messages,ref:h,"data-testid":"message-list",children:n.map((m,p)=>a&&m.role==="assistant"&&m.content===""&&p===n.length-1?g.jsx("div",{className:st.msg,"data-testid":"thinking-indicator",children:g.jsxs("div",{className:st.thinking,children:["Thinking",g.jsx("span",{className:st.thinkingDot,children:"."}),g.jsx("span",{className:st.thinkingDot,children:"."}),g.jsx("span",{className:st.thinkingDot,children:"."})]})},p):g.jsxs("div",{className:m.role==="user"?st.msgUser:st.msg,"data-testid":`chat-message-${p}`,children:[g.jsx("div",{className:tw(m),children:m.isError?g.jsx(If,{content:m.content}):m.role==="assistant"?g.jsx(pA,{content:m.toolExecutions?ew(m.content):m.content}):m.content}),m.toolCalls&&m.toolCalls.length>0&&g.jsx(UA,{toolCalls:m.toolCalls}),m.toolExecutions&&Object.keys(m.toolExecutions).length>0&&g.jsx(LS,{toolExecutions:m.toolExecutions}),m.tokenUsage&&g.jsx(SA,{usage:m.tokenUsage})]},p))})});function aw(){const a=new URLSearchParams(window.location.search).get("port");return a&&/^\d+$/.test(a)?`http://localhost:${a}`:""}const Bn=aw();function Sn(n,a){if((a==null?void 0:a.method)==="POST"){const i=new Headers(a.headers);return i.set("X-Agentcore-Local","1"),fetch(n,{...a,headers:i})}return fetch(n,a)}function lw(){const[n,a]=B.useState([]),[i,r]=B.useState(!1),[u,o]=B.useState(null),[c,h]=B.useState(null),m=B.useCallback(async()=>{try{return(await Sn(`${Bn}/api/memory?memoryName=__probe__&namespace=__probe__`)).status===404?(h(!1),!1):(h(!0),!0)}catch{return h(!1),!1}},[]),p=B.useCallback(async(x,b)=>{r(!0),o(null),a([]);try{const E=new URLSearchParams({memoryName:x,namespace:b}),j=await Sn(`${Bn}/api/memory?${E.toString()}`);if(j.status===404){o("Memory browsing is only available in invoke mode."),h(!1);return}const O=await j.json();O.success&&O.records?a(O.records):o(O.error||"Failed to load memory records")}catch(E){o(E instanceof Error?E.message:"Failed to load memory records")}finally{r(!1)}},[]),v=B.useCallback(async(x,b,E)=>{r(!0),o(null),a([]);try{const j={memoryName:x,namespace:b,searchQuery:E},O=await Sn(`${Bn}/api/memory/search`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)});if(O.status===404){o("Memory browsing is only available in invoke mode."),h(!1);return}const S=await O.json();S.success&&S.records?a(S.records):o(S.error||"Failed to search memory records")}catch(j){o(j instanceof Error?j.message:"Failed to search memory records")}finally{r(!1)}},[]),y=B.useCallback(()=>{a([]),o(null)},[]);return{records:n,isLoading:i,error:u,isAvailable:c,checkAvailability:m,listRecords:p,searchRecords:v,clear:y}}function Vu(n){try{const a=Number(n),i=Number.isFinite(a)&&a>1e12?new Date(a):new Date(n);return isNaN(i.getTime())?n:i.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return n}}const iw="_notice_1isal_1",rw="_warning_1isal_12",sw="_retryBtn_1isal_16",Df={notice:iw,warning:rw,retryBtn:sw};function wy({children:n,variant:a="error",onRetry:i}){return g.jsxs("div",{className:`${Df.notice} ${a==="warning"?Df.warning:""}`,children:[n,i&&g.jsx("button",{className:Df.retryBtn,onClick:i,children:"Retry"})]})}const uw="_container_qogk5_1",ow="_content_qogk5_47",cw="_status_qogk5_55",fw="_error_qogk5_62",dw="_detail_qogk5_73",hw="_detailHeader_qogk5_80",mw="_detailTitle_qogk5_89",pw="_closeBtn_qogk5_95",gw="_controls_qogk5_118",yw="_field_qogk5_124",vw="_fieldLabel_qogk5_130",_w="_input_qogk5_138",xw="_select_qogk5_158",bw="_actions_qogk5_175",Sw="_actionBtn_qogk5_180",kw="_searchBtn_qogk5_202",Tw="_resultCount_qogk5_213",Ew="_recordList_qogk5_219",Nw="_recordRow_qogk5_228",Cw="_recordRowSelected_qogk5_248",Aw="_recordMain_qogk5_254",ww="_recordContent_qogk5_261",jw="_scoreBadge_qogk5_271",Mw="_recordMeta_qogk5_281",Rw="_strategyTag_qogk5_288",zw="_recordTime_qogk5_296",Ow="_detailBody_qogk5_302",Dw="_detailSection_qogk5_309",Lw="_detailLabel_qogk5_315",Bw="_detailContent_qogk5_322",Uw="_metadataGrid_qogk5_335",Hw="_metadataRow_qogk5_341",Iw="_metadataKey_qogk5_354",qw="_metadataValue_qogk5_361",Vw="_detailId_qogk5_370",Gw="_namespacesValue_qogk5_377",Zw="_noMetadata_qogk5_383",ge={container:uw,content:ow,status:cw,error:fw,detail:dw,detailHeader:hw,detailTitle:mw,closeBtn:pw,controls:gw,field:yw,fieldLabel:vw,input:_w,select:xw,actions:bw,actionBtn:Sw,searchBtn:kw,resultCount:Tw,recordList:Ew,recordRow:Nw,recordRowSelected:Cw,recordMain:Aw,recordContent:ww,scoreBadge:jw,recordMeta:Mw,strategyTag:Rw,recordTime:zw,detailBody:Ow,detailSection:Dw,detailLabel:Lw,detailContent:Bw,metadataGrid:Uw,metadataRow:Hw,metadataKey:Iw,metadataValue:qw,detailId:Vw,namespacesValue:Gw,noMetadata:Zw};function Yw({memories:n,sessionId:a,userId:i,isActive:r}){var T;const{records:u,isLoading:o,error:c,isAvailable:h,checkAvailability:m,listRecords:p,searchRecords:v,clear:y}=lw(),[x,b]=B.useState(((T=n[0])==null?void 0:T.name)??""),[E,j]=B.useState(""),[O,S]=B.useState({}),[R,M]=B.useState(""),[J,te]=B.useState(null),[q,ae]=B.useState(!1),[de,ve]=B.useState(!1);B.useEffect(()=>{!x&&n.length>0&&b(n[0].name)},[n,x]);const L=n.find(U=>U.name===x),P=(L==null?void 0:L.strategies)??[],$=P.find(U=>U.type===E),fe=B.useMemo(()=>$?[...new Set($.namespaces.flatMap(U=>(U.match(/\{(\w+)\}/g)||[]).map(he=>he.slice(1,-1))))]:[],[$]);B.useEffect(()=>{r&&h===null&&m()},[r,h,m]),B.useEffect(()=>{if(!$){S({});return}const U={};for(const ie of fe)ie==="actorId"?U[ie]=i||"default-user":ie==="sessionId"&&a?U[ie]=a:U[ie]="";S(U)},[$,fe,a,i]);const W=U=>{b(U),j(""),te(null),ve(!1),y()},ee=U=>{j(U),te(null),ve(!1),y()},D=(U,ie)=>{S(he=>({...he,[U]:ie}))},F=()=>$?$.namespaces.map(U=>U.replace(/\{(\w+)\}/g,(ie,he)=>{var je;return((je=O[he])==null?void 0:je.trim())||""})).join(","):"",ue=$!=null&&fe.every(U=>{var ie;return(ie=O[U])==null?void 0:ie.trim()}),ne=()=>{ue&&(ae(!1),te(null),ve(!0),p(x,F()))},N=()=>{!ue||!R.trim()||(ae(!0),te(null),ve(!0),v(x,F(),R.trim()))},A=U=>{U.key==="Enter"&&(R.trim()?N():ne())},Z=U=>{te(ie=>(ie==null?void 0:ie.memoryRecordId)===U.memoryRecordId?null:U)};return n.length===0?g.jsxs("div",{className:ge.status,children:[g.jsx("div",{children:"No AgentCore Memory found."}),g.jsxs("div",{children:["Run ",g.jsx("code",{className:"cmd",children:"agentcore add"})," to add Memory, then"," ",g.jsx("code",{className:"cmd",children:"agentcore deploy"})," to deploy it."]})]}):g.jsx("div",{className:ge.container,children:g.jsxs("div",{className:ge.content,children:[n.some(U=>U.deploymentStatus!=="deployed")&&g.jsxs(wy,{variant:"warning",children:[g.jsx("span",{children:"AgentCore Memory must be deployed before it can be used."}),g.jsxs("span",{children:["To test memory, run ",g.jsx("code",{className:"cmd",children:"agentcore deploy"})," and restart dev."]})]}),n.some(U=>U.deploymentStatus==="deployed")&&g.jsx(wy,{variant:"warning",children:"Memories may take 1-2 minutes to update after an invocation."}),h!==!1&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:ge.controls,children:[g.jsxs("div",{className:ge.field,children:[g.jsx("label",{className:ge.fieldLabel,htmlFor:"memory-selector",children:"Memory"}),g.jsx("select",{id:"memory-selector",className:ge.select,value:x,onChange:U=>W(U.target.value),children:n.map(U=>g.jsx("option",{value:U.name,children:U.name},U.name))})]}),g.jsxs("div",{className:ge.field,children:[g.jsx("label",{className:ge.fieldLabel,htmlFor:`strat-${x}`,children:"Strategy"}),g.jsxs("select",{id:`strat-${x}`,className:ge.select,value:E,onChange:U=>ee(U.target.value),children:[g.jsx("option",{value:"",disabled:!0,children:"Select a strategy…"}),P.map(U=>g.jsx("option",{value:U.type,children:U.type},U.type))]})]}),fe.map(U=>g.jsxs("div",{className:ge.field,children:[g.jsx("label",{className:ge.fieldLabel,htmlFor:`ns-${x}-${U}`,children:U}),g.jsx("input",{id:`ns-${x}-${U}`,className:ge.input,type:"text",placeholder:`Enter ${U}…`,value:O[U]||"",onChange:ie=>D(U,ie.target.value),onKeyDown:A})]},U)),$&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:ge.field,children:[g.jsx("label",{className:ge.fieldLabel,htmlFor:`search-${x}`,children:"Search (optional)"}),g.jsx("input",{id:`search-${x}`,className:ge.input,type:"text",placeholder:"Semantic search query…",value:R,onChange:U=>M(U.target.value),onKeyDown:A})]}),g.jsxs("div",{className:ge.actions,children:[g.jsx("button",{className:ge.actionBtn,onClick:ne,disabled:!ue||o,children:"List"}),g.jsx("button",{className:`${ge.actionBtn} ${ge.searchBtn}`,onClick:N,disabled:!ue||!R.trim()||o,children:"Search"})]})]})]}),o&&g.jsx("div",{className:ge.status,children:"Loading records…"}),c&&g.jsx("div",{className:ge.error,children:g.jsxs("span",{children:[g.jsx(od,{size:12})," ",c]})}),!o&&!c&&de&&u.length===0&&g.jsx("div",{className:ge.status,children:"No memory records found for this namespace."}),!o&&u.length>0&&g.jsxs("div",{className:ge.recordList,children:[g.jsxs("div",{className:ge.resultCount,children:[u.length," record",u.length!==1?"s":"",q?" (search results)":""]}),u.map(U=>g.jsx($w,{record:U,isSelected:(J==null?void 0:J.memoryRecordId)===U.memoryRecordId,showScore:q,onClick:()=>Z(U)},U.memoryRecordId))]}),J&&g.jsx(Xw,{record:J,onClose:()=>te(null)})]})]})})}function $w({record:n,isSelected:a,showScore:i,onClick:r}){const u=n.content?n.content.length>120?n.content.slice(0,120)+"…":n.content:"(no content)";return g.jsxs("button",{className:`${ge.recordRow} ${a?ge.recordRowSelected:""}`,onClick:r,"aria-label":`Memory record ${n.memoryRecordId}`,children:[g.jsxs("div",{className:ge.recordMain,children:[g.jsx("span",{className:ge.recordContent,children:u}),i&&n.score!==null&&n.score!==void 0&&g.jsx("span",{className:ge.scoreBadge,children:n.score.toFixed(3)})]}),g.jsxs("div",{className:ge.recordMeta,children:[g.jsx("span",{className:ge.strategyTag,children:n.memoryStrategyId}),g.jsx("span",{className:ge.recordTime,children:Vu(n.createdAt)})]})]})}function Xw({record:n,onClose:a}){const i=Object.entries(n.metadata||{});return g.jsxs("div",{className:ge.detail,children:[g.jsxs("div",{className:ge.detailHeader,children:[g.jsx("span",{className:ge.detailTitle,children:"Record Detail"}),g.jsx("button",{className:ge.closeBtn,onClick:a,"aria-label":"Close record detail",children:g.jsx(Du,{size:12})})]}),g.jsxs("div",{className:ge.detailBody,children:[g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"ID"}),g.jsx("span",{className:ge.detailId,children:n.memoryRecordId})]}),g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Content"}),g.jsx("div",{className:ge.detailContent,children:n.content||"(no content)"})]}),g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Strategy"}),g.jsx("span",{className:ge.strategyTag,children:n.memoryStrategyId})]}),g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Created"}),g.jsx("span",{className:ge.recordTime,children:Vu(n.createdAt)})]}),n.score!==null&&n.score!==void 0&&g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Relevance Score"}),g.jsx("span",{className:ge.scoreBadge,children:n.score.toFixed(4)})]}),n.namespaces.length>0&&g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Namespaces"}),g.jsx("span",{className:ge.namespacesValue,children:n.namespaces.join(", ")})]}),i.length>0&&g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Metadata"}),g.jsx("div",{className:ge.metadataGrid,children:i.map(([r,u])=>g.jsxs("div",{className:ge.metadataRow,children:[g.jsx("span",{className:ge.metadataKey,children:r}),g.jsx("span",{className:ge.metadataValue,children:u})]},r))})]}),i.length===0&&g.jsxs("div",{className:ge.detailSection,children:[g.jsx("span",{className:ge.detailLabel,children:"Metadata"}),g.jsx("span",{className:ge.noMetadata,children:"No metadata"})]})]})]})}const Qw="_panel_lfvg8_1",Fw="_resizeHandle_lfvg8_13",Kw="_header_lfvg8_30",Jw="_projectName_lfvg8_39",Pw="_headerActions_lfvg8_45",Ww="_iconBtn_lfvg8_50",ej="_tabBar_lfvg8_70",tj="_tab_lfvg8_70",nj="_tabActive_lfvg8_93",aj="_body_lfvg8_98",lj="_tabContent_lfvg8_104",ij="_status_lfvg8_114",rj="_error_lfvg8_121",sj="_retryBtn_lfvg8_132",uj="_graph_lfvg8_146",oj="_section_lfvg8_152",cj="_sectionTitle_lfvg8_158",fj="_childNode_lfvg8_167",dj="_node_lfvg8_183",hj="_nodeSelected_lfvg8_201",mj="_nodeIcon_lfvg8_206",pj="_agent_lfvg8_216",gj="_harness_lfvg8_220",yj="_memory_lfvg8_224",vj="_credential_lfvg8_228",_j="_gateway_lfvg8_232",xj="_gatewayTarget_lfvg8_236",bj="_mcpTool_lfvg8_240",Sj="_evaluator_lfvg8_244",kj="_onlineEval_lfvg8_248",Tj="_policyEngine_lfvg8_252",Ej="_policy_lfvg8_252",Nj="_unassignedTarget_lfvg8_260",Cj="_nodeContent_lfvg8_264",Aj="_nodeName_lfvg8_272",wj="_nodeNameRow_lfvg8_281",jj="_deployBadge_lfvg8_288",Mj="_deploy_deployed_lfvg8_298",Rj="_nodeSubtitle_lfvg8_313",zj="_nodeConnections_lfvg8_321",Oj="_connectionTag_lfvg8_328",Dj="_infoCard_lfvg8_386",Lj="_infoHeader_lfvg8_393",Bj="_kindBadge_lfvg8_402",Uj="_infoName_lfvg8_461",Hj="_infoBody_lfvg8_467",Ij="_infoSectionHeader_lfvg8_471",qj="_infoRow_lfvg8_481",Vj="_infoKey_lfvg8_494",Gj="_infoValue_lfvg8_499",Ce={panel:Qw,resizeHandle:Fw,header:Kw,projectName:Jw,headerActions:Pw,iconBtn:Ww,tabBar:ej,tab:tj,tabActive:nj,body:aj,tabContent:lj,status:ij,error:rj,retryBtn:sj,graph:uj,section:oj,sectionTitle:cj,childNode:fj,node:dj,nodeSelected:hj,nodeIcon:mj,agent:pj,harness:gj,memory:yj,credential:vj,gateway:_j,gatewayTarget:xj,mcpTool:bj,evaluator:Sj,onlineEval:kj,policyEngine:Tj,policy:Ej,unassignedTarget:Nj,nodeContent:Cj,nodeName:Aj,nodeNameRow:wj,deployBadge:jj,deploy_deployed:Mj,"deploy_local-only":"_deploy_local-only_lfvg8_303","deploy_pending-removal":"_deploy_pending-removal_lfvg8_308",nodeSubtitle:Rj,nodeConnections:zj,connectionTag:Oj,infoCard:Dj,infoHeader:Lj,kindBadge:Bj,infoName:Uj,infoBody:Hj,infoSectionHeader:Ij,infoRow:qj,infoKey:Vj,infoValue:Gj},Zj={agent:Hf,harness:J0,memory:X0,credential:_x,gateway:px,gatewayTarget:ox,mcpTool:wa,evaluator:rx,onlineEval:Z0,policyEngine:Ex,policy:hx,unassignedTarget:Qy},Yj={deployed:"Deployed","local-only":"Not deployed","pending-removal":"Removed locally"};function Dn({kind:n,name:a,subtitle:i,isSelected:r,onClick:u,connections:o,deploymentStatus:c}){const h=Zj[n];return g.jsxs("button",{className:`${Ce.node} ${Ce[n]} ${r?Ce.nodeSelected:""}`,onClick:u,"aria-label":`${n}: ${a}`,children:[g.jsx("span",{className:Ce.nodeIcon,children:g.jsx(h,{size:14})}),g.jsxs("div",{className:Ce.nodeContent,children:[g.jsxs("div",{className:Ce.nodeNameRow,children:[g.jsx("span",{className:Ce.nodeName,children:a}),c&&g.jsx("span",{className:`${Ce.deployBadge} ${Ce[`deploy_${c}`]}`,children:Yj[c]})]}),i&&g.jsx("span",{className:Ce.nodeSubtitle,children:i}),o&&o.length>0&&g.jsx("div",{className:Ce.nodeConnections,children:o.map(m=>g.jsx("span",{className:Ce.connectionTag,children:m},m))})]})]})}function $j(){const n=Bn,[a,i]=B.useState([]),[r,u]=B.useState([]),[o,c]=B.useState(!1),[h,m]=B.useState(!1),[p,v]=B.useState(null),[y,x]=B.useState(null),b=B.useCallback(async(O,S)=>{c(!0),v(null),u([]);try{const R=new URLSearchParams;O&&R.set("agentName",O),(S==null?void 0:S.startTime)!==void 0&&R.set("startTime",String(S.startTime)),(S==null?void 0:S.endTime)!==void 0&&R.set("endTime",String(S.endTime));const M=await Sn(`${n}/api/traces?${R.toString()}`);if(M.status===404){x(!1),i([]);return}x(!0);const J=await M.json();J.success?i(J.traces):(v(J.error),i([]))}catch(R){v(R instanceof Error?R.message:"Failed to load traces"),i([])}finally{c(!1)}},[n]),E=B.useCallback(async(O,S,R)=>{m(!0),v(null);try{const M=new URLSearchParams;S&&M.set("agentName",S),(R==null?void 0:R.startTime)!==void 0&&M.set("startTime",String(R.startTime)),(R==null?void 0:R.endTime)!==void 0&&M.set("endTime",String(R.endTime));const te=await(await Sn(`${n}/api/traces/${encodeURIComponent(O)}?${M.toString()}`)).json();te.success?u(ev(te.resourceSpans,te.resourceLogs)):(v(te.error),u([]))}catch(M){v(M instanceof Error?M.message:"Failed to load trace detail"),u([])}finally{m(!1)}},[n]),j=B.useCallback(()=>{u([]),v(null)},[]);return{traces:a,spans:r,isLoadingTraces:o,isLoadingSpans:h,error:p,isAvailable:y,fetchTraces:b,fetchTraceDetail:E,clearSpans:j}}function Ai(n){if(!n)return{};const a={};for(const i of n){if(!i.key||!i.value)continue;const r=i.value;r.stringValue!==void 0?a[i.key]=r.stringValue:r.intValue!==void 0?a[i.key]=r.intValue:r.doubleValue!==void 0?a[i.key]=r.doubleValue:r.boolValue!==void 0&&(a[i.key]=r.boolValue)}return a}function Zt(n){if(n!=null){if(typeof n!="string")return n;try{return JSON.parse(n)}catch{return n}}}function Xj(n){if(!n||!n.startsWith("["))return null;try{const a=JSON.parse(n);if(Array.isArray(a)&&a.length>0&&typeof a[0]=="object")return a}catch{}return null}function jy(n){if(!n||!n.startsWith("{")&&!n.startsWith("["))return null;try{return JSON.parse(n)}catch{return null}}const Qj="_dimText_1vmqq_1",Fj="_assistantMsg_1vmqq_5",Kj="_toolCalls_1vmqq_9",Jj="_toolCall_1vmqq_9",Pj="_toolIcon_1vmqq_22",Wj="_toolName_1vmqq_26",e4="_toolArgs_1vmqq_32",t4="_toolResult_1vmqq_45",n4="_toolResultStatus_1vmqq_51",a4="_finishReason_1vmqq_58",l4="_genAiContent_1vmqq_64",i4="_contentText_1vmqq_70",r4="_strandsEvent_1vmqq_74",s4="_strandsSection_1vmqq_80",u4="_strandsLabel_1vmqq_86",o4="_messageList_1vmqq_93",c4="_msgRow_1vmqq_99",f4="_roleBadge_1vmqq_105",d4="_role_user_1vmqq_116",h4="_role_assistant_1vmqq_121",m4="_role_system_1vmqq_126",p4="_role_tool_1vmqq_131",g4="_msgText_1vmqq_136",y4="_msgContent_1vmqq_142",v4="_parsedContent_1vmqq_147",_4="_spanScope_1vmqq_153",x4="_spanRaw_1vmqq_159",Ee={dimText:Qj,assistantMsg:Fj,toolCalls:Kj,toolCall:Jj,toolIcon:Pj,toolName:Wj,toolArgs:e4,toolResult:t4,toolResultStatus:n4,finishReason:a4,genAiContent:l4,contentText:i4,strandsEvent:r4,strandsSection:s4,strandsLabel:u4,messageList:o4,msgRow:c4,roleBadge:f4,role_user:d4,role_assistant:h4,role_system:m4,role_tool:p4,msgText:g4,msgContent:y4,parsedContent:v4,spanScope:_4,spanRaw:x4};function b4({span:n}){const a=n.events,i=n.attributes;if(a&&a.length>0)return g.jsx("div",{className:Ee.strandsEvent,children:a.map((r,u)=>g.jsx(S4,{event:r},u))});if(i){const r=Object.entries(i).filter(([u,o])=>o!=null&&(u.startsWith("gen_ai.")||u.startsWith("rpc.")||u==="tool.name"));if(r.length>0)return g.jsx("div",{className:Ee.strandsEvent,children:r.map(([u,o])=>g.jsxs("span",{className:Ee.spanScope,children:[u,": ",typeof o=="object"?JSON.stringify(o):String(o)]},u))})}return g.jsx("span",{className:Ee.dimText,children:"—"})}function S4({event:n}){const a=n.name,i=Ai(n.attributes);if(a==="gen_ai.user.message"||a==="gen_ai.system.message"){const r=Zt(i.content);if(Array.isArray(r))return g.jsx(Ni,{content:r});if(r)return g.jsx("span",{children:String(r)})}if(a==="gen_ai.choice"){const r=Zt(i.message);if(Array.isArray(r))return g.jsx(Ni,{content:r});if(r)return g.jsx(Gu,{body:{message:r,finish_reason:i.finish_reason}})}if(a==="gen_ai.tool.message"){const r=Zt(i.content);if(Array.isArray(r))return g.jsx(Ni,{content:r});if(r)return g.jsx("span",{children:String(r)})}return g.jsxs("span",{className:Ee.spanScope,children:[a||"event",i.content?`: ${String(i.content).slice(0,200)}`:""]})}function Gu({body:n}){if(n==null)return g.jsx("span",{className:Ee.dimText,children:"—"});if(typeof n=="string")return g.jsx("span",{children:n});if(typeof n!="object")return g.jsx("span",{children:String(n)});const a=n;if(typeof a.message=="string"&&!a.content&&!a.input&&!a.output)return g.jsx("span",{children:a.message});if(Array.isArray(a.content))return g.jsx(Ni,{content:a.content});if(a.message&&typeof a.message=="object"){const i=a.message;if(i.role==="assistant"&&Array.isArray(i.content)){const r=i.content.map(u=>u.text).filter(Boolean).join("");if(r)return g.jsx("div",{className:Ee.assistantMsg,children:r})}if(Array.isArray(i.tool_calls))return g.jsxs("div",{className:Ee.toolCalls,children:[i.tool_calls.map((r,u)=>{const o=r.function;return g.jsxs("div",{className:Ee.toolCall,children:[g.jsx("span",{className:Ee.toolIcon,children:g.jsx(wa,{size:12})}),g.jsx("span",{className:Ee.toolName,children:String((o==null?void 0:o.name)??"unknown")}),g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(o==null?void 0:o.arguments,null,2)})]},u)}),a.finish_reason!==null&&a.finish_reason!==void 0&&g.jsx("span",{className:Ee.finishReason,children:String(a.finish_reason)})]});if(i.role==="assistant"&&typeof i.content=="string")return g.jsx("div",{className:Ee.assistantMsg,children:i.content})}return a.input||a.output?g.jsx(k4,{input:a.input,output:a.output}):g.jsx("pre",{className:Ee.spanRaw,children:JSON.stringify(a,null,2)})}function Ni({content:n}){return g.jsx("div",{className:Ee.genAiContent,children:n.map((a,i)=>{const r=a;if(r.text)return g.jsx("div",{className:Ee.contentText,children:String(r.text)},i);if(r.toolUse){const u=r.toolUse;return g.jsxs("div",{className:Ee.toolCall,children:[g.jsx("span",{className:Ee.toolIcon,children:g.jsx(wa,{size:12})}),g.jsx("span",{className:Ee.toolName,children:String(u.name)}),g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(u.input,null,2)})]},i)}if(r.toolResult){const u=r.toolResult;return g.jsxs("div",{className:Ee.toolResult,children:[g.jsx("span",{className:Ee.toolResultStatus,children:String(u.status||"result")}),Array.isArray(u.content)&&u.content.map((o,c)=>g.jsx("pre",{className:Ee.toolArgs,children:String(o.text??JSON.stringify(o))},c))]},i)}return g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(r,null,2)},i)})})}function My(n){if(n&&typeof n=="object"&&!Array.isArray(n)){const a=n.messages;if(Array.isArray(a))return a}}function k4({input:n,output:a}){const i=My(n),r=My(a);return g.jsxs("div",{className:Ee.strandsEvent,children:[n!=null&&g.jsxs("div",{className:Ee.strandsSection,children:[g.jsx("span",{className:Ee.strandsLabel,children:"Input"}),i?g.jsx(Ry,{messages:i}):g.jsx("pre",{className:Ee.spanRaw,children:JSON.stringify(n,null,2)})]}),a!=null&&g.jsxs("div",{className:Ee.strandsSection,children:[g.jsx("span",{className:Ee.strandsLabel,children:"Output"}),r?g.jsx(Ry,{messages:r}):g.jsx("pre",{className:Ee.spanRaw,children:JSON.stringify(a,null,2)})]})]})}function Ry({messages:n}){return!n||!Array.isArray(n)?null:g.jsx("div",{className:Ee.messageList,children:n.map((a,i)=>{const r=a,u=String(r.role||""),o=r.content;let c="";typeof o=="string"?c=o:o&&typeof o=="object"&&(c=o.message||o.content||"");const h=Xj(c);return g.jsxs("div",{className:Ee.msgRow,children:[g.jsx("span",{className:`${Ee.roleBadge} ${Ee[`role_${u}`]||""}`,children:u}),g.jsx("div",{className:Ee.msgContent,children:h?g.jsx(T4,{items:h}):g.jsx("span",{className:Ee.msgText,children:c||JSON.stringify(o)})})]},i)})})}function T4({items:n}){return g.jsx("div",{className:Ee.parsedContent,children:n.map((a,i)=>{if(a.text){const r=String(a.text),u=jy(r);return u?g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(u,null,2)},i):g.jsx("div",{className:Ee.contentText,children:r},i)}if(a.toolUse){const r=a.toolUse;return g.jsxs("div",{className:Ee.toolCall,children:[g.jsx("span",{className:Ee.toolIcon,children:g.jsx(wa,{size:12})}),g.jsx("span",{className:Ee.toolName,children:String(r.name)}),r.input!==null&&r.input!==void 0&&Object.keys(r.input).length>0&&g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(r.input,null,2)})]},i)}if(a.toolResult){const r=a.toolResult,u=String(r.status||"result");return g.jsxs("div",{className:Ee.toolResult,children:[g.jsx("span",{className:Ee.toolResultStatus,children:u}),Array.isArray(r.content)&&r.content.map((o,c)=>{const h=String(o.text??""),m=jy(h);return m?g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(m,null,2)},c):g.jsx("pre",{className:Ee.toolArgs,children:h},c)})]},i)}return g.jsx("pre",{className:Ee.toolArgs,children:JSON.stringify(a,null,2)},i)})})}const E4="_container_1hcbv_1",N4="_toggleRow_1hcbv_6",C4="_toggle_1hcbv_6",A4="_chevron_1hcbv_32",w4="_icon_1hcbv_38",j4="_label_1hcbv_43",M4="_content_1hcbv_47",R4="_status_1hcbv_55",z4="_error_1hcbv_62",O4="_detail_1hcbv_73",D4="_traceDetail_1hcbv_73",L4="_detailHeader_1hcbv_80",B4="_detailTitle_1hcbv_89",U4="_closeBtn_1hcbv_95",H4="_controls_1hcbv_111",I4="_controlRow_1hcbv_118",q4="_refreshBtn_1hcbv_124",V4="_retryBtn_1hcbv_144",G4="_timeFilter_1hcbv_158",Z4="_timeModeToggle_1hcbv_164",Y4="_timeModeBtn_1hcbv_173",$4="_timeModeBtnActive_1hcbv_188",X4="_dateRange_1hcbv_193",Q4="_dateField_1hcbv_200",F4="_dateLabel_1hcbv_208",K4="_dateInput_1hcbv_216",J4="_traceList_1hcbv_238",P4="_traceRow_1hcbv_247",W4="_traceRowSelected_1hcbv_267",e3="_traceMain_1hcbv_273",t3="_traceId_1hcbv_279",n3="_spanCount_1hcbv_286",a3="_traceMeta_1hcbv_294",l3="_traceTime_1hcbv_300",i3="_sessionId_1hcbv_305",r3="_spanList_1hcbv_319",s3="_spanRow_1hcbv_326",u3="_spanHeader_1hcbv_339",o3="_spanTimestamp_1hcbv_346",c3="_severityBadge_1hcbv_351",f3="_sevINFO_1hcbv_361",d3="_sevWARN_1hcbv_366",h3="_sevERROR_1hcbv_371",m3="_spanIdTag_1hcbv_376",p3="_spanScope_1hcbv_385",g3="_spanBody_1hcbv_391",y3="_rawToggle_1hcbv_397",v3="_spanRaw_1hcbv_412",be={container:E4,toggleRow:N4,toggle:C4,chevron:A4,icon:w4,label:j4,content:M4,status:R4,error:z4,detail:O4,traceDetail:D4,detailHeader:L4,detailTitle:B4,closeBtn:U4,controls:H4,controlRow:I4,refreshBtn:q4,retryBtn:V4,timeFilter:G4,timeModeToggle:Z4,timeModeBtn:Y4,timeModeBtnActive:$4,dateRange:X4,dateField:Q4,dateLabel:F4,dateInput:K4,traceList:J4,traceRow:P4,traceRowSelected:W4,traceMain:e3,traceId:t3,spanCount:n3,traceMeta:a3,traceTime:l3,sessionId:i3,spanList:r3,spanRow:s3,spanHeader:u3,spanTimestamp:o3,severityBadge:c3,sevINFO:f3,sevWARN:d3,sevERROR:h3,spanIdTag:m3,spanScope:p3,spanBody:g3,rawToggle:y3,spanRaw:v3},_3=[{label:"Last 1 hour",ms:3600*1e3},{label:"Last 6 hours",ms:360*60*1e3},{label:"Last 12 hours",ms:720*60*1e3},{label:"Last 24 hours",ms:1440*60*1e3},{label:"Last 3 days",ms:4320*60*1e3},{label:"Last 7 days",ms:10080*60*1e3}],x3=720*60*1e3;function hu(n,a){const i=n?new Date(n).getTime():void 0,r=a?new Date(a).getTime():void 0;if(!(i===void 0&&r===void 0))return{startTime:i,endTime:r}}function mu(n){const a=Date.now();return{startTime:a-n,endTime:a}}function Lf(n){return n||void 0}function b3({agents:n,isActive:a}){const{traces:i,spans:r,isLoadingTraces:u,isLoadingSpans:o,error:c,isAvailable:h,fetchTraces:m,fetchTraceDetail:p,clearSpans:v}=$j(),y=n.map(ne=>ne.name),x="",[b,E]=B.useState(x),[j,O]=B.useState(null),[S,R]=B.useState("relative"),[M,J]=B.useState(x3),[te,q]=B.useState(""),[ae,de]=B.useState(""),ve=B.useCallback(()=>S==="relative"?mu(M):hu(te,ae),[S,M,te,ae]),L=B.useCallback((ne,N)=>{O(null),v(),m(Lf(ne),N)},[v,m]),P=B.useRef(!1);B.useEffect(()=>{a&&!P.current&&L(b,mu(M)),P.current=!!a},[a,L,b,M]);const $=ne=>{E(ne),L(ne,ve())},fe=ne=>{j===ne.traceId?(O(null),v()):(O(ne.traceId),p(ne.traceId,Lf(b),ve()))},W=()=>{L(b,ve())},ee=ne=>{if(R(ne),ne==="relative")L(b,mu(M));else{const N=new Date,A=new Date(N.getTime()-M);q(pu(A)),de(pu(N)),L(b,hu(pu(A),pu(N)))}},D=ne=>{J(ne),L(b,mu(ne))},F=ne=>{q(ne),L(b,hu(ne,ae))},ue=ne=>{de(ne),L(b,hu(te,ne))};return y.length===0?g.jsx("div",{className:be.status,children:"No traces available."}):g.jsxs("div",{className:be.container,children:[g.jsx("div",{className:be.controls,children:g.jsxs("div",{className:be.controlRow,children:[g.jsxs("div",{className:be.dateField,children:[g.jsx("label",{className:be.dateLabel,htmlFor:"traces-agent",children:"Agent"}),g.jsxs("select",{id:"traces-agent",className:be.dateInput,value:b,onChange:ne=>$(ne.target.value),children:[g.jsx("option",{value:"",children:"All agents"}),y.map(ne=>g.jsx("option",{value:ne,children:ne},ne))]})]}),g.jsx("button",{className:be.refreshBtn,onClick:W,title:"Refresh traces","aria-label":"Refresh traces",children:g.jsx(ud,{size:12})})]})}),g.jsxs("div",{className:be.content,children:[h!==!1&&g.jsxs("div",{className:be.timeFilter,children:[g.jsxs("div",{className:be.timeModeToggle,children:[g.jsx("button",{className:`${be.timeModeBtn} ${S==="relative"?be.timeModeBtnActive:""}`,onClick:()=>ee("relative"),children:"Relative"}),g.jsx("button",{className:`${be.timeModeBtn} ${S==="absolute"?be.timeModeBtnActive:""}`,onClick:()=>ee("absolute"),children:"Absolute"})]}),S==="relative"?g.jsx("div",{className:be.dateField,children:g.jsx("select",{className:be.dateInput,value:M,onChange:ne=>D(Number(ne.target.value)),children:_3.map(ne=>g.jsx("option",{value:ne.ms,children:ne.label},ne.ms))})}):g.jsxs("div",{className:be.dateRange,children:[g.jsxs("div",{className:be.dateField,children:[g.jsx("label",{className:be.dateLabel,htmlFor:"traces-start",children:"Start"}),g.jsx("input",{id:"traces-start",className:be.dateInput,type:"datetime-local",value:te,onChange:ne=>F(ne.target.value)})]}),g.jsxs("div",{className:be.dateField,children:[g.jsx("label",{className:be.dateLabel,htmlFor:"traces-end",children:"End"}),g.jsx("input",{id:"traces-end",className:be.dateInput,type:"datetime-local",value:ae,onChange:ne=>ue(ne.target.value)})]})]})]}),u&&g.jsx("div",{className:be.status,children:"Loading traces…"}),c&&g.jsxs("div",{className:be.error,children:[g.jsxs("span",{children:[g.jsx(od,{size:12})," ",c]}),g.jsx("button",{className:be.retryBtn,onClick:()=>m(Lf(b),ve()),children:"Retry"})]}),!u&&!c&&h!==!1&&i.length===0&&g.jsx("div",{className:be.status,children:"No traces found."}),!u&&i.length>0&&g.jsx("div",{className:be.traceList,children:i.map(ne=>g.jsx(S3,{trace:ne,isSelected:j===ne.traceId,onClick:()=>fe(ne)},ne.traceId))}),j&&g.jsxs("div",{className:be.traceDetail,children:[g.jsxs("div",{className:be.detailHeader,children:[g.jsx("span",{className:be.detailTitle,children:"Spans"}),g.jsx("button",{className:be.closeBtn,onClick:()=>{O(null),v()},"aria-label":"Close span detail",children:g.jsx(Du,{size:12})})]}),o&&g.jsx("div",{className:be.status,children:"Loading spans…"}),!o&&r.length===0&&!c&&g.jsx("div",{className:be.status,children:"No spans found."}),!o&&r.length>0&&g.jsx("div",{className:be.spanList,children:r.map((ne,N)=>g.jsx(k3,{span:ne},N))})]})]})]})}function S3({trace:n,isSelected:a,onClick:i}){return g.jsxs("button",{className:`${be.traceRow} ${a?be.traceRowSelected:""}`,onClick:i,"aria-label":`Trace ${n.traceId}`,children:[g.jsxs("div",{className:be.traceMain,children:[g.jsxs("span",{className:be.traceId,children:[n.traceId.slice(0,12),"…"]}),g.jsxs("span",{className:be.spanCount,children:[n.spanCount," spans"]})]}),g.jsxs("div",{className:be.traceMeta,children:[g.jsx("span",{className:be.traceTime,children:Vu(n.timestamp)}),n.sessionId&&g.jsxs("span",{className:be.sessionId,children:["session: ",n.sessionId.slice(0,10),"…"]})]})]})}function k3({span:n}){var y;const a=n.severityText||"",i=(y=n.scope)==null?void 0:y.name,r=n.spanId||"",u=n.body,o=n.name||"",c=n.type==="span",[h,m]=B.useState(!1),p=n.timestampMs>0?new Date(n.timestampMs).toISOString():"",v=c?T3(n.kind):"";return g.jsxs("div",{className:be.spanRow,children:[g.jsxs("div",{className:be.spanHeader,children:[g.jsx("span",{className:be.spanTimestamp,children:p}),a&&g.jsx("span",{className:`${be.severityBadge} ${be[`sev${a.toUpperCase()}`]||""}`,children:a}),c&&v&&g.jsx("span",{className:be.severityBadge,children:v}),r&&g.jsx("span",{className:be.spanIdTag,children:r.slice(0,8)})]}),i&&g.jsx("div",{className:be.spanScope,children:i}),c&&o&&g.jsx("div",{className:be.spanScope,children:o}),g.jsx("div",{className:be.spanBody,children:c?g.jsx(b4,{span:n}):g.jsx(Gu,{body:u})}),g.jsx("button",{className:be.rawToggle,onClick:()=>m(x=>!x),children:h?g.jsxs(g.Fragment,{children:[g.jsx(il,{size:10})," Hide raw"]}):g.jsxs(g.Fragment,{children:[g.jsx(Al,{size:10})," Raw JSON"]})}),h&&g.jsx("pre",{className:be.spanRaw,children:JSON.stringify(n,null,2)})]})}function T3(n){switch(n){case 1:return"SERVER";case 2:return"CLIENT";case 3:return"PRODUCER";case 4:return"CONSUMER";default:return"INTERNAL"}}function pu(n){const a=i=>String(i).padStart(2,"0");return`${n.getFullYear()}-${a(n.getMonth()+1)}-${a(n.getDate())}T${a(n.getHours())}:${a(n.getMinutes())}`}function E3({resources:n,sessionId:a,userId:i,onClose:r}){const{data:u,isLoading:o,error:c,fetch:h}=n,[m,p]=B.useState(null),[v,y]=B.useState("resources"),[x,b]=B.useState(620),E=B.useRef(null),j=B.useCallback(S=>{S.preventDefault();const R=J=>{const te=window.innerWidth-J.clientX;b(Math.max(320,Math.min(te,window.innerWidth*.8)))},M=()=>{E.current=null,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",M),document.body.style.cursor="",document.body.style.userSelect=""};E.current={move:R,up:M},document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",R),document.addEventListener("mouseup",M)},[]);B.useEffect(()=>()=>{E.current&&(document.removeEventListener("mousemove",E.current.move),document.removeEventListener("mouseup",E.current.up),document.body.style.cursor="",document.body.style.userSelect="")},[]);const O=(S,R)=>{p(M=>(M==null?void 0:M.kind)===S&&M.resource.name===R.name?null:{kind:S,resource:R})};return g.jsxs("div",{className:Ce.panel,style:{width:x},"data-testid":"resource-panel",children:[g.jsx("div",{className:Ce.resizeHandle,onMouseDown:j,role:"separator","aria-label":"Resize panel"}),g.jsxs("div",{className:Ce.header,children:[g.jsx("span",{className:Ce.projectName,children:(u==null?void 0:u.project)||"Resources"}),g.jsxs("div",{className:Ce.headerActions,children:[g.jsx("button",{className:Ce.iconBtn,onClick:h,title:"Refresh","aria-label":"Refresh resources",children:g.jsx(ud,{size:12})}),g.jsx("button",{className:Ce.iconBtn,onClick:r,title:"Close","aria-label":"Close resource panel",children:g.jsx(Du,{size:12})})]})]}),g.jsx("div",{className:Ce.tabBar,role:"tablist",children:["resources","traces","memories"].map(S=>g.jsx("button",{role:"tab","aria-selected":v===S,className:`${Ce.tab} ${v===S?Ce.tabActive:""}`,onClick:()=>y(S),children:S.charAt(0).toUpperCase()+S.slice(1)},S))}),g.jsxs("div",{className:Ce.body,children:[g.jsxs("div",{className:Ce.tabContent,hidden:v!=="resources",children:[o&&!u&&g.jsx("div",{className:Ce.status,children:"Loading resources…"}),c&&!u&&g.jsxs("div",{className:Ce.error,children:[g.jsxs("span",{children:[g.jsx(od,{size:12})," ",c]}),g.jsx("button",{className:Ce.retryBtn,onClick:h,children:"Retry"})]}),u&&g.jsxs("div",{className:Ce.graph,children:[u.agents.length>0&&g.jsx(ea,{title:"Agents",children:u.agents.map(S=>g.jsx(Dn,{kind:"agent",name:S.name,subtitle:S.build,isSelected:(m==null?void 0:m.kind)==="agent"&&m.resource.name===S.name,onClick:()=>O("agent",S),connections:N3(S,u.mcpRuntimeTools),deploymentStatus:S.deploymentStatus},S.name))}),(u.harnesses??[]).length>0&&g.jsx(ea,{title:"Harnesses",children:(u.harnesses??[]).map(S=>g.jsx(Dn,{kind:"harness",name:S.name,subtitle:S.model,isSelected:(m==null?void 0:m.kind)==="harness"&&m.resource.name===S.name,onClick:()=>O("harness",S),deploymentStatus:S.deploymentStatus},S.name))}),u.memories.length>0&&g.jsx(ea,{title:"Memories",children:u.memories.map(S=>g.jsx(Dn,{kind:"memory",name:S.name,subtitle:S.strategies.map(R=>R.type).join(", "),isSelected:(m==null?void 0:m.kind)==="memory"&&m.resource.name===S.name,onClick:()=>O("memory",S),deploymentStatus:S.deploymentStatus},S.name))}),u.credentials.length>0&&g.jsx(ea,{title:"Credentials",children:u.credentials.map(S=>g.jsx(Dn,{kind:"credential",name:S.name,subtitle:S.type,isSelected:(m==null?void 0:m.kind)==="credential"&&m.resource.name===S.name,onClick:()=>O("credential",S),deploymentStatus:S.deploymentStatus},S.name))}),u.gateways.length>0&&g.jsx(ea,{title:"Gateways",children:u.gateways.map(S=>g.jsxs("div",{children:[g.jsx(Dn,{kind:"gateway",name:S.name,subtitle:`${S.targets.length} target(s)`,isSelected:(m==null?void 0:m.kind)==="gateway"&&m.resource.name===S.name,onClick:()=>O("gateway",S),deploymentStatus:S.deploymentStatus}),S.targets.map(R=>g.jsx("div",{className:Ce.childNode,children:g.jsx(Dn,{kind:"gatewayTarget",name:R.name,subtitle:R.targetType,isSelected:(m==null?void 0:m.kind)==="gatewayTarget"&&m.resource.name===R.name,onClick:()=>O("gatewayTarget",R)})},R.name))]},S.name))}),u.mcpRuntimeTools.length>0&&g.jsx(ea,{title:"MCP Runtime Tools",children:u.mcpRuntimeTools.map(S=>g.jsx(Dn,{kind:"mcpTool",name:S.name,subtitle:S.bindings.map(R=>R.runtimeName).join(", "),isSelected:(m==null?void 0:m.kind)==="mcpTool"&&m.resource.name===S.name,onClick:()=>O("mcpTool",S),connections:S.bindings.map(R=>`→ ${R.runtimeName}`),deploymentStatus:S.deploymentStatus},S.name))}),u.evaluators.length>0&&g.jsx(ea,{title:"Evaluators",children:u.evaluators.map(S=>g.jsx(Dn,{kind:"evaluator",name:S.name,subtitle:`${S.level} — ${S.configType}`,isSelected:(m==null?void 0:m.kind)==="evaluator"&&m.resource.name===S.name,onClick:()=>O("evaluator",S),deploymentStatus:S.deploymentStatus},S.name))}),u.onlineEvalConfigs.length>0&&g.jsx(ea,{title:"Online Eval Configs",children:u.onlineEvalConfigs.map(S=>g.jsx(Dn,{kind:"onlineEval",name:S.name,subtitle:`${S.evaluators.length} evaluator(s), ${S.samplingRate}% sampling`,isSelected:(m==null?void 0:m.kind)==="onlineEval"&&m.resource.name===S.name,onClick:()=>O("onlineEval",S),connections:[`→ ${S.agent}`],deploymentStatus:S.deploymentStatus},S.name))}),u.policyEngines.length>0&&g.jsx(ea,{title:"Policy Engines",children:u.policyEngines.map(S=>g.jsxs("div",{children:[g.jsx(Dn,{kind:"policyEngine",name:S.name,subtitle:`${S.policies.length} polic${S.policies.length!==1?"ies":"y"}`,isSelected:(m==null?void 0:m.kind)==="policyEngine"&&m.resource.name===S.name,onClick:()=>O("policyEngine",S),deploymentStatus:S.deploymentStatus}),S.policies.map(R=>g.jsx("div",{className:Ce.childNode,children:g.jsx(Dn,{kind:"policy",name:R.name,subtitle:R.description,isSelected:(m==null?void 0:m.kind)==="policy"&&m.resource.name===R.name,onClick:()=>O("policy",R),deploymentStatus:R.deploymentStatus})},R.name))]},S.name))}),u.unassignedTargets.length>0&&g.jsx(ea,{title:"Unassigned Targets",children:u.unassignedTargets.map(S=>g.jsx(Dn,{kind:"unassignedTarget",name:S.name,subtitle:S.targetType,isSelected:(m==null?void 0:m.kind)==="unassignedTarget"&&m.resource.name===S.name,onClick:()=>O("unassignedTarget",S)},S.name))})]}),m&&g.jsxs("div",{className:Ce.infoCard,children:[g.jsxs("div",{className:Ce.infoHeader,children:[g.jsx("span",{className:`${Ce.kindBadge} ${Ce[m.kind]}`,children:A3(m.kind)}),g.jsx("span",{className:Ce.infoName,children:m.resource.name})]}),g.jsxs("div",{className:Ce.infoBody,children:[Object.entries(m.resource).filter(([S,R])=>S!=="deployed"&&!C3(R)).map(([S,R])=>g.jsxs("div",{className:Ce.infoRow,children:[g.jsx("span",{className:Ce.infoKey,children:S}),g.jsx("span",{className:Ce.infoValue,children:zy(R)})]},S)),"deployed"in m.resource&&m.resource.deployed!==null&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:Ce.infoSectionHeader,children:"Deployed State"}),Object.entries(m.resource.deployed).map(([S,R])=>g.jsxs("div",{className:Ce.infoRow,children:[g.jsx("span",{className:Ce.infoKey,children:S}),g.jsx("span",{className:Ce.infoValue,children:zy(R)})]},S))]})]})]})]}),g.jsx("div",{className:Ce.tabContent,hidden:v!=="traces",children:g.jsx(b3,{agents:(u==null?void 0:u.agents)??[],isActive:v==="traces"})}),g.jsx("div",{className:Ce.tabContent,hidden:v!=="memories",children:g.jsx(Yw,{memories:(u==null?void 0:u.memories)??[],sessionId:a,userId:i,isActive:v==="memories"})})]})]})}function ea({title:n,children:a}){return g.jsxs("div",{className:Ce.section,children:[g.jsx("div",{className:Ce.sectionTitle,children:n}),a]})}function N3(n,a){const i=[];for(const r of a)r.bindings.some(u=>u.runtimeName===n.name)&&i.push(`← ${r.name}`);return i}function C3(n){return!!(n===null||n===""||n===void 0||Array.isArray(n)&&n.length===0)}function zy(n){if(n==null)return"—";if(Array.isArray(n))return n.map(i=>typeof i=="object"?JSON.stringify(i):i).join(", ")||"—";const a=String(n);return a===""?"—":a}function A3(n){return{agent:"Agent",harness:"Harness",memory:"Memory",credential:"Credential",gateway:"Gateway",gatewayTarget:"Target",mcpTool:"MCP Tool",evaluator:"Evaluator",onlineEval:"Online Eval",policyEngine:"Policy Engine",policy:"Policy",unassignedTarget:"Unassigned Target"}[n]}const w3="_body_sadpk_1",j3="_interactionsList_sadpk_9",M3="_interactionItem_sadpk_17",R3="_interactionItemSelected_sadpk_36",z3="_interactionPrompt_sadpk_41",O3="_interactionMeta_sadpk_49",D3="_interactionTraceId_sadpk_55",L3="_interactionTime_sadpk_61",B3="_interactionSpanCount_sadpk_66",U3="_rightArea_sadpk_75",H3="_waterfall_sadpk_84",I3="_userPromptRow_sadpk_90",q3="_userPromptText_sadpk_101",V3="_waterfallRow_sadpk_108",G3="_waterfallRowSelected_sadpk_122",Z3="_spanIcon_sadpk_128",Y3="_spanLabel_sadpk_135",$3="_barContainer_sadpk_145",X3="_bar_sadpk_145",Q3="_barInvocation_sadpk_160",F3="_barAgent_sadpk_164",K3="_barLlm_sadpk_168",J3="_barTool_sadpk_172",P3="_barOther_sadpk_176",W3="_duration_sadpk_180",eM="_detailPane_sadpk_190",tM="_detailHeader_sadpk_197",nM="_iconBtn_sadpk_209",aM="_tabBar_sadpk_224",lM="_tab_sadpk_224",iM="_tabActive_sadpk_244",rM="_detailBody_sadpk_249",sM="_attrTable_sadpk_254",uM="_attrKey_sadpk_265",oM="_attrValue_sadpk_273",cM="_emptyState_sadpk_280",ze={body:w3,interactionsList:j3,interactionItem:M3,interactionItemSelected:R3,interactionPrompt:z3,interactionMeta:O3,interactionTraceId:D3,interactionTime:L3,interactionSpanCount:B3,rightArea:U3,waterfall:H3,userPromptRow:I3,userPromptText:q3,waterfallRow:V3,waterfallRowSelected:G3,spanIcon:Z3,spanLabel:Y3,barContainer:$3,bar:X3,barInvocation:Q3,barAgent:F3,barLlm:K3,barTool:J3,barOther:P3,duration:W3,detailPane:eM,detailHeader:tM,iconBtn:nM,tabBar:aM,tab:lM,tabActive:iM,detailBody:rM,attrTable:sM,attrKey:uM,attrValue:oM,emptyState:cM};function fM({invocations:n,selectedTraceId:a,onSelect:i}){return n.length===0?g.jsx("div",{className:ze.emptyState,children:"No interactions yet"}):g.jsx("div",{className:ze.interactionsList,"data-testid":"trace-list",children:n.map(r=>g.jsxs("button",{className:`${ze.interactionItem} ${a===r.traceId?ze.interactionItemSelected:""}`,onClick:()=>i(r.traceId),"aria-label":`Trace ${r.traceId}`,children:[r.userPrompt&&g.jsx("span",{className:ze.interactionPrompt,title:r.userPrompt,children:r.userPrompt}),g.jsxs("div",{className:ze.interactionMeta,children:[g.jsxs("span",{className:ze.interactionTraceId,children:[r.traceId.slice(0,12),"..."]}),g.jsx("span",{className:ze.interactionSpanCount,children:r.spanCount})]}),g.jsx("span",{className:ze.interactionTime,children:Vu(r.timestamp)})]},r.traceId))})}function vu(n){if(typeof n=="string"){const a=Zt(n);return typeof a!="string"?vu(a)??n:n}if(Array.isArray(n)){const a=n.filter(i=>i.text).map(i=>String(i.text));if(a.length>0)return a.join(" ")}return null}function dM(n){var i;for(const r of n){if(!((i=r.name)!=null&&i.startsWith("invoke_agent")))continue;const u=r.events;if(u)for(const o of u){if(o.name!=="gen_ai.user.message")continue;const c=Ai(o.attributes),h=vu(c.content);if(h)return h}}let a=null;for(const r of n){const u=r.events;if(u)for(const o of u){if(o.name!=="gen_ai.user.message")continue;const c=Ai(o.attributes),h=vu(c.content);h&&(a=h)}}if(a)return a;for(const r of n){const u=r.attributes??{};if(u["gen_ai.content.prompt"]){const o=vu(u["gen_ai.content.prompt"]);if(o)return o}}for(const r of n){const u=r.attributes??{};if(u["gen_ai.input.messages"]){const o=u["gen_ai.input.messages"],c=typeof o=="string"?Zt(o):o;if(Array.isArray(c)){const h=c.find(m=>m.role==="user");if(h!=null&&h.parts&&Array.isArray(h.parts)){const m=h.parts.filter(p=>p.type==="text"&&p.content).map(p=>String(p.content));if(m.length>0)return m.join(" ")}}}}return null}function hM(n){switch(n){case 1:return"SERVER";case 2:return"CLIENT";case 3:return"PRODUCER";case 4:return"CONSUMER";default:return"INTERNAL"}}function mM(n){var o;const a={...n.attributes??{}},i=xn(n.startTimeUnixNano),u=xn(n.endTimeUnixNano)-i;return{attributes:a,status:n.status,kind:n.type==="span"?hM(n.kind):void 0,scope:(o=n.scope)==null?void 0:o.name,duration:u>0?`${u}ms`:void 0}}function pM(n){const a=n.events;if(a){let r=null;for(const u of a){const o=u.name,c=Ai(u.attributes);o==="gen_ai.user.message"&&(r={type:"genai",content:Zt(c.content)??c.content})}if(r)return r}const i=n.attributes??{};return i["gen_ai.content.prompt"]?{type:"genai",content:Zt(i["gen_ai.content.prompt"])}:i["gen_ai.tool.call.arguments"]?{type:"tool",content:Zt(i["gen_ai.tool.call.arguments"])}:i["gen_ai.input.messages"]?{type:"genai",content:Zt(i["gen_ai.input.messages"])}:i["gen_ai.task.input"]?{type:"raw",content:Zt(i["gen_ai.task.input"])}:n.type==="log"&&n.body?{type:"raw",content:n.body}:null}function gM(n){const a=n.events;if(a){let r=null;for(const u of a){const o=u.name,c=Ai(u.attributes);o==="gen_ai.choice"&&(r={type:"genai",content:Zt(c.message)??c})}if(r)return r}const i=n.attributes??{};if(i["tool.name"]&&a){for(const r of a)if(r.name==="gen_ai.tool.message"){const o=Ai(r.attributes);return{type:"tool",content:Zt(o.content)??o.content}}}return i["gen_ai.content.completion"]?{type:"genai",content:Zt(i["gen_ai.content.completion"])}:i["gen_ai.tool.call.result"]?{type:"tool",content:Zt(i["gen_ai.tool.call.result"])}:i["gen_ai.output.messages"]?{type:"genai",content:Zt(i["gen_ai.output.messages"])}:i["gen_ai.task.output"]?{type:"raw",content:Zt(i["gen_ai.task.output"])}:null}function yM({span:n,onClose:a}){const[i,r]=B.useState("event");return g.jsxs("div",{className:ze.detailPane,children:[g.jsxs("div",{className:ze.detailHeader,children:[g.jsx("div",{className:ze.tabBar,children:["event","request","response"].map(u=>g.jsx("button",{className:`${ze.tab} ${i===u?ze.tabActive:""}`,onClick:()=>r(u),children:u.charAt(0).toUpperCase()+u.slice(1)},u))}),g.jsx("button",{className:ze.iconBtn,onClick:a,"aria-label":"Close detail",children:g.jsx(Du,{size:14})})]}),g.jsxs("div",{className:ze.detailBody,children:[i==="event"&&g.jsx(vM,{span:n}),i==="request"&&g.jsx(_M,{span:n}),i==="response"&&g.jsx(xM,{span:n})]})]})}function vM({span:n}){const a=mM(n),i=[];n.name&&i.push(["name",n.name]),a.kind&&i.push(["kind",a.kind]),a.scope&&i.push(["scope",a.scope]),a.duration&&i.push(["duration",a.duration]),a.status&&(i.push(["status.code",String(a.status.code??"OK")]),a.status.message&&i.push(["status.message",a.status.message]));const r=new Set(i.map(([u])=>u));for(const[u,o]of Object.entries(a.attributes))o!=null&&!r.has(u)&&i.push([u,typeof o=="object"?JSON.stringify(o):String(o)]);return i.length===0?g.jsx("div",{className:ze.emptyState,children:"No event data"}):g.jsx("table",{className:ze.attrTable,children:g.jsx("tbody",{children:i.map(([u,o])=>g.jsxs("tr",{children:[g.jsx("td",{className:ze.attrKey,children:u}),g.jsx("td",{className:ze.attrValue,children:o})]},u))})})}function _M({span:n}){const a=pM(n);return a?a.type==="genai"&&Array.isArray(a.content)?g.jsx(Ni,{content:a.content}):g.jsx(Gu,{body:a.content}):g.jsx("div",{className:ze.emptyState,children:"No request data"})}function xM({span:n}){const a=gM(n);return a?a.type==="genai"&&Array.isArray(a.content)?g.jsx(Ni,{content:a.content}):g.jsx(Gu,{body:a.content}):g.jsx("div",{className:ze.emptyState,children:"No response data"})}const bM=16,SM={invocation:g.jsx(Fy,{size:12}),agent:g.jsx(fx,{size:12}),llm:g.jsx(Sx,{size:12}),tool:g.jsx(wa,{size:12}),other:g.jsx(lx,{size:10})},kM={invocation:ze.barInvocation,agent:ze.barAgent,llm:ze.barLlm,tool:ze.barTool,other:ze.barOther};function TM({tree:n,selectedSpanId:a,onSelectSpan:i,userPrompt:r}){const u=EA(n);return u.length===0?g.jsx("div",{className:ze.emptyState,children:"No spans"}):g.jsxs("div",{className:ze.waterfall,children:[r&&g.jsxs("div",{className:ze.userPromptRow,children:[g.jsx("span",{className:ze.spanIcon,children:g.jsx(Mx,{size:12})}),g.jsx("span",{className:ze.userPromptText,title:r,children:r})]}),u.map((o,c)=>g.jsx(EM,{entry:o,isSelected:a===o.node.span.spanId,onSelect:()=>i(o.node.span)},o.node.span.spanId??c))]})}function EM({entry:n,isSelected:a,onSelect:i}){var v;const{node:r,offsetPercent:u,widthPercent:o}=n,c=NA(r.span),h=SM[c],m=kM[c],p=r.span.name||((v=r.span.scope)==null?void 0:v.name)||"span";return g.jsxs("div",{className:`${ze.waterfallRow} ${a?ze.waterfallRowSelected:""}`,style:{paddingLeft:`${10+r.depth*bM}px`},onClick:i,role:"button",tabIndex:0,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&i()},children:[g.jsx("span",{className:ze.spanIcon,children:h}),g.jsx("span",{className:ze.spanLabel,title:p,children:p}),g.jsx("div",{className:ze.barContainer,children:g.jsx("div",{className:`${ze.bar} ${m}`,style:{left:`${u}%`,width:`${o}%`}})}),g.jsx("span",{className:ze.duration,children:tv(r.durationMs)})]})}function NM({traces:n}){const{invocations:a,selectedInvocation:i,isLoading:r,selectTrace:u,refresh:o}=n,[c,h]=B.useState(null);return B.useEffect(()=>{h(null)},[i==null?void 0:i.traceId]),g.jsx(Lu,{title:"Timeline view",status:r?"Loading...":void 0,onRefresh:o,children:g.jsxs("div",{className:ze.body,children:[g.jsx(fM,{invocations:a,selectedTraceId:(i==null?void 0:i.traceId)??null,onSelect:u}),g.jsxs("div",{className:ze.rightArea,children:[!i&&g.jsx("div",{className:ze.emptyState,children:"Select an interaction to view"}),i&&g.jsxs(g.Fragment,{children:[g.jsx(TM,{tree:i.tree,selectedSpanId:(c==null?void 0:c.spanId)??null,onSelectSpan:h,userPrompt:i.userPrompt}),c&&g.jsx(yM,{span:c,onClose:()=>h(null)})]})]})]})})}const CM="_error_1vxci_1",AM="_toolListItems_1vxci_7",wM="_toolItem_1vxci_14",jM="_toolItemSelected_1vxci_34",MM="_toolName_1vxci_39",RM="_toolDesc_1vxci_45",zM="_toolForm_1vxci_53",OM="_toolFormHeader_1vxci_58",DM="_toolFormDesc_1vxci_66",LM="_noParams_1vxci_72",BM="_field_1vxci_78",UM="_fieldLabel_1vxci_82",HM="_fieldType_1vxci_92",IM="_fieldInput_1vxci_98",qM="_fieldTextarea_1vxci_115",VM="_fieldHint_1vxci_122",GM="_callBtn_1vxci_128",ZM="_spinning_1vxci_153",Tt={error:CM,toolListItems:AM,toolItem:wM,toolItemSelected:jM,toolName:MM,toolDesc:RM,toolForm:zM,toolFormHeader:OM,toolFormDesc:DM,noParams:LM,field:BM,fieldLabel:UM,fieldType:HM,fieldInput:IM,fieldTextarea:qM,fieldHint:VM,callBtn:GM,spinning:ZM};function YM(n,a){if(a.type==="integer"){const i=parseInt(n,10);return Number.isNaN(i)?0:i}if(a.type==="number"){const i=parseFloat(n);return Number.isNaN(i)?0:i}if(a.type==="boolean")return n==="true";if(a.type==="object"||a.type==="array")try{return JSON.parse(n)}catch{return n}return n}function $M(n){return n.type==="integer"||n.type==="number"?"number":"text"}function XM({tool:n,isCalling:a,onCall:i}){var p,v;const r=((p=n.inputSchema)==null?void 0:p.properties)??{},u=new Set(((v=n.inputSchema)==null?void 0:v.required)??[]),o=Object.keys(r),[c,h]=B.useState(()=>{const y={};for(const x of o){const b=r[x];y[x]=b.default!==void 0?String(b.default):""}return y}),m=y=>{y.preventDefault();const x={};for(const b of o){const E=c[b];E===""&&!u.has(b)||(x[b]=YM(E,r[b]))}i(n.name,x)};return g.jsxs("form",{className:Tt.toolForm,onSubmit:m,children:[g.jsx("div",{className:Tt.toolFormHeader,children:n.name}),n.description&&g.jsx("div",{className:Tt.toolFormDesc,children:n.description}),o.length===0&&g.jsx("div",{className:Tt.noParams,children:"No parameters"}),o.map(y=>{const x=r[y],b=u.has(y);return g.jsxs("div",{className:Tt.field,children:[g.jsxs("label",{className:Tt.fieldLabel,children:[y,g.jsxs("span",{className:Tt.fieldType,children:[x.type,b?", required":""]})]}),x.enum?g.jsxs("select",{className:Tt.fieldInput,value:c[y],onChange:E=>h(j=>({...j,[y]:E.target.value})),children:[g.jsx("option",{value:"",children:"Select..."}),x.enum.map(E=>g.jsx("option",{value:E,children:E},E))]}):x.type==="boolean"?g.jsxs("select",{className:Tt.fieldInput,value:c[y],onChange:E=>h(j=>({...j,[y]:E.target.value})),children:[g.jsx("option",{value:"",children:"Select..."}),g.jsx("option",{value:"true",children:"true"}),g.jsx("option",{value:"false",children:"false"})]}):x.type==="object"||x.type==="array"?g.jsx("textarea",{className:`${Tt.fieldInput} ${Tt.fieldTextarea}`,value:c[y],onChange:E=>h(j=>({...j,[y]:E.target.value})),placeholder:"JSON",rows:3}):g.jsx("input",{className:Tt.fieldInput,type:$M(x),value:c[y],onChange:E=>h(j=>({...j,[y]:E.target.value})),placeholder:x.description??""}),x.description&&g.jsx("div",{className:Tt.fieldHint,children:x.description})]},y)}),g.jsx("button",{type:"submit",className:Tt.callBtn,disabled:a,children:a?g.jsxs(g.Fragment,{children:[g.jsx(Xy,{size:14,className:Tt.spinning}),"Calling..."]}):"Call Tool"})]})}function QM({tools:n,isLoading:a,error:i,onRefresh:r,onCallTool:u,onToolCallMessage:o}){const[c,h]=B.useState(null),[m,p]=B.useState(!1),v=n.find(x=>x.name===c),y=async(x,b)=>{var O;p(!0);const E=Object.keys(b).length>0?`(${JSON.stringify(b)})`:"()",j=`Called ${x}${E}`;try{const S=await u(x,b),R=((O=S.content)==null?void 0:O.filter(J=>J.text!==void 0).map(J=>J.text))??[],M=R.length>0?R.join(`
265
265
  `):JSON.stringify(S,null,2);o(j,M,S.isError)}catch(S){o(j,S.message,!0)}finally{p(!1)}};return g.jsxs(Lu,{title:`Tools (${n.length})`,onRefresh:r,isRefreshing:a,children:[i&&g.jsx("div",{className:Tt.error,children:i}),g.jsx("div",{className:Tt.toolListItems,children:n.map(x=>g.jsxs("button",{className:`${Tt.toolItem} ${c===x.name?Tt.toolItemSelected:""}`,onClick:()=>h(c===x.name?null:x.name),children:[g.jsx("span",{className:Tt.toolName,children:x.name}),g.jsx("span",{className:Tt.toolDesc,children:x.description??""})]},x.name))}),v&&g.jsx(XM,{tool:v,isCalling:m,onCall:y},v.name)]})}function FM(n,a,i,r){const[u,o]=B.useState(null),[c,h]=B.useState(!1),[m,p]=B.useState(null);B.useEffect(()=>{o(null),p(null)},[a]);const v=B.useCallback(async()=>{if(!(!a||i!=="A2A")){h(!0),p(null);try{const y=await Sn(`${n}/api/a2a/agent-card?agentName=${encodeURIComponent(a)}`);if(!y.ok){const b=await y.text();throw new Error(`Failed to fetch agent card (${y.status}): ${b}`)}const x=await y.json();if(!x.success||!x.card)throw new Error(x.error??"Agent card not available");o(x.card)}catch(y){p(y.message)}finally{h(!1)}}},[n,a,i]);return B.useEffect(()=>{a&&i==="A2A"&&r&&v()},[a,i,r,v]),{card:u,isLoading:c,error:m,fetchCard:v}}function KM(n){const[a,i]=B.useState([]),[r,u]=B.useState([]),[o,c]=B.useState([]),[h,m]=B.useState(void 0),[p,v]=B.useState(!1),[y,x]=B.useState(!1);return B.useEffect(()=>{let b,E=!1;async function j(){try{const S=await(await Sn(`${n}/api/status`)).json();if(E)return;i(S.agents),u(S.harnesses??[]),c(S.errors??[]),m(R=>R??S.selectedAgent),v(!0),x(!0)}catch{if(E)return;v(!1)}E||(b=setTimeout(j,5e3))}return j(),()=>{E=!0,clearTimeout(b)}},[n]),{agents:a,harnesses:r,errors:o,selectedAgent:h,isConnected:p,hasConnected:y}}const JM=60;function PM(n,a){const i=B.useRef(null),r=B.useRef(!1),u=()=>{const h=i.current;return h?h.scrollHeight-h.scrollTop-h.clientHeight<=JM:!0},o=B.useCallback(()=>{const h=i.current;h&&(r.current=!1,h.scrollTop=h.scrollHeight)},[]),c=B.useCallback(()=>{const h=i.current;!h||r.current||(a?h.scrollTop=h.scrollHeight:h.scrollTo({top:h.scrollHeight,behavior:"smooth"}))},[a]);return B.useLayoutEffect(()=>{const h=i.current;if(!h)return;const m=()=>{requestAnimationFrame(()=>{i.current&&(r.current=!u())})},p=()=>{u()&&r.current&&(r.current=!1)};return h.addEventListener("wheel",m,{passive:!0}),h.addEventListener("touchmove",m,{passive:!0}),h.addEventListener("scroll",p,{passive:!0}),()=>{h.removeEventListener("wheel",m),h.removeEventListener("touchmove",m),h.removeEventListener("scroll",p)}},[]),B.useEffect(()=>{c()},[n,c]),{containerRef:i,forceScrollToBottom:o}}function WM(n){if(!n.startsWith("data: "))return null;const a=n.slice(6);try{const i=JSON.parse(a);return typeof i.type!="string"?null:i}catch{return null}}function eR(n,a,i){const[r,u]=B.useState([]),[o,c]=B.useState(!1),[h,m]=B.useState(null),[p,v]=B.useState({}),y=B.useRef(null),x=B.useRef({}),b=B.useRef(null),E=B.useCallback(async S=>{var M,J;(M=b.current)==null||M.abort();const R=new AbortController;b.current=R,c(!0);try{const te=await Sn(`${n}/invocations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S),signal:R.signal});if(!te.ok){const F=await te.text();u(ue=>{const ne=[...ue];return ne[ne.length-1]={role:"assistant",content:F||`Error: ${te.status}`,isError:!0},ne});return}const q=te.headers.get("x-session-id");if(q&&(y.current=q,m(q)),!te.body){u(F=>{const ue=[...F];return ue[ue.length-1]={role:"assistant",content:"(empty response)"},ue});return}const ae=te.body.getReader(),de=new TextDecoder;let ve="",L="",P=null,$;const fe=new Map,W=()=>{P=null;const F=Object.keys(x.current).length>0?{...x.current}:void 0;u(ue=>{const ne=[...ue];return ne[ne.length-1]={role:"assistant",content:L,...F?{toolExecutions:F}:{}},ne})},ee=()=>{P===null&&(P=requestAnimationFrame(W))};for(;;){const{done:F,value:ue}=await ae.read();if(F)break;ve+=de.decode(ue,{stream:!0});const ne=ve.split(`
266
266
  `);ve=ne.pop()||"";for(const N of ne){const A=WM(N);if(!A)continue;const Z=A,T=Z.contentBlockIndex;switch(A.type){case"messageStart":break;case"contentBlockStart":{const U=Z.start;if((U==null?void 0:U.type)==="toolUse"){const ie=U.toolUse;x.current[ie.toolUseId]={toolName:ie.name,serverName:ie.serverName,input:"",result:""},T!==void 0&&fe.set(T,ie.toolUseId)}else if((U==null?void 0:U.type)==="toolResult"){const ie=U.toolResult;ie!=null&&ie.toolUseId&&x.current[ie.toolUseId]&&(ie.status&&(x.current[ie.toolUseId].resultStatus=ie.status),T!==void 0&&fe.set(T,ie.toolUseId))}ee();break}case"contentBlockDelta":{const U=Z.delta;if((U==null?void 0:U.type)==="text")L+=U.text;else if((U==null?void 0:U.type)==="toolUse"){const ie=T!==void 0?fe.get(T):void 0;ie&&x.current[ie]&&(x.current[ie].input+=U.input)}else if((U==null?void 0:U.type)==="toolResult"){const ie=T!==void 0?fe.get(T):void 0,he=U.results;if(ie&&x.current[ie]&&he)for(const je of he)typeof je.text=="string"&&(x.current[ie].result+=je.text)}ee();break}case"contentBlockStop":{const U=T!==void 0?fe.get(T):void 0;U&&((J=x.current[U])!=null&&J.result)&&(L+=`
267
267
 
@@ -270,6 +270,5 @@ Error generating stack: `+s.message+`
270
270
  \`\`\`
271
271
 
272
272
  `),ee();break}case"metadata":{$=Z.usage;break}case"error":{L+=`
273
- Error: ${Z.message}`,ee();break}default:break}}}P!==null&&cancelAnimationFrame(P);const D=Object.keys(x.current).length>0?{...x.current}:void 0;x.current={},u(F=>{const ue=[...F];return ue[ue.length-1]={role:"assistant",content:L||(D?"":"(empty response)"),...D?{toolExecutions:D}:{},...$?{tokenUsage:{inputTokens:$.inputTokens,outputTokens:$.outputTokens,totalTokens:$.totalTokens}}:{}},ue})}catch(te){const q=te instanceof Error&&te.message.includes("Failed to fetch")?"Connection failed — is the dev server running?":te instanceof Error?te.message:"Unknown error";u(ae=>{const de=[...ae];return de[de.length-1]={role:"assistant",content:q,isError:!0},de})}finally{c(!1)}},[n]),j=B.useCallback(async S=>{var R;!S||o||!a||(x.current={},u(M=>[...M,{role:"user",content:S},{role:"assistant",content:""}]),await E({harnessName:a,prompt:S,...y.current?{sessionId:y.current}:{},...i?{userId:i}:{},harnessOverrides:{...p,skills:(R=p.skills)==null?void 0:R.map(M=>({path:M}))}}))},[a,o,i,p,E]),O=B.useCallback(()=>{var S;(S=b.current)==null||S.abort(),b.current=null,u([]),m(null),y.current=null,x.current={},c(!1)},[]);return{messages:r,isStreaming:o,sessionId:h,harnessOverrides:p,setHarnessOverrides:v,sendMessage:j,resetChat:O}}function tR(n){const a=ev(n.resourceSpans,n.resourceLogs),i=kA(a),r=dM(a);return{traceId:n.traceId,timestamp:n.timestamp,sessionId:n.sessionId,spanCount:n.spanCount,spans:a,tree:i,userPrompt:r}}function nR(n){const a=Bn,[i,r]=B.useState([]),[u,o]=B.useState(null),[c,h]=B.useState(!1),[m,p]=B.useState(null),[v,y]=B.useState(null),x=B.useRef(n);x.current=n;const b=B.useCallback(async()=>{h(!0),p(null);try{const J=new URLSearchParams;x.current&&J.set("agentName",x.current);const te=Date.now();J.set("startTime",String(te-720*60*1e3)),J.set("endTime",String(te));const q=await Sn(`${a}/api/traces?${J.toString()}`);if(q.status===404){y(!1),r([]);return}y(!0);const ae=await q.json();ae.success?r(ae.traces.map(tR)):(p(ae.error),r([]))}catch(J){p(J instanceof Error?J.message:"Failed to load traces"),r([])}finally{h(!1)}},[a]),E=i.find(J=>J.traceId===u)??null,j=B.useCallback(J=>{o(te=>te===J?te:J)},[]),O=B.useCallback(()=>{o(null)},[]),S=B.useCallback(()=>{b()},[b]),R=B.useCallback(()=>{setTimeout(()=>b(),1500),setTimeout(()=>b(),5e3)},[b]),M=B.useRef(n);return B.useEffect(()=>{M.current!==n&&(M.current=n,r([]),o(null),p(null)),b()},[n,b]),{invocations:i,selectedInvocation:E,isLoading:c,error:m,isAvailable:v,selectTrace:j,deselectTrace:O,refresh:S,onInvocationComplete:R}}let Bf=1;function Oy(n){if(typeof n=="string"){const a=n.match(/^data:\s*(.+)$/m);if(a)try{return JSON.parse(a[1])}catch{throw new Error(`Failed to parse SSE data: ${a[1].slice(0,200)}`)}try{return JSON.parse(n)}catch{throw new Error(`Unexpected MCP result format: ${n.slice(0,200)}`)}}if(n&&typeof n=="object")return n;throw new Error("Empty MCP result")}async function gu(n,a,i,r){const u=await Sn(`${n}/api/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:a,body:i,sessionId:r})});if(!u.ok){const o=await u.text();throw new Error(`MCP proxy error (${u.status}): ${o}`)}return u.json()}function aR(n,a,i,r){const[u,o]=B.useState([]),[c,h]=B.useState(!1),[m,p]=B.useState(null),v=B.useRef(void 0),y=B.useRef(null);B.useEffect(()=>{o([]),p(null),v.current=void 0,y.current=null},[a]);const x=B.useCallback(j=>{if(y.current)return y.current;const O=(async()=>{const S=await gu(n,j,{jsonrpc:"2.0",id:Bf++,method:"initialize",params:{protocolVersion:"2025-03-26",capabilities:{},clientInfo:{name:"agentcore-inspector",version:"1.0.0"}}});if(!S.success)throw new Error(S.error??"Failed to initialize MCP session");v.current=S.sessionId,await gu(n,j,{jsonrpc:"2.0",method:"notifications/initialized"},v.current)})().catch(S=>{throw y.current=null,S});return y.current=O,O},[n]),b=B.useCallback(async()=>{if(!(!a||i!=="MCP")){h(!0),p(null);try{await x(a);const j=await gu(n,a,{jsonrpc:"2.0",id:Bf++,method:"tools/list",params:{}},v.current);if(!j.success)throw new Error(j.error??"Failed to list tools");const S=Oy(j.result).result;o((S==null?void 0:S.tools)??[])}catch(j){p(j.message)}finally{h(!1)}}},[n,a,i,x]),E=B.useCallback(async(j,O)=>{if(!a)throw new Error("No agent selected");await x(a);const S=await gu(n,a,{jsonrpc:"2.0",id:Bf++,method:"tools/call",params:{name:j,arguments:O}},v.current);if(!S.success)throw new Error(S.error??"Tool call failed");const R=Oy(S.result),M=R.result,J=R.error;if(J)throw new Error(J.message);return M??{content:[{type:"text",text:JSON.stringify(R)}]}},[n,a,x]);return B.useEffect(()=>{a&&i==="MCP"&&r&&b()},[a,i,r,b]),{tools:u,isLoading:c,error:m,fetchTools:b,callTool:E}}const lR=15e3;function iR(n){const[a,i]=B.useState(null),[r,u]=B.useState(!1),[o,c]=B.useState(null),h=B.useRef(void 0),m=B.useCallback(async()=>{u(!0),c(null);try{const v=await(await Sn(`${n}/api/resources`)).json();v.success?i(v):c(v.error||"Failed to load resources")}catch(p){c(p instanceof Error?p.message:"Failed to load resources")}finally{u(!1)}},[n]);return B.useEffect(()=>(m(),h.current=setInterval(m,lR),()=>clearInterval(h.current)),[m]),{data:a,isLoading:r,error:o,fetch:m}}function rR(n){const[a,i]=B.useState(!1),[r,u]=B.useState(!1),[o,c]=B.useState(null),h=B.useCallback(async m=>{i(!0),u(!1),c(null);try{const v=await(await Sn(`${n}/api/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:m})})).json();return v.success?(u(!0),!0):(c(v.error||"Failed to start agent"),!1)}catch(p){return c(p instanceof Error?p.message:"Failed to start agent"),!1}finally{i(!1)}},[n]);return{isStarting:a,isReady:r,error:o,startAgent:h}}var Fe;(function(n){n.assertEqual=u=>{};function a(u){}n.assertIs=a;function i(u){throw new Error}n.assertNever=i,n.arrayToEnum=u=>{const o={};for(const c of u)o[c]=c;return o},n.getValidEnumValues=u=>{const o=n.objectKeys(u).filter(h=>typeof u[u[h]]!="number"),c={};for(const h of o)c[h]=u[h];return n.objectValues(c)},n.objectValues=u=>n.objectKeys(u).map(function(o){return u[o]}),n.objectKeys=typeof Object.keys=="function"?u=>Object.keys(u):u=>{const o=[];for(const c in u)Object.prototype.hasOwnProperty.call(u,c)&&o.push(c);return o},n.find=(u,o)=>{for(const c of u)if(o(c))return c},n.isInteger=typeof Number.isInteger=="function"?u=>Number.isInteger(u):u=>typeof u=="number"&&Number.isFinite(u)&&Math.floor(u)===u;function r(u,o=" | "){return u.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(u,o)=>typeof o=="bigint"?o.toString():o})(Fe||(Fe={}));var Dy;(function(n){n.mergeShapes=(a,i)=>({...a,...i})})(Dy||(Dy={}));const me=Fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ll=n=>{switch(typeof n){case"undefined":return me.undefined;case"string":return me.string;case"number":return Number.isNaN(n)?me.nan:me.number;case"boolean":return me.boolean;case"function":return me.function;case"bigint":return me.bigint;case"symbol":return me.symbol;case"object":return Array.isArray(n)?me.array:n===null?me.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?me.promise:typeof Map<"u"&&n instanceof Map?me.map:typeof Set<"u"&&n instanceof Set?me.set:typeof Date<"u"&&n instanceof Date?me.date:me.object;default:return me.unknown}},re=Fe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Aa extends Error{get errors(){return this.issues}constructor(a){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=a}format(a){const i=a||function(o){return o.message},r={_errors:[]},u=o=>{for(const c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(u);else if(c.code==="invalid_return_type")u(c.returnTypeError);else if(c.code==="invalid_arguments")u(c.argumentsError);else if(c.path.length===0)r._errors.push(i(c));else{let h=r,m=0;for(;m<c.path.length;){const p=c.path[m];m===c.path.length-1?(h[p]=h[p]||{_errors:[]},h[p]._errors.push(i(c))):h[p]=h[p]||{_errors:[]},h=h[p],m++}}};return u(this),r}static assert(a){if(!(a instanceof Aa))throw new Error(`Not a ZodError: ${a}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(a=i=>i.message){const i={},r=[];for(const u of this.issues)if(u.path.length>0){const o=u.path[0];i[o]=i[o]||[],i[o].push(a(u))}else r.push(a(u));return{formErrors:r,fieldErrors:i}}get formErrors(){return this.flatten()}}Aa.create=n=>new Aa(n);const Pf=(n,a)=>{let i;switch(n.code){case re.invalid_type:n.received===me.undefined?i="Required":i=`Expected ${n.expected}, received ${n.received}`;break;case re.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(n.expected,Fe.jsonStringifyReplacer)}`;break;case re.unrecognized_keys:i=`Unrecognized key(s) in object: ${Fe.joinValues(n.keys,", ")}`;break;case re.invalid_union:i="Invalid input";break;case re.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${Fe.joinValues(n.options)}`;break;case re.invalid_enum_value:i=`Invalid enum value. Expected ${Fe.joinValues(n.options)}, received '${n.received}'`;break;case re.invalid_arguments:i="Invalid function arguments";break;case re.invalid_return_type:i="Invalid function return type";break;case re.invalid_date:i="Invalid date";break;case re.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(i=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?i=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?i=`Invalid input: must end with "${n.validation.endsWith}"`:Fe.assertNever(n.validation):n.validation!=="regex"?i=`Invalid ${n.validation}`:i="Invalid";break;case re.too_small:n.type==="array"?i=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?i=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?i=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?i=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?i=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:i="Invalid input";break;case re.too_big:n.type==="array"?i=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?i=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?i=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?i=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?i=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:i="Invalid input";break;case re.custom:i="Invalid input";break;case re.invalid_intersection_types:i="Intersection results could not be merged";break;case re.not_multiple_of:i=`Number must be a multiple of ${n.multipleOf}`;break;case re.not_finite:i="Number must be finite";break;default:i=a.defaultError,Fe.assertNever(n)}return{message:i}};let sR=Pf;function uR(){return sR}const oR=n=>{const{data:a,path:i,errorMaps:r,issueData:u}=n,o=[...i,...u.path||[]],c={...u,path:o};if(u.message!==void 0)return{...u,path:o,message:u.message};let h="";const m=r.filter(p=>!!p).slice().reverse();for(const p of m)h=p(c,{data:a,defaultError:h}).message;return{...u,path:o,message:h}};function ce(n,a){const i=uR(),r=oR({issueData:a,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,i,i===Pf?void 0:Pf].filter(u=>!!u)});n.common.issues.push(r)}class Pt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,i){const r=[];for(const u of i){if(u.status==="aborted")return Ae;u.status==="dirty"&&a.dirty(),r.push(u.value)}return{status:a.value,value:r}}static async mergeObjectAsync(a,i){const r=[];for(const u of i){const o=await u.key,c=await u.value;r.push({key:o,value:c})}return Pt.mergeObjectSync(a,r)}static mergeObjectSync(a,i){const r={};for(const u of i){const{key:o,value:c}=u;if(o.status==="aborted"||c.status==="aborted")return Ae;o.status==="dirty"&&a.dirty(),c.status==="dirty"&&a.dirty(),o.value!=="__proto__"&&(typeof c.value<"u"||u.alwaysSet)&&(r[o.value]=c.value)}return{status:a.value,value:r}}}const Ae=Object.freeze({status:"aborted"}),zr=n=>({status:"dirty",value:n}),Hn=n=>({status:"valid",value:n}),Ly=n=>n.status==="aborted",By=n=>n.status==="dirty",wi=n=>n.status==="valid",ku=n=>typeof Promise<"u"&&n instanceof Promise;var xe;(function(n){n.errToObj=a=>typeof a=="string"?{message:a}:a||{},n.toString=a=>typeof a=="string"?a:a==null?void 0:a.message})(xe||(xe={}));class aa{constructor(a,i,r,u){this._cachedPath=[],this.parent=a,this.data=i,this._path=r,this._key=u}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Uy=(n,a)=>{if(wi(a))return{success:!0,data:a.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new Aa(n.common.issues);return this._error=i,this._error}}};function Le(n){if(!n)return{};const{errorMap:a,invalid_type_error:i,required_error:r,description:u}=n;if(a&&(i||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:u}:{errorMap:(c,h)=>{const{message:m}=n;return c.code==="invalid_enum_value"?{message:m??h.defaultError}:typeof h.data>"u"?{message:m??r??h.defaultError}:c.code!=="invalid_type"?{message:h.defaultError}:{message:m??i??h.defaultError}},description:u}}class Ye{get description(){return this._def.description}_getType(a){return ll(a.data)}_getOrReturnCtx(a,i){return i||{common:a.parent.common,data:a.data,parsedType:ll(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}_processInputParams(a){return{status:new Pt,ctx:{common:a.parent.common,data:a.data,parsedType:ll(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}}_parseSync(a){const i=this._parse(a);if(ku(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(a){const i=this._parse(a);return Promise.resolve(i)}parse(a,i){const r=this.safeParse(a,i);if(r.success)return r.data;throw r.error}safeParse(a,i){const r={common:{issues:[],async:(i==null?void 0:i.async)??!1,contextualErrorMap:i==null?void 0:i.errorMap},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:ll(a)},u=this._parseSync({data:a,path:r.path,parent:r});return Uy(r,u)}"~validate"(a){var r,u;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:ll(a)};if(!this["~standard"].async)try{const o=this._parseSync({data:a,path:[],parent:i});return wi(o)?{value:o.value}:{issues:i.common.issues}}catch(o){(u=(r=o==null?void 0:o.message)==null?void 0:r.toLowerCase())!=null&&u.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:a,path:[],parent:i}).then(o=>wi(o)?{value:o.value}:{issues:i.common.issues})}async parseAsync(a,i){const r=await this.safeParseAsync(a,i);if(r.success)return r.data;throw r.error}async safeParseAsync(a,i){const r={common:{issues:[],contextualErrorMap:i==null?void 0:i.errorMap,async:!0},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:ll(a)},u=this._parse({data:a,path:r.path,parent:r}),o=await(ku(u)?u:Promise.resolve(u));return Uy(r,o)}refine(a,i){const r=u=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(u):i;return this._refinement((u,o)=>{const c=a(u),h=()=>o.addIssue({code:re.custom,...r(u)});return typeof Promise<"u"&&c instanceof Promise?c.then(m=>m?!0:(h(),!1)):c?!0:(h(),!1)})}refinement(a,i){return this._refinement((r,u)=>a(r)?!0:(u.addIssue(typeof i=="function"?i(r,u):i),!1))}_refinement(a){return new Rl({schema:this,typeName:we.ZodEffects,effect:{type:"refinement",refinement:a}})}superRefine(a){return this._refinement(a)}constructor(a){this.spa=this.safeParseAsync,this._def=a,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:i=>this["~validate"](i)}}optional(){return Ca.create(this,this._def)}nullable(){return zl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return na.create(this)}promise(){return ju.create(this,this._def)}or(a){return Eu.create([this,a],this._def)}and(a){return Nu.create(this,a,this._def)}transform(a){return new Rl({...Le(this._def),schema:this,typeName:we.ZodEffects,effect:{type:"transform",transform:a}})}default(a){const i=typeof a=="function"?a:()=>a;return new Mu({...Le(this._def),innerType:this,defaultValue:i,typeName:we.ZodDefault})}brand(){return new iv({typeName:we.ZodBranded,type:this,...Le(this._def)})}catch(a){const i=typeof a=="function"?a:()=>a;return new Ru({...Le(this._def),innerType:this,catchValue:i,typeName:we.ZodCatch})}describe(a){const i=this.constructor;return new i({...this._def,description:a})}pipe(a){return wd.create(this,a)}readonly(){return zu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cR=/^c[^\s-]{8,}$/i,fR=/^[0-9a-z]+$/,dR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hR=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mR=/^[a-z0-9_-]{21}$/i,pR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gR=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,yR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Uf;const _R=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,bR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,SR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ER=new RegExp(`^${nv}$`);function av(n){let a="[0-5]\\d";n.precision?a=`${a}\\.\\d{${n.precision}}`:n.precision==null&&(a=`${a}(\\.\\d+)?`);const i=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${a})${i}`}function NR(n){return new RegExp(`^${av(n)}$`)}function CR(n){let a=`${nv}T${av(n)}`;const i=[];return i.push(n.local?"Z?":"Z"),n.offset&&i.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${i.join("|")})`,new RegExp(`^${a}$`)}function AR(n,a){return!!((a==="v4"||!a)&&_R.test(n)||(a==="v6"||!a)&&bR.test(n))}function wR(n,a){if(!pR.test(n))return!1;try{const[i]=n.split(".");if(!i)return!1;const r=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),u=JSON.parse(atob(r));return!(typeof u!="object"||u===null||"typ"in u&&(u==null?void 0:u.typ)!=="JWT"||!u.alg||a&&u.alg!==a)}catch{return!1}}function jR(n,a){return!!((a==="v4"||!a)&&xR.test(n)||(a==="v6"||!a)&&SR.test(n))}class Na extends Ye{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==me.string){const o=this._getOrReturnCtx(a);return ce(o,{code:re.invalid_type,expected:me.string,received:o.parsedType}),Ae}const r=new Pt;let u;for(const o of this._def.checks)if(o.kind==="min")a.data.length<o.value&&(u=this._getOrReturnCtx(a,u),ce(u,{code:re.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")a.data.length>o.value&&(u=this._getOrReturnCtx(a,u),ce(u,{code:re.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const c=a.data.length>o.value,h=a.data.length<o.value;(c||h)&&(u=this._getOrReturnCtx(a,u),c?ce(u,{code:re.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):h&&ce(u,{code:re.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")yR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"email",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Uf||(Uf=new RegExp(vR,"u")),Uf.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"emoji",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")hR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"uuid",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")mR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"nanoid",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")cR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"cuid",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")fR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"cuid2",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")dR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"ulid",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(a.data)}catch{u=this._getOrReturnCtx(a,u),ce(u,{validation:"url",code:re.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"regex",code:re.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?a.data=a.data.trim():o.kind==="includes"?a.data.includes(o.value,o.position)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?a.data=a.data.toLowerCase():o.kind==="toUpperCase"?a.data=a.data.toUpperCase():o.kind==="startsWith"?a.data.startsWith(o.value)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?a.data.endsWith(o.value)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?CR(o).test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?ER.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?NR(o).test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?gR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"duration",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?AR(a.data,o.version)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"ip",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?wR(a.data,o.alg)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"jwt",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?jR(a.data,o.version)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"cidr",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?kR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"base64",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?TR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"base64url",code:re.invalid_string,message:o.message}),r.dirty()):Fe.assertNever(o);return{status:r.value,value:a.data}}_regex(a,i,r){return this.refinement(u=>a.test(u),{validation:i,code:re.invalid_string,...xe.errToObj(r)})}_addCheck(a){return new Na({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...xe.errToObj(a)})}url(a){return this._addCheck({kind:"url",...xe.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...xe.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...xe.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...xe.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...xe.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...xe.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...xe.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...xe.errToObj(a)})}base64url(a){return this._addCheck({kind:"base64url",...xe.errToObj(a)})}jwt(a){return this._addCheck({kind:"jwt",...xe.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...xe.errToObj(a)})}cidr(a){return this._addCheck({kind:"cidr",...xe.errToObj(a)})}datetime(a){return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,offset:(a==null?void 0:a.offset)??!1,local:(a==null?void 0:a.local)??!1,...xe.errToObj(a==null?void 0:a.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,...xe.errToObj(a==null?void 0:a.message)})}duration(a){return this._addCheck({kind:"duration",...xe.errToObj(a)})}regex(a,i){return this._addCheck({kind:"regex",regex:a,...xe.errToObj(i)})}includes(a,i){return this._addCheck({kind:"includes",value:a,position:i==null?void 0:i.position,...xe.errToObj(i==null?void 0:i.message)})}startsWith(a,i){return this._addCheck({kind:"startsWith",value:a,...xe.errToObj(i)})}endsWith(a,i){return this._addCheck({kind:"endsWith",value:a,...xe.errToObj(i)})}min(a,i){return this._addCheck({kind:"min",value:a,...xe.errToObj(i)})}max(a,i){return this._addCheck({kind:"max",value:a,...xe.errToObj(i)})}length(a,i){return this._addCheck({kind:"length",value:a,...xe.errToObj(i)})}nonempty(a){return this.min(1,xe.errToObj(a))}trim(){return new Na({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Na({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Na({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isCIDR(){return!!this._def.checks.find(a=>a.kind==="cidr")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get isBase64url(){return!!this._def.checks.find(a=>a.kind==="base64url")}get minLength(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxLength(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}}Na.create=n=>new Na({checks:[],typeName:we.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...Le(n)});function MR(n,a){const i=(n.toString().split(".")[1]||"").length,r=(a.toString().split(".")[1]||"").length,u=i>r?i:r,o=Number.parseInt(n.toFixed(u).replace(".","")),c=Number.parseInt(a.toFixed(u).replace(".",""));return o%c/10**u}class ji extends Ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==me.number){const o=this._getOrReturnCtx(a);return ce(o,{code:re.invalid_type,expected:me.number,received:o.parsedType}),Ae}let r;const u=new Pt;for(const o of this._def.checks)o.kind==="int"?Fe.isInteger(a.data)||(r=this._getOrReturnCtx(a,r),ce(r,{code:re.invalid_type,expected:"integer",received:"float",message:o.message}),u.dirty()):o.kind==="min"?(o.inclusive?a.data<o.value:a.data<=o.value)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),u.dirty()):o.kind==="max"?(o.inclusive?a.data>o.value:a.data>=o.value)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),u.dirty()):o.kind==="multipleOf"?MR(a.data,o.value)!==0&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.not_multiple_of,multipleOf:o.value,message:o.message}),u.dirty()):o.kind==="finite"?Number.isFinite(a.data)||(r=this._getOrReturnCtx(a,r),ce(r,{code:re.not_finite,message:o.message}),u.dirty()):Fe.assertNever(o);return{status:u.value,value:a.data}}gte(a,i){return this.setLimit("min",a,!0,xe.toString(i))}gt(a,i){return this.setLimit("min",a,!1,xe.toString(i))}lte(a,i){return this.setLimit("max",a,!0,xe.toString(i))}lt(a,i){return this.setLimit("max",a,!1,xe.toString(i))}setLimit(a,i,r,u){return new ji({...this._def,checks:[...this._def.checks,{kind:a,value:i,inclusive:r,message:xe.toString(u)}]})}_addCheck(a){return new ji({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:xe.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xe.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xe.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xe.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xe.toString(a)})}multipleOf(a,i){return this._addCheck({kind:"multipleOf",value:a,message:xe.toString(i)})}finite(a){return this._addCheck({kind:"finite",message:xe.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xe.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xe.toString(a)})}get minValue(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxValue(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}get isInt(){return!!this._def.checks.find(a=>a.kind==="int"||a.kind==="multipleOf"&&Fe.isInteger(a.value))}get isFinite(){let a=null,i=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(i===null||r.value>i)&&(i=r.value):r.kind==="max"&&(a===null||r.value<a)&&(a=r.value)}return Number.isFinite(i)&&Number.isFinite(a)}}ji.create=n=>new ji({checks:[],typeName:we.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...Le(n)});class Hr extends Ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce)try{a.data=BigInt(a.data)}catch{return this._getInvalidInput(a)}if(this._getType(a)!==me.bigint)return this._getInvalidInput(a);let r;const u=new Pt;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?a.data<o.value:a.data<=o.value)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),u.dirty()):o.kind==="max"?(o.inclusive?a.data>o.value:a.data>=o.value)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),u.dirty()):o.kind==="multipleOf"?a.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.not_multiple_of,multipleOf:o.value,message:o.message}),u.dirty()):Fe.assertNever(o);return{status:u.value,value:a.data}}_getInvalidInput(a){const i=this._getOrReturnCtx(a);return ce(i,{code:re.invalid_type,expected:me.bigint,received:i.parsedType}),Ae}gte(a,i){return this.setLimit("min",a,!0,xe.toString(i))}gt(a,i){return this.setLimit("min",a,!1,xe.toString(i))}lte(a,i){return this.setLimit("max",a,!0,xe.toString(i))}lt(a,i){return this.setLimit("max",a,!1,xe.toString(i))}setLimit(a,i,r,u){return new Hr({...this._def,checks:[...this._def.checks,{kind:a,value:i,inclusive:r,message:xe.toString(u)}]})}_addCheck(a){return new Hr({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xe.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xe.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xe.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xe.toString(a)})}multipleOf(a,i){return this._addCheck({kind:"multipleOf",value:a,message:xe.toString(i)})}get minValue(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxValue(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}}Hr.create=n=>new Hr({checks:[],typeName:we.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...Le(n)});class Wf extends Ye{_parse(a){if(this._def.coerce&&(a.data=!!a.data),this._getType(a)!==me.boolean){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.boolean,received:r.parsedType}),Ae}return Hn(a.data)}}Wf.create=n=>new Wf({typeName:we.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...Le(n)});class Tu extends Ye{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==me.date){const o=this._getOrReturnCtx(a);return ce(o,{code:re.invalid_type,expected:me.date,received:o.parsedType}),Ae}if(Number.isNaN(a.data.getTime())){const o=this._getOrReturnCtx(a);return ce(o,{code:re.invalid_date}),Ae}const r=new Pt;let u;for(const o of this._def.checks)o.kind==="min"?a.data.getTime()<o.value&&(u=this._getOrReturnCtx(a,u),ce(u,{code:re.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?a.data.getTime()>o.value&&(u=this._getOrReturnCtx(a,u),ce(u,{code:re.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Fe.assertNever(o);return{status:r.value,value:new Date(a.data.getTime())}}_addCheck(a){return new Tu({...this._def,checks:[...this._def.checks,a]})}min(a,i){return this._addCheck({kind:"min",value:a.getTime(),message:xe.toString(i)})}max(a,i){return this._addCheck({kind:"max",value:a.getTime(),message:xe.toString(i)})}get minDate(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a!=null?new Date(a):null}}Tu.create=n=>new Tu({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:we.ZodDate,...Le(n)});class Hy extends Ye{_parse(a){if(this._getType(a)!==me.symbol){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.symbol,received:r.parsedType}),Ae}return Hn(a.data)}}Hy.create=n=>new Hy({typeName:we.ZodSymbol,...Le(n)});class ed extends Ye{_parse(a){if(this._getType(a)!==me.undefined){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.undefined,received:r.parsedType}),Ae}return Hn(a.data)}}ed.create=n=>new ed({typeName:we.ZodUndefined,...Le(n)});class td extends Ye{_parse(a){if(this._getType(a)!==me.null){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.null,received:r.parsedType}),Ae}return Hn(a.data)}}td.create=n=>new td({typeName:we.ZodNull,...Le(n)});class nd extends Ye{constructor(){super(...arguments),this._any=!0}_parse(a){return Hn(a.data)}}nd.create=n=>new nd({typeName:we.ZodAny,...Le(n)});class ad extends Ye{constructor(){super(...arguments),this._unknown=!0}_parse(a){return Hn(a.data)}}ad.create=n=>new ad({typeName:we.ZodUnknown,...Le(n)});class rl extends Ye{_parse(a){const i=this._getOrReturnCtx(a);return ce(i,{code:re.invalid_type,expected:me.never,received:i.parsedType}),Ae}}rl.create=n=>new rl({typeName:we.ZodNever,...Le(n)});class Iy extends Ye{_parse(a){if(this._getType(a)!==me.undefined){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.void,received:r.parsedType}),Ae}return Hn(a.data)}}Iy.create=n=>new Iy({typeName:we.ZodVoid,...Le(n)});class na extends Ye{_parse(a){const{ctx:i,status:r}=this._processInputParams(a),u=this._def;if(i.parsedType!==me.array)return ce(i,{code:re.invalid_type,expected:me.array,received:i.parsedType}),Ae;if(u.exactLength!==null){const c=i.data.length>u.exactLength.value,h=i.data.length<u.exactLength.value;(c||h)&&(ce(i,{code:c?re.too_big:re.too_small,minimum:h?u.exactLength.value:void 0,maximum:c?u.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:u.exactLength.message}),r.dirty())}if(u.minLength!==null&&i.data.length<u.minLength.value&&(ce(i,{code:re.too_small,minimum:u.minLength.value,type:"array",inclusive:!0,exact:!1,message:u.minLength.message}),r.dirty()),u.maxLength!==null&&i.data.length>u.maxLength.value&&(ce(i,{code:re.too_big,maximum:u.maxLength.value,type:"array",inclusive:!0,exact:!1,message:u.maxLength.message}),r.dirty()),i.common.async)return Promise.all([...i.data].map((c,h)=>u.type._parseAsync(new aa(i,c,i.path,h)))).then(c=>Pt.mergeArray(r,c));const o=[...i.data].map((c,h)=>u.type._parseSync(new aa(i,c,i.path,h)));return Pt.mergeArray(r,o)}get element(){return this._def.type}min(a,i){return new na({...this._def,minLength:{value:a,message:xe.toString(i)}})}max(a,i){return new na({...this._def,maxLength:{value:a,message:xe.toString(i)}})}length(a,i){return new na({...this._def,exactLength:{value:a,message:xe.toString(i)}})}nonempty(a){return this.min(1,a)}}na.create=(n,a)=>new na({type:n,minLength:null,maxLength:null,exactLength:null,typeName:we.ZodArray,...Le(a)});function Ti(n){if(n instanceof jt){const a={};for(const i in n.shape){const r=n.shape[i];a[i]=Ca.create(Ti(r))}return new jt({...n._def,shape:()=>a})}else return n instanceof na?new na({...n._def,type:Ti(n.element)}):n instanceof Ca?Ca.create(Ti(n.unwrap())):n instanceof zl?zl.create(Ti(n.unwrap())):n instanceof jl?jl.create(n.items.map(a=>Ti(a))):n}class jt extends Ye{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),i=Fe.objectKeys(a);return this._cached={shape:a,keys:i},this._cached}_parse(a){if(this._getType(a)!==me.object){const p=this._getOrReturnCtx(a);return ce(p,{code:re.invalid_type,expected:me.object,received:p.parsedType}),Ae}const{status:r,ctx:u}=this._processInputParams(a),{shape:o,keys:c}=this._getCached(),h=[];if(!(this._def.catchall instanceof rl&&this._def.unknownKeys==="strip"))for(const p in u.data)c.includes(p)||h.push(p);const m=[];for(const p of c){const v=o[p],y=u.data[p];m.push({key:{status:"valid",value:p},value:v._parse(new aa(u,y,u.path,p)),alwaysSet:p in u.data})}if(this._def.catchall instanceof rl){const p=this._def.unknownKeys;if(p==="passthrough")for(const v of h)m.push({key:{status:"valid",value:v},value:{status:"valid",value:u.data[v]}});else if(p==="strict")h.length>0&&(ce(u,{code:re.unrecognized_keys,keys:h}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const v of h){const y=u.data[v];m.push({key:{status:"valid",value:v},value:p._parse(new aa(u,y,u.path,v)),alwaysSet:v in u.data})}}return u.common.async?Promise.resolve().then(async()=>{const p=[];for(const v of m){const y=await v.key,x=await v.value;p.push({key:y,value:x,alwaysSet:v.alwaysSet})}return p}).then(p=>Pt.mergeObjectSync(r,p)):Pt.mergeObjectSync(r,m)}get shape(){return this._def.shape()}strict(a){return xe.errToObj,new jt({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:(i,r)=>{var o,c;const u=((c=(o=this._def).errorMap)==null?void 0:c.call(o,i,r).message)??r.defaultError;return i.code==="unrecognized_keys"?{message:xe.errToObj(a).message??u}:{message:u}}}:{}})}strip(){return new jt({...this._def,unknownKeys:"strip"})}passthrough(){return new jt({...this._def,unknownKeys:"passthrough"})}extend(a){return new jt({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new jt({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:we.ZodObject})}setKey(a,i){return this.augment({[a]:i})}catchall(a){return new jt({...this._def,catchall:a})}pick(a){const i={};for(const r of Fe.objectKeys(a))a[r]&&this.shape[r]&&(i[r]=this.shape[r]);return new jt({...this._def,shape:()=>i})}omit(a){const i={};for(const r of Fe.objectKeys(this.shape))a[r]||(i[r]=this.shape[r]);return new jt({...this._def,shape:()=>i})}deepPartial(){return Ti(this)}partial(a){const i={};for(const r of Fe.objectKeys(this.shape)){const u=this.shape[r];a&&!a[r]?i[r]=u:i[r]=u.optional()}return new jt({...this._def,shape:()=>i})}required(a){const i={};for(const r of Fe.objectKeys(this.shape))if(a&&!a[r])i[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ca;)o=o._def.innerType;i[r]=o}return new jt({...this._def,shape:()=>i})}keyof(){return lv(Fe.objectKeys(this.shape))}}jt.create=(n,a)=>new jt({shape:()=>n,unknownKeys:"strip",catchall:rl.create(),typeName:we.ZodObject,...Le(a)});jt.strictCreate=(n,a)=>new jt({shape:()=>n,unknownKeys:"strict",catchall:rl.create(),typeName:we.ZodObject,...Le(a)});jt.lazycreate=(n,a)=>new jt({shape:n,unknownKeys:"strip",catchall:rl.create(),typeName:we.ZodObject,...Le(a)});class Eu extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a),r=this._def.options;function u(o){for(const h of o)if(h.result.status==="valid")return h.result;for(const h of o)if(h.result.status==="dirty")return i.common.issues.push(...h.ctx.common.issues),h.result;const c=o.map(h=>new Aa(h.ctx.common.issues));return ce(i,{code:re.invalid_union,unionErrors:c}),Ae}if(i.common.async)return Promise.all(r.map(async o=>{const c={...i,common:{...i.common,issues:[]},parent:null};return{result:await o._parseAsync({data:i.data,path:i.path,parent:c}),ctx:c}})).then(u);{let o;const c=[];for(const m of r){const p={...i,common:{...i.common,issues:[]},parent:null},v=m._parseSync({data:i.data,path:i.path,parent:p});if(v.status==="valid")return v;v.status==="dirty"&&!o&&(o={result:v,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(o)return i.common.issues.push(...o.ctx.common.issues),o.result;const h=c.map(m=>new Aa(m));return ce(i,{code:re.invalid_union,unionErrors:h}),Ae}}get options(){return this._def.options}}Eu.create=(n,a)=>new Eu({options:n,typeName:we.ZodUnion,...Le(a)});const Ea=n=>n instanceof id?Ea(n.schema):n instanceof Rl?Ea(n.innerType()):n instanceof Au?[n.value]:n instanceof Ml?n.options:n instanceof wu?Fe.objectValues(n.enum):n instanceof Mu?Ea(n._def.innerType):n instanceof ed?[void 0]:n instanceof td?[null]:n instanceof Ca?[void 0,...Ea(n.unwrap())]:n instanceof zl?[null,...Ea(n.unwrap())]:n instanceof iv||n instanceof zu?Ea(n.unwrap()):n instanceof Ru?Ea(n._def.innerType):[];class Ad extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a);if(i.parsedType!==me.object)return ce(i,{code:re.invalid_type,expected:me.object,received:i.parsedType}),Ae;const r=this.discriminator,u=i.data[r],o=this.optionsMap.get(u);return o?i.common.async?o._parseAsync({data:i.data,path:i.path,parent:i}):o._parseSync({data:i.data,path:i.path,parent:i}):(ce(i,{code:re.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,i,r){const u=new Map;for(const o of i){const c=Ea(o.shape[a]);if(!c.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const h of c){if(u.has(h))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(h)}`);u.set(h,o)}}return new Ad({typeName:we.ZodDiscriminatedUnion,discriminator:a,options:i,optionsMap:u,...Le(r)})}}function ld(n,a){const i=ll(n),r=ll(a);if(n===a)return{valid:!0,data:n};if(i===me.object&&r===me.object){const u=Fe.objectKeys(a),o=Fe.objectKeys(n).filter(h=>u.indexOf(h)!==-1),c={...n,...a};for(const h of o){const m=ld(n[h],a[h]);if(!m.valid)return{valid:!1};c[h]=m.data}return{valid:!0,data:c}}else if(i===me.array&&r===me.array){if(n.length!==a.length)return{valid:!1};const u=[];for(let o=0;o<n.length;o++){const c=n[o],h=a[o],m=ld(c,h);if(!m.valid)return{valid:!1};u.push(m.data)}return{valid:!0,data:u}}else return i===me.date&&r===me.date&&+n==+a?{valid:!0,data:n}:{valid:!1}}class Nu extends Ye{_parse(a){const{status:i,ctx:r}=this._processInputParams(a),u=(o,c)=>{if(Ly(o)||Ly(c))return Ae;const h=ld(o.value,c.value);return h.valid?((By(o)||By(c))&&i.dirty(),{status:i.value,value:h.data}):(ce(r,{code:re.invalid_intersection_types}),Ae)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,c])=>u(o,c)):u(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Nu.create=(n,a,i)=>new Nu({left:n,right:a,typeName:we.ZodIntersection,...Le(i)});class jl extends Ye{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==me.array)return ce(r,{code:re.invalid_type,expected:me.array,received:r.parsedType}),Ae;if(r.data.length<this._def.items.length)return ce(r,{code:re.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ae;!this._def.rest&&r.data.length>this._def.items.length&&(ce(r,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const o=[...r.data].map((c,h)=>{const m=this._def.items[h]||this._def.rest;return m?m._parse(new aa(r,c,r.path,h)):null}).filter(c=>!!c);return r.common.async?Promise.all(o).then(c=>Pt.mergeArray(i,c)):Pt.mergeArray(i,o)}get items(){return this._def.items}rest(a){return new jl({...this._def,rest:a})}}jl.create=(n,a)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jl({items:n,typeName:we.ZodTuple,rest:null,...Le(a)})};class Cu extends Ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==me.object)return ce(r,{code:re.invalid_type,expected:me.object,received:r.parsedType}),Ae;const u=[],o=this._def.keyType,c=this._def.valueType;for(const h in r.data)u.push({key:o._parse(new aa(r,h,r.path,h)),value:c._parse(new aa(r,r.data[h],r.path,h)),alwaysSet:h in r.data});return r.common.async?Pt.mergeObjectAsync(i,u):Pt.mergeObjectSync(i,u)}get element(){return this._def.valueType}static create(a,i,r){return i instanceof Ye?new Cu({keyType:a,valueType:i,typeName:we.ZodRecord,...Le(r)}):new Cu({keyType:Na.create(),valueType:a,typeName:we.ZodRecord,...Le(i)})}}class qy extends Ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==me.map)return ce(r,{code:re.invalid_type,expected:me.map,received:r.parsedType}),Ae;const u=this._def.keyType,o=this._def.valueType,c=[...r.data.entries()].map(([h,m],p)=>({key:u._parse(new aa(r,h,r.path,[p,"key"])),value:o._parse(new aa(r,m,r.path,[p,"value"]))}));if(r.common.async){const h=new Map;return Promise.resolve().then(async()=>{for(const m of c){const p=await m.key,v=await m.value;if(p.status==="aborted"||v.status==="aborted")return Ae;(p.status==="dirty"||v.status==="dirty")&&i.dirty(),h.set(p.value,v.value)}return{status:i.value,value:h}})}else{const h=new Map;for(const m of c){const p=m.key,v=m.value;if(p.status==="aborted"||v.status==="aborted")return Ae;(p.status==="dirty"||v.status==="dirty")&&i.dirty(),h.set(p.value,v.value)}return{status:i.value,value:h}}}}qy.create=(n,a,i)=>new qy({valueType:a,keyType:n,typeName:we.ZodMap,...Le(i)});class Ir extends Ye{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==me.set)return ce(r,{code:re.invalid_type,expected:me.set,received:r.parsedType}),Ae;const u=this._def;u.minSize!==null&&r.data.size<u.minSize.value&&(ce(r,{code:re.too_small,minimum:u.minSize.value,type:"set",inclusive:!0,exact:!1,message:u.minSize.message}),i.dirty()),u.maxSize!==null&&r.data.size>u.maxSize.value&&(ce(r,{code:re.too_big,maximum:u.maxSize.value,type:"set",inclusive:!0,exact:!1,message:u.maxSize.message}),i.dirty());const o=this._def.valueType;function c(m){const p=new Set;for(const v of m){if(v.status==="aborted")return Ae;v.status==="dirty"&&i.dirty(),p.add(v.value)}return{status:i.value,value:p}}const h=[...r.data.values()].map((m,p)=>o._parse(new aa(r,m,r.path,p)));return r.common.async?Promise.all(h).then(m=>c(m)):c(h)}min(a,i){return new Ir({...this._def,minSize:{value:a,message:xe.toString(i)}})}max(a,i){return new Ir({...this._def,maxSize:{value:a,message:xe.toString(i)}})}size(a,i){return this.min(a,i).max(a,i)}nonempty(a){return this.min(1,a)}}Ir.create=(n,a)=>new Ir({valueType:n,minSize:null,maxSize:null,typeName:we.ZodSet,...Le(a)});class id extends Ye{get schema(){return this._def.getter()}_parse(a){const{ctx:i}=this._processInputParams(a);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}id.create=(n,a)=>new id({getter:n,typeName:we.ZodLazy,...Le(a)});class Au extends Ye{_parse(a){if(a.data!==this._def.value){const i=this._getOrReturnCtx(a);return ce(i,{received:i.data,code:re.invalid_literal,expected:this._def.value}),Ae}return{status:"valid",value:a.data}}get value(){return this._def.value}}Au.create=(n,a)=>new Au({value:n,typeName:we.ZodLiteral,...Le(a)});function lv(n,a){return new Ml({values:n,typeName:we.ZodEnum,...Le(a)})}class Ml extends Ye{_parse(a){if(typeof a.data!="string"){const i=this._getOrReturnCtx(a),r=this._def.values;return ce(i,{expected:Fe.joinValues(r),received:i.parsedType,code:re.invalid_type}),Ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(a.data)){const i=this._getOrReturnCtx(a),r=this._def.values;return ce(i,{received:i.data,code:re.invalid_enum_value,options:r}),Ae}return Hn(a.data)}get options(){return this._def.values}get enum(){const a={};for(const i of this._def.values)a[i]=i;return a}get Values(){const a={};for(const i of this._def.values)a[i]=i;return a}get Enum(){const a={};for(const i of this._def.values)a[i]=i;return a}extract(a,i=this._def){return Ml.create(a,{...this._def,...i})}exclude(a,i=this._def){return Ml.create(this.options.filter(r=>!a.includes(r)),{...this._def,...i})}}Ml.create=lv;class wu extends Ye{_parse(a){const i=Fe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(a);if(r.parsedType!==me.string&&r.parsedType!==me.number){const u=Fe.objectValues(i);return ce(r,{expected:Fe.joinValues(u),received:r.parsedType,code:re.invalid_type}),Ae}if(this._cache||(this._cache=new Set(Fe.getValidEnumValues(this._def.values))),!this._cache.has(a.data)){const u=Fe.objectValues(i);return ce(r,{received:r.data,code:re.invalid_enum_value,options:u}),Ae}return Hn(a.data)}get enum(){return this._def.values}}wu.create=(n,a)=>new wu({values:n,typeName:we.ZodNativeEnum,...Le(a)});class ju extends Ye{unwrap(){return this._def.type}_parse(a){const{ctx:i}=this._processInputParams(a);if(i.parsedType!==me.promise&&i.common.async===!1)return ce(i,{code:re.invalid_type,expected:me.promise,received:i.parsedType}),Ae;const r=i.parsedType===me.promise?i.data:Promise.resolve(i.data);return Hn(r.then(u=>this._def.type.parseAsync(u,{path:i.path,errorMap:i.common.contextualErrorMap})))}}ju.create=(n,a)=>new ju({type:n,typeName:we.ZodPromise,...Le(a)});class Rl extends Ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===we.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(a){const{status:i,ctx:r}=this._processInputParams(a),u=this._def.effect||null,o={addIssue:c=>{ce(r,c),c.fatal?i.abort():i.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),u.type==="preprocess"){const c=u.transform(r.data,o);if(r.common.async)return Promise.resolve(c).then(async h=>{if(i.value==="aborted")return Ae;const m=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return m.status==="aborted"?Ae:m.status==="dirty"||i.value==="dirty"?zr(m.value):m});{if(i.value==="aborted")return Ae;const h=this._def.schema._parseSync({data:c,path:r.path,parent:r});return h.status==="aborted"?Ae:h.status==="dirty"||i.value==="dirty"?zr(h.value):h}}if(u.type==="refinement"){const c=h=>{const m=u.refinement(h,o);if(r.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(r.common.async===!1){const h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return h.status==="aborted"?Ae:(h.status==="dirty"&&i.dirty(),c(h.value),{status:i.value,value:h.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>h.status==="aborted"?Ae:(h.status==="dirty"&&i.dirty(),c(h.value).then(()=>({status:i.value,value:h.value}))))}if(u.type==="transform")if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!wi(c))return Ae;const h=u.transform(c.value,o);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:h}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>wi(c)?Promise.resolve(u.transform(c.value,o)).then(h=>({status:i.value,value:h})):Ae);Fe.assertNever(u)}}Rl.create=(n,a,i)=>new Rl({schema:n,typeName:we.ZodEffects,effect:a,...Le(i)});Rl.createWithPreprocess=(n,a,i)=>new Rl({schema:a,effect:{type:"preprocess",transform:n},typeName:we.ZodEffects,...Le(i)});class Ca extends Ye{_parse(a){return this._getType(a)===me.undefined?Hn(void 0):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}Ca.create=(n,a)=>new Ca({innerType:n,typeName:we.ZodOptional,...Le(a)});class zl extends Ye{_parse(a){return this._getType(a)===me.null?Hn(null):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}zl.create=(n,a)=>new zl({innerType:n,typeName:we.ZodNullable,...Le(a)});class Mu extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a);let r=i.data;return i.parsedType===me.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}Mu.create=(n,a)=>new Mu({innerType:n,typeName:we.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...Le(a)});class Ru extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a),r={...i,common:{...i.common,issues:[]}},u=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ku(u)?u.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Aa(r.common.issues)},input:r.data})})):{status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Aa(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ru.create=(n,a)=>new Ru({innerType:n,typeName:we.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...Le(a)});class Vy extends Ye{_parse(a){if(this._getType(a)!==me.nan){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.nan,received:r.parsedType}),Ae}return{status:"valid",value:a.data}}}Vy.create=n=>new Vy({typeName:we.ZodNaN,...Le(n)});class iv extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a),r=i.data;return this._def.type._parse({data:r,path:i.path,parent:i})}unwrap(){return this._def.type}}class wd extends Ye{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ae:o.status==="dirty"?(i.dirty(),zr(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const u=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?Ae:u.status==="dirty"?(i.dirty(),{status:"dirty",value:u.value}):this._def.out._parseSync({data:u.value,path:r.path,parent:r})}}static create(a,i){return new wd({in:a,out:i,typeName:we.ZodPipeline})}}class zu extends Ye{_parse(a){const i=this._def.innerType._parse(a),r=u=>(wi(u)&&(u.value=Object.freeze(u.value)),u);return ku(i)?i.then(u=>r(u)):r(i)}unwrap(){return this._def.innerType}}zu.create=(n,a)=>new zu({innerType:n,typeName:we.ZodReadonly,...Le(a)});var we;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(we||(we={}));const le=Na.create,rd=ji.create,Ke=Wf.create,kn=nd.create,zi=ad.create;rl.create;const Xn=na.create,We=jt.create,Zu=Eu.create,Yu=Ad.create;Nu.create;jl.create;const Zr=Cu.create,ye=Au.create;Ml.create;const RR=wu.create;ju.create;Ca.create;zl.create;const zR=We({name:le(),arguments:le()}),OR=We({id:le(),type:ye("function"),function:zR,encryptedValue:le().optional()}),$u=We({id:le(),role:le(),content:le().optional(),name:le().optional(),encryptedValue:le().optional()}),DR=We({type:ye("text"),text:le()}),LR=We({type:ye("data"),value:le(),mimeType:le()}),BR=We({type:ye("url"),value:le(),mimeType:le().optional()}),Xu=Yu("type",[LR,BR]),UR=We({type:ye("image"),source:Xu,metadata:zi().optional()}),HR=We({type:ye("audio"),source:Xu,metadata:zi().optional()}),IR=We({type:ye("video"),source:Xu,metadata:zi().optional()}),qR=We({type:ye("document"),source:Xu,metadata:zi().optional()}),rv=We({type:ye("binary"),mimeType:le(),id:le().optional(),url:le().optional(),data:le().optional(),filename:le().optional()}),sv=(n,a)=>{!n.id&&!n.url&&!n.data&&a.addIssue({code:re.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})};rv.superRefine((n,a)=>{sv(n,a)});const VR=Yu("type",[DR,UR,HR,IR,qR,rv]),GR=VR.superRefine((n,a)=>{n.type==="binary"&&sv(n,a)}),ZR=$u.extend({role:ye("developer"),content:le()}),YR=$u.extend({role:ye("system"),content:le()}),$R=$u.extend({role:ye("assistant"),content:le().optional(),toolCalls:Xn(OR).optional()}),XR=$u.extend({role:ye("user"),content:Zu([le(),Xn(GR)])}),QR=We({id:le(),content:le(),role:ye("tool"),toolCallId:le(),error:le().optional(),encryptedValue:le().optional()}),FR=We({id:le(),role:ye("activity"),activityType:le(),content:Zr(kn())}),KR=We({id:le(),role:ye("reasoning"),content:le(),encryptedValue:le().optional()}),uv=Yu("role",[ZR,YR,$R,XR,QR,FR,KR]);Zu([ye("developer"),ye("system"),ye("assistant"),ye("user"),ye("tool"),ye("activity"),ye("reasoning")]);const JR=We({description:le(),value:le()}),ov=We({name:le(),description:le(),parameters:kn(),metadata:Zr(kn()).optional()}),PR=We({threadId:le(),runId:le(),parentRunId:le().optional(),state:kn(),messages:Xn(uv),tools:Xn(ov),context:Xn(JR),forwardedProps:kn()}),WR=kn(),ez=We({name:le(),description:le().optional()}),tz=We({name:le().optional(),type:le().optional(),description:le().optional(),version:le().optional(),provider:le().optional(),documentationUrl:le().optional(),metadata:Zr(zi()).optional()}),nz=We({streaming:Ke().optional(),websocket:Ke().optional(),httpBinary:Ke().optional(),pushNotifications:Ke().optional(),resumable:Ke().optional()}),az=We({supported:Ke().optional(),items:Xn(ov).optional(),parallelCalls:Ke().optional(),clientProvided:Ke().optional()}),lz=We({structuredOutput:Ke().optional(),supportedMimeTypes:Xn(le()).optional()}),iz=We({snapshots:Ke().optional(),deltas:Ke().optional(),memory:Ke().optional(),persistentState:Ke().optional()}),rz=We({supported:Ke().optional(),delegation:Ke().optional(),handoffs:Ke().optional(),subAgents:Xn(ez).optional()}),sz=We({supported:Ke().optional(),streaming:Ke().optional(),encrypted:Ke().optional()}),uz=We({image:Ke().optional(),audio:Ke().optional(),video:Ke().optional(),pdf:Ke().optional(),file:Ke().optional()}),oz=We({image:Ke().optional(),audio:Ke().optional()}),cz=We({input:uz.optional(),output:oz.optional()}),fz=We({codeExecution:Ke().optional(),sandboxed:Ke().optional(),maxIterations:rd().optional(),maxExecutionTime:rd().optional()}),dz=We({supported:Ke().optional(),approvals:Ke().optional(),interventions:Ke().optional(),feedback:Ke().optional()});We({identity:tz.optional(),transport:nz.optional(),tools:az.optional(),output:lz.optional(),state:iz.optional(),multiAgent:rz.optional(),reasoning:sz.optional(),multimodal:cz.optional(),execution:fz.optional(),humanInTheLoop:dz.optional(),custom:Zr(zi()).optional()});const cv=Zu([ye("developer"),ye("system"),ye("assistant"),ye("user")]);let qe=(function(n){return n.TEXT_MESSAGE_START="TEXT_MESSAGE_START",n.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",n.TEXT_MESSAGE_END="TEXT_MESSAGE_END",n.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",n.TOOL_CALL_START="TOOL_CALL_START",n.TOOL_CALL_ARGS="TOOL_CALL_ARGS",n.TOOL_CALL_END="TOOL_CALL_END",n.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",n.TOOL_CALL_RESULT="TOOL_CALL_RESULT",n.THINKING_START="THINKING_START",n.THINKING_END="THINKING_END",n.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",n.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",n.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",n.STATE_SNAPSHOT="STATE_SNAPSHOT",n.STATE_DELTA="STATE_DELTA",n.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",n.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",n.ACTIVITY_DELTA="ACTIVITY_DELTA",n.RAW="RAW",n.CUSTOM="CUSTOM",n.RUN_STARTED="RUN_STARTED",n.RUN_FINISHED="RUN_FINISHED",n.RUN_ERROR="RUN_ERROR",n.STEP_STARTED="STEP_STARTED",n.STEP_FINISHED="STEP_FINISHED",n.REASONING_START="REASONING_START",n.REASONING_MESSAGE_START="REASONING_MESSAGE_START",n.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",n.REASONING_MESSAGE_END="REASONING_MESSAGE_END",n.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",n.REASONING_END="REASONING_END",n.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",n})({});const et=We({type:RR(qe),timestamp:rd().optional(),rawEvent:kn().optional()}).passthrough(),hz=et.extend({type:ye(qe.TEXT_MESSAGE_START),messageId:le(),role:cv.default("assistant"),name:le().optional()}),fv=et.extend({type:ye(qe.TEXT_MESSAGE_CONTENT),messageId:le(),delta:le()}),mz=et.extend({type:ye(qe.TEXT_MESSAGE_END),messageId:le()}),pz=et.extend({type:ye(qe.TEXT_MESSAGE_CHUNK),messageId:le().optional(),role:cv.optional(),delta:le().optional(),name:le().optional()}),gz=et.extend({type:ye(qe.THINKING_TEXT_MESSAGE_START)}),yz=fv.omit({messageId:!0,type:!0}).extend({type:ye(qe.THINKING_TEXT_MESSAGE_CONTENT)}),vz=et.extend({type:ye(qe.THINKING_TEXT_MESSAGE_END)}),_z=et.extend({type:ye(qe.TOOL_CALL_START),toolCallId:le(),toolCallName:le(),parentMessageId:le().optional()}),xz=et.extend({type:ye(qe.TOOL_CALL_ARGS),toolCallId:le(),delta:le()}),bz=et.extend({type:ye(qe.TOOL_CALL_END),toolCallId:le()}),Sz=et.extend({messageId:le(),type:ye(qe.TOOL_CALL_RESULT),toolCallId:le(),content:le(),role:ye("tool").optional()}),kz=et.extend({type:ye(qe.TOOL_CALL_CHUNK),toolCallId:le().optional(),toolCallName:le().optional(),parentMessageId:le().optional(),delta:le().optional()}),Tz=et.extend({type:ye(qe.THINKING_START),title:le().optional()}),Ez=et.extend({type:ye(qe.THINKING_END)}),Nz=et.extend({type:ye(qe.STATE_SNAPSHOT),snapshot:WR}),Cz=et.extend({type:ye(qe.STATE_DELTA),delta:Xn(kn())}),Az=et.extend({type:ye(qe.MESSAGES_SNAPSHOT),messages:Xn(uv)}),wz=et.extend({type:ye(qe.ACTIVITY_SNAPSHOT),messageId:le(),activityType:le(),content:Zr(kn()),replace:Ke().optional().default(!0)}),jz=et.extend({type:ye(qe.ACTIVITY_DELTA),messageId:le(),activityType:le(),patch:Xn(kn())}),Mz=et.extend({type:ye(qe.RAW),event:kn(),source:le().optional()}),Rz=et.extend({type:ye(qe.CUSTOM),name:le(),value:kn()}),zz=et.extend({type:ye(qe.RUN_STARTED),threadId:le(),runId:le(),parentRunId:le().optional(),input:PR.optional()}),Oz=et.extend({type:ye(qe.RUN_FINISHED),threadId:le(),runId:le(),result:kn().optional()}),Dz=et.extend({type:ye(qe.RUN_ERROR),message:le(),code:le().optional()}),Lz=et.extend({type:ye(qe.STEP_STARTED),stepName:le()}),Bz=et.extend({type:ye(qe.STEP_FINISHED),stepName:le()}),Uz=Zu([ye("tool-call"),ye("message")]),Hz=et.extend({type:ye(qe.REASONING_START),messageId:le()}),Iz=et.extend({type:ye(qe.REASONING_MESSAGE_START),messageId:le(),role:ye("reasoning")}),qz=et.extend({type:ye(qe.REASONING_MESSAGE_CONTENT),messageId:le(),delta:le()}),Vz=et.extend({type:ye(qe.REASONING_MESSAGE_END),messageId:le()}),Gz=et.extend({type:ye(qe.REASONING_MESSAGE_CHUNK),messageId:le().optional(),delta:le().optional()}),Zz=et.extend({type:ye(qe.REASONING_END),messageId:le()}),Yz=et.extend({type:ye(qe.REASONING_ENCRYPTED_VALUE),subtype:Uz,entityId:le(),encryptedValue:le()}),$z=Yu("type",[hz,fv,mz,pz,Tz,Ez,gz,yz,vz,_z,xz,bz,kz,Sz,Nz,Cz,Az,wz,jz,Mz,Rz,zz,Oz,Dz,Lz,Bz,Hz,Iz,qz,Vz,Gz,Zz,Yz]);function Xz(n){let a;try{a=JSON.parse(n)}catch{return"not-agui"}if(typeof a!="object"||a===null||!("type"in a))return"not-agui";const i=$z.safeParse(a);if(!i.success)return"not-agui";switch(i.data.type){case qe.TEXT_MESSAGE_CONTENT:case qe.TEXT_MESSAGE_CHUNK:return{type:"data",content:i.data.delta??""};case qe.RUN_ERROR:return{type:"data",content:`Error: ${i.data.message??"Unknown error"}`};default:return null}}function Qz(n){try{const a=JSON.parse(n);if(typeof a=="string")return{type:"data",content:a};if(a&&typeof a=="object"&&"error"in a)return{type:"data",content:`Error: ${a.error}`}}catch{}return{type:"data",content:n}}function Fz(n,a){if(!n.startsWith("data: "))return null;const i=n.slice(6);if(a==="metadata")return{type:"metadata",content:i};const r=Xz(i);return r!=="not-agui"?r:Qz(i)}function Kz(n,a,i){const[r,u]=B.useState([]),[o,c]=B.useState(!1),[h,m]=B.useState(null),p=B.useRef(null),v=async E=>{if(!(!E||o)){c(!0),u(j=>[...j,{role:"user",content:E},{role:"assistant",content:""}]);try{const j=await Sn(`${n}/invocations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:E,...a?{agentName:a}:{},...p.current?{sessionId:p.current}:{},...i?{userId:i}:{}})});if(!j.ok){const P=await j.text();u($=>{const fe=[...$];return fe[fe.length-1]={role:"assistant",content:P||`Error: ${j.status}`,isError:!0},fe});return}const O=j.headers.get("x-session-id");if(O&&(p.current=O,m(O)),!j.body){u(P=>{const $=[...P];return $[$.length-1]={role:"assistant",content:"(empty response)"},$});return}const S=j.body.getReader(),R=new TextDecoder;let M="",J="",te=!1,q="",ae=null;const de=()=>{ae=null,u(P=>{const $=[...P];return $[$.length-1]={role:"assistant",content:J},$})},ve=()=>{ae===null&&(ae=requestAnimationFrame(de))},L=P=>{if(P.startsWith("event: ")||P.startsWith("event:")){q=P.slice(P.indexOf(":")+1).trim();return}if(P===""){q="";return}const $=Fz(P,q);$!==null&&($.type==="metadata"||(te=!0,J+=$.content))};for(;;){const{done:P,value:$}=await S.read();if(P)break;M+=R.decode($,{stream:!0});const fe=M.split(`
273
+ Error: ${Z.message}`,ee();break}default:break}}}P!==null&&cancelAnimationFrame(P);const D=Object.keys(x.current).length>0?{...x.current}:void 0;x.current={},u(F=>{const ue=[...F];return ue[ue.length-1]={role:"assistant",content:L||(D?"":"(empty response)"),...D?{toolExecutions:D}:{},...$?{tokenUsage:{inputTokens:$.inputTokens,outputTokens:$.outputTokens,totalTokens:$.totalTokens}}:{}},ue})}catch(te){const q=te instanceof Error&&te.message.includes("Failed to fetch")?"Connection failed — is the dev server running?":te instanceof Error?te.message:"Unknown error";u(ae=>{const de=[...ae];return de[de.length-1]={role:"assistant",content:q,isError:!0},de})}finally{c(!1)}},[n]),j=B.useCallback(async S=>{var R;!S||o||!a||(x.current={},u(M=>[...M,{role:"user",content:S},{role:"assistant",content:""}]),await E({harnessName:a,prompt:S,...y.current?{sessionId:y.current}:{},...i?{userId:i}:{},harnessOverrides:{...p,skills:(R=p.skills)==null?void 0:R.map(M=>({path:M}))}}))},[a,o,i,p,E]),O=B.useCallback(()=>{var S;(S=b.current)==null||S.abort(),b.current=null,u([]),m(null),y.current=null,x.current={},c(!1)},[]);return{messages:r,isStreaming:o,sessionId:h,harnessOverrides:p,setHarnessOverrides:v,sendMessage:j,resetChat:O}}function tR(n){const a=ev(n.resourceSpans,n.resourceLogs),i=kA(a),r=dM(a);return{traceId:n.traceId,timestamp:n.timestamp,sessionId:n.sessionId,spanCount:n.spanCount,spans:a,tree:i,userPrompt:r}}function nR(n){const a=Bn,[i,r]=B.useState([]),[u,o]=B.useState(null),[c,h]=B.useState(!1),[m,p]=B.useState(null),[v,y]=B.useState(null),x=B.useRef(n);x.current=n;const b=B.useCallback(async()=>{h(!0),p(null);try{const J=new URLSearchParams;x.current&&J.set("agentName",x.current);const te=Date.now();J.set("startTime",String(te-720*60*1e3)),J.set("endTime",String(te));const q=await Sn(`${a}/api/traces?${J.toString()}`);if(q.status===404){y(!1),r([]);return}y(!0);const ae=await q.json();ae.success?r(ae.traces.map(tR)):(p(ae.error),r([]))}catch(J){p(J instanceof Error?J.message:"Failed to load traces"),r([])}finally{h(!1)}},[a]),E=i.find(J=>J.traceId===u)??null,j=B.useCallback(J=>{o(te=>te===J?te:J)},[]),O=B.useCallback(()=>{o(null)},[]),S=B.useCallback(()=>{b()},[b]),R=B.useCallback(()=>{setTimeout(()=>b(),1500),setTimeout(()=>b(),5e3)},[b]),M=B.useRef(n);return B.useEffect(()=>{M.current!==n&&(M.current=n,r([]),o(null),p(null)),b()},[n,b]),{invocations:i,selectedInvocation:E,isLoading:c,error:m,isAvailable:v,selectTrace:j,deselectTrace:O,refresh:S,onInvocationComplete:R}}let Bf=1;function Oy(n){if(typeof n=="string"){const a=n.match(/^data:\s*(.+)$/m);if(a)try{return JSON.parse(a[1])}catch{throw new Error(`Failed to parse SSE data: ${a[1].slice(0,200)}`)}try{return JSON.parse(n)}catch{throw new Error(`Unexpected MCP result format: ${n.slice(0,200)}`)}}if(n&&typeof n=="object")return n;throw new Error("Empty MCP result")}async function gu(n,a,i,r){const u=await Sn(`${n}/api/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:a,body:i,sessionId:r})});if(!u.ok){const o=await u.text();throw new Error(`MCP proxy error (${u.status}): ${o}`)}return u.json()}function aR(n,a,i,r){const[u,o]=B.useState([]),[c,h]=B.useState(!1),[m,p]=B.useState(null),v=B.useRef(void 0),y=B.useRef(null);B.useEffect(()=>{o([]),p(null),v.current=void 0,y.current=null},[a]);const x=B.useCallback(j=>{if(y.current)return y.current;const O=(async()=>{const S=await gu(n,j,{jsonrpc:"2.0",id:Bf++,method:"initialize",params:{protocolVersion:"2025-03-26",capabilities:{},clientInfo:{name:"agentcore-inspector",version:"1.0.0"}}});if(!S.success)throw new Error(S.error??"Failed to initialize MCP session");v.current=S.sessionId,await gu(n,j,{jsonrpc:"2.0",method:"notifications/initialized"},v.current)})().catch(S=>{throw y.current=null,S});return y.current=O,O},[n]),b=B.useCallback(async()=>{if(!(!a||i!=="MCP")){h(!0),p(null);try{await x(a);const j=await gu(n,a,{jsonrpc:"2.0",id:Bf++,method:"tools/list",params:{}},v.current);if(!j.success)throw new Error(j.error??"Failed to list tools");const S=Oy(j.result).result;o((S==null?void 0:S.tools)??[])}catch(j){p(j.message)}finally{h(!1)}}},[n,a,i,x]),E=B.useCallback(async(j,O)=>{if(!a)throw new Error("No agent selected");await x(a);const S=await gu(n,a,{jsonrpc:"2.0",id:Bf++,method:"tools/call",params:{name:j,arguments:O}},v.current);if(!S.success)throw new Error(S.error??"Tool call failed");const R=Oy(S.result),M=R.result,J=R.error;if(J)throw new Error(J.message);return M??{content:[{type:"text",text:JSON.stringify(R)}]}},[n,a,x]);return B.useEffect(()=>{a&&i==="MCP"&&r&&b()},[a,i,r,b]),{tools:u,isLoading:c,error:m,fetchTools:b,callTool:E}}const lR=15e3;function iR(n){const[a,i]=B.useState(null),[r,u]=B.useState(!1),[o,c]=B.useState(null),h=B.useRef(void 0),m=B.useCallback(async()=>{u(p=>p||a===null),c(null);try{const v=await(await Sn(`${n}/api/resources`)).json();v.success?i(v):c(v.error||"Failed to load resources")}catch(p){c(p instanceof Error?p.message:"Failed to load resources")}finally{u(!1)}},[n]);return B.useEffect(()=>(m(),h.current=setInterval(m,lR),()=>clearInterval(h.current)),[m]),{data:a,isLoading:r,error:o,fetch:m}}function rR(n){const[a,i]=B.useState(!1),[r,u]=B.useState(!1),[o,c]=B.useState(null),h=B.useCallback(async m=>{i(!0),u(!1),c(null);try{const v=await(await Sn(`${n}/api/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:m})})).json();return v.success?(u(!0),!0):(c(v.error||"Failed to start agent"),!1)}catch(p){return c(p instanceof Error?p.message:"Failed to start agent"),!1}finally{i(!1)}},[n]);return{isStarting:a,isReady:r,error:o,startAgent:h}}var Fe;(function(n){n.assertEqual=u=>{};function a(u){}n.assertIs=a;function i(u){throw new Error}n.assertNever=i,n.arrayToEnum=u=>{const o={};for(const c of u)o[c]=c;return o},n.getValidEnumValues=u=>{const o=n.objectKeys(u).filter(h=>typeof u[u[h]]!="number"),c={};for(const h of o)c[h]=u[h];return n.objectValues(c)},n.objectValues=u=>n.objectKeys(u).map(function(o){return u[o]}),n.objectKeys=typeof Object.keys=="function"?u=>Object.keys(u):u=>{const o=[];for(const c in u)Object.prototype.hasOwnProperty.call(u,c)&&o.push(c);return o},n.find=(u,o)=>{for(const c of u)if(o(c))return c},n.isInteger=typeof Number.isInteger=="function"?u=>Number.isInteger(u):u=>typeof u=="number"&&Number.isFinite(u)&&Math.floor(u)===u;function r(u,o=" | "){return u.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(u,o)=>typeof o=="bigint"?o.toString():o})(Fe||(Fe={}));var Dy;(function(n){n.mergeShapes=(a,i)=>({...a,...i})})(Dy||(Dy={}));const me=Fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ll=n=>{switch(typeof n){case"undefined":return me.undefined;case"string":return me.string;case"number":return Number.isNaN(n)?me.nan:me.number;case"boolean":return me.boolean;case"function":return me.function;case"bigint":return me.bigint;case"symbol":return me.symbol;case"object":return Array.isArray(n)?me.array:n===null?me.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?me.promise:typeof Map<"u"&&n instanceof Map?me.map:typeof Set<"u"&&n instanceof Set?me.set:typeof Date<"u"&&n instanceof Date?me.date:me.object;default:return me.unknown}},re=Fe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Aa extends Error{get errors(){return this.issues}constructor(a){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=a}format(a){const i=a||function(o){return o.message},r={_errors:[]},u=o=>{for(const c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(u);else if(c.code==="invalid_return_type")u(c.returnTypeError);else if(c.code==="invalid_arguments")u(c.argumentsError);else if(c.path.length===0)r._errors.push(i(c));else{let h=r,m=0;for(;m<c.path.length;){const p=c.path[m];m===c.path.length-1?(h[p]=h[p]||{_errors:[]},h[p]._errors.push(i(c))):h[p]=h[p]||{_errors:[]},h=h[p],m++}}};return u(this),r}static assert(a){if(!(a instanceof Aa))throw new Error(`Not a ZodError: ${a}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(a=i=>i.message){const i={},r=[];for(const u of this.issues)if(u.path.length>0){const o=u.path[0];i[o]=i[o]||[],i[o].push(a(u))}else r.push(a(u));return{formErrors:r,fieldErrors:i}}get formErrors(){return this.flatten()}}Aa.create=n=>new Aa(n);const Pf=(n,a)=>{let i;switch(n.code){case re.invalid_type:n.received===me.undefined?i="Required":i=`Expected ${n.expected}, received ${n.received}`;break;case re.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(n.expected,Fe.jsonStringifyReplacer)}`;break;case re.unrecognized_keys:i=`Unrecognized key(s) in object: ${Fe.joinValues(n.keys,", ")}`;break;case re.invalid_union:i="Invalid input";break;case re.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${Fe.joinValues(n.options)}`;break;case re.invalid_enum_value:i=`Invalid enum value. Expected ${Fe.joinValues(n.options)}, received '${n.received}'`;break;case re.invalid_arguments:i="Invalid function arguments";break;case re.invalid_return_type:i="Invalid function return type";break;case re.invalid_date:i="Invalid date";break;case re.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(i=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?i=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?i=`Invalid input: must end with "${n.validation.endsWith}"`:Fe.assertNever(n.validation):n.validation!=="regex"?i=`Invalid ${n.validation}`:i="Invalid";break;case re.too_small:n.type==="array"?i=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?i=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?i=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?i=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?i=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:i="Invalid input";break;case re.too_big:n.type==="array"?i=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?i=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?i=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?i=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?i=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:i="Invalid input";break;case re.custom:i="Invalid input";break;case re.invalid_intersection_types:i="Intersection results could not be merged";break;case re.not_multiple_of:i=`Number must be a multiple of ${n.multipleOf}`;break;case re.not_finite:i="Number must be finite";break;default:i=a.defaultError,Fe.assertNever(n)}return{message:i}};let sR=Pf;function uR(){return sR}const oR=n=>{const{data:a,path:i,errorMaps:r,issueData:u}=n,o=[...i,...u.path||[]],c={...u,path:o};if(u.message!==void 0)return{...u,path:o,message:u.message};let h="";const m=r.filter(p=>!!p).slice().reverse();for(const p of m)h=p(c,{data:a,defaultError:h}).message;return{...u,path:o,message:h}};function ce(n,a){const i=uR(),r=oR({issueData:a,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,i,i===Pf?void 0:Pf].filter(u=>!!u)});n.common.issues.push(r)}class Pt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,i){const r=[];for(const u of i){if(u.status==="aborted")return Ae;u.status==="dirty"&&a.dirty(),r.push(u.value)}return{status:a.value,value:r}}static async mergeObjectAsync(a,i){const r=[];for(const u of i){const o=await u.key,c=await u.value;r.push({key:o,value:c})}return Pt.mergeObjectSync(a,r)}static mergeObjectSync(a,i){const r={};for(const u of i){const{key:o,value:c}=u;if(o.status==="aborted"||c.status==="aborted")return Ae;o.status==="dirty"&&a.dirty(),c.status==="dirty"&&a.dirty(),o.value!=="__proto__"&&(typeof c.value<"u"||u.alwaysSet)&&(r[o.value]=c.value)}return{status:a.value,value:r}}}const Ae=Object.freeze({status:"aborted"}),zr=n=>({status:"dirty",value:n}),Hn=n=>({status:"valid",value:n}),Ly=n=>n.status==="aborted",By=n=>n.status==="dirty",wi=n=>n.status==="valid",ku=n=>typeof Promise<"u"&&n instanceof Promise;var xe;(function(n){n.errToObj=a=>typeof a=="string"?{message:a}:a||{},n.toString=a=>typeof a=="string"?a:a==null?void 0:a.message})(xe||(xe={}));class aa{constructor(a,i,r,u){this._cachedPath=[],this.parent=a,this.data=i,this._path=r,this._key=u}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Uy=(n,a)=>{if(wi(a))return{success:!0,data:a.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new Aa(n.common.issues);return this._error=i,this._error}}};function Le(n){if(!n)return{};const{errorMap:a,invalid_type_error:i,required_error:r,description:u}=n;if(a&&(i||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:u}:{errorMap:(c,h)=>{const{message:m}=n;return c.code==="invalid_enum_value"?{message:m??h.defaultError}:typeof h.data>"u"?{message:m??r??h.defaultError}:c.code!=="invalid_type"?{message:h.defaultError}:{message:m??i??h.defaultError}},description:u}}class Ye{get description(){return this._def.description}_getType(a){return ll(a.data)}_getOrReturnCtx(a,i){return i||{common:a.parent.common,data:a.data,parsedType:ll(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}_processInputParams(a){return{status:new Pt,ctx:{common:a.parent.common,data:a.data,parsedType:ll(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}}_parseSync(a){const i=this._parse(a);if(ku(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(a){const i=this._parse(a);return Promise.resolve(i)}parse(a,i){const r=this.safeParse(a,i);if(r.success)return r.data;throw r.error}safeParse(a,i){const r={common:{issues:[],async:(i==null?void 0:i.async)??!1,contextualErrorMap:i==null?void 0:i.errorMap},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:ll(a)},u=this._parseSync({data:a,path:r.path,parent:r});return Uy(r,u)}"~validate"(a){var r,u;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:ll(a)};if(!this["~standard"].async)try{const o=this._parseSync({data:a,path:[],parent:i});return wi(o)?{value:o.value}:{issues:i.common.issues}}catch(o){(u=(r=o==null?void 0:o.message)==null?void 0:r.toLowerCase())!=null&&u.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:a,path:[],parent:i}).then(o=>wi(o)?{value:o.value}:{issues:i.common.issues})}async parseAsync(a,i){const r=await this.safeParseAsync(a,i);if(r.success)return r.data;throw r.error}async safeParseAsync(a,i){const r={common:{issues:[],contextualErrorMap:i==null?void 0:i.errorMap,async:!0},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:ll(a)},u=this._parse({data:a,path:r.path,parent:r}),o=await(ku(u)?u:Promise.resolve(u));return Uy(r,o)}refine(a,i){const r=u=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(u):i;return this._refinement((u,o)=>{const c=a(u),h=()=>o.addIssue({code:re.custom,...r(u)});return typeof Promise<"u"&&c instanceof Promise?c.then(m=>m?!0:(h(),!1)):c?!0:(h(),!1)})}refinement(a,i){return this._refinement((r,u)=>a(r)?!0:(u.addIssue(typeof i=="function"?i(r,u):i),!1))}_refinement(a){return new Rl({schema:this,typeName:we.ZodEffects,effect:{type:"refinement",refinement:a}})}superRefine(a){return this._refinement(a)}constructor(a){this.spa=this.safeParseAsync,this._def=a,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:i=>this["~validate"](i)}}optional(){return Ca.create(this,this._def)}nullable(){return zl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return na.create(this)}promise(){return ju.create(this,this._def)}or(a){return Eu.create([this,a],this._def)}and(a){return Nu.create(this,a,this._def)}transform(a){return new Rl({...Le(this._def),schema:this,typeName:we.ZodEffects,effect:{type:"transform",transform:a}})}default(a){const i=typeof a=="function"?a:()=>a;return new Mu({...Le(this._def),innerType:this,defaultValue:i,typeName:we.ZodDefault})}brand(){return new iv({typeName:we.ZodBranded,type:this,...Le(this._def)})}catch(a){const i=typeof a=="function"?a:()=>a;return new Ru({...Le(this._def),innerType:this,catchValue:i,typeName:we.ZodCatch})}describe(a){const i=this.constructor;return new i({...this._def,description:a})}pipe(a){return wd.create(this,a)}readonly(){return zu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cR=/^c[^\s-]{8,}$/i,fR=/^[0-9a-z]+$/,dR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hR=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mR=/^[a-z0-9_-]{21}$/i,pR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gR=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,yR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Uf;const _R=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,bR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,SR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ER=new RegExp(`^${nv}$`);function av(n){let a="[0-5]\\d";n.precision?a=`${a}\\.\\d{${n.precision}}`:n.precision==null&&(a=`${a}(\\.\\d+)?`);const i=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${a})${i}`}function NR(n){return new RegExp(`^${av(n)}$`)}function CR(n){let a=`${nv}T${av(n)}`;const i=[];return i.push(n.local?"Z?":"Z"),n.offset&&i.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${i.join("|")})`,new RegExp(`^${a}$`)}function AR(n,a){return!!((a==="v4"||!a)&&_R.test(n)||(a==="v6"||!a)&&bR.test(n))}function wR(n,a){if(!pR.test(n))return!1;try{const[i]=n.split(".");if(!i)return!1;const r=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),u=JSON.parse(atob(r));return!(typeof u!="object"||u===null||"typ"in u&&(u==null?void 0:u.typ)!=="JWT"||!u.alg||a&&u.alg!==a)}catch{return!1}}function jR(n,a){return!!((a==="v4"||!a)&&xR.test(n)||(a==="v6"||!a)&&SR.test(n))}class Na extends Ye{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==me.string){const o=this._getOrReturnCtx(a);return ce(o,{code:re.invalid_type,expected:me.string,received:o.parsedType}),Ae}const r=new Pt;let u;for(const o of this._def.checks)if(o.kind==="min")a.data.length<o.value&&(u=this._getOrReturnCtx(a,u),ce(u,{code:re.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")a.data.length>o.value&&(u=this._getOrReturnCtx(a,u),ce(u,{code:re.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const c=a.data.length>o.value,h=a.data.length<o.value;(c||h)&&(u=this._getOrReturnCtx(a,u),c?ce(u,{code:re.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):h&&ce(u,{code:re.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")yR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"email",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Uf||(Uf=new RegExp(vR,"u")),Uf.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"emoji",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")hR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"uuid",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")mR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"nanoid",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")cR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"cuid",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")fR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"cuid2",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")dR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"ulid",code:re.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(a.data)}catch{u=this._getOrReturnCtx(a,u),ce(u,{validation:"url",code:re.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"regex",code:re.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?a.data=a.data.trim():o.kind==="includes"?a.data.includes(o.value,o.position)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?a.data=a.data.toLowerCase():o.kind==="toUpperCase"?a.data=a.data.toUpperCase():o.kind==="startsWith"?a.data.startsWith(o.value)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?a.data.endsWith(o.value)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?CR(o).test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?ER.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?NR(o).test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{code:re.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?gR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"duration",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?AR(a.data,o.version)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"ip",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?wR(a.data,o.alg)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"jwt",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?jR(a.data,o.version)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"cidr",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?kR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"base64",code:re.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?TR.test(a.data)||(u=this._getOrReturnCtx(a,u),ce(u,{validation:"base64url",code:re.invalid_string,message:o.message}),r.dirty()):Fe.assertNever(o);return{status:r.value,value:a.data}}_regex(a,i,r){return this.refinement(u=>a.test(u),{validation:i,code:re.invalid_string,...xe.errToObj(r)})}_addCheck(a){return new Na({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...xe.errToObj(a)})}url(a){return this._addCheck({kind:"url",...xe.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...xe.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...xe.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...xe.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...xe.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...xe.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...xe.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...xe.errToObj(a)})}base64url(a){return this._addCheck({kind:"base64url",...xe.errToObj(a)})}jwt(a){return this._addCheck({kind:"jwt",...xe.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...xe.errToObj(a)})}cidr(a){return this._addCheck({kind:"cidr",...xe.errToObj(a)})}datetime(a){return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,offset:(a==null?void 0:a.offset)??!1,local:(a==null?void 0:a.local)??!1,...xe.errToObj(a==null?void 0:a.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,...xe.errToObj(a==null?void 0:a.message)})}duration(a){return this._addCheck({kind:"duration",...xe.errToObj(a)})}regex(a,i){return this._addCheck({kind:"regex",regex:a,...xe.errToObj(i)})}includes(a,i){return this._addCheck({kind:"includes",value:a,position:i==null?void 0:i.position,...xe.errToObj(i==null?void 0:i.message)})}startsWith(a,i){return this._addCheck({kind:"startsWith",value:a,...xe.errToObj(i)})}endsWith(a,i){return this._addCheck({kind:"endsWith",value:a,...xe.errToObj(i)})}min(a,i){return this._addCheck({kind:"min",value:a,...xe.errToObj(i)})}max(a,i){return this._addCheck({kind:"max",value:a,...xe.errToObj(i)})}length(a,i){return this._addCheck({kind:"length",value:a,...xe.errToObj(i)})}nonempty(a){return this.min(1,xe.errToObj(a))}trim(){return new Na({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Na({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Na({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isCIDR(){return!!this._def.checks.find(a=>a.kind==="cidr")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get isBase64url(){return!!this._def.checks.find(a=>a.kind==="base64url")}get minLength(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxLength(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}}Na.create=n=>new Na({checks:[],typeName:we.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...Le(n)});function MR(n,a){const i=(n.toString().split(".")[1]||"").length,r=(a.toString().split(".")[1]||"").length,u=i>r?i:r,o=Number.parseInt(n.toFixed(u).replace(".","")),c=Number.parseInt(a.toFixed(u).replace(".",""));return o%c/10**u}class ji extends Ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==me.number){const o=this._getOrReturnCtx(a);return ce(o,{code:re.invalid_type,expected:me.number,received:o.parsedType}),Ae}let r;const u=new Pt;for(const o of this._def.checks)o.kind==="int"?Fe.isInteger(a.data)||(r=this._getOrReturnCtx(a,r),ce(r,{code:re.invalid_type,expected:"integer",received:"float",message:o.message}),u.dirty()):o.kind==="min"?(o.inclusive?a.data<o.value:a.data<=o.value)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),u.dirty()):o.kind==="max"?(o.inclusive?a.data>o.value:a.data>=o.value)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),u.dirty()):o.kind==="multipleOf"?MR(a.data,o.value)!==0&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.not_multiple_of,multipleOf:o.value,message:o.message}),u.dirty()):o.kind==="finite"?Number.isFinite(a.data)||(r=this._getOrReturnCtx(a,r),ce(r,{code:re.not_finite,message:o.message}),u.dirty()):Fe.assertNever(o);return{status:u.value,value:a.data}}gte(a,i){return this.setLimit("min",a,!0,xe.toString(i))}gt(a,i){return this.setLimit("min",a,!1,xe.toString(i))}lte(a,i){return this.setLimit("max",a,!0,xe.toString(i))}lt(a,i){return this.setLimit("max",a,!1,xe.toString(i))}setLimit(a,i,r,u){return new ji({...this._def,checks:[...this._def.checks,{kind:a,value:i,inclusive:r,message:xe.toString(u)}]})}_addCheck(a){return new ji({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:xe.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xe.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xe.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xe.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xe.toString(a)})}multipleOf(a,i){return this._addCheck({kind:"multipleOf",value:a,message:xe.toString(i)})}finite(a){return this._addCheck({kind:"finite",message:xe.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xe.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xe.toString(a)})}get minValue(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxValue(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}get isInt(){return!!this._def.checks.find(a=>a.kind==="int"||a.kind==="multipleOf"&&Fe.isInteger(a.value))}get isFinite(){let a=null,i=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(i===null||r.value>i)&&(i=r.value):r.kind==="max"&&(a===null||r.value<a)&&(a=r.value)}return Number.isFinite(i)&&Number.isFinite(a)}}ji.create=n=>new ji({checks:[],typeName:we.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...Le(n)});class Hr extends Ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce)try{a.data=BigInt(a.data)}catch{return this._getInvalidInput(a)}if(this._getType(a)!==me.bigint)return this._getInvalidInput(a);let r;const u=new Pt;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?a.data<o.value:a.data<=o.value)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),u.dirty()):o.kind==="max"?(o.inclusive?a.data>o.value:a.data>=o.value)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),u.dirty()):o.kind==="multipleOf"?a.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(a,r),ce(r,{code:re.not_multiple_of,multipleOf:o.value,message:o.message}),u.dirty()):Fe.assertNever(o);return{status:u.value,value:a.data}}_getInvalidInput(a){const i=this._getOrReturnCtx(a);return ce(i,{code:re.invalid_type,expected:me.bigint,received:i.parsedType}),Ae}gte(a,i){return this.setLimit("min",a,!0,xe.toString(i))}gt(a,i){return this.setLimit("min",a,!1,xe.toString(i))}lte(a,i){return this.setLimit("max",a,!0,xe.toString(i))}lt(a,i){return this.setLimit("max",a,!1,xe.toString(i))}setLimit(a,i,r,u){return new Hr({...this._def,checks:[...this._def.checks,{kind:a,value:i,inclusive:r,message:xe.toString(u)}]})}_addCheck(a){return new Hr({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xe.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xe.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xe.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xe.toString(a)})}multipleOf(a,i){return this._addCheck({kind:"multipleOf",value:a,message:xe.toString(i)})}get minValue(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxValue(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}}Hr.create=n=>new Hr({checks:[],typeName:we.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...Le(n)});class Wf extends Ye{_parse(a){if(this._def.coerce&&(a.data=!!a.data),this._getType(a)!==me.boolean){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.boolean,received:r.parsedType}),Ae}return Hn(a.data)}}Wf.create=n=>new Wf({typeName:we.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...Le(n)});class Tu extends Ye{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==me.date){const o=this._getOrReturnCtx(a);return ce(o,{code:re.invalid_type,expected:me.date,received:o.parsedType}),Ae}if(Number.isNaN(a.data.getTime())){const o=this._getOrReturnCtx(a);return ce(o,{code:re.invalid_date}),Ae}const r=new Pt;let u;for(const o of this._def.checks)o.kind==="min"?a.data.getTime()<o.value&&(u=this._getOrReturnCtx(a,u),ce(u,{code:re.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?a.data.getTime()>o.value&&(u=this._getOrReturnCtx(a,u),ce(u,{code:re.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Fe.assertNever(o);return{status:r.value,value:new Date(a.data.getTime())}}_addCheck(a){return new Tu({...this._def,checks:[...this._def.checks,a]})}min(a,i){return this._addCheck({kind:"min",value:a.getTime(),message:xe.toString(i)})}max(a,i){return this._addCheck({kind:"max",value:a.getTime(),message:xe.toString(i)})}get minDate(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a!=null?new Date(a):null}}Tu.create=n=>new Tu({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:we.ZodDate,...Le(n)});class Hy extends Ye{_parse(a){if(this._getType(a)!==me.symbol){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.symbol,received:r.parsedType}),Ae}return Hn(a.data)}}Hy.create=n=>new Hy({typeName:we.ZodSymbol,...Le(n)});class ed extends Ye{_parse(a){if(this._getType(a)!==me.undefined){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.undefined,received:r.parsedType}),Ae}return Hn(a.data)}}ed.create=n=>new ed({typeName:we.ZodUndefined,...Le(n)});class td extends Ye{_parse(a){if(this._getType(a)!==me.null){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.null,received:r.parsedType}),Ae}return Hn(a.data)}}td.create=n=>new td({typeName:we.ZodNull,...Le(n)});class nd extends Ye{constructor(){super(...arguments),this._any=!0}_parse(a){return Hn(a.data)}}nd.create=n=>new nd({typeName:we.ZodAny,...Le(n)});class ad extends Ye{constructor(){super(...arguments),this._unknown=!0}_parse(a){return Hn(a.data)}}ad.create=n=>new ad({typeName:we.ZodUnknown,...Le(n)});class rl extends Ye{_parse(a){const i=this._getOrReturnCtx(a);return ce(i,{code:re.invalid_type,expected:me.never,received:i.parsedType}),Ae}}rl.create=n=>new rl({typeName:we.ZodNever,...Le(n)});class Iy extends Ye{_parse(a){if(this._getType(a)!==me.undefined){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.void,received:r.parsedType}),Ae}return Hn(a.data)}}Iy.create=n=>new Iy({typeName:we.ZodVoid,...Le(n)});class na extends Ye{_parse(a){const{ctx:i,status:r}=this._processInputParams(a),u=this._def;if(i.parsedType!==me.array)return ce(i,{code:re.invalid_type,expected:me.array,received:i.parsedType}),Ae;if(u.exactLength!==null){const c=i.data.length>u.exactLength.value,h=i.data.length<u.exactLength.value;(c||h)&&(ce(i,{code:c?re.too_big:re.too_small,minimum:h?u.exactLength.value:void 0,maximum:c?u.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:u.exactLength.message}),r.dirty())}if(u.minLength!==null&&i.data.length<u.minLength.value&&(ce(i,{code:re.too_small,minimum:u.minLength.value,type:"array",inclusive:!0,exact:!1,message:u.minLength.message}),r.dirty()),u.maxLength!==null&&i.data.length>u.maxLength.value&&(ce(i,{code:re.too_big,maximum:u.maxLength.value,type:"array",inclusive:!0,exact:!1,message:u.maxLength.message}),r.dirty()),i.common.async)return Promise.all([...i.data].map((c,h)=>u.type._parseAsync(new aa(i,c,i.path,h)))).then(c=>Pt.mergeArray(r,c));const o=[...i.data].map((c,h)=>u.type._parseSync(new aa(i,c,i.path,h)));return Pt.mergeArray(r,o)}get element(){return this._def.type}min(a,i){return new na({...this._def,minLength:{value:a,message:xe.toString(i)}})}max(a,i){return new na({...this._def,maxLength:{value:a,message:xe.toString(i)}})}length(a,i){return new na({...this._def,exactLength:{value:a,message:xe.toString(i)}})}nonempty(a){return this.min(1,a)}}na.create=(n,a)=>new na({type:n,minLength:null,maxLength:null,exactLength:null,typeName:we.ZodArray,...Le(a)});function Ti(n){if(n instanceof jt){const a={};for(const i in n.shape){const r=n.shape[i];a[i]=Ca.create(Ti(r))}return new jt({...n._def,shape:()=>a})}else return n instanceof na?new na({...n._def,type:Ti(n.element)}):n instanceof Ca?Ca.create(Ti(n.unwrap())):n instanceof zl?zl.create(Ti(n.unwrap())):n instanceof jl?jl.create(n.items.map(a=>Ti(a))):n}class jt extends Ye{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),i=Fe.objectKeys(a);return this._cached={shape:a,keys:i},this._cached}_parse(a){if(this._getType(a)!==me.object){const p=this._getOrReturnCtx(a);return ce(p,{code:re.invalid_type,expected:me.object,received:p.parsedType}),Ae}const{status:r,ctx:u}=this._processInputParams(a),{shape:o,keys:c}=this._getCached(),h=[];if(!(this._def.catchall instanceof rl&&this._def.unknownKeys==="strip"))for(const p in u.data)c.includes(p)||h.push(p);const m=[];for(const p of c){const v=o[p],y=u.data[p];m.push({key:{status:"valid",value:p},value:v._parse(new aa(u,y,u.path,p)),alwaysSet:p in u.data})}if(this._def.catchall instanceof rl){const p=this._def.unknownKeys;if(p==="passthrough")for(const v of h)m.push({key:{status:"valid",value:v},value:{status:"valid",value:u.data[v]}});else if(p==="strict")h.length>0&&(ce(u,{code:re.unrecognized_keys,keys:h}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const v of h){const y=u.data[v];m.push({key:{status:"valid",value:v},value:p._parse(new aa(u,y,u.path,v)),alwaysSet:v in u.data})}}return u.common.async?Promise.resolve().then(async()=>{const p=[];for(const v of m){const y=await v.key,x=await v.value;p.push({key:y,value:x,alwaysSet:v.alwaysSet})}return p}).then(p=>Pt.mergeObjectSync(r,p)):Pt.mergeObjectSync(r,m)}get shape(){return this._def.shape()}strict(a){return xe.errToObj,new jt({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:(i,r)=>{var o,c;const u=((c=(o=this._def).errorMap)==null?void 0:c.call(o,i,r).message)??r.defaultError;return i.code==="unrecognized_keys"?{message:xe.errToObj(a).message??u}:{message:u}}}:{}})}strip(){return new jt({...this._def,unknownKeys:"strip"})}passthrough(){return new jt({...this._def,unknownKeys:"passthrough"})}extend(a){return new jt({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new jt({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:we.ZodObject})}setKey(a,i){return this.augment({[a]:i})}catchall(a){return new jt({...this._def,catchall:a})}pick(a){const i={};for(const r of Fe.objectKeys(a))a[r]&&this.shape[r]&&(i[r]=this.shape[r]);return new jt({...this._def,shape:()=>i})}omit(a){const i={};for(const r of Fe.objectKeys(this.shape))a[r]||(i[r]=this.shape[r]);return new jt({...this._def,shape:()=>i})}deepPartial(){return Ti(this)}partial(a){const i={};for(const r of Fe.objectKeys(this.shape)){const u=this.shape[r];a&&!a[r]?i[r]=u:i[r]=u.optional()}return new jt({...this._def,shape:()=>i})}required(a){const i={};for(const r of Fe.objectKeys(this.shape))if(a&&!a[r])i[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ca;)o=o._def.innerType;i[r]=o}return new jt({...this._def,shape:()=>i})}keyof(){return lv(Fe.objectKeys(this.shape))}}jt.create=(n,a)=>new jt({shape:()=>n,unknownKeys:"strip",catchall:rl.create(),typeName:we.ZodObject,...Le(a)});jt.strictCreate=(n,a)=>new jt({shape:()=>n,unknownKeys:"strict",catchall:rl.create(),typeName:we.ZodObject,...Le(a)});jt.lazycreate=(n,a)=>new jt({shape:n,unknownKeys:"strip",catchall:rl.create(),typeName:we.ZodObject,...Le(a)});class Eu extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a),r=this._def.options;function u(o){for(const h of o)if(h.result.status==="valid")return h.result;for(const h of o)if(h.result.status==="dirty")return i.common.issues.push(...h.ctx.common.issues),h.result;const c=o.map(h=>new Aa(h.ctx.common.issues));return ce(i,{code:re.invalid_union,unionErrors:c}),Ae}if(i.common.async)return Promise.all(r.map(async o=>{const c={...i,common:{...i.common,issues:[]},parent:null};return{result:await o._parseAsync({data:i.data,path:i.path,parent:c}),ctx:c}})).then(u);{let o;const c=[];for(const m of r){const p={...i,common:{...i.common,issues:[]},parent:null},v=m._parseSync({data:i.data,path:i.path,parent:p});if(v.status==="valid")return v;v.status==="dirty"&&!o&&(o={result:v,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(o)return i.common.issues.push(...o.ctx.common.issues),o.result;const h=c.map(m=>new Aa(m));return ce(i,{code:re.invalid_union,unionErrors:h}),Ae}}get options(){return this._def.options}}Eu.create=(n,a)=>new Eu({options:n,typeName:we.ZodUnion,...Le(a)});const Ea=n=>n instanceof id?Ea(n.schema):n instanceof Rl?Ea(n.innerType()):n instanceof Au?[n.value]:n instanceof Ml?n.options:n instanceof wu?Fe.objectValues(n.enum):n instanceof Mu?Ea(n._def.innerType):n instanceof ed?[void 0]:n instanceof td?[null]:n instanceof Ca?[void 0,...Ea(n.unwrap())]:n instanceof zl?[null,...Ea(n.unwrap())]:n instanceof iv||n instanceof zu?Ea(n.unwrap()):n instanceof Ru?Ea(n._def.innerType):[];class Ad extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a);if(i.parsedType!==me.object)return ce(i,{code:re.invalid_type,expected:me.object,received:i.parsedType}),Ae;const r=this.discriminator,u=i.data[r],o=this.optionsMap.get(u);return o?i.common.async?o._parseAsync({data:i.data,path:i.path,parent:i}):o._parseSync({data:i.data,path:i.path,parent:i}):(ce(i,{code:re.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,i,r){const u=new Map;for(const o of i){const c=Ea(o.shape[a]);if(!c.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const h of c){if(u.has(h))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(h)}`);u.set(h,o)}}return new Ad({typeName:we.ZodDiscriminatedUnion,discriminator:a,options:i,optionsMap:u,...Le(r)})}}function ld(n,a){const i=ll(n),r=ll(a);if(n===a)return{valid:!0,data:n};if(i===me.object&&r===me.object){const u=Fe.objectKeys(a),o=Fe.objectKeys(n).filter(h=>u.indexOf(h)!==-1),c={...n,...a};for(const h of o){const m=ld(n[h],a[h]);if(!m.valid)return{valid:!1};c[h]=m.data}return{valid:!0,data:c}}else if(i===me.array&&r===me.array){if(n.length!==a.length)return{valid:!1};const u=[];for(let o=0;o<n.length;o++){const c=n[o],h=a[o],m=ld(c,h);if(!m.valid)return{valid:!1};u.push(m.data)}return{valid:!0,data:u}}else return i===me.date&&r===me.date&&+n==+a?{valid:!0,data:n}:{valid:!1}}class Nu extends Ye{_parse(a){const{status:i,ctx:r}=this._processInputParams(a),u=(o,c)=>{if(Ly(o)||Ly(c))return Ae;const h=ld(o.value,c.value);return h.valid?((By(o)||By(c))&&i.dirty(),{status:i.value,value:h.data}):(ce(r,{code:re.invalid_intersection_types}),Ae)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,c])=>u(o,c)):u(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Nu.create=(n,a,i)=>new Nu({left:n,right:a,typeName:we.ZodIntersection,...Le(i)});class jl extends Ye{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==me.array)return ce(r,{code:re.invalid_type,expected:me.array,received:r.parsedType}),Ae;if(r.data.length<this._def.items.length)return ce(r,{code:re.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ae;!this._def.rest&&r.data.length>this._def.items.length&&(ce(r,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const o=[...r.data].map((c,h)=>{const m=this._def.items[h]||this._def.rest;return m?m._parse(new aa(r,c,r.path,h)):null}).filter(c=>!!c);return r.common.async?Promise.all(o).then(c=>Pt.mergeArray(i,c)):Pt.mergeArray(i,o)}get items(){return this._def.items}rest(a){return new jl({...this._def,rest:a})}}jl.create=(n,a)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jl({items:n,typeName:we.ZodTuple,rest:null,...Le(a)})};class Cu extends Ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==me.object)return ce(r,{code:re.invalid_type,expected:me.object,received:r.parsedType}),Ae;const u=[],o=this._def.keyType,c=this._def.valueType;for(const h in r.data)u.push({key:o._parse(new aa(r,h,r.path,h)),value:c._parse(new aa(r,r.data[h],r.path,h)),alwaysSet:h in r.data});return r.common.async?Pt.mergeObjectAsync(i,u):Pt.mergeObjectSync(i,u)}get element(){return this._def.valueType}static create(a,i,r){return i instanceof Ye?new Cu({keyType:a,valueType:i,typeName:we.ZodRecord,...Le(r)}):new Cu({keyType:Na.create(),valueType:a,typeName:we.ZodRecord,...Le(i)})}}class qy extends Ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==me.map)return ce(r,{code:re.invalid_type,expected:me.map,received:r.parsedType}),Ae;const u=this._def.keyType,o=this._def.valueType,c=[...r.data.entries()].map(([h,m],p)=>({key:u._parse(new aa(r,h,r.path,[p,"key"])),value:o._parse(new aa(r,m,r.path,[p,"value"]))}));if(r.common.async){const h=new Map;return Promise.resolve().then(async()=>{for(const m of c){const p=await m.key,v=await m.value;if(p.status==="aborted"||v.status==="aborted")return Ae;(p.status==="dirty"||v.status==="dirty")&&i.dirty(),h.set(p.value,v.value)}return{status:i.value,value:h}})}else{const h=new Map;for(const m of c){const p=m.key,v=m.value;if(p.status==="aborted"||v.status==="aborted")return Ae;(p.status==="dirty"||v.status==="dirty")&&i.dirty(),h.set(p.value,v.value)}return{status:i.value,value:h}}}}qy.create=(n,a,i)=>new qy({valueType:a,keyType:n,typeName:we.ZodMap,...Le(i)});class Ir extends Ye{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==me.set)return ce(r,{code:re.invalid_type,expected:me.set,received:r.parsedType}),Ae;const u=this._def;u.minSize!==null&&r.data.size<u.minSize.value&&(ce(r,{code:re.too_small,minimum:u.minSize.value,type:"set",inclusive:!0,exact:!1,message:u.minSize.message}),i.dirty()),u.maxSize!==null&&r.data.size>u.maxSize.value&&(ce(r,{code:re.too_big,maximum:u.maxSize.value,type:"set",inclusive:!0,exact:!1,message:u.maxSize.message}),i.dirty());const o=this._def.valueType;function c(m){const p=new Set;for(const v of m){if(v.status==="aborted")return Ae;v.status==="dirty"&&i.dirty(),p.add(v.value)}return{status:i.value,value:p}}const h=[...r.data.values()].map((m,p)=>o._parse(new aa(r,m,r.path,p)));return r.common.async?Promise.all(h).then(m=>c(m)):c(h)}min(a,i){return new Ir({...this._def,minSize:{value:a,message:xe.toString(i)}})}max(a,i){return new Ir({...this._def,maxSize:{value:a,message:xe.toString(i)}})}size(a,i){return this.min(a,i).max(a,i)}nonempty(a){return this.min(1,a)}}Ir.create=(n,a)=>new Ir({valueType:n,minSize:null,maxSize:null,typeName:we.ZodSet,...Le(a)});class id extends Ye{get schema(){return this._def.getter()}_parse(a){const{ctx:i}=this._processInputParams(a);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}id.create=(n,a)=>new id({getter:n,typeName:we.ZodLazy,...Le(a)});class Au extends Ye{_parse(a){if(a.data!==this._def.value){const i=this._getOrReturnCtx(a);return ce(i,{received:i.data,code:re.invalid_literal,expected:this._def.value}),Ae}return{status:"valid",value:a.data}}get value(){return this._def.value}}Au.create=(n,a)=>new Au({value:n,typeName:we.ZodLiteral,...Le(a)});function lv(n,a){return new Ml({values:n,typeName:we.ZodEnum,...Le(a)})}class Ml extends Ye{_parse(a){if(typeof a.data!="string"){const i=this._getOrReturnCtx(a),r=this._def.values;return ce(i,{expected:Fe.joinValues(r),received:i.parsedType,code:re.invalid_type}),Ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(a.data)){const i=this._getOrReturnCtx(a),r=this._def.values;return ce(i,{received:i.data,code:re.invalid_enum_value,options:r}),Ae}return Hn(a.data)}get options(){return this._def.values}get enum(){const a={};for(const i of this._def.values)a[i]=i;return a}get Values(){const a={};for(const i of this._def.values)a[i]=i;return a}get Enum(){const a={};for(const i of this._def.values)a[i]=i;return a}extract(a,i=this._def){return Ml.create(a,{...this._def,...i})}exclude(a,i=this._def){return Ml.create(this.options.filter(r=>!a.includes(r)),{...this._def,...i})}}Ml.create=lv;class wu extends Ye{_parse(a){const i=Fe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(a);if(r.parsedType!==me.string&&r.parsedType!==me.number){const u=Fe.objectValues(i);return ce(r,{expected:Fe.joinValues(u),received:r.parsedType,code:re.invalid_type}),Ae}if(this._cache||(this._cache=new Set(Fe.getValidEnumValues(this._def.values))),!this._cache.has(a.data)){const u=Fe.objectValues(i);return ce(r,{received:r.data,code:re.invalid_enum_value,options:u}),Ae}return Hn(a.data)}get enum(){return this._def.values}}wu.create=(n,a)=>new wu({values:n,typeName:we.ZodNativeEnum,...Le(a)});class ju extends Ye{unwrap(){return this._def.type}_parse(a){const{ctx:i}=this._processInputParams(a);if(i.parsedType!==me.promise&&i.common.async===!1)return ce(i,{code:re.invalid_type,expected:me.promise,received:i.parsedType}),Ae;const r=i.parsedType===me.promise?i.data:Promise.resolve(i.data);return Hn(r.then(u=>this._def.type.parseAsync(u,{path:i.path,errorMap:i.common.contextualErrorMap})))}}ju.create=(n,a)=>new ju({type:n,typeName:we.ZodPromise,...Le(a)});class Rl extends Ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===we.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(a){const{status:i,ctx:r}=this._processInputParams(a),u=this._def.effect||null,o={addIssue:c=>{ce(r,c),c.fatal?i.abort():i.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),u.type==="preprocess"){const c=u.transform(r.data,o);if(r.common.async)return Promise.resolve(c).then(async h=>{if(i.value==="aborted")return Ae;const m=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return m.status==="aborted"?Ae:m.status==="dirty"||i.value==="dirty"?zr(m.value):m});{if(i.value==="aborted")return Ae;const h=this._def.schema._parseSync({data:c,path:r.path,parent:r});return h.status==="aborted"?Ae:h.status==="dirty"||i.value==="dirty"?zr(h.value):h}}if(u.type==="refinement"){const c=h=>{const m=u.refinement(h,o);if(r.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(r.common.async===!1){const h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return h.status==="aborted"?Ae:(h.status==="dirty"&&i.dirty(),c(h.value),{status:i.value,value:h.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>h.status==="aborted"?Ae:(h.status==="dirty"&&i.dirty(),c(h.value).then(()=>({status:i.value,value:h.value}))))}if(u.type==="transform")if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!wi(c))return Ae;const h=u.transform(c.value,o);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:h}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>wi(c)?Promise.resolve(u.transform(c.value,o)).then(h=>({status:i.value,value:h})):Ae);Fe.assertNever(u)}}Rl.create=(n,a,i)=>new Rl({schema:n,typeName:we.ZodEffects,effect:a,...Le(i)});Rl.createWithPreprocess=(n,a,i)=>new Rl({schema:a,effect:{type:"preprocess",transform:n},typeName:we.ZodEffects,...Le(i)});class Ca extends Ye{_parse(a){return this._getType(a)===me.undefined?Hn(void 0):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}Ca.create=(n,a)=>new Ca({innerType:n,typeName:we.ZodOptional,...Le(a)});class zl extends Ye{_parse(a){return this._getType(a)===me.null?Hn(null):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}zl.create=(n,a)=>new zl({innerType:n,typeName:we.ZodNullable,...Le(a)});class Mu extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a);let r=i.data;return i.parsedType===me.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}Mu.create=(n,a)=>new Mu({innerType:n,typeName:we.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...Le(a)});class Ru extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a),r={...i,common:{...i.common,issues:[]}},u=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ku(u)?u.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Aa(r.common.issues)},input:r.data})})):{status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Aa(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ru.create=(n,a)=>new Ru({innerType:n,typeName:we.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...Le(a)});class Vy extends Ye{_parse(a){if(this._getType(a)!==me.nan){const r=this._getOrReturnCtx(a);return ce(r,{code:re.invalid_type,expected:me.nan,received:r.parsedType}),Ae}return{status:"valid",value:a.data}}}Vy.create=n=>new Vy({typeName:we.ZodNaN,...Le(n)});class iv extends Ye{_parse(a){const{ctx:i}=this._processInputParams(a),r=i.data;return this._def.type._parse({data:r,path:i.path,parent:i})}unwrap(){return this._def.type}}class wd extends Ye{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ae:o.status==="dirty"?(i.dirty(),zr(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const u=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?Ae:u.status==="dirty"?(i.dirty(),{status:"dirty",value:u.value}):this._def.out._parseSync({data:u.value,path:r.path,parent:r})}}static create(a,i){return new wd({in:a,out:i,typeName:we.ZodPipeline})}}class zu extends Ye{_parse(a){const i=this._def.innerType._parse(a),r=u=>(wi(u)&&(u.value=Object.freeze(u.value)),u);return ku(i)?i.then(u=>r(u)):r(i)}unwrap(){return this._def.innerType}}zu.create=(n,a)=>new zu({innerType:n,typeName:we.ZodReadonly,...Le(a)});var we;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(we||(we={}));const le=Na.create,rd=ji.create,Ke=Wf.create,kn=nd.create,zi=ad.create;rl.create;const Xn=na.create,We=jt.create,Zu=Eu.create,Yu=Ad.create;Nu.create;jl.create;const Zr=Cu.create,ye=Au.create;Ml.create;const RR=wu.create;ju.create;Ca.create;zl.create;const zR=We({name:le(),arguments:le()}),OR=We({id:le(),type:ye("function"),function:zR,encryptedValue:le().optional()}),$u=We({id:le(),role:le(),content:le().optional(),name:le().optional(),encryptedValue:le().optional()}),DR=We({type:ye("text"),text:le()}),LR=We({type:ye("data"),value:le(),mimeType:le()}),BR=We({type:ye("url"),value:le(),mimeType:le().optional()}),Xu=Yu("type",[LR,BR]),UR=We({type:ye("image"),source:Xu,metadata:zi().optional()}),HR=We({type:ye("audio"),source:Xu,metadata:zi().optional()}),IR=We({type:ye("video"),source:Xu,metadata:zi().optional()}),qR=We({type:ye("document"),source:Xu,metadata:zi().optional()}),rv=We({type:ye("binary"),mimeType:le(),id:le().optional(),url:le().optional(),data:le().optional(),filename:le().optional()}),sv=(n,a)=>{!n.id&&!n.url&&!n.data&&a.addIssue({code:re.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})};rv.superRefine((n,a)=>{sv(n,a)});const VR=Yu("type",[DR,UR,HR,IR,qR,rv]),GR=VR.superRefine((n,a)=>{n.type==="binary"&&sv(n,a)}),ZR=$u.extend({role:ye("developer"),content:le()}),YR=$u.extend({role:ye("system"),content:le()}),$R=$u.extend({role:ye("assistant"),content:le().optional(),toolCalls:Xn(OR).optional()}),XR=$u.extend({role:ye("user"),content:Zu([le(),Xn(GR)])}),QR=We({id:le(),content:le(),role:ye("tool"),toolCallId:le(),error:le().optional(),encryptedValue:le().optional()}),FR=We({id:le(),role:ye("activity"),activityType:le(),content:Zr(kn())}),KR=We({id:le(),role:ye("reasoning"),content:le(),encryptedValue:le().optional()}),uv=Yu("role",[ZR,YR,$R,XR,QR,FR,KR]);Zu([ye("developer"),ye("system"),ye("assistant"),ye("user"),ye("tool"),ye("activity"),ye("reasoning")]);const JR=We({description:le(),value:le()}),ov=We({name:le(),description:le(),parameters:kn(),metadata:Zr(kn()).optional()}),PR=We({threadId:le(),runId:le(),parentRunId:le().optional(),state:kn(),messages:Xn(uv),tools:Xn(ov),context:Xn(JR),forwardedProps:kn()}),WR=kn(),ez=We({name:le(),description:le().optional()}),tz=We({name:le().optional(),type:le().optional(),description:le().optional(),version:le().optional(),provider:le().optional(),documentationUrl:le().optional(),metadata:Zr(zi()).optional()}),nz=We({streaming:Ke().optional(),websocket:Ke().optional(),httpBinary:Ke().optional(),pushNotifications:Ke().optional(),resumable:Ke().optional()}),az=We({supported:Ke().optional(),items:Xn(ov).optional(),parallelCalls:Ke().optional(),clientProvided:Ke().optional()}),lz=We({structuredOutput:Ke().optional(),supportedMimeTypes:Xn(le()).optional()}),iz=We({snapshots:Ke().optional(),deltas:Ke().optional(),memory:Ke().optional(),persistentState:Ke().optional()}),rz=We({supported:Ke().optional(),delegation:Ke().optional(),handoffs:Ke().optional(),subAgents:Xn(ez).optional()}),sz=We({supported:Ke().optional(),streaming:Ke().optional(),encrypted:Ke().optional()}),uz=We({image:Ke().optional(),audio:Ke().optional(),video:Ke().optional(),pdf:Ke().optional(),file:Ke().optional()}),oz=We({image:Ke().optional(),audio:Ke().optional()}),cz=We({input:uz.optional(),output:oz.optional()}),fz=We({codeExecution:Ke().optional(),sandboxed:Ke().optional(),maxIterations:rd().optional(),maxExecutionTime:rd().optional()}),dz=We({supported:Ke().optional(),approvals:Ke().optional(),interventions:Ke().optional(),feedback:Ke().optional()});We({identity:tz.optional(),transport:nz.optional(),tools:az.optional(),output:lz.optional(),state:iz.optional(),multiAgent:rz.optional(),reasoning:sz.optional(),multimodal:cz.optional(),execution:fz.optional(),humanInTheLoop:dz.optional(),custom:Zr(zi()).optional()});const cv=Zu([ye("developer"),ye("system"),ye("assistant"),ye("user")]);let qe=(function(n){return n.TEXT_MESSAGE_START="TEXT_MESSAGE_START",n.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",n.TEXT_MESSAGE_END="TEXT_MESSAGE_END",n.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",n.TOOL_CALL_START="TOOL_CALL_START",n.TOOL_CALL_ARGS="TOOL_CALL_ARGS",n.TOOL_CALL_END="TOOL_CALL_END",n.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",n.TOOL_CALL_RESULT="TOOL_CALL_RESULT",n.THINKING_START="THINKING_START",n.THINKING_END="THINKING_END",n.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",n.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",n.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",n.STATE_SNAPSHOT="STATE_SNAPSHOT",n.STATE_DELTA="STATE_DELTA",n.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",n.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",n.ACTIVITY_DELTA="ACTIVITY_DELTA",n.RAW="RAW",n.CUSTOM="CUSTOM",n.RUN_STARTED="RUN_STARTED",n.RUN_FINISHED="RUN_FINISHED",n.RUN_ERROR="RUN_ERROR",n.STEP_STARTED="STEP_STARTED",n.STEP_FINISHED="STEP_FINISHED",n.REASONING_START="REASONING_START",n.REASONING_MESSAGE_START="REASONING_MESSAGE_START",n.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",n.REASONING_MESSAGE_END="REASONING_MESSAGE_END",n.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",n.REASONING_END="REASONING_END",n.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",n})({});const et=We({type:RR(qe),timestamp:rd().optional(),rawEvent:kn().optional()}).passthrough(),hz=et.extend({type:ye(qe.TEXT_MESSAGE_START),messageId:le(),role:cv.default("assistant"),name:le().optional()}),fv=et.extend({type:ye(qe.TEXT_MESSAGE_CONTENT),messageId:le(),delta:le()}),mz=et.extend({type:ye(qe.TEXT_MESSAGE_END),messageId:le()}),pz=et.extend({type:ye(qe.TEXT_MESSAGE_CHUNK),messageId:le().optional(),role:cv.optional(),delta:le().optional(),name:le().optional()}),gz=et.extend({type:ye(qe.THINKING_TEXT_MESSAGE_START)}),yz=fv.omit({messageId:!0,type:!0}).extend({type:ye(qe.THINKING_TEXT_MESSAGE_CONTENT)}),vz=et.extend({type:ye(qe.THINKING_TEXT_MESSAGE_END)}),_z=et.extend({type:ye(qe.TOOL_CALL_START),toolCallId:le(),toolCallName:le(),parentMessageId:le().optional()}),xz=et.extend({type:ye(qe.TOOL_CALL_ARGS),toolCallId:le(),delta:le()}),bz=et.extend({type:ye(qe.TOOL_CALL_END),toolCallId:le()}),Sz=et.extend({messageId:le(),type:ye(qe.TOOL_CALL_RESULT),toolCallId:le(),content:le(),role:ye("tool").optional()}),kz=et.extend({type:ye(qe.TOOL_CALL_CHUNK),toolCallId:le().optional(),toolCallName:le().optional(),parentMessageId:le().optional(),delta:le().optional()}),Tz=et.extend({type:ye(qe.THINKING_START),title:le().optional()}),Ez=et.extend({type:ye(qe.THINKING_END)}),Nz=et.extend({type:ye(qe.STATE_SNAPSHOT),snapshot:WR}),Cz=et.extend({type:ye(qe.STATE_DELTA),delta:Xn(kn())}),Az=et.extend({type:ye(qe.MESSAGES_SNAPSHOT),messages:Xn(uv)}),wz=et.extend({type:ye(qe.ACTIVITY_SNAPSHOT),messageId:le(),activityType:le(),content:Zr(kn()),replace:Ke().optional().default(!0)}),jz=et.extend({type:ye(qe.ACTIVITY_DELTA),messageId:le(),activityType:le(),patch:Xn(kn())}),Mz=et.extend({type:ye(qe.RAW),event:kn(),source:le().optional()}),Rz=et.extend({type:ye(qe.CUSTOM),name:le(),value:kn()}),zz=et.extend({type:ye(qe.RUN_STARTED),threadId:le(),runId:le(),parentRunId:le().optional(),input:PR.optional()}),Oz=et.extend({type:ye(qe.RUN_FINISHED),threadId:le(),runId:le(),result:kn().optional()}),Dz=et.extend({type:ye(qe.RUN_ERROR),message:le(),code:le().optional()}),Lz=et.extend({type:ye(qe.STEP_STARTED),stepName:le()}),Bz=et.extend({type:ye(qe.STEP_FINISHED),stepName:le()}),Uz=Zu([ye("tool-call"),ye("message")]),Hz=et.extend({type:ye(qe.REASONING_START),messageId:le()}),Iz=et.extend({type:ye(qe.REASONING_MESSAGE_START),messageId:le(),role:ye("reasoning")}),qz=et.extend({type:ye(qe.REASONING_MESSAGE_CONTENT),messageId:le(),delta:le()}),Vz=et.extend({type:ye(qe.REASONING_MESSAGE_END),messageId:le()}),Gz=et.extend({type:ye(qe.REASONING_MESSAGE_CHUNK),messageId:le().optional(),delta:le().optional()}),Zz=et.extend({type:ye(qe.REASONING_END),messageId:le()}),Yz=et.extend({type:ye(qe.REASONING_ENCRYPTED_VALUE),subtype:Uz,entityId:le(),encryptedValue:le()}),$z=Yu("type",[hz,fv,mz,pz,Tz,Ez,gz,yz,vz,_z,xz,bz,kz,Sz,Nz,Cz,Az,wz,jz,Mz,Rz,zz,Oz,Dz,Lz,Bz,Hz,Iz,qz,Vz,Gz,Zz,Yz]);function Xz(n){let a;try{a=JSON.parse(n)}catch{return"not-agui"}if(typeof a!="object"||a===null||!("type"in a))return"not-agui";const i=$z.safeParse(a);if(!i.success)return"not-agui";switch(i.data.type){case qe.TEXT_MESSAGE_CONTENT:case qe.TEXT_MESSAGE_CHUNK:return{type:"data",content:i.data.delta??""};case qe.RUN_ERROR:return{type:"data",content:`Error: ${i.data.message??"Unknown error"}`};default:return null}}function Qz(n){try{const a=JSON.parse(n);if(typeof a=="string")return{type:"data",content:a};if(a&&typeof a=="object"&&"error"in a)return{type:"data",content:`Error: ${a.error}`}}catch{}return{type:"data",content:n}}function Fz(n,a){if(!n.startsWith("data: "))return null;const i=n.slice(6);if(a==="metadata")return{type:"metadata",content:i};const r=Xz(i);return r!=="not-agui"?r:Qz(i)}function Kz(n,a,i){const[r,u]=B.useState([]),[o,c]=B.useState(!1),[h,m]=B.useState(null),p=B.useRef(null),v=async E=>{if(!(!E||o)){c(!0),u(j=>[...j,{role:"user",content:E},{role:"assistant",content:""}]);try{const j=await Sn(`${n}/invocations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:E,...a?{agentName:a}:{},...p.current?{sessionId:p.current}:{},...i?{userId:i}:{}})});if(!j.ok){const P=await j.text();u($=>{const fe=[...$];return fe[fe.length-1]={role:"assistant",content:P||`Error: ${j.status}`,isError:!0},fe});return}const O=j.headers.get("x-session-id");if(O&&(p.current=O,m(O)),!j.body){u(P=>{const $=[...P];return $[$.length-1]={role:"assistant",content:"(empty response)"},$});return}const S=j.body.getReader(),R=new TextDecoder;let M="",J="",te=!1,q="",ae=null;const de=()=>{ae=null,u(P=>{const $=[...P];return $[$.length-1]={role:"assistant",content:J},$})},ve=()=>{ae===null&&(ae=requestAnimationFrame(de))},L=P=>{if(P.startsWith("event: ")||P.startsWith("event:")){q=P.slice(P.indexOf(":")+1).trim();return}if(P===""){q="";return}const $=Fz(P,q);$!==null&&($.type==="metadata"||(te=!0,J+=$.content))};for(;;){const{done:P,value:$}=await S.read();if(P)break;M+=R.decode($,{stream:!0});const fe=M.split(`
274
274
  `);M=fe.pop()||"";for(const W of fe)L(W);te&&ve()}if(ae!==null&&cancelAnimationFrame(ae),M&&L(M),!te){const P=J||M||R.decode();try{const $=JSON.parse(P);J=$.result!==null&&$.result!==void 0?typeof $.result=="string"?$.result:JSON.stringify($.result,null,2):JSON.stringify($,null,2)}catch{J=P}}u(P=>{const $=[...P];return $[$.length-1]={role:"assistant",content:J||"(empty response)"},$})}catch(j){const O=j instanceof Error&&j.message.includes("Failed to fetch")?"Connection failed — is the agent server running?":j instanceof Error?j.message:"Unknown error";u(S=>{const R=[...S];return R[R.length-1]={role:"assistant",content:O,isError:!0},R})}finally{c(!1)}}},y=B.useCallback((...E)=>{u(j=>[...j,...E])},[]),x=B.useCallback((E,j,O)=>{u(S=>{const R=[...S];for(let M=R.length-1;M>=0;M--)if(R[M].role==="assistant"&&!R[M].toolCalls){R[M]={...R[M],toolCalls:E,traceId:j,...O?{tokenUsage:O}:{}};break}return R})},[]);return{messages:r,isStreaming:o,sessionId:h,sendMessage:v,resetChat:()=>{u([]),m(null),p.current=null},addMessages:y,enrichLastAssistantMessage:x}}function Jz(n){const a=n.filter(y=>{if(y.type!=="span")return!1;const x=y.attributes??{};return x["gen_ai.usage.input_tokens"]!==void 0||x["gen_ai.usage.output_tokens"]!==void 0});if(a.length===0)return null;const i=new Set(a.map(y=>y.spanId).filter(Boolean));let r=a.filter(y=>!y.parentSpanId||!i.has(y.parentSpanId));r.some(y=>(y.attributes??{})["gen_ai.operation.name"]!=="invoke_agent")&&(r=r.filter(y=>(y.attributes??{})["gen_ai.operation.name"]!=="invoke_agent"));let o=0,c=0,h=0,m=0,p=!1,v;for(const y of r){const x=y.attributes??{};o+=Number(x["gen_ai.usage.input_tokens"]??0),c+=Number(x["gen_ai.usage.output_tokens"]??0),h+=Number(x["gen_ai.usage.total_tokens"]??0),x["gen_ai.usage.cache_read.input_tokens"]!==void 0&&(p=!0,m+=Number(x["gen_ai.usage.cache_read.input_tokens"])),v||(v=x["gen_ai.response.model"]??x["gen_ai.request.model"])}return h===0&&(h=o+c),{inputTokens:o,outputTokens:c,totalTokens:h,...p?{cacheReadInputTokens:m}:{},model:v}}function Gy(n,a){var u;const i=n.attributes;if(!Array.isArray(i))return;const r=i.find(o=>o.key===a);return(u=r==null?void 0:r.value)==null?void 0:u.stringValue}function Pz(n){if(!n||!Array.isArray(n))return{};let a,i;for(const r of n){const u=r,o=u.name;o==="gen_ai.tool.message"?a=a??Gy(u,"content"):o==="gen_ai.choice"&&(i=i??Gy(u,"message"))}return{input:a,output:i}}function Wz(n){if(n.type!=="span")return!1;const a=(n.name??"").toLowerCase(),i=n.attributes??{};return a==="tool_use"||a==="tool_call"||a.startsWith("execute_tool")||!!i["tool.name"]||!!i["gen_ai.tool.name"]}function eO(n){const a=n.filter(Wz),i=new Set(a.map(r=>r.spanId).filter(Boolean));return a.filter(r=>!r.parentSpanId||!i.has(r.parentSpanId)).map(r=>{const u=r.attributes??{},o=xn(r.startTimeUnixNano),c=xn(r.endTimeUnixNano);let h=u["gen_ai.tool.call.arguments"],m=u["gen_ai.tool.call.result"];if(!h||!m){const p=Pz(r.events);h=h??p.input,m=m??p.output}return{name:u["gen_ai.tool.name"]??u["tool.name"]??r.name??"unknown",input:h,output:m,durationMs:o&&c?c-o:void 0,spanId:r.spanId??"",traceId:r.traceId??""}})}function tO(){const{agents:n,harnesses:a,errors:i,selectedAgent:r,isConnected:u,hasConnected:o}=KM(Bn),[c,h]=B.useState(void 0),[m,p]=B.useState(void 0),{isStarting:v,isReady:y,error:x,startAgent:b}=rR(Bn),E=iR(Bn),[j,O]=B.useState(!0),S=n.find(at=>at.name===c)??n[0],R=a.find(at=>at.name===m),M=R!==void 0,J=i.find(at=>at.name===(S==null?void 0:S.name)),te=!M&&n.length>0&&(v||!y&&!x&&!J),q=async at=>{const Xt=c;h(at),p(void 0),fe(),D.resetChat(),await b(at)||h(Xt)},ae=at=>{p(at),h(void 0),fe(),D.resetChat()};B.useEffect(()=>{if(n.length>0&&!c&&!m&&!y&&!v&&!x&&!J){const at=n.find(Xt=>Xt.name===r)??n[0];b(at.name).then(Xt=>{Xt&&h(at.name)})}},[n,c,m,y,v,x,b,J,r]),B.useEffect(()=>{n.length===0&&a.length>0&&!c&&!m&&p(a[0].name)},[n,a,c,m]);const[de]=B.useState("default-user"),{messages:ve,isStreaming:L,sessionId:P,sendMessage:$,resetChat:fe,addMessages:W,enrichLastAssistantMessage:ee}=Kz(Bn,S==null?void 0:S.name,de),D=eR(Bn,R==null?void 0:R.name,de),F=M?D.messages:ve,ue=M?D.isStreaming:L,ne=M?D.sessionId:P,N=M?D.sendMessage:$,A=M?D.resetChat:fe,{tools:Z,isLoading:T,error:U,fetchTools:ie,callTool:he}=aR(Bn,S==null?void 0:S.name,S==null?void 0:S.protocol,y),{card:je,isLoading:dt,error:tt,fetchCard:Wt}=FM(Bn,S==null?void 0:S.name,S==null?void 0:S.protocol,y),In=B.useCallback((at,Xt,Tn)=>{W({role:"user",content:at},{role:"assistant",content:Xt,isError:Tn})},[W]),{containerRef:ul,forceScrollToBottom:Dl}=PM(F,ue),qt=nR(S==null?void 0:S.name),ia=B.useRef(!1);B.useEffect(()=>{ia.current&&!ue&&qt.onInvocationComplete(),ia.current=ue},[ue,qt.onInvocationComplete]);const Qn=B.useRef(new Set);return B.useEffect(()=>{Qn.current.clear()},[c]),B.useEffect(()=>{if(qt.invocations.length===0)return;const at=qt.invocations[0];if(Qn.current.has(at.traceId))return;const Xt=eO(at.spans),Tn=Jz(at.spans);(Xt.length>0||Tn)&&(Qn.current.add(at.traceId),ee(Xt,at.traceId,Tn??void 0))},[qt.invocations,ee]),g.jsxs("div",{className:"appLayout",children:[g.jsxs("div",{className:"app",children:[g.jsx(pS,{isConnected:u,hasConnected:o,hasError:!!J||!!x,onToggleResources:()=>O(at=>!at),isResourcesOpen:j}),J&&!M&&g.jsx("div",{className:"startError",children:g.jsx(If,{content:J.message})}),x&&!J&&!M&&g.jsx("div",{className:"startError",children:g.jsx(If,{content:x})}),o&&!u?g.jsxs("div",{className:"disconnectedView",children:[g.jsx("div",{className:"disconnectedIcon",children:g.jsx(Qy,{size:36})}),g.jsx("div",{className:"disconnectedTitle",children:"Server disconnected"}),g.jsx("p",{className:"disconnectedText",children:"Start the dev server to reconnect:"}),g.jsx("code",{className:"disconnectedCmd",children:"agentcore dev"})]}):g.jsxs(g.Fragment,{children:[g.jsx(Qb,{agents:n,harnesses:a,errors:i,selectedAgentName:M||S==null?void 0:S.name,selectedHarnessName:m,isStarting:v,isReady:M?!0:y,startError:x,sessionId:ne,onSelectAgent:q,onSelectHarness:ae,onResetChat:A}),g.jsx(nw,{ref:ul,messages:F,isStreaming:ue,isStarting:M?!1:te,agentName:M?R==null?void 0:R.name:S==null?void 0:S.name,agentBuildType:M?"Harness":S==null?void 0:S.buildType,agentProtocol:M?"Harness":S==null?void 0:S.protocol,hasAvailableTargets:n.length>0||a.length>0}),M&&g.jsx(rS,{overrides:D.harnessOverrides,onChange:D.setHarnessOverrides}),!M&&(S==null?void 0:S.protocol)==="MCP"&&(Z.length>0||U)&&g.jsx(QM,{tools:Z,isLoading:T,error:U,onRefresh:ie,onCallTool:he,onToolCallMessage:In}),!M&&(S==null?void 0:S.protocol)==="A2A"&&(je||tt||dt)&&g.jsx(ub,{card:je,isLoading:dt,error:tt,onRefresh:Wt}),(S&&S.protocol!=="MCP"&&!M||M)&&g.jsx(hb,{isStreaming:ue||!M&&te,isStarting:M?!1:te,onSend:at=>{Dl(),N(at)}}),!M&&(S==null?void 0:S.protocol)!=="MCP"&&g.jsx(NM,{traces:qt})]})]}),j&&g.jsx(E3,{resources:E,sessionId:ne,userId:de,onClose:()=>O(!1)})]})}B0.createRoot(document.getElementById("root")).render(g.jsx(w0.StrictMode,{children:g.jsx(tO,{})}));
275
- //# sourceMappingURL=index.js.map