@theoremjs/studio 0.3.4-next.401.gec4c582 → 0.3.4-next.405.g57fd3a0

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 (64) hide show
  1. package/browser-engine.d.ts +1 -1
  2. package/browser-engine.js +1 -1
  3. package/browser-transport.d.ts +12 -0
  4. package/browser-transport.js +26 -7
  5. package/browser.d.ts +1 -1
  6. package/browser.js +1 -1
  7. package/mod.d.ts +2 -1
  8. package/mod.js +2 -1
  9. package/package.json +4 -4
  10. package/page/assets/{Banner-BXAD_Vfi.js → Banner-QusdlIyi.js} +2 -2
  11. package/page/assets/{ContextMenu-BHyTgQRM.js → ContextMenu-fveoNjBr.js} +2 -2
  12. package/page/assets/{ToolResultCharts-bFoajfnu.js → ToolResultCharts-BjcUZQFb.js} +1 -1
  13. package/page/assets/{TraceInspector-DAY3Ke6H.js → TraceInspector-CLOnBoTm.js} +1 -1
  14. package/page/assets/{TraceOverview-CRWvJDZj.js → TraceOverview-DZvDDMnn.js} +2 -2
  15. package/page/assets/{_virtual_studio-type-sources-BCXnWGOW.js → _virtual_studio-type-sources-BJMljtdu.js} +2 -0
  16. package/page/assets/browser-engine-Bs0KjxWa.js +11 -0
  17. package/page/assets/browser-transport-CX0KfTc_.js +47 -0
  18. package/page/assets/{encode-files-Bc3HJyAh.js → encode-files-DZ4tVtEQ.js} +1 -1
  19. package/page/assets/{export-agent-Ywtc2-0C.js → export-agent-DpYJK1Fw.js} +3 -3
  20. package/page/assets/{guardrail-tester-Dy-ahvCI.js → guardrail-tester-D6fnIprh.js} +2 -2
  21. package/page/assets/{index-CBA4_EUF.js → index-9DTfp56-.js} +71 -71
  22. package/page/assets/{live-messages-BYi31jQk.js → live-messages-BZGmMo_v.js} +1 -1
  23. package/page/assets/reader-paEmSrWc.js +7 -0
  24. package/page/assets/{shaped-data-BcarWqd5.js → shaped-data-0GUF7Al3.js} +1 -1
  25. package/page/assets/{stub-DEZDrr-l.js → stub-DpBSP8Ld.js} +1 -1
  26. package/page/assets/{studio-code-pane-CICFFR42.js → studio-code-pane-CvMvK1dS.js} +3 -3
  27. package/page/assets/{studio-console-U7aNSe1H.js → studio-console-eGboNvee.js} +3 -3
  28. package/page/assets/studio-decision-qRaiEHpZ.js +1 -0
  29. package/page/assets/{studio-embedding-aQnxMD3i.js → studio-embedding-jg1jkUOk.js} +1 -1
  30. package/page/assets/studio-host-console-D9G0Xsi9.js +2 -0
  31. package/page/assets/{studio-live-BWYH4C-n.js → studio-live-DqRAjP8W.js} +2 -2
  32. package/page/assets/{studio-map-3GO33qQG.js → studio-map-BvY_0EHQ.js} +1 -1
  33. package/page/assets/studio-trace-replay-CUV0arIO.js +2 -0
  34. package/page/assets/{studio-type-checker-CV8Jl9--.js → studio-type-checker-Cm6RZxV3.js} +1 -1
  35. package/page/assets/{tool-schema-BrqSc6vO.js → tool-schema-CgpwKFX7.js} +7 -7
  36. package/page/assets/{trace-record-C3zNksA_.js → trace-record-BjsBbPRl.js} +1 -1
  37. package/page/assets/tree-BxX70aqA.js +3 -0
  38. package/page/assets/turn-client-BZUECwPn.js +2 -0
  39. package/page/assets/types-BoECJ8mE.js +1 -0
  40. package/page/assets/{use-one-call-DFaDtl-b.js → use-one-call-DDzd4qr2.js} +1 -1
  41. package/page/assets/{workspace-Ck0o-_fd.js → workspace-Bc---F49.js} +1 -1
  42. package/page/index.html +13 -13
  43. package/replay.d.ts +97 -0
  44. package/replay.js +387 -0
  45. package/server/draft-handler.js +2 -1
  46. package/transport.d.ts +5 -1
  47. package/transport.js +7 -2
  48. package/ui/inspector-context.d.ts +1 -1
  49. package/ui/lib/send-when-ready.d.ts +7 -0
  50. package/ui/lib/send-when-ready.js +14 -0
  51. package/ui/studio-connection.d.ts +1 -1
  52. package/ui/studio-runner.d.ts +4 -1
  53. package/ui/studio-runner.js +3 -2
  54. package/ui/studio-screen.js +110 -11
  55. package/ui/studio-trace-replay.d.ts +23 -0
  56. package/ui/studio-trace-replay.js +216 -0
  57. package/page/assets/browser-engine-DVCpc0ZM.js +0 -11
  58. package/page/assets/browser-transport-0PBe1ivB.js +0 -47
  59. package/page/assets/reader-B0gVhfoZ.js +0 -7
  60. package/page/assets/studio-decision-CgIpnrcU.js +0 -1
  61. package/page/assets/studio-host-console-Ccm2Blar.js +0 -2
  62. package/page/assets/tree-DeO1319a.js +0 -3
  63. package/page/assets/turn-client-DwVPS3TX.js +0 -2
  64. package/page/assets/types-EVrOoUBG.js +0 -1
@@ -1,47 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-engine-DVCpc0ZM.js","assets/preload-helper-DpV6A1kQ.js","assets/schemas-BQ9Jydzb.js","assets/rolldown-runtime-hePW80VL.js","assets/tool-schema-BrqSc6vO.js","assets/host-patterns-C9RMP16Q.js","assets/shaped-data-BcarWqd5.js","assets/reader-B0gVhfoZ.js","assets/live-ingress-lDUGPwth.js","assets/trace-schema-9CdEyG6Q.js","assets/stub-DEZDrr-l.js","assets/trace-record-C3zNksA_.js","assets/turn-client-DwVPS3TX.js","assets/encode-files-Bc3HJyAh.js","assets/live-messages-BYi31jQk.js","assets/lent-keys-C32ems-I.js","assets/index-CBA4_EUF.js","assets/themeProps-3IqahpCr.js","assets/tokens.stylex-DkHf0P9C.js","assets/SegmentedControlItem-BLuJOusN.js","assets/padding.stylex-B76907Zf.js","assets/VStack-CkVMcNiK.js","assets/mergeProps-ptS-gIMz.js","assets/StackItem-CQviqAfM.js","assets/useLayerDismissal-BAnTRYTt.js","assets/fieldParts-Cs6Amprh.js","assets/Icon-ZfFwTt8n.js","assets/devWarning-DxuplmRl.js","assets/Text-BsiAsowd.js","assets/sharedResizeObserver-4U9Xq5Oq.js","assets/useMediaQuery-BCT0NUeZ.js","assets/focusOutline.stylex-BT0kfa4t.js","assets/IconButton-CG5klqF1.js","assets/useTooltip-rxACYEAC.js","assets/useDevWarning-Cna3kqg1.js","assets/Tooltip-CTEuMRLe.js","assets/createReactComponent-CZwsv6DD.js","assets/isRtlElement-BG33-k_H.js","assets/CodeBlock-Kjgv83A6.js","assets/useClipboard-B1amtN2V.js","assets/useScrollableArea-vxuztwym.js","assets/focusReturn-CTppP2k0.js","assets/SidePanel-OYp0bLNO.js","assets/Card-Ghe4ozhC.js","assets/container.stylex-BmOi-8DQ.js","assets/ScrollableArea-C8AVuqnt.js","assets/labels-provider-BqgbdxdT.js","assets/Dialog-BDUExlk_.js","assets/useScrollLock-Dyf6PHJt.js","assets/chainEventHandlers-C6ttXGfW.js","assets/HoverCard-C6thuzrf.js","assets/CheckboxInput-C9kbVyhK.js","assets/IconAlertTriangle-BqAEqqdU.js","assets/Banner-BXAD_Vfi.js","assets/arrive-DvbqpeRS.js","assets/Center-nHS1JSux.js","assets/IconEye-BB5aY-wQ.js","assets/IconSearch-BTx66a40.js","assets/tree-DeO1319a.js","assets/workspace-Ck0o-_fd.js","assets/editors-BJX_S59A.js","assets/EmptyState-C8W4JKBZ.js","assets/PaneState-C8jetBGI.js","assets/PaneState-CnxaP3LD.css","assets/CollapsibleGroup-toq0Nedn.js","assets/useAdaptivePresentation-BY_zvjIp.js","assets/Section-DJ97F7QE.js","assets/ContextMenu-BHyTgQRM.js","assets/useContainerReveal-BFy8N_QU.js","assets/BottomSheet-BQPskY35.js","assets/index-Oo9otEIT.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,c as n,i as r,l as i,n as a,o,r as s,t as c,u as l}from"./themeProps-3IqahpCr.js";import{c as u,v as d}from"./padding.stylex-B76907Zf.js";import{t as f}from"./mergeProps-ptS-gIMz.js";import{a as p,i as m,n as h,r as g,t as _}from"./useLayerDismissal-BAnTRYTt.js";import{S as v,g as ee,x as te}from"./fieldParts-Cs6Amprh.js";import{b as ne,h as y,i as b,m as re,t as ie,u as ae,x as oe}from"./Icon-ZfFwTt8n.js";import"./devWarning-DxuplmRl.js";import{i as se,r as x}from"./focusOutline.stylex-BT0kfa4t.js";import{a as ce,h as le,i as ue,n as S,r as de,t as fe}from"./IconButton-CG5klqF1.js";import{b as C,x as pe}from"./SidePanel-OYp0bLNO.js";import{r as me}from"./Text-BsiAsowd.js";import{t as he}from"./preload-helper-DpV6A1kQ.js";import{t as ge}from"./Card-Ghe4ozhC.js";import{t as w}from"./useDevWarning-Cna3kqg1.js";import{t as _e}from"./Tooltip-CTEuMRLe.js";import{t as T}from"./createReactComponent-CZwsv6DD.js";import{i as ve}from"./ScrollableArea-C8AVuqnt.js";import{t as E}from"./IconAlertTriangle-BqAEqqdU.js";import{o as D,s as ye}from"./Banner-BXAD_Vfi.js";import{o as be,s as xe}from"./arrive-DvbqpeRS.js";import{n as O}from"./Center-nHS1JSux.js";import{t as k}from"./IconSearch-BTx66a40.js";import{E as A,_ as j,d as Se,g as M,l as N,o as Ce,v as P,w as F,x as we,y as I}from"./schemas-BQ9Jydzb.js";import{Dn as L,H as Te,Kn as Ee,Lr as De,Nr as Oe,R as ke,U as Ae,W as R,X as je,Y as Me,_ as Ne,cn as Pe,cr as Fe,h as z,hr as Ie,i as Le,ir as Re,j as ze,jr as Be,qn as Ve,v as He,vt as Ue,z as We}from"./tool-schema-BrqSc6vO.js";import{c as Ge,r as Ke}from"./host-patterns-C9RMP16Q.js";import{Mn as qe,Nn as Je,Sn as Ye,Zt as Xe,en as Ze,in as Qe,nn as $e,qt as et,wn as tt}from"./shaped-data-BcarWqd5.js";import{$ as nt,C as rt,D as it,E as B,Et as at,H as V,K as ot,M as st,Pt as ct,T as lt,U as ut,b as dt,d as ft,f as pt,h as mt,i as ht,l as gt,m as _t,p as vt,r as yt,s as bt,t as xt,tt as St,u as Ct,v as wt,x as Tt,y as Et}from"./reader-B0gVhfoZ.js";import{B as Dt,H as Ot,L as kt,V as At,b as jt,l as Mt,m as Nt,s as Pt,t as H,x as Ft,z as It}from"./tree-DeO1319a.js";import{a as Lt,r as Rt}from"./live-ingress-lDUGPwth.js";import{n as zt}from"./trace-schema-9CdEyG6Q.js";import{n as Bt,t as Vt}from"./types-EVrOoUBG.js";import{t as Ht}from"./useScrollLock-Dyf6PHJt.js";import{t as Ut}from"./useContainerReveal-BFy8N_QU.js";function Wt(e){let t=``;for(let n of e){let e=n.codePointAt(0)??0;t+=n===`"`||n===`\\`||e<32||e===127?`\\${(e===0?65533:e).toString(16)} `:n}return t}function U(e){return e===`base`?``:e.split(`+`).map(e=>{let t=e.indexOf(`:`),n=t===-1?e:e.slice(0,t),r=t===-1?e:e.slice(t+1);return`[${c(n)}="${Wt(r)}"]`}).join(``)}var Gt={avatar:[{property:`borderRadius`,vars:[`--_avatar-radius`]}],banner:[{property:`borderRadius`,vars:[`--_banner-radius`]}],"bottom-sheet":[{property:`padding`,expand:`container`}],button:[{property:`borderRadius`,vars:[`--_button-radius`]}],card:[{property:`borderRadius`,vars:[`--_card-radius`]},{property:`padding`,expand:`container`}],chat:[{property:`borderRadius`,vars:[`--_chat-composer-radius`]},{property:`padding`,vars:[`--_chat-composer-padding`]}],dialog:[{property:`borderRadius`,vars:[`--_dialog-radius`]},{property:`padding`,expand:`container`}],drawer:[{property:`padding`,expand:`container`}],"context-menu":[{property:`borderRadius`,vars:[`--_dropdown-menu-radius`]},{property:`padding`,vars:[`--_dropdown-menu-padding`]}],"dropdown-menu":[{property:`borderRadius`,vars:[`--_dropdown-menu-radius`]},{property:`padding`,vars:[`--_dropdown-menu-padding`]}],field:[{property:`borderRadius`,vars:[`--_field-radius`]}],"hover-card":[{property:`borderRadius`,vars:[`--_hovercard-radius`]}],item:[{property:`paddingInline`,vars:[`--_item-inset-inline`]}],"number-input":[{property:`padding`,expand:`container`},{property:`borderRadius`,vars:[`--_field-radius`]}],popover:[{property:`borderRadius`,vars:[`--_popover-radius`]}],"progress-bar-mark":[{property:`width`,vars:[`--_progressbar-mark-width`],replaces:!0},{property:`height`,vars:[`--_progressbar-mark-height`],replaces:!0}],section:[{property:`padding`,expand:`container`}],"segmented-control":[{property:`borderRadius`,vars:[`--_segmented-control-radius`]},{property:`padding`,vars:[`--_segmented-control-padding`]}],"text-area":[{property:`paddingInline`,vars:[`--_textarea-inline-padding`],replaces:!0}]};function Kt(e,t){let n=Gt[e];return n?n.filter(e=>e.property===t):[]}function qt(e){return e===`
3
- `||e===`\r`||e===`\f`}function Jt(e){return e===` `||e===` `||qt(e)}function Yt(e){return/^[0-9a-fA-F]$/.test(e)}function Xt(e){return/^[A-Za-z_]$/.test(e)||e.charCodeAt(0)>=128}function Zt(e){return Xt(e)||/^[0-9-]$/.test(e)}function Qt(e){return e.replace(/\r\n?|\f/g,`
4
- `).replace(/\0/g,`�`)}var $t=/[\x01-\x08\x0b\x0e-\x1f\x7f]/;function en(e,t){return e[t]===`\\`&&t+1<e.length&&!qt(e[t+1])}function tn(e,t){let n=e[t];if(n===`-`){let n=e[t+1];return n!==void 0&&(n===`-`||Xt(n)||en(e,t+1))}return n===`\\`?en(e,t):n!==void 0&&Xt(n)}function nn(e,t){if(Yt(e[t])){let n=t;for(;n<e.length&&n-t<6&&Yt(e[n]);)n++;return n<e.length&&Jt(e[n])&&n++,n}return t+((e.codePointAt(t)??0)>65535?2:1)}function rn(e,t){let n=``,r=t;for(;r<e.length;){let t=e[r];if(Zt(t))n+=t,r++;else if(en(e,r)){let t=nn(e,r+1);if(Yt(e[r+1])){let i=e.slice(r+1,t).trim(),a=parseInt(i,16);n+=a===0||a>1114111||a>=55296&&a<=57343?`�`:String.fromCodePoint(a)}else n+=e.slice(r+1,t);r=t}else break}return{end:r,name:n}}function an(e,t){let n=e[t],r=t+1;for(;r<e.length;){let t=e[r];if(t===n)return{end:r+1};if(qt(t))return{reason:`a newline inside a quoted string makes a bad string`};if(t===`\\`){if(r+1>=e.length)break;r=qt(e[r+1])?r+2:nn(e,r+1)}else r++}return{reason:`an unclosed ${n} string would swallow the rest of the rule`}}function on(e,t){let n=t;for(;n<e.length;){let t=e[n];if(t===`)`)return{end:n+1};if(Jt(t)){for(;n<e.length&&Jt(e[n]);)n++;if(n>=e.length)break;return e[n]===`)`?{end:n+1}:{reason:`whitespace inside an unquoted url() makes a bad url`}}if($t.test(t))return{reason:`a non-printable character inside url() makes a bad url`};if(t===`"`||t===`'`||t===`(`)return{reason:`"${t}" inside an unquoted url() makes a bad url; quote the URL instead`};if(t===`\\`){if(!en(e,n))return{reason:`a stray backslash inside url() makes a bad url`};n=nn(e,n+1)}else n++}return{reason:`an unclosed url( would swallow the rest of the rule`}}var sn={"(":`)`,"[":`]`,"{":`}`};function cn(e){let t=Qt(e),n=[],r=0;for(;r<t.length;){let e=t[r];if(e===`/`&&t[r+1]===`*`){let e=t.indexOf(`*/`,r+2);if(e===-1)return`an unclosed /* comment would swallow the rest of the rule`;r=e+2}else if(e===`"`||e===`'`){let e=an(t,r);if(`reason`in e)return e.reason;r=e.end}else if(tn(t,r)){let e=rn(t,r);if(r=e.end,t[r]===`(`&&e.name.toLowerCase()===`url`){let e=r+1;for(;e<t.length&&Jt(t[e]);)e++;if(t[e]===`"`||t[e]===`'`){n.push(`)`),r+=1;continue}let i=on(t,e);if(`reason`in i)return i.reason;r=i.end}}else if(e===`\\`){if(r+1>=t.length)return`a trailing backslash would escape the declaration terminator`;r=qt(t[r+1])?r+1:nn(t,r+1)}else if(e===`(`||e===`[`||e===`{`){if(e===`{`&&n.length===0)return`an unquoted "{" would open a nested block`;n.push(sn[e]),r++}else if(e===`)`||e===`]`||e===`}`){if(n.length===0)return e===`}`?`an unquoted "}" would close the rule`:`an unbalanced "${e}" has nothing to close`;let t=n.pop();if(t!==e)return`"${e}" does not close the open "${t===`)`?`(`:t===`]`?`[`:`{`}"`;r++}else{if(e===`;`&&n.length===0)return`an unquoted ";" would end the declaration`;r++}}if(n.length>0){let e=n[n.length-1];return`an unclosed "${e===`)`?`(`:e===`]`?`[`:`{`}" would swallow the rest of the rule`}return null}function ln(e){let t=Qt(e);if(t.length===0||!tn(t,0))return`a property name must be a CSS identifier`;let{end:n}=rn(t,0);return n===t.length?null:`a property name must be one CSS identifier; "${t[n]}" cannot appear in one`}function un(e){return`[data-${o}-theme="${e}"]`}var dn=`[data-${o}-theme]`;function fn(e){return`[data-${o}-media="${e}"]`}function pn(e,t){return`.${s}-${e}${t}`}function mn(e,t,n){let r=pn(e,t);return n?`:is(${fn(n)}) :is(${r})`:r}var hn=`:where(:not(:disabled,[aria-disabled="true"]))`;function gn(e,t){let n=[],r=0,i=0;for(let t=0;t<e.length;t++){let a=e[t];a===`(`?r++:a===`)`?r=Math.max(0,r-1):a===`,`&&r===0&&(n.push(e.slice(i,t).trim()),i=t+1)}n.push(e.slice(i).trim());let a=_n(t);return n.map(e=>`${e}${a}`).join(`, `)}function _n(e){if(!/^:hover(?![-\w])/.test(e)||e.includes(`[aria-disabled`))return e;let t=e.indexOf(`::`);return t===-1?e+hn:e.slice(0,t)+hn+e.slice(t)}function vn(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}var yn=new Set([`padding`,`paddingBlock`,`paddingInline`,`paddingBlockStart`,`paddingBlockEnd`,`paddingInlineStart`,`paddingInlineEnd`]),bn={paddingTop:`paddingBlockStart`,paddingBottom:`paddingBlockEnd`},xn=new Set([...yn,...Object.keys(bn)]);function Sn(e){let t={};for(let[n,r]of e)switch(bn[n]??n){case`padding`:{let e=r.trim().split(/\s+/);e.length===1?(t.blockStart=e[0],t.blockEnd=e[0],t.inline=e[0]):e.length===2?(t.blockStart=e[0],t.blockEnd=e[0],t.inline=e[1]):e.length>=3&&(t.blockStart=e[0],t.inline=e[1],t.blockEnd=e[2]);break}case`paddingBlock`:{let e=r.trim().split(/\s+/);t.blockStart=e[0],t.blockEnd=e[1]??e[0];break}case`paddingInline`:{let e=r.trim().split(/\s+/);e.length===1?t.inline=e[0]:(t.inlineStart=e[0],t.inlineEnd=e[1]);break}case`paddingBlockStart`:t.blockStart=r;break;case`paddingBlockEnd`:t.blockEnd=r;break;case`paddingInlineStart`:t.inlineStart=r;break;case`paddingInlineEnd`:t.inlineEnd=r}return t}function Cn(e,t,n=!1){let i=r(`${e}-padding`),a=[],o=t.inlineStart??t.inline,s=t.inlineEnd??t.inline;if(o!=null&&s!=null&&o===s&&t.blockStart!=null&&t.blockEnd!=null&&o===t.blockStart&&t.blockStart===t.blockEnd?a.push([i,o??``]):(t.inlineStart!=null||t.inlineEnd!=null?(o!=null&&a.push([`${i}-inline-start`,o]),s!=null&&a.push([`${i}-inline-end`,s])):t.inline!=null&&a.push([`${i}-inline`,t.inline]),t.blockStart!=null&&a.push([`${i}-block-start`,t.blockStart]),t.blockEnd!=null&&a.push([`${i}-block-end`,t.blockEnd])),n){let e=new Set(a.map(([e])=>e)),t=e.has(i)?[`${i}-inline`,`${i}-inline-start`,`${i}-inline-end`,`${i}-block-start`,`${i}-block-end`]:e.has(`${i}-inline`)?[`${i}-inline-start`,`${i}-inline-end`]:[];for(let n of t)e.has(n)||a.push([n,`initial`])}return a}var wn=e=>{console.warn(`[astryx theme] ${e}`)};function Tn(e){return e?t=>e.push(t):wn}function En(e){let t=JSON.stringify(e);return t.length>80?`${t.slice(0,77)}..."`:t}function Dn(e,t,n,r,i){e(`dropped "${t}" in ${r}: ${i} (value: ${En(n)})`)}function On(e,t,n,r){let i=ln(e)??cn(t);return i===null||(Dn(r,e,t,n,i),!1)}function kn(e,t,n,r=e=>e){let i=[];for(let[a,o]of e){let e=`${o}`,s=r(a);On(s,e,t,n)&&i.push(` ${s}: ${e};`)}return i.join(`
5
- `)}function An(e,t,n){let r=[kn(Object.entries(e.tokens),`${t}tokens`,n),kn(Object.entries(e.localTokens??{}),`${t}localTokens`,n)].filter(e=>e.length>0).join(`
6
- `);return Object.keys(e.tokens).length>0||Object.keys(e.localTokens??{}).length>0?` :scope {\n${r}\n }`:null}function jn(e,t,n){return`${e}components.${t}[${JSON.stringify(n)}]`}function Mn(e,t){let n=[],r=Tn(t),i=e=>`var(${e})`,a=An(e,``,r);return a!==null&&n.push(a),e.tokens[`--font-family-body`]&&n.push(` :scope {
7
- font-family: var(--font-family-body);
8
- }`),e.components&&In(e.components,n,{sink:r}),Ln(i,n),Rn(e.components||{},n),Bn(e.components||{},n),Pn(e.components||{},n),n}var Nn={normal:`var(--font-weight-normal)`,medium:`var(--font-weight-medium)`,semibold:`var(--font-weight-semibold)`,bold:`var(--font-weight-bold)`};function Pn(e,t,{surface:n,inheritedComponents:r,forceAll:i=!1,authoredOnly:a=!1}={}){let o=e.heading,s=o&&typeof o==`object`&&!Array.isArray(o)?o:void 0;if(!s&&!i)return;let c=r?.heading,l=c&&typeof c==`object`?c:void 0;for(let[e,r]of Object.entries(Nn)){let i=`weight:${e}`,o=s?Fn(s,i):void 0;if(a&&o===void 0)continue;let c=l?Fn(l,i):void 0,u=o??c??r,d=mn(`heading`,U(i),n);t.push(` ${d} { font-weight: ${u}; }`)}}function Fn(e,t){let n=e[t];if(typeof n!=`object`||!n||Array.isArray(n))return;let r=n.fontWeight;return typeof r==`string`&&cn(r)===null?r:void 0}function In(e,t,{resetInheritedPaddingSpecificity:n=!1,surface:r,sink:i=wn,location:a=``}={}){for(let[o,s]of Object.entries(e))for(let[e,c]of Object.entries(s)){let s=Object.entries(c);if(s.length===0)continue;let l=mn(o,U(e),r),u=jn(a,o,e),d=[],f=[];for(let[e,t]of s)e.startsWith(`:`)&&typeof t==`object`?f.push([e,t]):On(vn(e),`${t}`,u,i)&&d.push([e,t]);let p=d,m=[],h=!1,g=new Set;for(let[e,t]of d){let n=Kt(o,e),r=yn.has(e)&&e!==`padding`?Kt(o,`padding`):[];for(let i of[...n,...r])if(i.expand===`container`&&yn.has(e)&&(h=!0),i.replaces&&g.add(e),i.vars)for(let e of i.vars)m.push([e,t]);e in bn&&Kt(o,`padding`).some(e=>e.expand===`container`)&&(h=!0)}if(h){let e=d.filter(([e])=>xn.has(e)),t=d.filter(([e])=>!xn.has(e)),r=Cn(o,Sn(e),n);p=[...t,...r]}if(g.size>0&&(p=p.filter(([e])=>!g.has(e))),m.length>0&&(p=[...p,...m]),p.length>0){let e=kn(p,u,i,vn);t.push(` ${l} {\n${e}\n }`)}for(let[e,n]of f){let r=Object.entries(n);if(r.length>0){let n=kn(r,`${u}[${JSON.stringify(e)}]`,i,vn);t.push(` ${gn(l,e)} {\n${n}\n }`)}}}}function Ln(e,t){t.push(` :where(h1, h2, h3, h4, h5, h6) {
9
- font-family: var(--font-family-heading);
10
- color: var(--color-text-primary);
11
- }`);for(let n=1;n<=6;n++)t.push(` :where(h${n}) {
12
- font-size: ${e(`--text-heading-${n}-size`)};
13
- font-weight: ${e(`--text-heading-${n}-weight`)};
14
- line-height: ${e(`--text-heading-${n}-leading`)};
15
- }`);t.push(` :where(p) {
16
- font-family: var(--font-family-body);
17
- font-size: ${e(`--text-body-size`)};
18
- font-weight: ${e(`--text-body-weight`)};
19
- line-height: ${e(`--text-body-leading`)};
20
- color: var(--color-text-primary);
21
- }`),t.push(` :where(small) {
22
- font-size: ${e(`--text-supporting-size`)};
23
- font-weight: ${e(`--text-supporting-weight`)};
24
- line-height: ${e(`--text-supporting-leading`)};
25
- color: var(--color-text-secondary);
26
- }`),t.push(` :where(code, pre) {
27
- font-family: var(--font-family-code);
28
- font-size: ${e(`--text-code-size`)};
29
- line-height: ${e(`--text-code-leading`)};
30
- }`),t.push(` :where(hr) {
31
- border: none;
32
- border-top: 1px solid var(--color-border);
33
- }`)}function Rn(e,t,n){let r={primary:`var(--color-text-primary)`,secondary:`var(--color-text-secondary)`,disabled:`var(--color-text-disabled)`,placeholder:`var(--color-text-secondary)`,accent:`var(--color-text-accent)`},i=`text`in e,a=`heading`in e,o=`link`in e;if(i||a||o)for(let[e,s]of Object.entries(r))i&&t.push(` ${mn(`text`,U(`color:${e}`),n)} { color: ${s}; }`),a&&t.push(` ${mn(`heading`,U(`color:${e}`),n)} { color: ${s}; }`),o&&t.push(` ${mn(`link`,U(`color:${e}`),n)} { color: ${s}; }`)}var zn={"4xs":`var(--font-size-4xs)`,"3xs":`var(--font-size-3xs)`,"2xs":`var(--font-size-2xs)`,xsm:`var(--font-size-xs)`,sm:`var(--font-size-sm)`,base:`var(--font-size-base)`,lg:`var(--font-size-lg)`,xl:`var(--font-size-xl)`,"2xl":`var(--font-size-2xl)`,"3xl":`var(--font-size-3xl)`,"4xl":`var(--font-size-4xl)`};function Bn(e,t,n){if(`text`in e)for(let[e,r]of Object.entries(zn)){let i=U(`size:${e}`);t.push(` ${mn(`text`,i,n)} { font-size: ${r}; }`)}}function Vn(e,t){let n=Mn(e,t),r=[],i=[];for(let e of n)e.trimStart().startsWith(`:where(`)?r.push(e):i.push(e);return{component:i,prose:r}}function Hn(e,t){let n=[],r=un(e.name),i=Tn(t);for(let t of[`dark`,`light`]){let r=t===`dark`?e.__onDark:e.__onLight;if(!r)continue;let a=t===`dark`?`onDark.`:`onLight.`,o=Object.entries(r.tokens);if(o.length>0){let e=kn(o,`${a}tokens`,i);n.push(` ${fn(t)} {\n${e}\n }`)}r.components&&(In(r.components,n,{resetInheritedPaddingSpecificity:!0,surface:t,sink:i,location:a}),Rn(r.components,n,t),Bn(r.components,n,t),Pn(r.components,n,{surface:t,inheritedComponents:e.components}))}return n.length===0?``:`@scope (${r}) to (${dn}) {\n${n.join(`
34
-
35
- `)}\n}`}function Un(e,t,n){let r=[],i=An(e,t,n);return i!==null&&r.push(i),e.components&&(In(e.components,r,{resetInheritedPaddingSpecificity:!0,sink:n,location:t}),Rn(e.components,r),Bn(e.components,r)),r}function Wn(e){let t=e?.heading;return typeof t==`object`&&!!t&&!Array.isArray(t)}function Gn(e,t,n){return`@media ${e} {\n @scope (${n}) to (${dn}) {\n${t.map(qn).join(`
36
-
37
- `)}\n }\n}`}function Kn(e,t){let n=Tn(t),r=e.__adaptations===void 0?void 0:re(e.name,e.__adaptations,void 0),i=e.__adaptationRules??(r?y(e.name,r,e.__axes??{},e.tokens,e.localTokens,e.components):void 0);if(!i||i.length===0)return{prose:``,component:``};let a=un(e.name),o=[],s=i.some(e=>Wn(e.components));for(let[e,t]of i.entries()){let r=Un(t,`adaptations[${e}].`,n);r.length!==0&&o.push(Gn(t.query,r,a))}if(s){let t=[];Pn(e.components??{},t,{forceAll:!0}),o.push(`@scope (${a}) to (${dn}) {\n${t.join(`
38
-
39
- `)}\n}`);for(let e of i){let t=[];Pn(e.components??{},t,{authoredOnly:!0}),t.length>0&&o.push(Gn(e.query,t,a))}}return{prose:``,component:o.join(`
40
-
41
- `)}}function qn(e){return` ${e}`}function Jn(e,t){let{component:n,prose:r}=Vn(e,t),i=un(e.name),a=dn,o=``;r.length>0&&(o=`@scope (${i}) to (${a}) {\n${r.join(`
42
-
43
- `)}\n}`);let s=``;n.length>0&&(s=`@scope (${i}) to (${a}) {\n${n.join(`
44
-
45
- `)}\n}`);let c=Kn(e,t);c.component&&(s=s?`${s}\n\n${c.component}`:c.component);let l=Hn(e,t);return l&&(s=s?`${s}\n\n${l}`:l),{prose:o,component:s}}var W=e(l(),1),G=n(),Yn={base:{k1xSpc:`xjp7ctv`,kMwMTN:`x1tgivj0`,kMv6JI:`x9ynric`,$$css:!0},light:{kQNsl9:`x19aimcq`,$$css:!0},dark:{kQNsl9:`xntwwlm`,$$css:!0},system:{kQNsl9:`x108lcm5`,$$css:!0}},Xn=W.createContext(!1);Xn.displayName=`ThemeNestingContext`;var Zn=new Set,Qn=`@layer reset, astryx-base, astryx-theme;`;function $n(e){let n=(0,W.useId)();(0,W.useInsertionEffect)(()=>{if(e.__built)return;let r=`astryx-theme-${e.name}`;if(Zn.has(r))return;`${e.name}`,`${e.name}${e.name}${e.name}${e.name}`;let{prose:i,component:a}=Jn(e);Zn.add(r);let o=[()=>Zn.delete(r)];if(i){let r=document.createElement(`style`);r.setAttribute(t(`theme-prose`),e.name),r.setAttribute(t(`id`),n),r.textContent=`${Qn}\n@layer reset {\n${i}\n}`,document.head.appendChild(r)}if(a){let r=document.createElement(`style`);r.setAttribute(t(`theme`),e.name),r.setAttribute(t(`id`),n),r.textContent=`${Qn}\n@layer astryx-theme {\n${a}\n}`,document.head.appendChild(r)}return(i||a)&&o.push(()=>{let r=document.querySelector(`style[${t(`theme-prose`)}="${e.name}"][${t(`id`)}="${n}"]`),i=document.querySelector(`style[${t(`theme`)}="${e.name}"][${t(`id`)}="${n}"]`);r?.remove(),i?.remove()}),()=>{for(let e of o)e()}},[e,n])}function er(e,n,r){g(()=>{if(!e&&typeof document<`u`)return n===`light`||n===`dark`?document.documentElement.setAttribute(`data-theme`,n):document.documentElement.removeAttribute(`data-theme`),document.documentElement.setAttribute(t(`theme`),r),()=>{document.documentElement.removeAttribute(`data-theme`),document.documentElement.removeAttribute(t(`theme`))}},[e,n,r])}function tr({theme:e,mode:t=`system`,children:n}){let r=(0,W.use)(Xn);ae(e),$n(e),er(r,t,e.name);let a=t===`dark`?Yn.dark:t===`light`?Yn.light:Yn.system,o=(0,W.useMemo)(()=>({theme:e,mode:t}),[e,t]);return(0,G.jsx)(b,{value:o,children:(0,G.jsx)(Xn,{value:!0,children:(0,G.jsx)(`div`,{...i(Yn.base,a),"data-astryx-theme":e.name,"data-theme":t===`system`?void 0:t,children:n})})})}tr.displayName=`Theme`;var nr=T(`outline`,`arrow-down`,`ArrowDown`,[[`path`,{d:`M12 5l0 14`,key:`svg-0`}],[`path`,{d:`M18 13l-6 6`,key:`svg-1`}],[`path`,{d:`M6 13l6 6`,key:`svg-2`}]]),rr=T(`outline`,`arrow-up`,`ArrowUp`,[[`path`,{d:`M12 5l0 14`,key:`svg-0`}],[`path`,{d:`M18 11l-6 -6`,key:`svg-1`}],[`path`,{d:`M6 11l6 -6`,key:`svg-2`}]]),ir=T(`outline`,`arrows-sort`,`ArrowsSort`,[[`path`,{d:`M3 9l4 -4l4 4m-4 -4v14`,key:`svg-0`}],[`path`,{d:`M21 15l-4 4l-4 -4m4 4v-14`,key:`svg-1`}]]),ar=T(`outline`,`calendar`,`Calendar`,[[`path`,{d:`M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12`,key:`svg-0`}],[`path`,{d:`M16 3v4`,key:`svg-1`}],[`path`,{d:`M8 3v4`,key:`svg-2`}],[`path`,{d:`M4 11h16`,key:`svg-3`}],[`path`,{d:`M11 15h1`,key:`svg-4`}],[`path`,{d:`M12 15v3`,key:`svg-5`}]]),or=T(`outline`,`checks`,`Checks`,[[`path`,{d:`M7 12l5 5l10 -10`,key:`svg-0`}],[`path`,{d:`M2 12l5 5m5 -5l5 -5`,key:`svg-1`}]]),sr=T(`outline`,`chevron-down`,`ChevronDown`,[[`path`,{d:`M6 9l6 6l6 -6`,key:`svg-0`}]]),cr=T(`outline`,`chevrons-left`,`ChevronsLeft`,[[`path`,{d:`M11 7l-5 5l5 5`,key:`svg-0`}],[`path`,{d:`M17 7l-5 5l5 5`,key:`svg-1`}]]),lr=T(`outline`,`chevrons-right`,`ChevronsRight`,[[`path`,{d:`M7 7l5 5l-5 5`,key:`svg-0`}],[`path`,{d:`M13 7l5 5l-5 5`,key:`svg-1`}]]),ur=T(`outline`,`circle-check`,`CircleCheck`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M9 12l2 2l4 -4`,key:`svg-1`}]]),dr=T(`outline`,`circle-x`,`CircleX`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M10 10l4 4m0 -4l-4 4`,key:`svg-1`}]]),fr=T(`outline`,`clock`,`Clock`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 7v5l3 3`,key:`svg-1`}]]),pr=T(`outline`,`columns`,`Columns`,[[`path`,{d:`M4 6l5.5 0`,key:`svg-0`}],[`path`,{d:`M4 10l5.5 0`,key:`svg-1`}],[`path`,{d:`M4 14l5.5 0`,key:`svg-2`}],[`path`,{d:`M4 18l5.5 0`,key:`svg-3`}],[`path`,{d:`M14.5 6l5.5 0`,key:`svg-4`}],[`path`,{d:`M14.5 10l5.5 0`,key:`svg-5`}],[`path`,{d:`M14.5 14l5.5 0`,key:`svg-6`}],[`path`,{d:`M14.5 18l5.5 0`,key:`svg-7`}]]),mr=T(`outline`,`dots`,`Dots`,[[`path`,{d:`M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-2`}]]),hr=T(`outline`,`filter`,`Filter`,[[`path`,{d:`M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227`,key:`svg-0`}]]),gr=T(`outline`,`menu-2`,`Menu2`,[[`path`,{d:`M4 6l16 0`,key:`svg-0`}],[`path`,{d:`M4 12l16 0`,key:`svg-1`}],[`path`,{d:`M4 18l16 0`,key:`svg-2`}]]),_r=T(`outline`,`microphone`,`Microphone`,[[`path`,{d:`M9 5a3 3 0 0 1 3 -3a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3a3 3 0 0 1 -3 -3l0 -5`,key:`svg-0`}],[`path`,{d:`M5 10a7 7 0 0 0 14 0`,key:`svg-1`}],[`path`,{d:`M8 21l8 0`,key:`svg-2`}],[`path`,{d:`M12 17l0 4`,key:`svg-3`}]]),vr=T(`outline`,`pencil`,`Pencil`,[[`path`,{d:`M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`,key:`svg-0`}],[`path`,{d:`M13.5 6.5l4 4`,key:`svg-1`}]]),yr=T(`outline`,`upload`,`Upload`,[[`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M7 9l5 -5l5 5`,key:`svg-1`}],[`path`,{d:`M12 4l0 12`,key:`svg-2`}]]),br=T(`filled`,`player-stop-filled`,`PlayerStopFilled`,[[`path`,{d:`M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z`,key:`svg-0`}]]),xr=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function Sr(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:xr(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var Cr=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},wr=e=>{let t=Cr(e);return t.charAt(0).toUpperCase()+t.slice(1)},Tr=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),K={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function Er(e){return e!=null}function Dr(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??K.width,a=e.size??e.height??K.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?Tr(...c):Tr(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??K[`stroke-width`])*Number(e.size??e.width??K.width)/Number(t.size??t.width??K.width):t.strokeWidth??K[`stroke-width`];return[`svg`,{...Object.entries(K).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Er(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Er(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Er(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Or(e,t={}){return Dr(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var kr=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ar=(0,W.createContext)({}),jr=()=>(0,W.useContext)(Ar),Mr=(0,W.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=jr()??{},ee=!!c||kr(d),[te,ne,y=[]]=Or(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:Tr(v,s),hasA11yProp:ee,attributes:d});return(0,W.createElement)(te,{ref:f,...ne},[...y.map(([e,t])=>(0,W.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function q(e,t=[],n=[]){let r=typeof e==`string`?Sr(e,t,n):e,i=(0,W.forwardRef)(({className:e,...t},n)=>(0,W.createElement)(Mr,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=wr(r.name)),i}var Nr={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Nr.node;var Pr=q(Nr),Fr={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};Fr.node;var Ir=q(Fr),Lr={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Lr.node;var Rr=q(Lr),zr={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};zr.node;var Br=q(zr),Vr={name:`check-check`,size:24,node:[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]};Vr.node;var Hr=q(Vr),Ur={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Ur.node;var Wr=q(Ur),Gr={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Gr.node;var Kr=q(Gr),qr={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};qr.node;var Jr=q(qr),Yr={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Yr.node;var Xr=q(Yr),Zr={name:`chevrons-left`,size:24,node:[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]};Zr.node;var Qr=q(Zr),$r={name:`chevrons-right`,size:24,node:[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]};$r.node;var ei=q($r),ti={name:`circle-check-big`,size:24,node:[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]],aliases:[`check-circle`]};ti.node;var ni=q(ti),ri={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};ri.node;var ii=q(ri),ai={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};ai.node;var oi=q(ai),si={name:`columns-2`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]],aliases:[`columns`]};si.node;var ci=q(si),li={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};li.node;var ui=q(li),di={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};di.node;var fi=q(di),pi={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};pi.node;var mi=q(pi),hi={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};hi.node;var gi=q(hi),_i={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};_i.node;var vi=q(_i),yi={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};yi.node;var bi=q(yi),xi={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};xi.node;var Si=q(xi),Ci={name:`mic`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]};Ci.node;var wi=q(Ci),Ti={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ti.node;var Ei=q(Ti),Di={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};Di.node;var Oi=q(Di),ki={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};ki.node;var Ai=q(ki),ji={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};ji.node;var Mi=q(ji),Ni={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};Ni.node;var Pi=q(Ni),Fi={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Fi.node;var Ii=q(Fi),J={size:`1em`,"aria-hidden":!0},Li={name:`neutral`,__built:!0,tokens:{"--font-size-4xs":`0.375rem`,"--font-size-3xs":`0.4375rem`,"--font-size-2xs":`0.5rem`,"--font-size-xs":`0.625rem`,"--font-size-sm":`0.75rem`,"--font-size-base":`0.875rem`,"--font-size-lg":`1.0625rem`,"--font-size-xl":`1.25rem`,"--font-size-2xl":`1.5rem`,"--font-size-3xl":`1.8125rem`,"--font-size-4xl":`2.1875rem`,"--font-size-5xl":`2.625rem`,"--text-heading-1-size":`var(--font-size-2xl)`,"--text-heading-1-weight":`var(--font-weight-semibold)`,"--text-heading-1-leading":`1.3333`,"--text-heading-2-size":`var(--font-size-xl)`,"--text-heading-2-weight":`var(--font-weight-semibold)`,"--text-heading-2-leading":`1.4`,"--text-heading-3-size":`var(--font-size-lg)`,"--text-heading-3-weight":`var(--font-weight-bold)`,"--text-heading-3-leading":`1.4118`,"--text-heading-4-size":`var(--font-size-base)`,"--text-heading-4-weight":`var(--font-weight-bold)`,"--text-heading-4-leading":`1.4286`,"--text-heading-5-size":`var(--font-size-sm)`,"--text-heading-5-weight":`var(--font-weight-semibold)`,"--text-heading-5-leading":`1.6667`,"--text-heading-6-size":`var(--font-size-xs)`,"--text-heading-6-weight":`var(--font-weight-semibold)`,"--text-heading-6-leading":`1.6`,"--text-body-size":`var(--font-size-base)`,"--text-body-weight":`var(--font-weight-normal)`,"--text-body-leading":`1.4286`,"--text-large-size":`var(--font-size-lg)`,"--text-large-weight":`var(--font-weight-semibold)`,"--text-large-leading":`1.4118`,"--text-label-size":`var(--font-size-base)`,"--text-label-weight":`var(--font-weight-medium)`,"--text-label-leading":`1.4286`,"--text-code-size":`var(--font-size-base)`,"--text-code-weight":`var(--font-weight-normal)`,"--text-code-leading":`1.4286`,"--text-supporting-size":`var(--font-size-sm)`,"--text-supporting-weight":`var(--font-weight-normal)`,"--text-supporting-leading":`1.6667`,"--text-display-1-size":`var(--font-size-5xl)`,"--text-display-1-weight":`var(--font-weight-normal)`,"--text-display-1-leading":`1.2381`,"--text-display-2-size":`var(--font-size-4xl)`,"--text-display-2-weight":`var(--font-weight-normal)`,"--text-display-2-leading":`1.2571`,"--text-display-3-size":`var(--font-size-3xl)`,"--text-display-3-weight":`var(--font-weight-normal)`,"--text-display-3-leading":`1.3793`,"--duration-fast-min":`95ms`,"--duration-fast":`125ms`,"--duration-fast-max":`165ms`,"--duration-medium-min":`225ms`,"--duration-medium":`300ms`,"--duration-medium-max":`400ms`,"--duration-slow-min":`525ms`,"--duration-slow":`700ms`,"--duration-slow-max":`935ms`,"--font-family-body":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-heading":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-code":`ui-monospace, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,"--color-syntax-keyword":`light-dark(#6b187c, #efa8ff)`,"--color-syntax-string":`light-dark(#0b5615, #a4d6a3)`,"--color-syntax-comment":`light-dark(#6a6a6a, #9e9e9e)`,"--color-syntax-number":`light-dark(#733100, #ffb37e)`,"--color-syntax-function":`light-dark(#00458c, #a1caff)`,"--color-syntax-type":`light-dark(#6b187c, #efa8ff)`,"--color-syntax-variable":`light-dark(#111111, #e2e2e2)`,"--color-syntax-operator":`light-dark(#6a6a6a, #9e9e9e)`,"--color-syntax-constant":`light-dark(#733100, #ffb37e)`,"--color-syntax-tag":`light-dark(#8a0011, #ffaea7)`,"--color-syntax-attribute":`light-dark(#584400, #eec448)`,"--color-syntax-property":`light-dark(#005348, #90d7c8)`,"--color-syntax-punctuation":`light-dark(#6a6a6a, #9e9e9e)`,"--color-syntax-background":`light-dark(#ffffff, #111111)`,"--color-syntax-added":`color-mix(in srgb, var(--color-success-muted) 25%, transparent)`,"--color-syntax-removed":`color-mix(in srgb, var(--color-error-muted) 25%, transparent)`,"--color-syntax-diff-header":`transparent`,"--color-syntax-added-marker":`var(--color-syntax-punctuation)`,"--color-syntax-removed-marker":`var(--color-syntax-punctuation)`,"--color-background-surface":`light-dark(#ffffff, #262626)`,"--color-background-body":`light-dark(#f1f1f1, #1b1b1b)`,"--color-background-card":`light-dark(#ffffff, #1b1b1b)`,"--color-background-popover":`light-dark(#ffffff, #1b1b1b)`,"--color-background-muted":`light-dark(#f1f1f1, #1b1b1b)`,"--color-accent":`light-dark(#1b1b1b, #f1f1f1)`,"--color-accent-muted":`light-dark(#f1f1f1, #262626)`,"--color-neutral":`light-dark(#0000000F, #ffffff1A)`,"--color-overlay":`light-dark(#00000080, #000000CC)`,"--color-overlay-hover":`light-dark(#0000000D, #ffffff0D)`,"--color-overlay-pressed":`light-dark(#0000001A, #ffffff1A)`,"--color-text-primary":`light-dark(#000000, #ffffff)`,"--color-text-secondary":`light-dark(#474747, #9e9e9e)`,"--color-text-disabled":`light-dark(#919191, #525252)`,"--color-text-accent":`light-dark(#1b1b1b, #f1f1f1)`,"--color-on-dark":`#ffffff`,"--color-on-light":`#111111`,"--color-on-accent":`light-dark(#ffffff, #111111)`,"--color-on-success":`light-dark(#ffffff, #111111)`,"--color-on-error":`light-dark(#ffffff, #111111)`,"--color-on-warning":`#111111`,"--color-icon-accent":`light-dark(#1b1b1b, #f1f1f1)`,"--color-icon-primary":`light-dark(#000000, #ffffff)`,"--color-icon-secondary":`light-dark(#6a6a6a, #9e9e9e)`,"--color-icon-disabled":`light-dark(#919191, #525252)`,"--color-success":`light-dark(#00490b, #a4d6a3)`,"--color-error":`light-dark(#76000c, #ffc4be)`,"--color-warning":`light-dark(#4b3900, #f8d36a)`,"--color-success-muted":`light-dark(#bce0bb, #90ca903D)`,"--color-error-muted":`light-dark(#ffc4be, #ff98903D)`,"--color-warning-muted":`light-dark(#fae19e, #e2b6233D)`,"--color-border":`light-dark(#00000014, #ffffff1A)`,"--color-border-emphasized":`light-dark(#d4d4d4, #525252)`,"--color-skeleton":`light-dark(#f1f1f1, #525252)`,"--color-shadow":`light-dark(#0000001A, #0000004D)`,"--color-tint-hover":`light-dark(black, white)`,"--color-background-red":`light-dark(#ffc4be, #5b2b28)`,"--color-border-red":`light-dark(#ffaea7, #fa6762)`,"--color-icon-red":`light-dark(#76000c, #ff9890)`,"--color-text-red":`light-dark(#76000c, #ffaea7)`,"--color-background-orange":`light-dark(#ffc7a1, #503424)`,"--color-border-orange":`light-dark(#ffc7a1, #df843f)`,"--color-icon-orange":`light-dark(#622700, #ff9e55)`,"--color-text-orange":`light-dark(#622700, #ffb37e)`,"--color-background-yellow":`light-dark(#fae19e, #453a1c)`,"--color-border-yellow":`light-dark(#e3c36c, #c29900)`,"--color-icon-yellow":`light-dark(#4b3900, #e2b623)`,"--color-text-yellow":`light-dark(#4b3900, #eec448)`,"--color-background-green":`light-dark(#bce0bb, #2b422b)`,"--color-border-green":`light-dark(#aad4a9, #6ab26b)`,"--color-icon-green":`light-dark(#00490b, #90ca90)`,"--color-text-green":`light-dark(#00490b, #90ca90)`,"--color-background-teal":`light-dark(#a9e2d6, #28413c)`,"--color-border-teal":`light-dark(#90d7c8, #4fb1a0)`,"--color-icon-teal":`light-dark(#00463d, #81c9bb)`,"--color-text-teal":`light-dark(#00463d, #90d7c8)`,"--color-background-cyan":`light-dark(#9ae2f4, #274046)`,"--color-border-cyan":`light-dark(#85d5e9, #49adc4)`,"--color-icon-cyan":`light-dark(#004351, #71c7dd)`,"--color-text-cyan":`light-dark(#004351, #85d5e9)`,"--color-background-blue":`light-dark(#b9d7ff, #253c5a)`,"--color-border-blue":`light-dark(#a1caff, #5aa0f8)`,"--color-icon-blue":`light-dark(#003978, #88bcff)`,"--color-text-blue":`light-dark(#003978, #a1caff)`,"--color-background-purple":`light-dark(#f7d5ff, #4a2f51)`,"--color-border-purple":`light-dark(#f3bfff, #d885eb)`,"--color-icon-purple":`light-dark(#5c0e6c, #e496f6)`,"--color-text-purple":`light-dark(#5c0e6c, #eaacf8)`,"--color-background-pink":`light-dark(#ffc0d7, #572b3d)`,"--color-border-pink":`light-dark(#ffc0d7, #fc78b1)`,"--color-icon-pink":`light-dark(#70003f, #fd92bd)`,"--color-text-pink":`light-dark(#70003f, #ffa9ca)`,"--color-background-gray":`light-dark(#e2e2e2, #303030)`,"--color-border-gray":`light-dark(#d4d4d4, #262626)`,"--color-icon-gray":`light-dark(#474747, #9e9e9e)`,"--color-text-gray":`light-dark(#1b1b1b, #d4d4d4)`,"--radius-none":`0px`,"--radius-inner":`0.375rem`,"--radius-element":`0.625rem`,"--radius-container":`0.75rem`,"--radius-page":`1.75rem`,"--radius-full":`9999px`,"--shadow-low":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 25%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 40%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 8%))`,"--shadow-med":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 35%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 12%))`,"--shadow-high":`0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 70%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 15%))`,"--shadow-inset-hover":`inset 0px 0px 0px 2px #0074e24D`,"--shadow-inset-selected":`inset 0px 0px 0px 2px #0074e280`,"--shadow-inset-success":`inset 0px 0px 0px 2px #2f7d334D`,"--shadow-inset-warning":`inset 0px 0px 0px 2px #f8d36a4D`,"--shadow-inset-error":`inset 0px 0px 0px 2px #de47454D`},localTokens:{"--astryx-theme-neutral-color-status-fill-accent":`light-dark(#0074e2, #6d9cfe)`,"--astryx-theme-neutral-color-status-fill-success":`light-dark(#198100, #64af4c)`,"--astryx-theme-neutral-color-status-fill-warning":`#ffce2f`,"--astryx-theme-neutral-color-status-fill-error":`light-dark(#c9303a, #ff705d)`,"--astryx-theme-neutral-color-status-muted-accent":`light-dark(#b9d7ff, #88bcff3D)`,"--astryx-theme-neutral-color-on-tint-neutral":`light-dark(#fafafa4D, #0a0a0a4D)`,"--astryx-theme-neutral-color-on-tint-overlay-hover":`light-dark(#fafafa1A, #0a0a0a1A)`,"--astryx-theme-neutral-color-on-tint-overlay-pressed":`light-dark(#fafafa33, #0a0a0a33)`,"--astryx-theme-neutral-color-destructive-overlay-hover":`light-dark(#ff7f770D, #ee736c0D)`,"--astryx-theme-neutral-color-destructive-overlay-pressed":`light-dark(#ff7f771A, #ee736c1A)`},__localTokenOwners:{"--astryx-theme-neutral-color-status-fill-accent":`neutral`,"--astryx-theme-neutral-color-status-fill-success":`neutral`,"--astryx-theme-neutral-color-status-fill-warning":`neutral`,"--astryx-theme-neutral-color-status-fill-error":`neutral`,"--astryx-theme-neutral-color-status-muted-accent":`neutral`,"--astryx-theme-neutral-color-on-tint-neutral":`neutral`,"--astryx-theme-neutral-color-on-tint-overlay-hover":`neutral`,"--astryx-theme-neutral-color-on-tint-overlay-pressed":`neutral`,"--astryx-theme-neutral-color-destructive-overlay-hover":`neutral`,"--astryx-theme-neutral-color-destructive-overlay-pressed":`neutral`},__localTokenLineage:[`neutral`],components:{heading:{"level:1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-1-size)`,fontWeight:`var(--text-heading-1-weight)`,lineHeight:`var(--text-heading-1-leading)`},"level:2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-2-size)`,fontWeight:`var(--text-heading-2-weight)`,lineHeight:`var(--text-heading-2-leading)`},"level:3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-3-size)`,fontWeight:`var(--text-heading-3-weight)`,lineHeight:`var(--text-heading-3-leading)`},"level:4":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-4-size)`,fontWeight:`var(--text-heading-4-weight)`,lineHeight:`var(--text-heading-4-leading)`},"level:5":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-5-size)`,fontWeight:`var(--text-heading-5-weight)`,lineHeight:`var(--text-heading-5-leading)`},"level:6":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-6-size)`,fontWeight:`var(--text-heading-6-weight)`,lineHeight:`var(--text-heading-6-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},text:{"type:body":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-body-size)`,lineHeight:`var(--text-body-leading)`},"type:large":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-large-size)`,lineHeight:`var(--text-large-leading)`},"type:label":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-label-size)`,lineHeight:`var(--text-label-leading)`},"type:code":{fontFamily:`var(--font-family-code)`,fontSize:`var(--text-code-size)`,lineHeight:`var(--text-code-leading)`},"type:supporting":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-supporting-size)`,lineHeight:`var(--text-supporting-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},button:{"variant:destructive":{backgroundColor:`var(--color-error-muted)`,color:`var(--color-error)`,"--color-overlay-hover":`var(--astryx-theme-neutral-color-destructive-overlay-hover)`,"--color-overlay-pressed":`var(--astryx-theme-neutral-color-destructive-overlay-pressed)`}},badge:{"variant:info":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-accent)`,color:`var(--color-on-accent)`},"variant:neutral":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`},"variant:success":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-success)`,color:`var(--color-on-success)`},"variant:warning":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-warning)`,color:`var(--color-on-warning)`},"variant:error":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-error)`,color:`var(--color-on-error)`},"variant:red":{backgroundColor:`var(--color-background-red)`,color:`var(--color-text-red)`},"variant:orange":{backgroundColor:`var(--color-background-orange)`,color:`var(--color-text-orange)`},"variant:yellow":{backgroundColor:`var(--color-background-yellow)`,color:`var(--color-text-yellow)`},"variant:green":{backgroundColor:`var(--color-background-green)`,color:`var(--color-text-green)`},"variant:teal":{backgroundColor:`var(--color-background-teal)`,color:`var(--color-text-teal)`},"variant:cyan":{backgroundColor:`var(--color-background-cyan)`,color:`var(--color-text-cyan)`},"variant:blue":{backgroundColor:`var(--color-background-blue)`,color:`var(--color-text-blue)`},"variant:purple":{backgroundColor:`var(--color-background-purple)`,color:`var(--color-text-purple)`},"variant:pink":{backgroundColor:`var(--color-background-pink)`,color:`var(--color-text-pink)`},"variant:gray":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`}},"status-dot":{"variant:success":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-success)`},"variant:warning":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-warning)`},"variant:error":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-error)`},"variant:accent":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-accent)`}},"avatar-status-dot":{"variant:success":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-success)`},"variant:error":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-error)`}},"segmented-control":{base:{padding:`var(--spacing-1)`}},"segmented-control-item":{"size:sm":{height:`calc(var(--size-element-sm) - 8px)`},"size:md":{height:`calc(var(--size-element-md) - 8px)`},"size:lg":{height:`calc(var(--size-element-lg) - 8px)`},selected:{boxShadow:`none`}},banner:{base:{"--color-neutral":`var(--astryx-theme-neutral-color-on-tint-neutral)`,"--color-overlay-hover":`var(--astryx-theme-neutral-color-on-tint-overlay-hover)`,"--color-overlay-pressed":`var(--astryx-theme-neutral-color-on-tint-overlay-pressed)`},"status:info":{"--color-accent-muted":`var(--astryx-theme-neutral-color-status-muted-accent)`,"--color-text-primary":`var(--color-text-blue)`,"--color-text-secondary":`var(--color-text-blue)`,"--color-accent":`var(--color-text-blue)`},"status:success":{"--color-text-primary":`var(--color-text-green)`,"--color-text-secondary":`var(--color-text-green)`,"--color-success":`var(--color-text-green)`},"status:warning":{"--color-text-primary":`var(--color-text-yellow)`,"--color-text-secondary":`var(--color-text-yellow)`,"--color-warning":`var(--color-text-yellow)`},"status:error":{"--color-text-primary":`var(--color-text-red)`,"--color-text-secondary":`var(--color-text-red)`,"--color-error":`var(--color-text-red)`}},"step-indicator":{"status:accent":{"--color-accent":`var(--astryx-theme-neutral-color-status-fill-accent)`},"status:success":{"--color-success":`var(--astryx-theme-neutral-color-status-fill-success)`},"status:warning":{"--color-warning":`var(--astryx-theme-neutral-color-status-fill-warning)`},"status:error":{"--color-error":`var(--astryx-theme-neutral-color-status-fill-error)`}},switch:{base:{"--color-background-gray":`var(--color-border-emphasized)`}},"progress-bar":{base:{"--color-background-muted":`var(--color-border-emphasized)`},"variant:accent":{"--color-accent":`var(--astryx-theme-neutral-color-status-fill-accent)`},"variant:success":{"--color-success":`var(--astryx-theme-neutral-color-status-fill-success)`},"variant:warning":{"--color-warning":`var(--astryx-theme-neutral-color-status-fill-warning)`},"variant:error":{"--color-error":`var(--astryx-theme-neutral-color-status-fill-error)`}},card:{base:{padding:`var(--spacing-3)`}},section:{base:{padding:`var(--spacing-3)`}}},__onDark:{tokens:{"color-scheme":`dark`,"--color-text-primary":`var(--color-on-dark)`,"--color-icon-primary":`var(--color-on-dark)`,"--color-accent":`var(--color-on-dark)`}},__onLight:{tokens:{"color-scheme":`light`,"--color-text-primary":`var(--color-on-light)`,"--color-icon-primary":`var(--color-on-light)`,"--color-accent":`var(--color-on-light)`}},__adaptations:{widthBreakpoints:{sm:640,md:768,lg:1024,xl:1280,"2xl":1536},rules:[{when:{pointer:`coarse`,width:{below:`lg`}},value:{typography:{scale:{base:16,ratio:1.1736}}}}]},__axes:{typography:{scale:{base:14,ratio:1.2},body:{family:`Figtree`,fallbacks:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`},heading:{family:`Figtree`,fallbacks:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,weights:{3:`bold`,4:`bold`}},code:{family:`ui-monospace`,fallbacks:`"SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`}},motion:{fast:125,medium:300,slow:700,ratio:.75}},icons:{close:(0,G.jsx)(Ii,{...J}),chevronDown:(0,G.jsx)(Kr,{...J}),chevronLeft:(0,G.jsx)(Jr,{...J}),chevronRight:(0,G.jsx)(Xr,{...J}),chevronsLeft:(0,G.jsx)(Qr,{...J}),chevronsRight:(0,G.jsx)(ei,{...J}),check:(0,G.jsx)(Wr,{...J}),success:(0,G.jsx)(ni,{...J}),error:(0,G.jsx)(ii,{...J}),warning:(0,G.jsx)(Ai,{...J}),info:(0,G.jsx)(bi,{...J}),calendar:(0,G.jsx)(Br,{...J}),clock:(0,G.jsx)(oi,{...J}),externalLink:(0,G.jsx)(mi,{...J}),menu:(0,G.jsx)(Si,{...J}),moreHorizontal:(0,G.jsx)(fi,{...J}),search:(0,G.jsx)(Ei,{...J}),upload:(0,G.jsx)(Mi,{...J}),arrowUp:(0,G.jsx)(Rr,{...J}),arrowDown:(0,G.jsx)(Pr,{...J}),arrowsUpDown:(0,G.jsx)(Ir,{...J}),funnel:(0,G.jsx)(vi,{...J}),eyeSlash:(0,G.jsx)(gi,{...J}),viewColumns:(0,G.jsx)(ci,{...J}),copy:(0,G.jsx)(ui,{...J}),checkDouble:(0,G.jsx)(Hr,{...J}),wrench:(0,G.jsx)(Pi,{...J}),stop:(0,G.jsx)(Oi,{...J}),microphone:(0,G.jsx)(wi,{...J})}},Ri=Object.fromEntries(Object.entries({close:ee,chevronDown:sr,chevronLeft:xe,chevronRight:be,chevronsLeft:cr,chevronsRight:lr,check:ye,success:ur,error:dr,warning:E,info:C,calendar:ar,clock:fr,externalLink:O,menu:gr,moreHorizontal:mr,search:k,arrowUp:rr,arrowDown:nr,arrowsUpDown:ir,funnel:hr,eyeSlash:pe,viewColumns:pr,copy:D,checkDouble:or,wrench:ve,stop:br,microphone:_r,upload:yr}).map(([e,t])=>[e,(0,W.createElement)(t,{size:`1em`,stroke:1.75,"aria-hidden":!0})])),zi=[R,Te,Ae];function Bi(e,t=[]){return[...t,...zi].find(t=>t.id===e.protocol)?.embeddingLimits?.(e.apiId)}var Vi=`••••`,Hi=/auth|key|token|secret|passw|pwd|cookie|session|signature|^sig$|credential|^code$|appid/i,Ui=/auth|key|token|secret|passw|pwd|signature|credential|appid/i,Wi=[[/^AIza/,`Google API key`],[/^sk-or-/,`OpenRouter key`],[/^sk-ant-/,`Anthropic key`],[/^sk-/,`OpenAI key`],[/^(?:ghp_|github_pat_)/,`GitHub token`],[/^xox[baprs]-/,`Slack token`],[/^AKIA/,`AWS access key id`],[/^eyJ[\w-]+\.[\w-]+\./,`JWT`],[/^Bearer\s/i,`a whole Bearer header, not a bare token`],[/^https?:\/\//i,`a URL, not a key`]],Gi=16;function Ki(e,t={}){let n=typeof e==`string`?e:``,r=n.trim(),i=[];/^(?:<.*>|x{3,}|\.{3}|your[-_ ]?(?:api[-_ ]?)?key|changeme|todo)$/i.test(r)?i.push(`a placeholder, not a real value`):(r&&r!==n&&i.push(`spaces or a line break around it`),/[\r\n]/.test(r)?i.push(`a line break inside`):/\s/.test(r)&&i.push(`a space inside`),/^(['"`]).*\1$/.test(r)&&i.push(`wrapped in quotes`),r&&r.length<Gi&&i.push(`shorter than keys usually are`));let a=Wi.find(([e])=>e.test(r))?.[1];return{secret:!0,set:r.length>0,...a?{looksLike:a}:{},problems:i,sameAs:[...t.sameAs??[]],usedBy:[...t.usedBy??[]]}}var qi=/^([a-z][a-z0-9+.-]*:\/\/)([^/?#@]*)@/i,Ji=/([?&;])([^=?&;#\s]*)=([^&;#\s]*)/g;function Yi(e){let t=e.indexOf(`:`);return t<0?[e,void 0]:[e.slice(0,t),e.slice(t+1)]}function Xi(e){try{return decodeURIComponent(e)}catch{return e}}function Zi(e){return Hi.test(e)}function Qi(e){let t=URL.canParse(e)?Hi:Ui;return e.replace(qi,(e,t,n)=>{let[r,i]=Yi(n);return`${t}${r&&`••••`}${i===void 0?``:`:${i&&`••••`}`}@`}).replace(Ji,(e,n,r,i)=>i&&t.test(Xi(r))?`${n}${r}=${Vi}`:e)}function $i(e,t){let[n,r]=Yi(qi.exec(t)?.[2]??``),i=new Map;for(let[,,e=``,n=``]of t.matchAll(Ji))i.set(e,[...i.get(e)??[],n]);return e.replace(qi,(e,t,i)=>{let[a,o]=Yi(i),s=a===`••••`&&n?n:a,c=o===`••••`&&r?r:o;return`${t}${s}${c===void 0?``:`:${c}`}@`}).replace(Ji,(e,t,n,r)=>{let a=r===`••••`?i.get(n)?.shift():void 0;return a?`${t}${n}=${a}`:e})}function ea(e){if(e==null||e===``)return e;let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return`(not a JSON object, ${String(e.length)} characters)`}if(typeof t!=`object`||!t||Array.isArray(t))return`(not a JSON object)`;let n=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Zi(e)?Vi:t]));return typeof e==`string`?JSON.stringify(n):n}function ta(e,t){if(rt(e))return{error:e.publicMessage??qe(`error.${e.kind}`,{},t),errorKind:e.kind,...e.internalMessage?{errorInternal:e.internalMessage}:{}};let n=De(e,t),r=Be(e);return{error:n,errorKind:Oe(e),...r&&r!==n?{errorInternal:r}:{}}}function na(e,t,n){let r=ta(e,t),i=r.errorKind===`cancelled`||n?.aborted===!0;return{...r,...i?{aborted:!0}:{}}}function ra(e,t=[]){let n=e.models[e.defaultModel];return{type:`embedding`,identity:{handle:e.identity.handle},inputs:at(e.inputs,n?Bi(n,t):void 0),...e.observability?{observability:{record:Lt(e.observability).record}}:{}}}var ia=I({result:I({model:F().min(1),embeddings:N(I({index:P().int().nonnegative(),values:N(P()),dimensions:P().int().positive()}).refine(e=>e.values.length===e.dimensions,`vector length must match dimensions`)),usage:I({inputTokens:P().int().nonnegative().optional(),costUsd:P().nonnegative().optional(),estimated:M(!0).optional()}).optional()}),traces:N(zt).optional()}),aa=I({interface:I({type:M(`embedding`),identity:I({handle:F()}),inputs:I({text:Se(),attachments:I({accept:N(F())}).optional(),maxFiles:P().optional(),maxBytes:P().optional(),maxTurnBytes:P().optional(),limitsByMime:we(F(),P()).optional()}),observability:I({record:Se()}).optional()})});function oa(e){return it(ia,e,`the embedding`)}function sa(e,t,n,r={}){return vt(e,t,n,r,oa)}function ca(e={}){let t=(e.endpoint??`/api/embedding`).replace(/\/$/,``);return{async describe(n){return it(aa,await Et(t,{signal:n},e),`the embedding description`).interface},embed:(n,r,i)=>sa(`${t}/embed`,{input:n,...r},i,e)}}var la=[`function`,`http`,`mcp`];function ua(e){return la.includes(e)}function da(e,t){return{type:`host`,id:e.id,tools:e.tools.allow.flatMap(e=>{let n=t(e);return!n||!ua(n.type)?[]:[{name:n.name,description:n.description,kind:n.type,access:n.access,permission:n.permission,inputSchema:n.inputSchema,outputSchema:n.outputSchema}]}),...e.observability?{observability:{record:Lt(e.observability).record}}:{}}}I({name:F().min(1).max(128),input:A()});var fa=we(F(),A()),pa=I({interface:I({type:M(`host`),id:F(),tools:N(I({name:F(),description:F(),kind:Ce(la),access:Ce(Re),permission:Ce(Fe),inputSchema:fa,outputSchema:fa})),observability:I({record:Se()}).optional()})});function ma(e={}){let t=(e.endpoint??`/api/host`).replace(/\/$/,``);return{pageResult:(n,r)=>lt(`${t}/page-result`,n,{...e,signal:r}),async describe(n){return it(pa,await Et(t,{signal:n},e),`the host description`).interface},call:(n,r,i)=>B(`${t}/call`,n,L,r,{...e,signal:i}),invoke:({replay:n,...r},i,a)=>B(`${t}/invoke`,r,L,i,{...e,signal:a})}}function Y(){let e=[],t=new Set;return{push(n){e=[...e,n];for(let e of t)e()},records:()=>e,subscribe(e){return t.add(e),()=>{t.delete(e)}}}}var ha=/\{\s*private\s*:/g;function ga(e,t){return e.slice(0,t).split(`
46
- `).length}function _a(e){let t=[],n=0;for(let r of e.matchAll(ha)){if(r.index<n)continue;let i=1,a=r.index+r[0].length;for(;a<e.length&&i>0;a++)e[a]===`{`?i++:e[a]===`}`&&i--;if(i>0)return{ok:!1,message:`The {private: section on line ${String(ga(e,r.index))} has no closing }.`};let o=e.slice(r.index+r[0].length,a-1).trim();if(!o)return{ok:!1,message:`The {private: section on line ${String(ga(e,r.index))} is empty.`};t.push(e.slice(n,r.index),{private:o}),n=a}if(t.push(e.slice(n)),t.length===1)return{ok:!0,prompt:e.trim()||void 0};let r=t[0],i=t.at(-1);return typeof r==`string`&&(t[0]=r.trimStart()),typeof i==`string`&&(t[t.length-1]=i.trimEnd()),{ok:!0,prompt:t.filter(e=>e!==``)}}var va=()=>void 0,ya=()=>void 0;function X(e){return(e??[]).map(e=>e.trim()).filter(Boolean)}function Z(e,t,n,r,i,a){i===null||Number.isInteger(i)&&i>=a||e(t,`${r} must be a ${a?`positive`:`non-negative`} whole number.`,n)}var ba={agentId:{label:`Profile id`,max:64},handle:{label:`Handle`,max:32}};function xa(e,t,n){let{label:r,max:i}=ba[t];n.trim()?Array.from(n).length>i&&e(`identity`,`${r} is at most ${i} characters.`,t):e(`identity`,`${r} is required.`,t)}function Sa(e,t){xa(t,`agentId`,e.identity.agentId),e.identity.profileType!==`host`&&xa(t,`handle`,e.identity.handle)}function Ca(e,t,n,r){let i=H(e.key),a=ze(n,t,{...e,apiId:e.apiId.trim()}),o=n.find(t=>t.id===e.provider);return o?We(o,t)?We(o,t,e.protocol)||r(i,`${e.provider} doesn't serve ${t} agents on ${e.protocol}.`,`protocol`):r(i,`${e.provider} doesn't serve ${t} agents.`,`provider`):r(i,`No provider is defined as ${e.provider}.`,`provider`),a.apiId||r(i,`API model is required.`,`apiId`),a}function wa(e,t,n,r){let i={};e.efforts.forEach(({alias:a,level:o},s)=>{let c=a.trim();c?c in i?r(n,`Effort alias '${c}' is used twice.`,`efforts`,s):i[c]=o:r(n,`Every effort needs an alias.`,`efforts`,s),z(t)&&!je.includes(o)&&r(n,`${e.provider} doesn't take the ${o} thinking level.`,`efforts`,s)}),e.allowEffortSelect&&Object.keys(i).length<2&&r(n,`Effort select needs at least two efforts.`,`allowEffortSelect`);let a=e.defaultEffort.trim();return!a&&Dt(e)?r(n,`Pick a default effort — there is more than one.`,`defaultEffort`):a&&!(a in i)&&r(n,`Default effort '${a}' is not one of the efforts.`,`defaultEffort`),{efforts:i,defaultEffort:a}}function Ta(e,t,n,r,i){let a=H(e.key),o=Ca(e,t,n,r),{apiId:s}=o,{efforts:c,defaultEffort:l}=wa(e,o,a,r),u=Object.keys(c).length;Z(r,a,`maxOutputTokens`,`Max output tokens`,e.maxOutputTokens,1),e.temperature!==null&&!(Number.isFinite(e.temperature)&&e.temperature>=0)&&r(a,`Temperature must be zero or more.`,`temperature`),Ea(e,n,t,a,r);let d=Da(e,t,a,r,i);return{protocol:e.protocol,provider:e.provider,apiId:s,...e.keySlot?{keySlot:e.keySlot}:{},...e.fallbackKeySlot?{fallbackKeySlot:e.fallbackKeySlot}:{},...u?{efforts:c}:{},...l?{defaultEffort:l}:{},...e.allowEffortSelect?{allowEffortSelect:!0}:{},...e.summaries===null?{}:{summaries:e.summaries},...e.maxOutputTokens===null?{}:{maxOutputTokens:e.maxOutputTokens},...e.temperature===null?{}:{temperature:e.temperature},...e.builtInTools.length?{builtInTools:[...e.builtInTools]}:{},...Object.keys(e.options).length?{options:e.options}:{},...d?{compaction:d}:{}}}function Ea(e,t,n,r,i){let a=t.find(t=>t.id===e.provider),o=a&&ke(a,n)?.find(t=>t.id===e.protocol);for(let t of o?.options.safeParse(e.options).error?.issues??[]){let e=t.code===`unrecognized_keys`?t.keys[0]:t.path[0];i(r,t.message,typeof e==`string`?`options.${e}`:`options`)}let s=e.apiId.trim();for(let t of s?o?.refusedOptions?.(s)??[]:[])e.options[t]!==void 0&&i(r,`${s} takes no ${t}.`,`options.${t}`)}function Da(e,t,n,r,i){let a=e.compactTiming;if(!a)return;t!==`text`&&r(n,`Only a text agent compacts its own history.`,`compactTiming`);let o=e.compactMaxTokens??null,s=e.compactAt??Mt.compactAt,c=e.compactKeep??null;o===null&&r(n,`Compaction needs a budget.`,`compactMaxTokens`),Z(r,n,`compactMaxTokens`,`Budget`,o,1),s>0&&s<1||r(n,`Compaction must start between 0 and 1 of the budget.`,`compactAt`),c!==null&&(c===0||Number.isInteger(c)&&c>=1||c>0&&c<s)||r(n,`Keep a whole number of exchanges, a fraction of the budget below where compaction starts, or 0.`,`compactKeep`);let l=e.compactWith??``,u=l?i(l):void 0;return l&&!u&&r(n,`The agent that summarised is gone. Pick another, or this agent.`,`compactWith`),{maxTokens:o??0,compactAt:s,...u?{profile:u}:{},previousExchanges:c??0,timing:a,...e.compactMeter?{meter:e.compactMeter}:{}}}function Oa(e,t,n){let{models:r,modelBindings:i}=e;i.length||n(`models`,`Add at least one model.`);let a=r.defaultModel.trim();return a&&!(a in t)?n(`models`,`Default model '${a}' is not one of the models.`,`defaultModel`):!a&&At(e)&&n(`models`,`Pick a default model — there is more than one.`,`defaultModel`),r.maxSteps!==null&&!Number.isInteger(r.maxSteps)&&n(`models`,`Max steps must be a whole number.`,`maxSteps`),a}function ka(e,t,n,r){let{models:i,modelBindings:a}=e,o={};for(let s of a){let a=Ta({...s,keySlot:s.keySlot||i.key||void 0,fallbackKeySlot:s.fallbackKeySlot||i.fallbackKey||void 0},t,e.providers,n,r),c=s.modelId.trim(),l=H(s.key);c?c in o?n(l,`Model id '${c}' is used twice.`,`modelId`):o[c]=a:n(l,`Model id is required.`,`modelId`)}let s=Oa(e,o,n),c=i.providerHistory===`provider`||i.providerHistory===`stateless`?i.providerHistory:void 0;return{models:o,...s?{defaultModel:s}:{},...c?{providerContinuation:{history:c}}:{},...i.allowModelSelect?{allowModelSelect:!0}:{},...i.maxSteps===null?{}:{maxSteps:i.maxSteps}}}function Aa(e,t){if(!e?.trim())return;let n;try{n=JSON.parse(e)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=Object.entries(n);return r.every(([,e])=>t(e))?r.length?Object.fromEntries(r):void 0:null}var ja=e=>typeof e==`string`,Ma=e=>!0;function Na(e){return Aa(e,ja)}var Pa=e=>ct(e,`system`)===void 0;function Fa(e,t){let n=Aa(e,Pa);if(n===null){t(`Instructions by role must be a JSON object of text, or of lists of text and { "private": text }.`);return}if(!n)return;let r={};for(let[e,i]of Object.entries(n)){if(typeof i!=`string`){r[e]=i;continue}let n=_a(i);if(!n.ok){t(`${e}: ${n.message}`);return}n.prompt!==void 0&&(r[e]=n.prompt)}return r}function Ia(e,t,n){let r=Aa(e,t);return r===null&&n(),r??void 0}function La(e,t){if(!e.authType||e.authType===`none`)return;let n=e.authService?.trim()??``;n||t(`Service is required.`,`authService`);let r=X(e.authScopes),i=e.authType===`api_key`?e.authQueryParam?.trim():void 0;i&&X(e.queryParams).includes(i)&&t(`${i} is also one of the query parameters the model fills.`,`authQueryParam`);let a=i?{queryParam:i}:{...e.authHeaderName?.trim()?{headerName:e.authHeaderName.trim()}:{},...e.authHeaderPrefix===void 0?{}:{headerPrefix:e.authHeaderPrefix}};return{slot:e.authSlot?.trim()||`default`,type:e.authType,service:n,...a,onUnauthenticated:e.authUnauthenticated??`gate`,...r.length?{scopes:r}:{},...e.authClientId?.trim()?{clientId:e.authClientId.trim()}:{},...e.authRedirectUri?.trim()?{redirectUri:e.authRedirectUri.trim()}:{}}}function Ra(e){try{return new URL(e),!0}catch{return!1}}function za(e,t){e?Ne(e)&&t(`${e} is a provider builtin — turn it on under the model's built-in tools.`,`toolName`):t(`Tool name is required.`,`toolName`)}function Ba(e,t,n){let r=e.toolName.trim();za(r,t);let i=e.description.trim();i||t(`Description is required.`,`description`);let a=e.toolType===`agent`?{inputSchema:n(e.agentKey??``)??Ha,outputSchema:Ua}:Va(e,t),o=X(e.paths);return{name:r,description:i,category:e.category.trim()||`studio`,access:e.access,permission:e.permission,loadTier:e.loadTier,paths:o.length?o:[`*`],...a}}function Va(e,t){let n=Le(e.inputJson,`Input`);n.ok||t(n.error,`inputJson`);let r=Le(e.outputJson,`Output`);return r.ok||t(r.error,`outputJson`),{inputSchema:n.ok?n.schema:{},outputSchema:r.ok?r.schema:{}}}var Ha=ot(nt({type:`text`}),`input`),Ua=ot(St,`output`);function Wa(e){let t=e.identity.profileType;if(t!==`text`&&t!==`image`&&t!==`speech`)return;let n=t!==`speech`&&Ft(e).includes(`inputs`)?ao(e.inputs,t,()=>{}):void 0;return ot(nt({type:t,...n?{inputs:n}:{}}),`input`)}function Ga(e){return(e??``).split(`
47
- `).map(e=>e.trim()).filter(Boolean)}function Ka(e,t,n){let r={},i={activity:{input:t.inputSchema},activityPast:{input:t.inputSchema,output:t.outputSchema},activityFailed:{input:t.inputSchema},request:{input:t.inputSchema}};for(let t of[`activity`,`activityPast`,`activityFailed`,`request`]){let a=Ga(e[t]),[o]=a;if(o===void 0)continue;let s=a.length===1?o:a,c=Ue(s,i[t]);c?n(c,t):r[t]=s}return Object.keys(r).length?r:void 0}function qa(e){let t=Object.entries(e??{}).find(([e,t])=>Zi(e)&&t!==`••••`)?.[0];return t?`${t} looks like a credential. Put it under Auth instead: Auth asks for it when a call runs and nothing saves it.`:void 0}function Ja(e){if(!e||!URL.canParse(e))return;let t=[...new URL(e).searchParams].find(([e,t])=>Zi(e)&&t&&t!==`••••`)?.[0];return t?`${t} in the URL looks like a credential. Put it under Auth instead, as an API key with ${t} as its query parameter: Auth asks for it when a call runs and nothing saves it.`:void 0}function Ya(e,t){let n=Na(e.headersJson);n===null&&t(`Headers must be a JSON object of strings. Until they are, a reload brings back the headers as they started.`,`headersJson`);let r=qa(n??void 0);r&&t(r,`headersJson`);let i=e.toolType===`mcp`?`serverUrl`:`endpoint`,a=Ja(e[i]?.trim());a&&t(a,i);let o=La(e,t);return{...n?{headers:n}:{},...o?{auth:o}:{}}}function Xa(e,t,n,r){let i=e[t]?.trim()??``;return i?Ra(i)||r(`${n} must be a full URL.`,t):r(`${n} is required.`,t),i}function Za(e,t,n){let r=Xa(e,`endpoint`,`Endpoint URL`,n),i=X(e.pathParams),a=X(e.queryParams),o=e.bodyParam?.trim(),s={...i.length?{pathParams:i}:{},...a.length?{queryParams:a}:{},...o?{bodyParam:o}:{}};return{type:`http`,...t,endpoint:r,method:e.method??Ee[0],...Ya(e,n),...Object.keys(s).length?{mapping:s}:{}}}function Qa(e,t,n){let r=Xa(e,`serverUrl`,`MCP server URL`,n),i=e.mcpToolName?.trim()??``;return i||n(`MCP tool name is required.`,`mcpToolName`),{type:`mcp`,...t,serverUrl:r,mcpToolName:i,...Ya(e,n)}}function $a(e,t,n){let r=e.answeredBy===`page`?{answeredBy:`page`}:{};if(!e.stubOutputJson?.trim())return{type:`function`,...t,...r};let i=Le(e.stubOutputJson,`Stub output`);return i.ok||n(i.error.replace(` JSON Schema`,``),`stubOutputJson`),{type:`function`,...t,...r,...i.ok?{stubResponse:i.schema}:{}}}function eo(e,t,n,r){let i=e.agentKey??``,a=i?r(i):void 0;i?a||n(`The agent this tool ran is gone. Pick another.`,`agentKey`):n(`Pick the agent this tool runs.`,`agentKey`);let o=e.maxCallsPerTurn??null;return o!==null&&!(Number.isInteger(o)&&o>=1)&&n(`Calls per turn must be a positive whole number.`,`maxCallsPerTurn`),{type:`agent`,...t,profile:a??``,...o===null?{}:{maxCallsPerTurn:o}}}var to={http:Za,mcp:Qa,function:$a,agent:eo};function no(e){return Vt.includes(e)}function ro(e,t,n,r){let i=Pt(e.key);if(!no(e.toolType)){t(i,Bt,`toolType`);return}let a=!1,o=(e,n)=>{a=!0,t(i,e,n)},s=Ba(e,o,r),c=Ka(e,s,o),l=to[e.toolType](e,s,o,n);return a?void 0:{...l,...c?{labels:c}:{}}}function io(e,t,n,r,i,a){let o=[],s=new Set;for(let t of e.toolSpecs){let e=ro(t,r,i,a);e&&(s.has(e.name)?r(Pt(t.key),`Tool name '${e.name}' is used twice.`,`toolName`):(s.add(e.name),o.push(e)))}let c=o.map(e=>e.name),l=t?e.tools.t2Loader.trim():``;l&&!s.has(l)&&r(`tools`,`T2 loader '${l}' must be one of the custom tools.`,`t2Loader`);let u=n&&e.tools.parallel;return{customTools:o,tools:{allow:c,...l?{t2Loader:l}:{},...u?{parallel:u}:{}}}}function ao(e,t,n){let r=t===`image`?e.attachmentsAccept.filter(e=>!Pe(Ve,e)):[];if(r.length&&n(`inputs`,`An image profile takes images, video, and PDF only, not ${r.join(`, `)}.`,`attachmentsAccept`),!e.text&&!e.attachmentsAccept.length&&!e.voiceAccept.length&&n(`inputs`,`Take text, files, or voice notes: with none, the agent can be sent nothing.`,`text`),Ot(e)){let t=[[`maxFiles`,`Max files`,e.maxFiles],[`maxBytes`,`Max bytes`,e.maxBytes],[`maxTurnBytes`,`Max turn bytes`,e.maxTurnBytes]];for(let[e,r,i]of t)i===null&&n(`inputs`,`${r} is required with attachments or voice.`,e)}Z(n,`inputs`,`maxFiles`,`Max files`,e.maxFiles,1),Z(n,`inputs`,`maxBytes`,`Max bytes`,e.maxBytes,1),Z(n,`inputs`,`maxTurnBytes`,`Max turn bytes`,e.maxTurnBytes,1);let i=Ia(e.limitsByMimeJson,lo,()=>{n(`inputs`,`Limits by type must be a JSON object of positive whole numbers.`,`limitsByMimeJson`)}),a=so(e,n),o=oo(e,n);return{...e.text?{}:{text:!1},...e.attachmentsAccept.length?{attachments:{accept:[...e.attachmentsAccept]}}:{},...e.voiceAccept.length?{voice:{accept:[...e.voiceAccept]}}:{},...e.maxFiles===null?{}:{maxFiles:e.maxFiles},...e.maxBytes===null?{}:{maxBytes:e.maxBytes},...e.maxTurnBytes===null?{}:{maxTurnBytes:e.maxTurnBytes},...i?{limitsByMime:i}:{},...a?{slots:a}:{},...o?{context:o}:{}}}function oo(e,t){if(e.contextFrom.length)return e.contextMaxChars===null&&t(`inputs`,`Max characters is required with context.`,`contextMaxChars`),Z(t,`inputs`,`contextMaxChars`,`Max characters`,e.contextMaxChars,1),{from:[...e.contextFrom],maxChars:e.contextMaxChars??0}}function so(e,t){return Ia(e.slotsJson,uo,()=>{t(`inputs`,`Slots must be a JSON object of lists of text.`,`slotsJson`)})}function co(e,t){let n=so(e,t),r=oo(e,t);return!n&&!r?{}:{inputs:{...n?{slots:n}:{},...r?{context:r}:{}}}}var lo=e=>typeof e==`number`&&Number.isInteger(e)&&e>0,uo=e=>Array.isArray(e)&&e.length>0&&e.every(e=>typeof e==`string`&&e.trim()!==``);function fo(e,t,n){let r,i=t&&e.validationEnabled;if(t&&e.mode===`structured`){let t=e.schemaId.trim();t||n(`outputs`,`Structured output needs a schema id.`,`schemaId`);let i=Le(e.schemaJson,`Structured output`);i.ok||n(`outputs`,i.error,`schemaJson`),t&&i.ok&&(r={id:t,spec:{jsonSchema:i.schema}})}i&&Z(n,`outputs`,`maxRetries`,`Validation max retries`,e.maxRetries,0);let a=Object.fromEntries(Object.entries(e.itemRules).map(([e,t])=>[e,{onFail:t}])),o=i?{...e.maxRetries===null?{}:{maxRetries:e.maxRetries},...Object.keys(a).length?{items:a}:{}}:{},s={...e.streamMode?{mode:e.streamMode}:{},...e.streamThoughts?{}:{streamThoughts:!1}},c={...r?{structured:r.id}:{},...Object.keys(o).length?{validation:o}:{},...Object.keys(s).length?{streaming:s}:{}};return{...Object.keys(c).length?{outputs:c}:{},...r?{structured:r}:{}}}function po(e,t){return e.resumeEnabled?(Z(t,`turnBehaviour`,`maxContinues`,`Max continues`,e.maxContinues,1),{allowContinue:[...e.allowContinue],autoContinue:[...e.autoContinue],...e.maxContinues===null?{}:{maxContinues:e.maxContinues}}):{allowContinue:[],autoContinue:[]}}function mo(e,t,n){let r=t?po(e,n):void 0,i={...r?{resumption:r}:{},...e.allowSteering?{}:{allowSteering:!1},...e.atStepLimit===`answer`?{atStepLimit:e.atStepLimit}:{}};return Object.keys(i).length?i:void 0}function ho(e,t,n,r){let i=[],a=e=>t.has(e)||t.has(`labels`),{turnBehaviour:o,guardrails:s,outputs:c}=e;if(a(`turnBehaviour`)&&kt(e)&&i.push([`turnBehaviour`,`continueInstruction`,`continue.instruction`,o.continueInstruction.trim()]),a(`guardrails`)&&n(`identity.system`)&&i.push([`guardrails`,`canaryBindNote`,`canary.bind_note`,s.canaryBindNote.trim()]),a(`guardrails`)&&n(`guardrails.quota`)&&i.push([`guardrails`,`quotaMessage`,`quota.exhausted`,s.quotaMessage.trim()]),a(`outputs`)&&n(`outputs.validation`)&&i.push([`outputs`,`repairGuidance`,`repair.default_guidance`,c.repairGuidance.trim()]),a(`guardrails`)&&n(`guardrails.blockedReply`)&&(i.push([`guardrails`,`egressRepairGuidance`,`egress.default_repair_guidance`,s.egressRepairGuidance.trim()]),i.push([`guardrails`,`egressRefusal`,`egress.refusal`,s.egressRefusal.trim()])),t.has(`labels`))for(let[t,n]of Object.entries(e.labels))Nt[t]||i.push([`labels`,t,t,n.trim()]);let l={};for(let[e,t,n,a]of i)if(a)try{Je({[n]:a},`Profile labels`),l[n]=a}catch(n){r(e,Be(n),t)}return Object.keys(l).length?l:void 0}function go(e,t){if(e.quotaEnabled){if(e.quotaPerDay===null)t(`guardrails`,`Quota needs turns per day.`,`quotaPerDay`);else return Z(t,`guardrails`,`quotaPerDay`,`Quota per day`,e.quotaPerDay,1),{perDay:e.quotaPerDay}}}function _o(e,t){Z(t,`guardrails`,`blockedReplyMaxRetries`,`Blocked reply max retries`,e.blockedReplyMaxRetries,0);let n={...e.blockedReplyOnBlock?{onBlock:e.blockedReplyOnBlock}:{},...e.blockedReplyMaxRetries===null?{}:{maxRetries:e.blockedReplyMaxRetries}};return Object.keys(n).length?n:void 0}function vo(e){return yo(e,()=>{})}function yo(e,t){let n=e.allowedHosts.map(e=>e.trim()),r=n.indexOf(``);r!==-1&&t(`guardrails`,`Allowed hosts cannot be blank.`,`allowedHosts`,r);let i=X(e.allowedSchemes);if(e.allowPrivateNetworks||n.length||i.length)return{...e.allowPrivateNetworks?{allowPrivateNetworks:!0}:{},...n.length?{allowedHosts:n}:{},...i.length?{allowedSchemes:i}:{}}}function bo(e,t,n){let r=t.hosts.map(e=>e.trim()),i=r.indexOf(``);i!==-1&&n(`guardrails`,`Allowed hosts cannot be blank.`,`allow.${e}.hosts`,i);let a=r.filter(Boolean),o={...a.length?{hosts:a}:{},...t.fromTools?{}:{fromTools:!1}};return Object.keys(o).length?o:void 0}function xo(e,t){for(let[t,n]of e.entries()){let e=`Pattern ${t+1}`;if(!n.name.trim())return`${e} needs a name.`;if(n.kind===`words`){if(!X(n.words).length)return`${e} needs a word to match.`}else if(!n.pattern)return`${e} needs a regular expression.`}let n=Ke(``,t);if(n===void 0)return;let r=/^\.patterns\[(\d+)\](?:\.(\w+))?:? (.*)$/s.exec(n);if(!r)return n.replace(/^\.patterns/,`This`);let[,i,a,o]=r;return`Pattern ${Number(i)+1}${a?`, ${a}`:``}: ${o}`}function So(e,t,n){let r=e.map(e=>{let t=e.name.trim();if(e.kind===`words`)return{name:t,words:X(e.words)};let n=e.flags.trim();return{name:t,pattern:e.pattern,...n?{flags:n}:{}}}),i=xo(e,r);return i!==void 0&&n(`guardrails`,i,t),r}function Co(e,t,n){if(!t||!Xe[e].patterns)return{};let r=wo(t.hint,`sources.${e}.hint`,n),i=So(t.patterns,`sources.${e}.patterns`,n);return{...t.theorem?{}:{theorem:!1},...i.length?{patterns:i}:{},...i.length&&r?{hint:r}:{}}}function wo(e,t,n){let r=e.trim();if(!r)return;let i=Qe(`The retry hint`,r);return i!==void 0&&n(`guardrails`,`${i}.`,t),r}function To(e,t){if(!e)return`Give this detector a key, such as acme.codenames.`;let n={label:e,action:`flag`,find:Do};return $e(`Detect`,{[e]:n},t)===void 0?void 0:`A key is a namespace, a dot, and a name, in lower case letters, digits and _, such as acme.codenames.`}function Eo(e,t,n){let r={};for(let[i,a]of e.entries()){let e=a.key.trim();if(Object.hasOwn(r,e)){n(`guardrails`,`Detector ${e} is listed twice.`,`own`,i);continue}let o=t.filter(e=>a.at[e]!==`ignore`),s=wo(a.hint,`own.${i}.hint`,n),c=So(a.patterns,`own.${i}.patterns`,n),l=a.label.trim(),u=To(e,t);u!==void 0&&n(`guardrails`,u,`own`,i),l||n(`guardrails`,`Give this detector a name.`,`own.${i}.label`),o.length||n(`guardrails`,`Pick what a match does. It is ignored now.`,`own.${i}.at`),u===void 0&&l&&o.length&&(r[e]={label:l,at:Object.fromEntries(o.map(e=>[e,a.at[e]])),patterns:c,...s?{hint:s}:{}})}return r}var Do=()=>[];function Oo(e){return e===void 0||typeof e==`string`?e:Object.fromEntries(Object.entries(e).map(([e,t])=>{if(typeof t==`string`||t.patterns===void 0)return[e,t];let{patterns:n,...r}=t;if(e.includes(`.`))return[e,{...r,find:Do}];let{hint:i,...a}=r;return[e,a]}))}function ko(e){let{guardrails:t}=e;return!t||!(`detect`in t)||t.detect===void 0?e:{...e,guardrails:{...t,detect:Oo(t.detect)}}}function Ao(e,t,n){let{detect:r}=e,i={};for(let a of et){let o=t.filter(e=>r[a][e]!==Ze[a][e]),s=t.some(e=>r[a][e]!==`ignore`)?jo(a,e,n):void 0,c=Co(a,e.sources[a],n);(o.length||s||Object.keys(c).length)&&(i[a]={...o.length?{at:Object.fromEntries(o.map(e=>[e,r[a][e]]))}:{},...c,...s?{allow:s}:{}})}Object.assign(i,Eo(e.own,t,n));let a=$e(`Detect`,Oo(i),t);return a!==void 0&&n(`guardrails`,a,`detect`),Object.keys(i).length?i:void 0}function jo(e,t,n){if(Mo(e))return bo(e,t.allow[e],n);if(Xe[e].allow!==`names`)return;let r=t.innocentNames.map(e=>e.trim()),i=r.indexOf(``);i!==-1&&n(`guardrails`,`Allowed names cannot be blank.`,`innocentNames`,i);let a=r.filter(Boolean);return a.length?{names:a}:void 0}function Mo(e){return Xe[e].allow===`urls`}function No(e){let{taintAfterRemoteRead:t,taintRemoteDestination:n}=e;if(t||n)return{...t?{afterRemoteRead:t}:{},...n?{remoteDestination:n}:{}}}function Po(e,t,n=Ye){let r={detect:Ao(e,n,t),quota:go(e,t),blockedReply:_o(e,t),network:yo(e,t),taint:No(e)},i=Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0));return Object.keys(i).length?i:void 0}function Fo(e,t){let n=Lt({}),{writeTo:r}=e,{sampleRate:i}=e;Number.isFinite(i)&&i>=0&&i<=1||t(`observability`,`Sample rate must be between 0 and 1.`,`sampleRate`),e.retainForDays!==null&&!Number.isFinite(e.retainForDays)&&t(`observability`,`Retain for days must be a number.`,`retainForDays`),e.rotateAfterMiB!==null&&!(Number.isFinite(e.rotateAfterMiB)&&e.rotateAfterMiB>0)&&t(`observability`,`Rotate after MiB must be more than zero.`,`rotateAfterMiB`);let a=Ia(e.resourceJson,Ma,()=>{t(`observability`,`Resource must be a JSON object.`,`resourceJson`)}),o=Object.fromEntries(Object.entries(e.include).filter(([e,t])=>t!==n.include[e])),s=Object.fromEntries(Object.entries(e.scrub).filter(([e,t])=>t!==n.scrub[e])),c={writeTo:r,...i===n.sampleRate?{}:{sampleRate:i},...Object.keys(o).length?{include:o}:{},...Object.keys(s).length?{scrub:s}:{},...e.retainForDays===null?{}:{retainForDays:e.retainForDays},...e.rotateAfterMiB===null?{}:{rotateAfterMiB:e.rotateAfterMiB},...a?{resource:a}:{}};return Object.keys(c).length?c:void 0}var Io={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`,gif:`image/gif`};function Lo(e){if(!URL.canParse(e))return;let t=new URL(e);return t.protocol!==`https:`&&t.protocol!==`http:`?void 0:Io[t.pathname.split(`.`).pop()?.toLowerCase()??``]}function Ro(e,t){return e.flatMap((e,n)=>{if(`data`in e)return e.mimeType.startsWith(`image/`)&&e.data?[{mimeType:e.mimeType,data:e.data,name:e.name}]:(t(`image`,`${e.name||`A reference`} is not an image.`,`references`,n),[]);let r=e.uri.trim(),i=Lo(r);return i?[{mimeType:i,uri:r,...e.name?{name:e.name}:{}}]:(t(`image`,r?`Link to a .png, .jpg, .webp or .gif image over http(s).`:`Add a link or remove the reference.`,`references`,n),[])})}function zo(e,t){Z(t,`image`,`n`,`Images per request`,e.n,1),Z(t,`image`,`seed`,`Seed`,e.seed,0),Z(t,`image`,`outputCompression`,`Compression`,e.outputCompression,0),e.outputCompression!==null&&e.outputCompression>100&&t(`image`,`Compression goes from 0 to 100.`,`outputCompression`);let n=Ro(e.references,t);return{...e.aspectRatio.trim()?{aspectRatio:e.aspectRatio.trim()}:{},...e.resolution.trim()?{resolution:e.resolution.trim()}:{},...e.mimeType.trim()?{mimeType:e.mimeType.trim()}:{},...e.quality.trim()?{quality:e.quality.trim()}:{},...e.background.trim()?{background:e.background.trim()}:{},...e.n===null?{}:{n:e.n},...e.seed===null?{}:{seed:e.seed},...e.outputCompression===null?{}:{outputCompression:e.outputCompression},...e.includeText?{includeText:!0}:{},...n.length?{references:n}:{}}}function Bo(e,t,n){let{format:r}=e;if(r){let e=t.modelBindings.find(e=>z(ze(t.providers,`speech`,e))&&!Me.includes(r));e&&n(`speech`,`Google doesn't make ${r}; ${e.modelId} is on ${e.provider}.`,`format`)}let i=t.modelBindings.find(e=>z(ze(t.providers,`speech`,e)));i&&!e.voice.trim()&&n(`speech`,`Gemini needs a voice to speak; ${i.modelId} is on ${i.provider}.`,`voice`);let{speed:a}=e;return{...e.voice.trim()?{voice:e.voice.trim()}:{},...e.style.trim()?{style:e.style.trim()}:{},...a===null?{}:{speed:a},...r?{format:r}:{}}}function Vo(e,t){Z(t,`live`,`resumedAfterMs`,`Away for`,e.resumedAfterMs,0);let n=e.resumedPrompt.trim();if(n&&!e.sessionResumption&&t(`live`,`A resume prompt needs Resumption on.`,`resumedPrompt`),!n)e.resumedAfterMs!==null&&t(`live`,`Away for needs a resume prompt.`,`resumedAfterMs`);else return{prompt:n,...e.resumedAfterMs===null?{}:{afterMs:e.resumedAfterMs}}}function Ho(e,t,n){!e.ingressAudio&&!e.ingressVideo&&!e.ingressText&&t(`live`,`Turn on at least one ingress channel.`),Z(t,`live`,`vadPrefixPaddingMs`,`VAD prefix padding`,e.vadPrefixPaddingMs,0),Z(t,`live`,`vadSilenceDurationMs`,`VAD silence duration`,e.vadSilenceDurationMs,0),e.contextCompression&&Uo(e,t,n.mode===`demo`?n.keys.liveInputTokens:void 0);let r=Vo(e,t),i={audio:e.ingressAudio,video:e.ingressVideo,text:e.ingressText},a=Object.fromEntries(Object.entries(i).filter(([e,t])=>t!==Rt(e))),o={...e.vadActivityHandling?{activityHandling:e.vadActivityHandling}:{},...e.vadStartSensitivity?{startSensitivity:e.vadStartSensitivity}:{},...e.vadEndSensitivity?{endSensitivity:e.vadEndSensitivity}:{},...e.vadPrefixPaddingMs===null?{}:{prefixPaddingMs:e.vadPrefixPaddingMs},...e.vadSilenceDurationMs===null?{}:{silenceDurationMs:e.vadSilenceDurationMs}},s={...e.transcriptionInput?{input:!0}:{},...e.transcriptionOutput?{output:!0}:{}};return{...Object.keys(a).length?{ingress:a}:{},...e.voice.trim()?{voice:e.voice.trim()}:{},...Object.keys(o).length?{vad:o}:{},...e.sessionResumption?{sessionResumption:!0}:{},...e.greeting.trim()?{greeting:e.greeting.trim()}:{},...r?{resumed:r}:{},...e.contextCompression?{contextCompression:Wo(e)}:{},...Object.keys(s).length?{transcription:s}:{}}}function Uo(e,t,n){Z(t,`live`,`compressionTriggerTokens`,`Compression trigger`,e.compressionTriggerTokens,1),Z(t,`live`,`compressionTargetTokens`,`Compression target`,e.compressionTargetTokens,1);let r=e.compressionTriggerTokens,i=e.compressionTargetTokens,a=n?.toLocaleString(`en-US`);n!==void 0&&r!==null&&r>n&&t(`live`,`Compression trigger can't exceed the ${a} input tokens a session holds on these keys.`,`compressionTriggerTokens`),i!==null&&(r!==null&&i>=r||n!==void 0&&r===null&&i>=n)&&t(`live`,r===null?`Compression target must be below the ${a} input tokens a session holds on these keys.`:`Compression target must be below the trigger.`,`compressionTargetTokens`)}function Wo(e){let t=e.compressionTriggerTokens,n=e.compressionTargetTokens;return{...t===null?{}:{triggerTokens:t},slidingWindow:n===null?{}:{targetTokens:n}}}function Go(e,t){let[n,...r]=t,{[n]:i,...a}=e;return!r.length||typeof i!=`object`||!i?a:{...a,[n]:Go(i,r)}}function Ko(e){let t=e;for(let{path:n}of Ie(e))t=Go(t,n.split(`.`));return t}function qo(e,t){let n=Object.create(null);return e.questions.length||t(`decision`,`Add at least one question.`,`questions`),e.questions.forEach((e,r)=>{let i=e=>t(`decision`,e,`questions`,r),a=e.id.trim(),o=e.instructions.trim();a?Object.hasOwn(n,a)&&i(`Question id '${a}' is used twice.`):i(`Each question needs an id.`),o||i(`Question '${a||r+1}' needs instructions.`);let s=e.criteria.map(e=>({label:e.label.trim(),text:e.text.trim()}));if(!a||!o)return;if(e.type===`box`){let t=e.image?.trim();n[a]={type:`box`,instructions:o,...t?{image:t}:{}};return}if(e.type===`score`){(s.length<2||s.some(e=>!e.text))&&i(`Score '${a}' needs at least two levels, each described.`),n[a]={type:`score`,instructions:o,criteria:s.map(e=>e.text)};return}let c=Object.create(null);for(let e of s)e.label?Object.hasOwn(c,e.label)?i(`Option '${e.label}' of '${a}' is used twice.`):c[e.label]=e.text||e.label:i(`Every option of '${a}' needs a label.`);e.type===`choice`?(s.length<2&&i(`Choice '${a}' needs at least two options.`),n[a]={type:`choice`,instructions:o,criteria:c}):n[a]={type:`noul`,instructions:o,...s.length?{criteria:c}:{}}}),n}var Jo=/^[a-z0-9_]+$/,Yo=[`image/png`,`image/jpeg`];function Xo(e,t){let n=Object.create(null);return e.images.forEach((e,r)=>{let i=e=>t(`decision`,e,`images`,r),a=e.name.trim(),o=`<${a}>`;Jo.test(a)?Object.hasOwn(n,o)?i(`Image ${o} is used twice.`):!Yo.includes(e.mimeType)||!e.data?i(`${o} is not a PNG or JPEG.`):n[o]={mimeType:e.mimeType,data:e.data}:i(`Name an image with lowercase letters, digits, and _.`)}),e.questions.forEach((e,r)=>{let i=[...e.instructions.matchAll(/<[a-z0-9_]+>/g)].map(([e])=>e),a=e.type===`box`?e.image?.trim():void 0;a?.startsWith(`<`)&&i.push(a);for(let e of new Set(i))Object.hasOwn(n,e)||t(`decision`,`No image is named ${e}.`,`questions`,r)}),n}function Zo(e,t,n){let r=t.has(`observability`)?Fo(e.observability,n):void 0,i=ho(e,t,t=>jt(e,t),n);return{...r?{observability:r}:{},...i?{labels:i}:{}}}function Qo(e,t){let{decision:n}=e,r=n.contract.trim();return r||t(`decision`,`Contract is required.`,`contract`),r}function $o(e,t,n,r){let i=n.decision,{decision:a,identity:o}=e,s=(e,t)=>e.trim().length>t;s(a.contract,i.idChars)&&r(`decision`,`Contract is limited to ${i.idChars} characters on these keys.`,`contract`),s(o.agentId,i.idChars)&&r(`identity`,`Profile id is limited to ${i.idChars} characters on these keys.`,`agentId`),s(o.handle,i.nameChars)&&r(`identity`,`Handle is limited to ${i.nameChars} characters on these keys.`,`handle`);let c=e.modelBindings[0];if(c){let e=H(c.key);c.timeoutMs!==null&&c.timeoutMs>i.timeoutMs&&r(e,`Timeout is limited to ${i.timeoutMs} ms on these keys.`,`timeoutMs`),s(c.modelId,i.nameChars)&&r(e,`Model id is limited to ${i.nameChars} characters on these keys.`,`modelId`),s(c.apiId,i.idChars)&&r(e,`API model is limited to ${i.idChars} characters on these keys.`,`apiId`)}a.maxStateBytes!==null&&a.maxStateBytes>i.stateBytes&&r(`decision`,`These keys take at most ${i.stateBytes} bytes of state.`,`maxStateBytes`),a.questions.length>i.questions&&r(`decision`,`These keys ask at most ${i.questions} questions.`,`questions`),a.images.length>i.images&&r(`decision`,`These keys send at most ${i.images} images.`,`images`),a.images.forEach((e,t)=>{Math.floor(e.data.length*3/4)>i.imageBytes&&r(`decision`,`Each image is limited to ${i.imageBytes} bytes on these keys.`,`images`,t)}),a.questions.forEach((a,o)=>{let l=e=>r(`decision`,e,`questions`,o);s(a.id,i.nameChars)&&l(`Question ids are limited to ${i.nameChars} characters on these keys.`),a.type===`box`&&i.images===0&&l(`These keys take no images, so a Box question has nothing to read.`),s(a.instructions,i.instructionsChars)&&l(`Instructions are limited to ${i.instructionsChars} characters on these keys.`),a.criteria.length>i.criteria&&l(`A question has at most ${i.criteria} options or levels on these keys.`),a.criteria.some(e=>s(e.text,i.criterionChars))&&l(`Each option or level is limited to ${i.criterionChars} characters on these keys.`),a.criteria.some(e=>s(e.label,i.nameChars))&&l(`Option labels are limited to ${i.nameChars} characters on these keys.`);let u=t[a.id.trim()],d=c&&u&&n.questionViolation(ze(e.providers,`decision`,c),u);d&&l(d)})}function es(e,t,n){let{decision:r}=e,i=new Set(Ft(e)),a=Qo(e,t);e.modelBindings.length!==1&&t(`models`,`A decision needs exactly one model binding.`);let o=e.modelBindings[0],s=o?H(o.key):`models`;o&&(Ca(o,`decision`,e.providers,t),Ea(o,e.providers,`decision`,s,t),o.modelId.trim()||t(s,`Model id is required.`,`modelId`),Z(t,s,`timeoutMs`,`Timeout`,o.timeoutMs,1)),Z(t,`decision`,`maxStateBytes`,`Max state`,r.maxStateBytes,1);let c=qo(r,t),l=Xo(r,t);return n.mode===`demo`&&$o(e,c,n.keys,t),{profile:{type:`decision`,id:e.identity.agentId.trim(),identity:{handle:e.identity.handle.trim()},models:o?{[o.modelId.trim()]:{protocol:o.protocol,provider:o.provider,apiId:o.apiId.trim(),...Object.keys(o.options).length?{options:o.options}:{},...o.keySlot||e.models.key?{keySlot:o.keySlot||e.models.key}:{},...o.fallbackKeySlot?{fallbackKeySlot:o.fallbackKeySlot}:{},...o.timeoutMs===null?{}:{timeoutMs:o.timeoutMs}}}:{},inputs:{state:`json`,...r.maxStateBytes===null?{}:{maxStateBytes:r.maxStateBytes}},decision:{contract:a},...Zo(e,i,t)},customTools:[],questions:c,...Object.keys(l).length?{images:{...l}}:{}}}function ts(e,t,n,r){let i=new Set(Ft(e)),{customTools:a,tools:o}=io(e,!1,!1,t,n,r);a.length||t(`tools`,`Add at least one tool: a host runs only its tools.`);let s=i.has(`guardrails`)?Po(e.guardrails,t,tt):void 0;return{profile:Ko({type:`host`,id:e.identity.agentId.trim(),tools:o,...s?{guardrails:s}:{},...Zo(e,i,t)}),customTools:a}}function ns(e,t,n,r,i,a){let o=new Set(Ft(e)),s=t=>jt(e,t),c=typeof e.identity.system==`string`?_a(e.identity.system):{ok:!1,message:`The system prompt must be text.`};c.ok||n(`identity`,c.message,`system`);let l=c.ok?c.prompt:void 0,u=Fa(e.identity.systemByRoleJson,e=>{n(`identity`,e,`systemByRoleJson`)}),d=ka(e,t,n,i),{outputs:f,structured:p}=o.has(`outputs`)?fo(e.outputs,s(`outputs.structured`),n):{},{customTools:m,tools:h}=o.has(`tools`)?io(e,s(`tools.t2Loader`),s(`tools.parallel`),n,i,a):{customTools:[]},g=o.has(`turnBehaviour`)?mo(e.turnBehaviour,s(`turnBehaviour.resumption`),n):void 0,_=o.has(`guardrails`)?Po(e.guardrails,n):void 0;return{profile:Ko({type:t,id:e.identity.agentId.trim(),identity:{handle:e.identity.handle.trim(),...l?{system:l}:{},...u?{systemByRole:u}:{}},...d,...o.has(`image`)?{image:zo(e.image,n)}:{},...o.has(`speech`)?{speech:Bo(e.speech,e,n)}:{},...o.has(`live`)?{live:Ho(e.live,n,r)}:{},...h?{tools:h}:{},...o.has(`inputs`)?t===`live`?co(e.inputs,n):{inputs:ao(e.inputs,t,n)}:{},...f?{outputs:f}:{},...g?{turnBehaviour:g}:{},..._?{guardrails:_}:{},...Zo(e,o,n)}),customTools:m,...p?{structured:p}:{}}}function rs(e,t,n=va,r=ya){let i=[],a=(e,t,n,r)=>{i.push({nodeId:e,message:t,...n===void 0?{}:{field:n},...r===void 0?{}:{index:r}})};Sa(e,a),new Set([e.models.key,e.models.fallbackKey,...e.modelBindings.flatMap(t=>{let{keySlot:n,fallbackKeySlot:r}=It(e,t);return[n,r]})].filter(Boolean)).size>32&&a(`models`,`The studio supports up to 32 key slots.`,`key`);let o=e.identity.profileType;if(!o)return a(`identity`,`Pick a profile type.`,`profileType`),{ok:!1,issues:i};if(o!==`host`)for(let n of e.modelBindings){if(!n.apiId.trim())continue;let r=He({...ze(e.providers,o,n),builtInTools:n.builtInTools},t);r&&a(H(n.key),r.message,r.field)}let s=o===`decision`?es(e,a,t):o===`host`?ts(e,a,n,r):ns(e,o,a,t,n,r);if(i.length)return{ok:!1,issues:i};try{V(ko(s.profile))}catch(e){if(!(e instanceof Ge))throw e;return{ok:!1,issues:[{nodeId:`identity`,message:e.message}]}}return{ok:!0,agentId:s.profile.id,providers:e.providers,...s}}var is=`theoremjs.studio.run`,as=`${is}.`,os=`${is}.index`;function ss(e){return`${as}${e}`}function cs(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`run-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function ls(e=typeof window<`u`?globalThis.location:{href:``}){let t=typeof e==`string`?e:e.href;if(!t)return null;try{let e=new URL(t,`http://localhost`).searchParams.get(`run`)?.trim();return e&&e.length>0?e:null}catch{return null}}function us(e,t,n,r=8){let i=e.filter(e=>e.id!==t),a=[{id:t,savedAt:n},...i];return a.length<=r?{entries:a,prunedIds:[]}:{entries:a.slice(0,r),prunedIds:a.slice(r).map(e=>e.id)}}function ds(e){if(e!==void 0)return e;if(typeof globalThis>`u`||!(`localStorage`in globalThis))return null;try{return globalThis.localStorage}catch{return null}}function fs(e){let t=e.getItem(os);if(!t)return[];try{let e=JSON.parse(t);return Array.isArray(e.entries)?e.entries:[]}catch{return[]}}function ps(e,t){e.setItem(os,JSON.stringify({entries:t}))}function ms(e,t,n){let r=ds(n);if(!r||!t)return;r.removeItem(is);let i={version:1,...e,runId:t};r.setItem(ss(t),JSON.stringify(i));let{entries:a,prunedIds:o}=us(fs(r),t,Date.now(),8);for(let e of o)r.removeItem(ss(e));ps(r,a)}function hs(e,t){let n=ds(t);if(!n||!e)return null;let r=n.getItem(ss(e));if(!r)return null;try{let e=JSON.parse(r);return typeof e!=`object`||!e||Array.isArray(e)?null:e}catch{return null}}function gs(e){let t=ds(e);if(!t)return[];let n=[];for(let e=0;e<t.length;e++){let r=t.key(e);r?.startsWith(as)&&r!==os&&n.push(r.slice(as.length))}return n}function _s(e,t){let n=ds(t);n&&e&&(n.removeItem(ss(e)),ps(n,fs(n).filter(t=>t.id!==e)))}var vs=j({profile:j({id:F()}),customTools:N(j({name:F()}))}),ys=vs.extend({agentId:F(),dependencies:N(vs).optional()});function bs(e,t,n){ms({...e},t,n)}function xs(e,t){let n=hs(e,t);return!n||!ys.safeParse(n).success?null:n}function Ss(e,t){_s(e,t)}function Cs(e){let t=new Map,n=ut(e=>t.get(e));for(let r of e.dependencies??[]){bt(n,r.customTools);let e=V(ko(r.profile));t.set(e.id,e)}return bt(n,e.customTools),{profile:V(ko(e.profile)),tools:n}}function ws(e){let{profile:t,tools:n}=Cs(e);return st(t,n)}function Ts(e){try{return Cs(e),!0}catch(e){if(e instanceof Ge)return!1;throw e}}function Es(e){for(let t of gs(e)){let n=xs(t,e);(!n||!Ts(n))&&Ss(t,e)}}var Ds=I({type:M(`trace`),record:zt}),Os=I({type:M(`steer_inbox`),inbox:F().min(1)}),ks={...mt,trace:Ds,steer_inbox:Os},As={...L,trace:Ds};function js(e,t,n){return r=>{r.type===`trace`?t.push(r.record):r.type===`steer_inbox`?n(r.inbox):e(r)}}function Ms(){}function Ns(e){return t=>{if(t.type===`conversation`)throw new Ge(`internal`,`a host call streamed a conversation line`);e(t)}}function Ps(e,t={}){return{describe:()=>Promise.resolve(ra(V(e.profile))),embed:(n,r,i)=>sa(`/api/studio/embedding/embed`,{profile:e.profile,input:n,...r},i,t),traces:t.traces??Y()}}function Fs(e,t={}){let n={profile:e.profile,customTools:e.customTools,structured:e.structured,dependencies:e.dependencies},r=t.traces??Y(),i=new Map;return{pageResult:(e,n)=>lt(`/api/studio/page-result`,e,{...t,signal:n}),describe:()=>Promise.resolve(ws(e)),turn:async(e,a,o)=>{try{await B(`/api/studio/turn`,{...n,...e},ks,js(a,r,t=>{e.turnId&&i.set(e.turnId,t)}),{...t,signal:o})}finally{e.turnId&&i.delete(e.turnId)}},invoke:(e,i,a)=>B(`/api/studio/invoke`,{...n,...e},ks,js(i,r,Ms),{...t,signal:a}),conversation:(e,r)=>wt(`/api/studio/conversation`,{...n,...e},{...t,signal:r}),rewind:(e,r)=>dt(`/api/studio/rewind`,{...n,...e},{...t,signal:r}),async steer({turnId:e,id:n,inject:r}){let a=i.get(e);if(!a)throw new Ge(`request`,`steer: the turn has not opened its inbox`,{copy:{key:`session.turn_ended`}});await lt(`/api/studio/turn/steer`,{turnId:a,id:n,inject:r},t)},traces:r}}function Is(e,t={}){let n=e.questions??{};return{describe:()=>Promise.resolve(Ct(V(e.profile),n,e.images)),decide:(r,i,a)=>{let o=gt(e.images,a);return pt(`/api/studio/decide`,{profile:e.profile,questions:n,state:r,...o?{assets:o}:{}},i,t)},traces:t.traces??Y()}}function Ls(e,t={}){let n={profile:e.profile,customTools:e.customTools,dependencies:e.dependencies},r=t.traces??Y(),i=[];return{pageResult:(e,n)=>lt(`/api/studio/page-result`,e,{...t,signal:n}),describe:()=>Promise.resolve(da(V(e.profile),t=>e.customTools.find(e=>e.name===t))),call:(e,a,o)=>B(`/api/studio/call`,{...n,...e,sessionPermissions:i},As,js(Ns(a),r,Ms),{...t,signal:o}),invoke:(e,a,o)=>(i=e.replay?.sessionPermissions??i,B(`/api/studio/invoke`,{...n,...e},As,js(Ns(a),r,Ms),{...t,signal:o})),traces:r}}var Rs={name:`theorem`,__built:!0,tokens:{"--font-size-4xs":`0.375rem`,"--font-size-3xs":`0.4375rem`,"--font-size-2xs":`0.5rem`,"--font-size-xs":`0.625rem`,"--font-size-sm":`0.75rem`,"--font-size-base":`0.875rem`,"--font-size-lg":`1.0625rem`,"--font-size-xl":`1.25rem`,"--font-size-2xl":`1.5rem`,"--font-size-3xl":`1.8125rem`,"--font-size-4xl":`2.1875rem`,"--font-size-5xl":`2.625rem`,"--text-heading-1-size":`var(--font-size-2xl)`,"--text-heading-1-weight":`var(--font-weight-semibold)`,"--text-heading-1-leading":`1.3333`,"--text-heading-2-size":`var(--font-size-xl)`,"--text-heading-2-weight":`var(--font-weight-semibold)`,"--text-heading-2-leading":`1.4`,"--text-heading-3-size":`var(--font-size-lg)`,"--text-heading-3-weight":`var(--font-weight-bold)`,"--text-heading-3-leading":`1.4118`,"--text-heading-4-size":`var(--font-size-base)`,"--text-heading-4-weight":`var(--font-weight-bold)`,"--text-heading-4-leading":`1.4286`,"--text-heading-5-size":`var(--font-size-sm)`,"--text-heading-5-weight":`var(--font-weight-semibold)`,"--text-heading-5-leading":`1.6667`,"--text-heading-6-size":`var(--font-size-xs)`,"--text-heading-6-weight":`var(--font-weight-semibold)`,"--text-heading-6-leading":`1.6`,"--text-body-size":`var(--font-size-base)`,"--text-body-weight":`var(--font-weight-normal)`,"--text-body-leading":`1.4286`,"--text-large-size":`var(--font-size-lg)`,"--text-large-weight":`var(--font-weight-semibold)`,"--text-large-leading":`1.4118`,"--text-label-size":`var(--font-size-base)`,"--text-label-weight":`var(--font-weight-medium)`,"--text-label-leading":`1.4286`,"--text-code-size":`var(--font-size-base)`,"--text-code-weight":`var(--font-weight-normal)`,"--text-code-leading":`1.4286`,"--text-supporting-size":`var(--font-size-sm)`,"--text-supporting-weight":`var(--font-weight-normal)`,"--text-supporting-leading":`1.6667`,"--text-display-1-size":`var(--font-size-5xl)`,"--text-display-1-weight":`var(--font-weight-normal)`,"--text-display-1-leading":`1.2381`,"--text-display-2-size":`var(--font-size-4xl)`,"--text-display-2-weight":`var(--font-weight-normal)`,"--text-display-2-leading":`1.2571`,"--text-display-3-size":`var(--font-size-3xl)`,"--text-display-3-weight":`var(--font-weight-normal)`,"--text-display-3-leading":`1.3793`,"--duration-fast-min":`95ms`,"--duration-fast":`125ms`,"--duration-fast-max":`165ms`,"--duration-medium-min":`225ms`,"--duration-medium":`300ms`,"--duration-medium-max":`400ms`,"--duration-slow-min":`525ms`,"--duration-slow":`700ms`,"--duration-slow-max":`935ms`,"--font-family-body":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-heading":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-code":`ui-monospace, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,"--color-syntax-keyword":`light-dark(#6b187c, #efa8ff)`,"--color-syntax-string":`light-dark(#0b5615, #a4d6a3)`,"--color-syntax-comment":`light-dark(#6a6a6a, #9e9e9e)`,"--color-syntax-number":`light-dark(#733100, #ffb37e)`,"--color-syntax-function":`light-dark(#00458c, #a1caff)`,"--color-syntax-type":`light-dark(#6b187c, #efa8ff)`,"--color-syntax-variable":`light-dark(#111111, #e2e2e2)`,"--color-syntax-operator":`light-dark(#6a6a6a, #9e9e9e)`,"--color-syntax-constant":`light-dark(#733100, #ffb37e)`,"--color-syntax-tag":`light-dark(#8a0011, #ffaea7)`,"--color-syntax-attribute":`light-dark(#584400, #eec448)`,"--color-syntax-property":`light-dark(#005348, #90d7c8)`,"--color-syntax-punctuation":`light-dark(#6a6a6a, #9e9e9e)`,"--color-syntax-background":`light-dark(#ffffff, #111111)`,"--color-syntax-added":`color-mix(in srgb, var(--color-success-muted) 25%, transparent)`,"--color-syntax-removed":`color-mix(in srgb, var(--color-error-muted) 25%, transparent)`,"--color-syntax-diff-header":`transparent`,"--color-syntax-added-marker":`var(--color-syntax-punctuation)`,"--color-syntax-removed-marker":`var(--color-syntax-punctuation)`,"--color-background-surface":`light-dark(#ffffff, #262626)`,"--color-background-body":`light-dark(#f1f1f1, #1b1b1b)`,"--color-background-card":`light-dark(#ffffff, #1b1b1b)`,"--color-background-popover":`light-dark(#ffffff, #1b1b1b)`,"--color-background-muted":`light-dark(#f1f1f1, #1b1b1b)`,"--color-accent":`light-dark(#1b1b1b, #f1f1f1)`,"--color-accent-muted":`light-dark(#f1f1f1, #262626)`,"--color-neutral":`light-dark(#0000000F, #ffffff1A)`,"--color-overlay":`light-dark(#00000080, #000000CC)`,"--color-overlay-hover":`light-dark(#0000000D, #ffffff0D)`,"--color-overlay-pressed":`light-dark(#0000001A, #ffffff1A)`,"--color-text-primary":`light-dark(#000000, #ffffff)`,"--color-text-secondary":`light-dark(#474747, #9e9e9e)`,"--color-text-disabled":`light-dark(#919191, #525252)`,"--color-text-accent":`light-dark(#1b1b1b, #f1f1f1)`,"--color-on-dark":`#ffffff`,"--color-on-light":`#111111`,"--color-on-accent":`light-dark(#ffffff, #111111)`,"--color-on-success":`light-dark(#ffffff, #111111)`,"--color-on-error":`light-dark(#ffffff, #111111)`,"--color-on-warning":`#111111`,"--color-icon-accent":`light-dark(#1b1b1b, #f1f1f1)`,"--color-icon-primary":`light-dark(#000000, #ffffff)`,"--color-icon-secondary":`light-dark(#6a6a6a, #9e9e9e)`,"--color-icon-disabled":`light-dark(#919191, #525252)`,"--color-success":`light-dark(#00490b, #a4d6a3)`,"--color-error":`light-dark(#76000c, #ffc4be)`,"--color-warning":`light-dark(#4b3900, #f8d36a)`,"--color-success-muted":`light-dark(#bce0bb, #90ca903D)`,"--color-error-muted":`light-dark(#ffc4be, #ff98903D)`,"--color-warning-muted":`light-dark(#fae19e, #e2b6233D)`,"--color-border":`light-dark(#00000014, #ffffff1A)`,"--color-border-emphasized":`light-dark(#d4d4d4, #525252)`,"--color-skeleton":`light-dark(#f1f1f1, #525252)`,"--color-shadow":`light-dark(#0000001A, #0000004D)`,"--color-tint-hover":`light-dark(black, white)`,"--color-background-red":`light-dark(#ffc4be, #5b2b28)`,"--color-border-red":`light-dark(#ffaea7, #fa6762)`,"--color-icon-red":`light-dark(#76000c, #ff9890)`,"--color-text-red":`light-dark(#76000c, #ffaea7)`,"--color-background-orange":`light-dark(#ffc7a1, #503424)`,"--color-border-orange":`light-dark(#ffc7a1, #df843f)`,"--color-icon-orange":`light-dark(#622700, #ff9e55)`,"--color-text-orange":`light-dark(#622700, #ffb37e)`,"--color-background-yellow":`light-dark(#fae19e, #453a1c)`,"--color-border-yellow":`light-dark(#e3c36c, #c29900)`,"--color-icon-yellow":`light-dark(#4b3900, #e2b623)`,"--color-text-yellow":`light-dark(#4b3900, #eec448)`,"--color-background-green":`light-dark(#bce0bb, #2b422b)`,"--color-border-green":`light-dark(#aad4a9, #6ab26b)`,"--color-icon-green":`light-dark(#00490b, #90ca90)`,"--color-text-green":`light-dark(#00490b, #90ca90)`,"--color-background-teal":`light-dark(#a9e2d6, #28413c)`,"--color-border-teal":`light-dark(#90d7c8, #4fb1a0)`,"--color-icon-teal":`light-dark(#00463d, #81c9bb)`,"--color-text-teal":`light-dark(#00463d, #90d7c8)`,"--color-background-cyan":`light-dark(#9ae2f4, #274046)`,"--color-border-cyan":`light-dark(#85d5e9, #49adc4)`,"--color-icon-cyan":`light-dark(#004351, #71c7dd)`,"--color-text-cyan":`light-dark(#004351, #85d5e9)`,"--color-background-blue":`light-dark(#b9d7ff, #253c5a)`,"--color-border-blue":`light-dark(#a1caff, #5aa0f8)`,"--color-icon-blue":`light-dark(#003978, #88bcff)`,"--color-text-blue":`light-dark(#003978, #a1caff)`,"--color-background-purple":`light-dark(#f7d5ff, #4a2f51)`,"--color-border-purple":`light-dark(#f3bfff, #d885eb)`,"--color-icon-purple":`light-dark(#5c0e6c, #e496f6)`,"--color-text-purple":`light-dark(#5c0e6c, #eaacf8)`,"--color-background-pink":`light-dark(#ffc0d7, #572b3d)`,"--color-border-pink":`light-dark(#ffc0d7, #fc78b1)`,"--color-icon-pink":`light-dark(#70003f, #fd92bd)`,"--color-text-pink":`light-dark(#70003f, #ffa9ca)`,"--color-background-gray":`light-dark(#e2e2e2, #303030)`,"--color-border-gray":`light-dark(#d4d4d4, #262626)`,"--color-icon-gray":`light-dark(#474747, #9e9e9e)`,"--color-text-gray":`light-dark(#1b1b1b, #d4d4d4)`,"--radius-none":`0px`,"--radius-inner":`0.375rem`,"--radius-element":`0.625rem`,"--radius-container":`0.75rem`,"--radius-page":`1.75rem`,"--radius-full":`9999px`,"--shadow-low":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 25%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 40%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 8%))`,"--shadow-med":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 35%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 12%))`,"--shadow-high":`0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 70%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 15%))`,"--shadow-inset-hover":`inset 0px 0px 0px 2px #0074e24D`,"--shadow-inset-selected":`inset 0px 0px 0px 2px #0074e280`,"--shadow-inset-success":`inset 0px 0px 0px 2px #2f7d334D`,"--shadow-inset-warning":`inset 0px 0px 0px 2px #f8d36a4D`,"--shadow-inset-error":`inset 0px 0px 0px 2px #de47454D`},localTokens:{"--astryx-theme-neutral-color-status-fill-accent":`light-dark(#0074e2, #6d9cfe)`,"--astryx-theme-neutral-color-status-fill-success":`light-dark(#198100, #64af4c)`,"--astryx-theme-neutral-color-status-fill-warning":`#ffce2f`,"--astryx-theme-neutral-color-status-fill-error":`light-dark(#c9303a, #ff705d)`,"--astryx-theme-neutral-color-status-muted-accent":`light-dark(#b9d7ff, #88bcff3D)`,"--astryx-theme-neutral-color-on-tint-neutral":`light-dark(#fafafa4D, #0a0a0a4D)`,"--astryx-theme-neutral-color-on-tint-overlay-hover":`light-dark(#fafafa1A, #0a0a0a1A)`,"--astryx-theme-neutral-color-on-tint-overlay-pressed":`light-dark(#fafafa33, #0a0a0a33)`,"--astryx-theme-neutral-color-destructive-overlay-hover":`light-dark(#ff7f770D, #ee736c0D)`,"--astryx-theme-neutral-color-destructive-overlay-pressed":`light-dark(#ff7f771A, #ee736c1A)`},__localTokenOwners:{"--astryx-theme-neutral-color-status-fill-accent":`neutral`,"--astryx-theme-neutral-color-status-fill-success":`neutral`,"--astryx-theme-neutral-color-status-fill-warning":`neutral`,"--astryx-theme-neutral-color-status-fill-error":`neutral`,"--astryx-theme-neutral-color-status-muted-accent":`neutral`,"--astryx-theme-neutral-color-on-tint-neutral":`neutral`,"--astryx-theme-neutral-color-on-tint-overlay-hover":`neutral`,"--astryx-theme-neutral-color-on-tint-overlay-pressed":`neutral`,"--astryx-theme-neutral-color-destructive-overlay-hover":`neutral`,"--astryx-theme-neutral-color-destructive-overlay-pressed":`neutral`},__localTokenLineage:[`neutral`,`theorem`],components:{heading:{"level:1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-1-size)`,fontWeight:`var(--text-heading-1-weight)`,lineHeight:`var(--text-heading-1-leading)`},"level:2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-2-size)`,fontWeight:`var(--text-heading-2-weight)`,lineHeight:`var(--text-heading-2-leading)`},"level:3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-3-size)`,fontWeight:`var(--text-heading-3-weight)`,lineHeight:`var(--text-heading-3-leading)`},"level:4":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-4-size)`,fontWeight:`var(--text-heading-4-weight)`,lineHeight:`var(--text-heading-4-leading)`},"level:5":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-5-size)`,fontWeight:`var(--text-heading-5-weight)`,lineHeight:`var(--text-heading-5-leading)`},"level:6":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-6-size)`,fontWeight:`var(--text-heading-6-weight)`,lineHeight:`var(--text-heading-6-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},text:{"type:body":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-body-size)`,lineHeight:`var(--text-body-leading)`},"type:large":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-large-size)`,lineHeight:`var(--text-large-leading)`},"type:label":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-label-size)`,lineHeight:`var(--text-label-leading)`},"type:code":{fontFamily:`var(--font-family-code)`,fontSize:`var(--text-code-size)`,lineHeight:`var(--text-code-leading)`},"type:supporting":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-supporting-size)`,lineHeight:`var(--text-supporting-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},button:{"variant:destructive":{backgroundColor:`var(--color-error-muted)`,color:`var(--color-error)`,"--color-overlay-hover":`var(--astryx-theme-neutral-color-destructive-overlay-hover)`,"--color-overlay-pressed":`var(--astryx-theme-neutral-color-destructive-overlay-pressed)`}},badge:{"variant:info":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-accent)`,color:`var(--color-on-accent)`},"variant:neutral":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`},"variant:success":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-success)`,color:`var(--color-on-success)`},"variant:warning":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-warning)`,color:`var(--color-on-warning)`},"variant:error":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-error)`,color:`var(--color-on-error)`},"variant:red":{backgroundColor:`var(--color-background-red)`,color:`var(--color-text-red)`},"variant:orange":{backgroundColor:`var(--color-background-orange)`,color:`var(--color-text-orange)`},"variant:yellow":{backgroundColor:`var(--color-background-yellow)`,color:`var(--color-text-yellow)`},"variant:green":{backgroundColor:`var(--color-background-green)`,color:`var(--color-text-green)`},"variant:teal":{backgroundColor:`var(--color-background-teal)`,color:`var(--color-text-teal)`},"variant:cyan":{backgroundColor:`var(--color-background-cyan)`,color:`var(--color-text-cyan)`},"variant:blue":{backgroundColor:`var(--color-background-blue)`,color:`var(--color-text-blue)`},"variant:purple":{backgroundColor:`var(--color-background-purple)`,color:`var(--color-text-purple)`},"variant:pink":{backgroundColor:`var(--color-background-pink)`,color:`var(--color-text-pink)`},"variant:gray":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`}},"status-dot":{"variant:success":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-success)`},"variant:warning":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-warning)`},"variant:error":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-error)`},"variant:accent":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-accent)`}},"avatar-status-dot":{"variant:success":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-success)`},"variant:error":{backgroundColor:`var(--astryx-theme-neutral-color-status-fill-error)`}},"segmented-control":{base:{padding:`var(--spacing-1)`}},"segmented-control-item":{"size:sm":{height:`calc(var(--size-element-sm) - 8px)`},"size:md":{height:`calc(var(--size-element-md) - 8px)`},"size:lg":{height:`calc(var(--size-element-lg) - 8px)`},selected:{boxShadow:`none`}},banner:{base:{"--color-neutral":`var(--astryx-theme-neutral-color-on-tint-neutral)`,"--color-overlay-hover":`var(--astryx-theme-neutral-color-on-tint-overlay-hover)`,"--color-overlay-pressed":`var(--astryx-theme-neutral-color-on-tint-overlay-pressed)`},"status:info":{"--color-accent-muted":`var(--astryx-theme-neutral-color-status-muted-accent)`,"--color-text-primary":`var(--color-text-blue)`,"--color-text-secondary":`var(--color-text-blue)`,"--color-accent":`var(--color-text-blue)`},"status:success":{"--color-text-primary":`var(--color-text-green)`,"--color-text-secondary":`var(--color-text-green)`,"--color-success":`var(--color-text-green)`},"status:warning":{"--color-text-primary":`var(--color-text-yellow)`,"--color-text-secondary":`var(--color-text-yellow)`,"--color-warning":`var(--color-text-yellow)`},"status:error":{"--color-text-primary":`var(--color-text-red)`,"--color-text-secondary":`var(--color-text-red)`,"--color-error":`var(--color-text-red)`}},"step-indicator":{"status:accent":{"--color-accent":`var(--astryx-theme-neutral-color-status-fill-accent)`},"status:success":{"--color-success":`var(--astryx-theme-neutral-color-status-fill-success)`},"status:warning":{"--color-warning":`var(--astryx-theme-neutral-color-status-fill-warning)`},"status:error":{"--color-error":`var(--astryx-theme-neutral-color-status-fill-error)`}},switch:{base:{"--color-background-gray":`var(--color-border-emphasized)`}},"progress-bar":{base:{"--color-background-muted":`var(--color-border-emphasized)`},"variant:accent":{"--color-accent":`var(--astryx-theme-neutral-color-status-fill-accent)`},"variant:success":{"--color-success":`var(--astryx-theme-neutral-color-status-fill-success)`},"variant:warning":{"--color-warning":`var(--astryx-theme-neutral-color-status-fill-warning)`},"variant:error":{"--color-error":`var(--astryx-theme-neutral-color-status-fill-error)`}},card:{base:{padding:`var(--spacing-3)`},"variant:bubble":{backgroundColor:`var(--color-neutral)`,borderRadius:`var(--radius-chat)`,paddingBlock:`var(--spacing-3)`,paddingInline:`var(--spacing-4)`}},section:{base:{padding:`var(--spacing-3)`}},lightbox:{base:{padding:`var(--spacing-12)`,"::backdrop":{backgroundColor:`light-dark(#00000059, #00000099)`}}},"collapsible-content":{base:{display:`block`,overflow:`clip`,interpolateSize:`allow-keywords`,transition:`height var(--duration-medium) var(--ease-standard), padding-top var(--duration-medium) var(--ease-standard), content-visibility var(--duration-medium) allow-discrete`,':where([aria-expanded="false"] + *)':{height:`0`,paddingTop:`0`,contentVisibility:`hidden`}}},citation:{base:{':where(*) > [aria-hidden="true"]':{backgroundColor:`transparent`,borderWidth:`0`,borderRadius:`0`},':where(*) > [aria-hidden="true"] > img':{width:`100%`,height:`100%`}}},"chat-tool-calls":{base:{':where(*) [role="button"][aria-expanded] > span:not(:first-child):not(:has(svg))':{alignSelf:`baseline`}}},"code-block":{"container:card":{borderRadius:`var(--radius-container)`}},"layout-panel":{base:{':where([role="complementary"])':{transition:`width var(--duration-medium) var(--ease-standard)`},':where([data-resizing] + [role="complementary"], [role="complementary"]:has(+ [data-resizing]))':{transition:`none`}}}},__onDark:{tokens:{"color-scheme":`dark`,"--color-text-primary":`var(--color-on-dark)`,"--color-icon-primary":`var(--color-on-dark)`,"--color-accent":`var(--color-on-dark)`}},__onLight:{tokens:{"color-scheme":`light`,"--color-text-primary":`var(--color-on-light)`,"--color-icon-primary":`var(--color-on-light)`,"--color-accent":`var(--color-on-light)`}},__adaptations:{widthBreakpoints:{sm:640,md:768,lg:1024,xl:1280,"2xl":1536},rules:[{when:{pointer:`coarse`,width:{below:`lg`}},value:{typography:{scale:{base:16,ratio:1.1736}}}},{when:{motion:`reduce`},value:{components:{"collapsible-content":{base:{transition:`none`}},"layout-panel":{base:{':where([role="complementary"])':{transition:`none`}}}}}}]},__axes:{typography:{scale:{base:14,ratio:1.2},body:{family:`Figtree`,fallbacks:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`},heading:{family:`Figtree`,fallbacks:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,weights:{3:`bold`,4:`bold`}},code:{family:`ui-monospace`,fallbacks:`"SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`}},motion:{fast:125,medium:300,slow:700,ratio:.75}},icons:{...Li.icons,...Ri}},zs=1e3,Bs=100,Vs={root:{kWkggS:`xprdx6m x1j0df82 x1o55y2u`,kSiTet:`xvpkmg4 x1tbh5bv`,$$css:!0},animate:{kILWW9:`xpz12be`,k44tkh:`xqgcaz`,ko0y90:`xa4qsjk`,kKVMdj:`xeuoslp x1aquc0h`,kyAemX:`x193epu2`,$$css:!0}},Hs={0:{kaIpWk:`xwksslw`,$$css:!0},1:{kaIpWk:`xx3sua9`,$$css:!0},2:{kaIpWk:`xh6dtrn`,$$css:!0},3:{kaIpWk:`x1hviunn`,$$css:!0},4:{kaIpWk:`x1hviunn`,$$css:!0},none:{kaIpWk:`x2u8bby`,$$css:!0},rounded:{kaIpWk:`xjspbzw`,$$css:!0}},Us={kKxzle:`xvo38ju`,$$css:!0},Ws={animationDelay:e=>[Us,{"--x-animationDelay":(e=>typeof e==`number`?e+`ms`:e??void 0)(`${zs+Bs*e}ms`)}],dimensions:(e,t)=>[{kzqmXN:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x5lhr3w`,kZKoxP:(typeof t==`number`?`${t}px`:t)==null?typeof t==`number`?`${t}px`:t:`x16ye13r`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e),"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof t==`number`?`${t}px`:t)}]};function Gs({width:e=`100%`,height:t=`100%`,radius:n=3,index:r=0,"data-testid":o,xstyle:s,className:c,style:l,ref:u,...d}){return(0,G.jsx)(`div`,{ref:u,"aria-hidden":`true`,"data-testid":o,...f(a(`skeleton`),i(Vs.root,Vs.animate,Hs[n],Ws.dimensions(e,t),Ws.animationDelay(r),s),c,l),...d})}Gs.displayName=`Skeleton`;var Ks={root:{kVAEAm:`x1n2onr6`,k1xSpc:`x3nfvp2`,kXwgrk:`xdt5ytf`,kzqmXN:`x1fu8urw`,kmuXW:`x2lah0s`,kHBbk8:`xc8icb0`,$$css:!0},imageContainer:{kVAEAm:`x1n2onr6`,kzqmXN:`xh8yej3`,kOBAk4:`x1plog1`,kaIpWk:`xh6dtrn`,kVQacm:`xb3r6kr`,kWkggS:`x17x4s8c`,$$css:!0},interactive:{kkrTdU:`x1ypdohk x16khyan`,$$css:!0},overlay:{"--_press-overlay":`x1s9pv7w xb8awce x1a5qima x1sad4of x1s2lk0z xmfmiv1 x1hn5ov8`,"--_press-overlay-transition":`x1wkyqe6 xbb2ue6 x1wphrdb`,k5JduY:`x1s928wv`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kUfP38:`x1k48kgn`,kloYau:`x2q1x1w`,kRicXK:`x1ywzrc5`,kPNhGg:`x18w5vxb`,kA8PQs:`x1dlmc9c`,ks3ayO:`x1l0fnur`,$$css:!0},removeButtonOverrides:{"--_button-radius":`xh8ntw8`,kVAEAm:`x1n2onr6`,kZKoxP:`x1qx5ct2`,k7Eaqz:`xt4ypqs`,kWkggS:`x1u4601x`,kMwMTN:`x9e3rv5`,"--_thumbnail-hit-inset":`x1ur4yav x1h9khjt`,k5JduY:`x1s928wv`,kwXMNM:`x1j6awrg`,kv0HGH:`xeu5z55`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kfzvcC:`x47corl`,$$css:!0}};function qs(){return(0,G.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M21 19V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2M8.5 13.5l2.5 3 3.5-4.5 4.5 6H5l3.5-5.5z`})})}function Js({src:e,alt:t,label:n,onRemove:r,onClick:o,isLoading:s=!1,isDisabled:c=!1,showRemoveOn:l=`hover`,xstyle:u,className:d,style:p,"data-testid":m,ref:h,...g}){let _=ue(),v=oe(),[ee,te]=(0,W.useState)(void 0),y=e!=null,b=y&&ee===e,re=s&&!y,ae=y&&!re&&!b,se=s&&y,ce=!s&&!y||b,S=o!=null&&!c&&!s,fe=r!=null&&!c,C=fe&&l===`hover`,{getContainerProps:pe,getContentRevealProps:me}=Ut({isEnabled:C}),he=n&&t?`${n} — ${t}`:n??t??v(`@astryx.thumbnail.fallbackName`),ge=!t,T=t!=null||n!=null||g[`aria-label`]!=null||g[`aria-labelledby`]!=null;w(`Thumbnail`,'`src` is set without `alt` or `label`. The image is treated as decorative and hidden from assistive technology, and the thumbnail falls back to a generic "thumbnail" name. Pass `alt` to describe the image content, or `label` (file name) to name the thumbnail.',y&&!T);let ve=(0,G.jsxs)(G.Fragment,{children:[ae&&(0,G.jsx)(`img`,{src:e,alt:t??``,role:ge?`presentation`:void 0,"aria-hidden":ge||void 0,onError:()=>te(e),className:`xh8yej3 x5yr21d xl1xv1r x1lliihq`}),re&&(0,G.jsx)(Gs,{radius:2}),ce&&(0,G.jsx)(`div`,{className:`x78zum5 x6s0dn4 xl56j7k xh8yej3 x5yr21d xv9yike`,children:(0,G.jsx)(qs,{})})]}),E=fe?(0,G.jsx)(`div`,{...f({className:`x10l6tqk x8d4r5l xy3asu9 x1vjfegm x14ju556`},C?me({isLayoutPreserved:!0}):{}),children:(0,G.jsx)(de,{icon:(0,G.jsx)(ie,{icon:`close`,size:`xsm`}),label:v(`@astryx.thumbnail.remove`,{accessibleName:he}),variant:`secondary`,size:`sm`,isIconOnly:!0,onClick:e=>{e.stopPropagation(),r(e)},xstyle:Ks.removeButtonOverrides})}):null,D=(0,G.jsx)(`div`,{ref:h,"data-testid":m,role:`group`,"aria-label":he,...f(a(`thumbnail`),i(Ks.root,c&&Ks.disabled,u),d,p),...g,children:(0,G.jsxs)(`div`,{...S?_:void 0,...f(x.focusWithin(Ks.imageContainer,S&&Ks.interactive,S&&Ks.overlay,S&&le.pressedAlpha),C?pe():{}),children:[S?(0,G.jsx)(`button`,{type:`button`,onClick:o,"aria-label":v(`@astryx.thumbnail.open`,{accessibleName:he}),className:`x1ypdohk x16khyan x1lliihq xh8yej3 x5yr21d xh6dtrn xb3r6kr`,children:ve}):ve,ae&&(0,G.jsx)(`div`,{className:`x10l6tqk x10a8y8t x1pjcqnp x1er153n x47corl`}),se&&(0,G.jsx)(`div`,{className:`x10l6tqk x10a8y8t x78zum5 x6s0dn4 xl56j7k x1u4601x x1pjcqnp x1vjfegm x14ju556`,children:(0,G.jsx)(ne,{size:`sm`,shade:`onMedia`})}),E]})});return n==null?D:(0,G.jsx)(_e,{content:n,children:D})}Js.displayName=`Thumbnail`;var Ys={interactive:{kVAEAm:`x1n2onr6`,kkrTdU:`x1ypdohk x16khyan`,kybGjl:`x1hl2dhg`,kMwMTN:`x1heor9g`,$$css:!0},overlay:{"--_press-overlay":`x1s9pv7w xb8awce x1a5qima x1sad4of x1s2lk0z xmfmiv1 x1hn5ov8`,"--_press-overlay-transition":`x1wkyqe6 xbb2ue6 x1wphrdb`,k5JduY:`x1s928wv`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kloYau:`x2q1x1w`,kRicXK:`x1ywzrc5`,kPNhGg:`x18w5vxb`,kA8PQs:`x1dlmc9c`,ks3ayO:`x1l0fnur`,$$css:!0},borderless:{kMzoRj:`xc342km`,$$css:!0},bordered:{kVAM5u:`x14i3s5s`,kZCmMZ:`xs19ii7`,kwRFfy:`x12frdag`,kLKAdn:`x1nex4ik`,kGO01o:`xbv1mwh`,k1ekBW:`xshfolx`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},borderedHoverOnPointer:{kpsWHe:`x1xwh4np`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,$$css:!0}};function Xs(e){e.preventDefault()}function Zs({label:e,onClick:t,onMouseUp:n,href:r,target:i,isDisabled:o=!1,children:s,padding:c,variant:l=`default`,elevation:u=`none`,width:d,height:p,maxWidth:m,ref:h,xstyle:g,className:_,style:v,...ee}){let ne=ue(),y=(0,W.useRef)(null),b=(0,W.useRef)(null),re=ce(),{onClick:ie,onMouseUp:ae}=te({containerRef:y,interactiveRef:b,onClick:t,href:r,target:i,disabled:o}),oe=n?e=>{ae(e),n(e)}:ae,se=r!=null,S=l==="default";return(0,G.jsxs)(ge,{ref:me(h,y),...o?void 0:ne,width:d,height:p,maxWidth:m,padding:c,variant:l,elevation:u,...f(a(`clickable-card`,{variant:l}),x.focusWithin(),_,v),xstyle:[Ys.interactive,S?Ys.bordered:Ys.borderless,!o&&Ys.overlay,!o&&le.pressedAlpha,!o&&S&&Ys.borderedHoverOnPointer,o&&Ys.disabled,g],onClick:o?void 0:ie,onMouseUp:o?void 0:oe,...ee,children:[se?(0,G.jsx)(re,{ref:b,href:o?void 0:r,target:o?void 0:i,onClick:o?Xs:void 0,role:o?`link`:void 0,"aria-label":e,"aria-disabled":o||void 0,tabIndex:o?-1:0,className:`x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km`}):(0,G.jsx)(`button`,{ref:b,type:`button`,"aria-label":e,disabled:o,onClick:t,className:`x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km`}),s]})}Zs.displayName=`ClickableCard`;var Q={dialog:{kVAEAm:`xixxii4`,kpwlN0:`x10a8y8t`,kzqmXN:`xn9wirt`,kZKoxP:`x1dr59a3`,ks0D6T:`x1x1rfll`,kskxy:`x7ab17h`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kVQacm:`xb3r6kr`,kI3sdo:`x1a2a7pz`,kGyWv1:`xnixb3f`,kba3nw:`x1abwkk1`,$$css:!0},imageWrapper:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kVQacm:`xb3r6kr`,kkrTdU:`xt0e3qv`,kfSwDN:`x87ps6o`,kAzted:`x2lwn1j`,$$css:!0},imageWrapperZoomable:{kkrTdU:`x1huxd7x x16khyan x2dt3px`,$$css:!0},imageWrapperZoomed:{kkrTdU:`x1jm3nie x16khyan`,$$css:!0},imageWrapperDragging:{kkrTdU:`xi9pz9s x16khyan`,$$css:!0},image:{ks0D6T:`x193iq5w`,kskxy:`xmz0i5r`,kVIFPx:`x19kjcj4`,kfzvcC:`x47corl`,k1ekBW:`x11xpdln`,kIyJzY:`x13dflua x12w9bfk`,kAMwcw:`x9lcvmn`,$$css:!0},imageDragging:{k1ekBW:`x13b0p5u`,$$css:!0},closeButton:{kVAEAm:`x10l6tqk`,k87sOh:`xyx6v2t`,kt4wiu:`x1mcfs9z`,kY2c9j:`x1vjfegm`,$$css:!0},navButton:{kVAEAm:`x10l6tqk`,k87sOh:`xwa60dl`,kIY38u:`x3sa99s`,kY2c9j:`x1vjfegm`,$$css:!0},navPrev:{kLqNvP:`x1ybfrjj`,$$css:!0},navNext:{kt4wiu:`x1mcfs9z`,$$css:!0},controlButton:{kMwMTN:`x9e3rv5`,$$css:!0}},Qs={imageTransform:e=>[{k3aq6I:e==null?e:`xsqj5wx`,$$css:!0},{"--x-transform":e??void 0}]},$s=50,ec={ArrowLeft:[$s,0],ArrowRight:[-50,0],ArrowUp:[0,$s],ArrowDown:[0,-50]};function tc({isOpen:e,onOpenChange:t,media:n,index:r,defaultIndex:o=0,onIndexChange:s,hasZoom:c=!1,hasAutoPlay:l=!1,xstyle:ee,className:te,style:ne,ref:y,onClick:b,onKeyDown:re,...ae}){let x=oe(),ce=(0,W.useRef)(null),le=me(y,ce),ue=(0,W.useRef)(null),de=(0,W.useRef)(null),C=(0,W.useRef)(null),pe=r!==void 0,[he,ge]=(0,W.useState)(o),w=pe?r:he,_e=(0,W.useCallback)(e=>{pe||ge(e),s?.(e)},[pe,s,ge]),[T,ve]=(0,W.useState)(1),[E,D]=(0,W.useState)({x:0,y:0}),[ye,be]=(0,W.useState)(!1),xe=(0,W.useRef)({x:0,y:0,panX:0,panY:0}),O=(0,W.useMemo)(()=>Array.isArray(n)?n:[n],[n]),k=O.length>1,A=O.length>0?O[Math.min(w,O.length-1)]:null,j=(A?.type??`image`)===`video`,Se=k&&w>0,M=k&&w<O.length-1;Ht(e);let N=A?.src,[Ce,P]=(0,W.useState)({index:w,src:N});(!Object.is(Ce.index,w)||!Object.is(Ce.src,N))&&(P({index:w,src:N}),ve(1),D({x:0,y:0}));let F=S(),we=(0,W.useRef)(w),I=(0,W.useRef)(e);(0,W.useEffect)(()=>{let t=we.current!==w,n=I.current;if(we.current=w,I.current=e,!t||!e||!n)return;let r=O[Math.min(w,O.length-1)],i={index:w+1,total:O.length};F(r?.alt?x(`@astryx.lightbox.mediaPosition`,{alt:r.alt,...i}):x(`@astryx.lightbox.imagePosition`,i))},[w,e,F,O,x]),g(()=>{let t=ce.current;t&&(e&&!t.open?(C.current=document.activeElement,t.showModal()):!e&&t.open&&(t.close(),C.current instanceof HTMLElement&&C.current.focus()))},[e]);let L=(0,W.useCallback)(()=>{t(!1)},[t]),{shouldDismissOnCloseRequest:Te}=_({isActive:e,onDismiss:L}),Ee=(0,W.useCallback)(e=>{e.preventDefault(),Te()&&L()},[L,Te]),De=(0,W.useRef)(!1),Oe=(0,W.useCallback)(e=>{De.current?De.current=!1:(e.target===e.currentTarget||e.target===ue.current)&&L()},[L]),ke=(0,W.useCallback)(()=>{Se&&_e(w-1)},[Se,w,_e]),Ae=(0,W.useCallback)(()=>{M&&_e(w+1)},[M,w,_e]),R=(0,W.useCallback)(e=>{c&&!j&&e!==T&&(ve(e),D({x:0,y:0}),F(x(e>1?`@astryx.lightbox.zoomedIn`:`@astryx.lightbox.zoomedOut`)))},[c,j,T,F,x]),je=(0,W.useCallback)(()=>{R(T===1?2:1)},[R,T]),Me=(0,W.useCallback)(e=>{if(c&&!j){if(e.key===`+`||e.key===`=`){e.preventDefault(),R(2);return}if(e.key===`-`){e.preventDefault(),R(1);return}if(T>1&&ec[e.key]!==void 0){e.preventDefault();let[t,n]=ec[e.key];D(e=>({x:e.x+t,y:e.y+n}));return}}e.key===`ArrowLeft`?(e.preventDefault(),ke()):e.key===`ArrowRight`&&(e.preventDefault(),Ae())},[c,j,T,R,ke,Ae]),Ne=(0,W.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),je())},[je]),Pe=(0,W.useCallback)(e=>{T<=1||!c||(be(!0),De.current=!1,xe.current={x:e.clientX,y:e.clientY,panX:E.x,panY:E.y})},[T,c,E]);(0,W.useEffect)(()=>{if(!ye)return;let e=e=>{De.current=!0;let t=e.clientX-xe.current.x,n=e.clientY-xe.current.y;D({x:xe.current.panX+t,y:xe.current.panY+n})},t=()=>{be(!1)};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[ye]);let Fe=T>1,z=c&&!j,Ie=T===1?null:`scale(${T}) translate(${E.x/T}px, ${E.y/T}px)`;return A?(0,G.jsx)(`dialog`,{ref:le,onCancel:Ee,onClick:e=>{Oe(e),b?.(e)},onKeyDown:e=>{Me(e),re?.(e)},"aria-label":A.alt||x(`@astryx.lightbox.mediaViewer`),...f(a(`lightbox`),i(p.reset,m.reset,Q.dialog,u.reset,ee),te,ne),...ae,children:(0,G.jsx)(h,{children:(0,G.jsx)(d,{children:(0,G.jsxs)(`div`,{ref:ue,className:`x78zum5 xdt5ytf x6s0dn4 xl56j7k xh8yej3 x5yr21d x1n2onr6`,children:[(0,G.jsx)(fe,{icon:(0,G.jsx)(ie,{icon:`close`,size:`sm`,color:`inherit`}),label:x(`@astryx.lightbox.close`),variant:`ghost`,onClick:L,xstyle:[Q.closeButton,Q.controlButton]}),k&&(0,G.jsx)(fe,{icon:(0,G.jsx)(ie,{icon:`chevronLeft`,size:`sm`,color:`inherit`,xstyle:v.mirror}),label:x(`@astryx.lightbox.previous`),variant:`ghost`,isDisabled:!Se,onClick:ke,xstyle:[Q.navButton,Q.navPrev,Q.controlButton]}),(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x6s0dn4 x193iq5w xmz0i5r xb3r6kr`,children:[(0,G.jsx)(`div`,{ref:de,role:z?`button`:void 0,tabIndex:z?0:void 0,"aria-pressed":z?Fe:void 0,"aria-label":z?x(`@astryx.lightbox.zoom`):void 0,...i(Q.imageWrapper,z&&se.focusVisible,!j&&c&&!Fe&&Q.imageWrapperZoomable,!j&&Fe&&Q.imageWrapperZoomed,!j&&ye&&Q.imageWrapperDragging),onDoubleClick:j?void 0:je,onKeyDown:z?Ne:void 0,onPointerDown:j?void 0:Pe,children:j?(0,G.jsx)(`video`,{src:A.src,"aria-label":A.alt,controls:!0,autoPlay:l,className:`x193iq5w xmz0i5r x19kjcj4 x1a2a7pz`}):(0,G.jsx)(`img`,{src:A.src,alt:A.alt,draggable:!1,...i(Q.image,ye&&Q.imageDragging,Ie!=null&&Qs.imageTransform(Ie))})}),A.caption&&(0,G.jsx)(`div`,{className:`x9e3rv5 x18juvz8 xf74fhv x2b8uid x1xye8es x18d9i69 xrrkdod xrlsmeg x2lah0s`,children:A.caption})]}),k&&(0,G.jsx)(fe,{icon:(0,G.jsx)(ie,{icon:`chevronRight`,size:`sm`,color:`inherit`,xstyle:v.mirror}),label:x(`@astryx.lightbox.next`),variant:`ghost`,isDisabled:!M,onClick:Ae,xstyle:[Q.navButton,Q.navNext,Q.controlButton]}),k&&O.length>1&&(0,G.jsxs)(`div`,{className:`x10l6tqk xyx6v2t x1ybfrjj x9e3rv5 xjm74w1 xw6l6zx x1vjfegm`,children:[w+1,` / `,O.length]})]})})})}):null}tc.displayName=`Lightbox`;function nc(e){let[t,n]=(0,W.useState)(rc);return(0,W.useEffect)(()=>{let t=new AbortController;return e.describe(t.signal).then(e=>{t.signal.aborted||n({iface:e,describeFailure:null})},e=>{t.signal.aborted||n({iface:null,describeFailure:ta(e)})}),()=>{t.abort()}},[e]),t}var rc={iface:null,describeFailure:null};function ic({theme:e,mode:t=`system`,children:n}){return(0,W.use)(b)!=null&&!e?(0,G.jsx)(G.Fragment,{children:n}):(0,G.jsx)(tr,{theme:e??Rs,mode:t,children:n})}var ac,oc=()=>ac??=he(()=>import(`./browser-engine-DVCpc0ZM.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]));async function*sc(e,t){yield*t(await e)}function $(e,t){return AbortSignal.any([e.signal,t].filter(e=>e!==void 0))}function cc(e,t){return Tt(yt(e,t.profile.labels,xt),`internal`)}async function lc(e,t,n){try{for await(let t of e){let e=t.type===`trace`||t.type===`steer_inbox`||t.type===`conversation`?t:ht(t,xt);if(e.type===`error`)throw Tt(e,`internal`);n(e)}}catch(e){throw rt(e)?e:cc(e,t)}}function uc(e,t){return e.execution?void 0:async e=>{await(await t())?.pageResult(e)}}function dc(e,t){let n=e.execution?void 0:t.browserExecution();if(n){let t=e;e={mode:t.mode,providers:t.providers,providerDefinitions:t.providerDefinitions,decision:t.decision,signal:t.signal,resolveHost:t.resolveHost?.bind(t),remoteTools:t.remoteTools,hostOptions:t.hostOptions?.bind(t),provider:t.provider?.bind(t),onAgentCall:t.onAgentCall?.bind(t),execution:n.execution,pageExecution:n.pageExecution}}return{runtime:e,local:n}}var fc=`studio-page`;function pc(e,t,n){let r=n.traces??Y(),i=oc().then(e=>({run:e,...dc(t,e),steer:e.createMemorySteerInbox(),conversations:{sessionId:fc,store:e.createSealedConversationStore({keys:{1:n.conversationKey},keyVersion:1})}}));i.catch(()=>{});let a=new Map,o={profile:e.profile,customTools:e.customTools,structured:e.structured,dependencies:e.dependencies},s=(e,t=e=>{})=>js(e,r,t),c=async t=>{try{return await t()}catch(t){throw cc(t,e)}};return{pageResult:uc(t,async()=>(await i).local),describe:()=>Promise.resolve(ws(e)),async turn(n,r,c){try{await lc(sc(i,({run:e,runtime:r,conversations:i,steer:a})=>e.streamStudioTurn({...o,runtime:r,request:n,conversations:i,signal:$(t,c),steer:a})),e,s(r,e=>{n.turnId&&a.set(n.turnId,e)}))}finally{n.turnId&&a.delete(n.turnId)}},invoke:(n,r,a)=>lc(sc(i,({run:e,runtime:r,conversations:i})=>e.streamStudioInvoke({...o,runtime:r,answer:n,conversations:i,signal:$(t,a)})),e,s(r)),conversation:e=>c(async()=>{let{run:t,runtime:n,conversations:r}=await i;return t.studioConversation({...o,runtime:n},r,e)}),rewind:(e,n)=>c(async()=>{let{run:r,runtime:a,conversations:s}=await i;return r.rewindStudio({...o,runtime:a},s,e,$(t,n))}),async steer(e){let t=a.get(e.turnId),{run:n,steer:r}=await i;if(!t||!await r.enqueue(t,n.steerUnitOf(e)))throw new Ge(`request`,`The turn has ended`,{copy:{key:`session.turn_ended`}})},traces:r}}function mc(e,t,n={}){let r=n.traces??Y(),i=[],a,o=()=>a??=oc().then(e=>({run:e,...dc(t,e)})),s={profile:e.profile,customTools:e.customTools,dependencies:e.dependencies},c=e=>js(Ns(e),r,()=>{});return{pageResult:uc(t,async()=>(await o()).local),describe:()=>Promise.resolve(da(V(e.profile),t=>e.customTools.find(e=>e.name===t))),call:(n,r,a)=>lc(sc(o(),({run:e,runtime:r})=>e.streamStudioCall({...s,runtime:r,call:n,sessionPermissions:i,signal:$(t,a)})),e,c(r)),invoke(n,r,a){return i=n.replay?.sessionPermissions??i,lc(sc(o(),({run:e,runtime:r})=>e.streamStudioHostInvoke({...s,runtime:r,answer:n,signal:$(t,a)})),e,c(r))},traces:r}}function hc(e,t,n={}){return{describe:()=>Promise.resolve(Ct(V(e.profile),e.questions??{},e.images)),decide:async(n,r,i)=>{try{return await(await oc()).runStudioDecision(e,n,t.decision??{},$(t,r),i)}catch(t){throw _t(cc(t,e),ft(t))}},traces:n.traces??Y()}}function gc(e,t,n={}){return{describe:()=>Promise.resolve(ra(V(e.profile))),embed:async(n,r,i)=>{try{let a=await oc(),o=await a.runStudioEmbedding(e,{input:n,...r,signal:$(t,i)},dc(t,a).runtime);return{result:o.result,traces:o.traces}}catch(t){throw _t(cc(t,e),ft(t))}},traces:n.traces??Y()}}export{ma as A,Ri as B,Wa as C,vo as D,Ja as E,ea as F,rr as G,vr as H,Qi as I,nr as K,Ki as L,ta as M,na as N,ko as O,Vi as P,$i as R,ls as S,qa as T,_r as U,Li as V,gr as W,ws as _,pc as a,bs as b,tc as c,Gs as d,Es as f,Fs as g,Ls as h,mc as i,ca as j,Y as k,Zs as l,Ps as m,hc as n,ic as o,Is as p,tr as q,gc as r,nc as s,oc as t,Js as u,Ds as v,rs as w,cs as x,xs as y,Bi as z};
@@ -1,7 +0,0 @@
1
- import{t as e}from"./preload-helper-DpV6A1kQ.js";import{C as t,E as n,O as r,T as i,b as a,d as o,f as s,g as c,l,m as u,o as d,p as f,s as p,u as m,v as h,w as g,x as _,y as v}from"./schemas-BQ9Jydzb.js";import{$n as y,$t as b,Br as x,Dn as S,Er as ee,G as te,Gt as C,Hn as w,Ht as T,In as E,Ir as D,Jn as O,Kt as ne,Ln as re,Lt as ie,Mn as ae,Nn as oe,On as se,Pr as ce,Qn as le,Rr as ue,Tr as de,Un as k,Vn as fe,Wn as pe,Xn as me,Xt as he,Yn as ge,Zt as _e,_r as ve,cn as A,dn as ye,er as be,fn as j,gr as xe,hr as Se,jn as Ce,jr as we,kn as Te,kr as Ee,ln as De,nr as Oe,or as ke,pn as Ae,qn as je,rr as Me,s as Ne,sn as Pe,tr as Fe,un as M,ur as Ie,vt as Le,wr as Re,xr as ze,zn as Be,zr as Ve,zt as He}from"./tool-schema-BrqSc6vO.js";import{c as N}from"./host-patterns-C9RMP16Q.js";import{An as Ue,B as We,Bt as Ge,En as Ke,Et as qe,F as Je,Gt as Ye,Ht as Xe,I as Ze,It as Qe,Lt as $e,M as et,Mn as P,Mt as tt,N as nt,Nn as rt,O as it,On as at,P as ot,Pt as st,Q as ct,Qt as lt,Rt as ut,Sn as dt,St as ft,Ut as pt,Vt as mt,W as ht,Wt as gt,X as _t,bt as vt,et as yt,fn as bt,ft as xt,gn as St,it as Ct,j as wt,jt as Tt,k as Et,mn as Dt,mt as F,nn as Ot,nt as kt,pn as At,qt as jt,rn as Mt,rt as Nt,tt as Pt,ut as Ft,wn as It,wt as Lt,xn as Rt,zt}from"./shaped-data-BcarWqd5.js";import{a as Bt,n as Vt}from"./live-ingress-lDUGPwth.js";import{n as Ht,t as Ut}from"./trace-schema-9CdEyG6Q.js";import{n as Wt}from"./stub-DEZDrr-l.js";function I(e){return{type:`guardrail`,guardrail:e}}function Gt(e,t,n,r=`redact`,i){if(n.length!==0)return I({stage:e,trust:t,action:r,hits:n,...i?{provenance:i}:{}})}function Kt(e,t){return e.type===`guardrail`?{...e,guardrail:St(e.guardrail,t)}:e}var L=65536;function R(e){let t=e.classStarts.length,n=new Uint16Array(L);for(let r=0;r<t;r++)n.fill(r,e.classStarts[r],e.classStarts[r+1]??L);let r=e.charsets.map(e=>{let n=new Uint8Array(t);for(let t of e)n[t]=1;return n}),i=e.nodes.length,a=new Int32Array(i),o=new Uint8Array(i),s=[];return e.nodes.forEach((e,t)=>{a[t]=e[0],o[t]=e[1],s.push(Int32Array.from(e.slice(2)))}),{classOf:n,has:r,pattern:a,final:o,edges:s,initials:e.initials,leads:e.leads,size:i}}var z,B,qt;async function Jt(){if(z)return;let{FORWARD_AUTOMATON:t,REVERSED_AUTOMATON:n}=await e(async()=>{let{FORWARD_AUTOMATON:e,REVERSED_AUTOMATON:t}=await import(`./egress-automata-B5ZGE1mT.js`);return{FORWARD_AUTOMATON:e,REVERSED_AUTOMATON:t}},[]);z={forward:t,reversed:n}}function Yt(){if(!z)throw Error(`A stream was opened before loadEgressAutomata() finished.`);return z}var V;function Xt(e){let t=String.fromCharCode(e).toUpperCase();if(t.length!==1)return e;let n=t.charCodeAt(0);return e>=128&&n<128?e:n}function Zt(e){if(!V){V=new Map;for(let e=0;e<L;e++){let t=Xt(e),n=V.get(t);n?n.push(e):V.set(t,[e])}}return V.get(Xt(e))??[e]}function Qt(e){let t=[0];for(let n of e)t.at(-1)!==n&&t.push(n),n+1<L&&t.push(n+1);return t}var $t=new Map;function en(e){let t=$t.get(e);if(t)return t;let n=Array.from({length:e.length},(t,n)=>Zt(e.charCodeAt(n))),r=Qt([...new Set(n.flat())].sort((e,t)=>e-t)),i=e=>r.indexOf(e),a=R({classStarts:r,charsets:n.map(e=>e.map(i)),initials:[0],leads:[-1],nodes:[...n.map((e,t)=>[0,0,t+1,t]),[0,1]]});return $t.set(e,a),a}function tn(e){let t=JSON.stringify(e),n=$t.get(t);if(n)return n;let r=[...new Set(e.flatMap(e=>Array.from(e,e=>e.charCodeAt(0))))];r.sort((e,t)=>e-t);let i=Qt(r),a=r.map(e=>[i.indexOf(e)]),o=[],s=R({classStarts:i,charsets:a,initials:e.map((e,t)=>{let n=o.length;for(let n=0;n<e.length;n++)o.push([t,0,o.length+1,r.indexOf(e.charCodeAt(n))]);return o.push([t,1]),n}),leads:e.map(()=>-1),nodes:o});return $t.set(t,s),s}function nn(e,t){let n=e.has[0]?.length??0,r=Array.from({length:n},()=>[]);for(let i of t){let t=e.edges[e.initials[i]];for(let i=0;i<t.length;i+=2){let a=e.has[t[i+1]];for(let e=0;e<n;e++)a[e]&&r[e]?.push(t[i])}}return r.map(e=>Int32Array.from(e))}function rn(e,t){e.text+=t,e.fresh+=t}function an(e){return e.text.length-e.fresh.length}function H(e,t){let n=an(e);return t>=n?e.fresh.charCodeAt(t-n):e.text.charCodeAt(t)}function on(e,t,n=e.text.length){let r=an(e);return t>=r?e.fresh.slice(t-r,n-r):e.text.slice(t,n)}function sn(e){let t={text:``,fresh:``,rawAt:e=>e,update(){t.text=e.text,t.fresh=e.fresh}};return t}function cn(e,t){let n={text:``,fresh:``,rawAt:e.rawAt,update(){n.fresh=``,rn(n,t(on(e,n.text.length)))}};return n}var ln=/\w/,un=Math.max(...ut.map(e=>e.length));function dn(e){return e.length<=un+1&&/^[A-Za-z]*$/.test(e)}function fn(e){let t=0,n,r=!1,i=[],a=(e,t,n)=>{rn(o,e);for(let r=0;r<e.length;r++)i.push(t+Math.min(r,n-1))},o={text:``,fresh:``,rawAt:r=>e.rawAt(r<i.length?i[r]:t-(n?.length??0)),update(){o.fresh=``;for(let i=e.text.length;t<i;t++){let i=String.fromCharCode(H(e,t)),o=ln.test(i);o&&!r&&(n=``),r=o,o?n===void 0?a(i,t,1):n+=i:(n!==void 0&&a(Xe(n),t-n.length,n.length),n=void 0,a(i,t,1))}n!==void 0&&!dn(n)&&(a(n,t-n.length,n.length),n=void 0)}};return o}function pn(e){let t={text:``,fresh:``,from:[],rawAt:n=>n<t.from.length?t.from[n]:e(),update(){}};return t}function U(e,t,n){rn(e,t);for(let r=0;r<t.length;r++)e.from.push(n)}var mn=55296,hn=56319,gn=/[A-Za-z]/,_n=56320,vn=57343;function yn(e){let t=0,n=``,r=[],i=``,a=[],o=!1,s=-1,c=pn(()=>Math.min(t,r[0]??t,a[0]??t,s<0?t:s));function l(e,t){s>=0&&(gn.test(e)||U(c,`\\`,s),s=-1),e===`\\`?s=t:U(c,e,t)}function u(e,t){if(pt(e)&&(o||i)){i+=e;for(let n=0;n<e.length;n++)a.push(t)}else{if(i){if(!gn.test(e))for(let e=0;e<i.length;e++)l(i[e],a[e]);i=``,a=[]}for(let n=0;n<e.length;n++)l(e[n],t);o=gn.test(e)&&e.length===1}}function d(){let e=0;for(;e<n.length;){let t=n.charCodeAt(e),i=t>=mn&&t<=hn;if(i&&e+1>=n.length)break;let a=n.charCodeAt(e+1),o=i&&a>=_n&&a<=vn?2:1;u(n.slice(e,e+o),r[e]),e+=o}n=n.slice(e),r=r.slice(e)}return c.update=()=>{c.fresh=``;let i=e.text.length;for(;t<i;){let a=H(e,t),o=a>=mn&&a<=hn;if(o&&t+1>=i)break;let s=H(e,t+1),c=o&&s>=_n&&s<=vn?2:1,l=gt(on(e,t,t+c));n+=l;for(let e=0;e<l.length;e++)r.push(t);t+=c}d()},c}var bn=/[0-9A-Fa-f]/;function xn(e){let t=0,n=-1,r=pn(()=>n<0?t:n);r.update=()=>{r.fresh=``;let a=e.text.length;for(;t<a;){let a=String.fromCharCode(H(e,t));if(n<0){a===`%`?n=t:(U(r,a,t),t++);continue}let o=(t-n)%3;if(o===0?a===`%`:bn.test(a))t++;else{i(t-o);for(let n=t-o;n<t;n++)U(r,String.fromCharCode(H(e,n)),n)}}};function i(t){t>n&&U(r,zt(on(e,n,t)),n),n=-1}return r}var Sn=new Set([`injection`,`base64`,`hex`,`spaced`,`pipe`]),Cn=new Map($e.map(({pattern:e,hit:t})=>[e,t])),wn=new Map(Pt.flatMap(({pattern:e,hit:t})=>t?[[e,t]]:[]));function W(e){return{rule:Rt(e),severity:`high`,detector:e}}var Tn=W(`injection`),En=W(`marker_leak`),Dn=W(`tool_leak`);function On({kind:e,group:t}){if(Sn.has(e))return Tn;switch(e){case`sensitive`:case`card`:return t===void 0?void 0:W(t);case`boundary`:return En;case`image`:return W(`ungiven_images`);default:return W(`ungiven_links`)}}function kn(e,t,n){if(e===`card`)return{hit:kt};if(e===`image`||e===`link`){let r=(e===`image`?Nt:Ct).indexOf(t),i=n[e][r];return`find`in i?{find:i.find}:{hit:i.test}}let r=Cn.get(t)??wn.get(t);return r?{hit:r}:{}}function An(e,{given:t,allow:n,skipImages:r}){let i=e=>({...e,...t?{given:t}:{}}),a={image:Ft(i(n?.ungiven_images)),link:xt(i(n?.ungiven_links),r??e.includes(`ungiven_images`))},o=[];return ct.forEach((t,n)=>{let r=On(t);r?.detector&&e.includes(r.detector)&&o.push({...r,id:n,regex:new RegExp(t.pattern.source,t.pattern.flags),...kn(t.kind,t.pattern,a)})}),o}function jn(){let e=[];return ct.forEach(({kind:t,pattern:n},r)=>{if(t!==`injection`)return;let i=Cn.get(n);e.push({...Tn,id:r,regex:new RegExp(n.source,n.flags),...i?{hit:i}:{}})}),e}function Mn(){return Ye.map((e,t)=>({...Tn,id:t,regex:new RegExp(e.source,e.flags)}))}function Nn(e,t,n){let r=nn(t,n.map(e=>e.id)),i=new Int32Array(t.initials.length).fill(-1);n.forEach((e,t)=>{i[e.id]=t});let a=new Int32Array(t.size),o=new Int32Array(t.size),s=new Int32Array(t.size),c=new Int32Array(t.size),l=0,u=new Int32Array(t.size),d=new Int32Array(t.size),f=0,p=0,m=new Uint8Array(n.length),h=new Uint8Array(n.length),g=new Int32Array(n.length),_=new Int32Array(n.length),v=new Uint8Array(n.length),y=Uint8Array.from(n,e=>+!!e.find),b=new Int32Array(n.length).fill(-1),x=new Int32Array(n.length).fill(-1),S=Int32Array.from(n,e=>t.leads[e.id]??-1),ee=[...new Set(S)].filter(e=>e>=0),te=n.flatMap((e,t)=>S[t]<0?[]:[t]),C=new Int32Array(t.has.length).fill(-1);function w(){let{text:n,fresh:h}=e,g=an(e),{classOf:_,has:v,edges:te,final:w,pattern:T}=t;for(;p<n.length;p++){let e=_[p>=g?h.charCodeAt(p-g):n.charCodeAt(p)];f++;let t=0,E=(e,n)=>{if(d[e]===f){let t=u[e];n<c[t]&&(c[t]=n)}else d[e]=f,u[e]=t,s[t]=e,c[t]=n,t++,w[e]&&(m[i[T[e]]]=1)};for(let t=0;t<l;t++){let n=te[a[t]],r=o[t];for(let t=0;t<n.length;t+=2)v[n[t+1]][e]&&E(n[t],r)}let D=r[e];for(let e=0;e<D.length;e++){let t=D[e],n=i[T[t]],r=S[n],a=r<0?-1:C[r],o=a<0?p:a;E(t,o),y[n]&&(x[n]=p,b[n]<0&&(b[n]=o))}for(let t of ee)v[t][e]?C[t]<0&&(C[t]=p):C[t]=-1;[a,s]=[s,a],[o,c]=[c,o],l=t}}function T(){let n=e.text.length;_.fill(n),v.fill(0);let r=n;for(let e=0;e<l;e++){let n=a[e],s=i[t.pattern[n]],c=o[e];c<_[s]&&(_[s]=c),t.final[n]&&(v[s]=1),c<r&&(r=c)}for(let e of te){let t=C[S[e]];t<0||(t<_[e]&&(_[e]=t),t<r&&(r=t))}return r}function E(t,r){let i=b[t],a=g[t];if(i<0||i>=r){g[t]=r;return}let{find:o,rule:s,severity:c,detector:l}=n[t],u=o?.(e.text,a,r);if(u===void 0)g[t]=r,b[t]=x[t]>=r?r:-1;else return g[t]=Math.max(a,u)+1,{rule:s,severity:c,start:e.rawAt(u),detector:l}}function D(t,r){if(!m[t]&&!h[t]){g[t]=r;return}m[t]=0;let i=e.text,{regex:a,hit:o,rule:s,severity:c,detector:l}=n[t];for(a.lastIndex=g[t];;){let n=a.exec(i);if(!n||n.index>=r){g[t]=r,h[t]=n||v[t]?1:0;return}let[u]=n;if(u&&(!o||o(u,i,n.index)))return g[t]=a.lastIndex,h[t]=1,{rule:s,severity:c,start:e.rawAt(n.index),detector:l};u||a.lastIndex++,g[t]=a.lastIndex}}function O(){for(let e=0;e<n.length;e++){let t=_[e];if(t<=g[e])continue;let r=n[e].find?E(e,t):D(e,t);if(r)return r}}return{run(t){w();let n=T();for(let e=O();e;e=O())t.push(e);return e.rawAt(n)}}}var Pn=new WeakMap;function Fn(e){let t=Pn.get(e);return t||(t=R(e),Pn.set(e,t)),t}function In(e={}){let t={text:``,fresh:``},n=sn(t),r=[n],i=(e,t,n)=>(r.includes(e)||r.push(e),Nn(e,t,n)),a=[],o=e.detect??[],s=An(o,e);if(s.length>0&&(B??=R(Yt().forward),a.push(i(n,B,s))),o.includes(`injection`)){B??=R(Yt().forward),qt??=R(Yt().reversed);let e=yn(t),r=jn();a.push(i(n,qt,Mn()),i(fn(n),B,r),i(e,B,r),i(fn(e),B,r),i(cn(n,mt),B,r),i(cn(n,e=>Ge(e)??e),B,r),i(xn(t),B,r))}if(o.includes(`marker_leak`)&&e.note){let t=yt(e.note);a.push(i(n,en(e.note),[{...En,id:0,regex:t}]))}if(o.includes(`tool_leak`)&&e.tools){let t=ht(e.tools),r=t.map(({regex:e},t)=>({...Dn,id:t,regex:e}));t.length>0&&a.push(i(n,tn(t.map(({literal:e})=>e)),r))}for(let{detector:t,compiled:r,matchers:o}of e.own??[]){let e=o.map(({regex:e},n)=>({...W(t),id:n,regex:new RegExp(e.source,e.flags)}));a.push(i(n,Fn(r.automaton),e))}let c=0;return{push(e){t.text+=e,t.fresh=e;for(let e of r)e.update();let n=[],i=t.text.length;for(let e of a)i=Math.min(i,e.run(n));return c=i,n},holdFrom:()=>c}}function Ln(e,t,n={},r=[]){let i=ot(e,t).filter(e=>!(Ze(e)||r.includes(e))),a=Je(e,t);if(i.length===0&&a.length===0)return;let o=[...i,...a.map(({id:e})=>e)],s=t.sources??{},c=[...i.map(e=>({detector:e,...s[e]})),...a.map(({id:e,matchers:t,compiled:n})=>({detector:e,matchers:t,compiled:n}))],l=c.some(({matchers:e,compiled:t})=>e?.length&&!t),u=In({detect:i.filter(e=>s[e]?.theorem!==!1),own:c.flatMap(({detector:e,compiled:t,matchers:n=[]})=>t?[{detector:e,compiled:t,matchers:n}]:[]),skipImages:t.ungiven_images[e]!==`ignore`,...n.allow?{allow:n.allow}:{},...n.givenUrls?{given:n.givenUrls}:{},...n.note?{note:n.note}:{},...n.ownTools?{tools:n.ownTools}:{}}),d=a.some(({find:e})=>e),f=e===`live_reply`?96:256,p=``,m=[];return{push(e){p+=e;for(let{start:t,detector:n}of u.push(e))n&&m.push({start:t,detector:n})},holdFrom(){if(l)return 0;let e=u.holdFrom();return d?Math.min(e,Math.max(0,p.length-f)):e},take(r,i,a=!1){let s=m.filter(({start:e})=>e<i);if(s.length===0&&!a&&!d)return{action:`allow`,text:p.slice(r,i),hits:[],taken:i-r};let c={from:r,to:i,settled:s.map(({detector:e})=>e)},l=nt(p,c,e,t,{detectors:o,scope:n});return m=m.filter(({start:e})=>e>=r+l.taken),l}}}function Rn(e){let{context:t}=e,n=e.detect,r=n?Ln(n.boundary,n.matrix,n.scope):void 0,i=e=>n?n.matrix[e][n.boundary]:`block`,a=i(`canary_leak`),o=i(`prompt_leak`),s=t.canaryGiven||a===`ignore`?void 0:t.canary,c=o===`ignore`?void 0:t.privateSystem,l=s!==void 0||c!==void 0,u=l?e.carry??``:``,d=[],f=new Set,p=``,m=0,h=``,g=u.slice(-F),_=u,v=0,y=u,b=0,x=0,S=s?ft(s):void 0;S?.push(u);function ee(e){let n=[];if(S?.push(e)&&n.push([a,Dt]),c){let r=_.length;_+=e;let i=Qe(_,r);_=_.slice(i),v+=i;let[a]=_t(_,c,t.canary);a&&n.push([o,a])}for(let[e,t]of n)e!==`flag`||f.has(t.rule)||(f.add(t.rule),d.push(t));return n.filter(([e])=>e!==`flag`).map(([,e])=>e)}function te(e){let t=l?ee(e??``):[];return e&&r?.push(e),t.length===0?null:{hits:t,...n?{boundary:n.boundary}:{}}}function C(){let e=s&&a!==`flag`?T(s):h.length,n=c&&o!==`flag`?E(c,t.canary):h.length;return m+Math.min(e,n)}function w(e){if(d.length===0)return e;let t=[...d,...e.found?.hits??[]];return d=[],{...e,found:{action:e.found?.action??`flag`,hits:t}}}function T(e){let t=u.length+m,n=Math.max(t,x),r=Math.max(b,n-F),i=r+vt(y.slice(r-b),e);i<n&&n>t&&(y=g+h,b=t-g.length,i=b+vt(y,e)),x=Math.min(i,u.length+p.length-F);let a=Math.max(b,Math.max(t,x)-F);return y=y.slice(a-b),b=a,Math.max(0,i-t)}function E(e,t){let n=m===0?u:``,r=u.length+m-n.length,[i,a]=v>=r?[_,v]:[n+h,r];return Math.max(0,a+st(i,e,t)-u.length-m)}function D(e){let t=te(e);if(t)return{blocked:!0,...t};let i=e===void 0,a=i?p.length:Math.min(C(),r?.holdFrom()??p.length),o=Math.max(0,a-m);if(!(n&&r))return w({blocked:!1,emit:O(o)});let s=r.take(m,m+o,i);return s.action===`block`||s.action===`redact`&&!n.rewrite?{blocked:!0,hits:s.hits,boundary:n.boundary}:(O(s.taken),w({blocked:!1,emit:s.text??``,...s.action===`allow`?{}:{found:{action:s.action,hits:s.hits}}}))}function O(e){let t=h.slice(0,e);return h=h.slice(e),m+=t.length,l&&(g=(g+t).slice(-F)),t}return{process(e){return e?(p+=e,h+=e,l&&(y+=e),D(e)):{blocked:!1,emit:``}},flush:()=>D(),accumulated:()=>p,unreleased:()=>h,drainUnreleased:()=>O(h.length),carryOut:()=>l?qe(u+p,s,c):``}}function G(e,t,n){return et(t,e.detect,n)}async function zn(e,t,n,r){return G(e,[n],t)?(await Jt(),Bn(e,t,n,r)):null}function Bn(e,t,n,r){return G(e,[n],t)?Rn({context:t,detect:{matrix:e.detect,boundary:n,rewrite:n===`reply`,scope:We(e,t)},...r?{carry:r}:{}}):null}async function Vn(e,t,n,r){return G(e,[n],r??t)?(await Jt(),Rn({context:t,detect:{matrix:e.detect,boundary:n,rewrite:!1,scope:r??We(e,t)}})):null}var Hn=class{open;gate;constructor(e){this.open=e}async read(e){if(this.gate===void 0&&(this.gate=await this.open()),this.gate===`stopped`)return``;if(!this.gate)return e;let t=this.gate.process(e);return t.blocked?(this.gate=`stopped`,``):t.emit}end(){if(!this.gate||this.gate===`stopped`)return``;let e=this.gate.flush();return e.blocked?``:e.emit}},Un=2,Wn=4,Gn=3,Kn=/(^|,)(\s*)("?)(?:([=@])|([+-])(?![0-9."]))/gm,qn=/^[A-Za-z0-9+/]*={0,2}$/,Jn=new Set([`text/csv`,`text/plain`,`text/markdown`]);function Yn(e){let{maxFiles:t,maxBytes:n,maxTurnBytes:r,limitsByMime:i}=e;if(t&&n&&r)return{maxFiles:t,maxBytes:n,maxTurnBytes:r,limitsByMime:i}}function Xn(e,t){if(t.limitsByMime){let n=j(e);if(t.limitsByMime[n])return t.limitsByMime[n];let[r]=n.split(`/`),i=`${r}/*`;if(t.limitsByMime[i])return t.limitsByMime[i]}return t.maxBytes}function Zn(e){return`uri`in e}function Qn(e){if(e.type===`speech`)throw new N(`request`,`Profile ${e.id} (speech) does not accept media input`);if(e.type===`live`)throw new N(`request`,`Profile ${e.id} (live) does not accept turn attachment input`);if(e.type===`host`||e.type===`decision`||e.type===`embedding`)throw new N(`request`,`Profile ${e.id} (${e.type}) does not accept turn input`);let t=Yn(e.inputs??{});if(!t)throw new N(`config`,`Profile ${e.id} must set maxFiles, maxBytes, and maxTurnBytes`);return t}function $n(e){let t=0;return e.endsWith(`==`)?t=Un:e.endsWith(`=`)&&(t=1),Math.floor(e.length*Gn/Wn)-t}function er(e){try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(e)}catch{return new TextDecoder(`latin1`).decode(e)}}function tr(e){return e.replace(Kn,(e,...t)=>{let[n,r,i,a,o]=t;return`${n}${r}${i}'${a??``}${o??``}`})}function nr(e,t,n){let r=er(t);return e===`text/csv`&&(r=tr(r)),new TextEncoder().encode(n.read(r))}function rr(e,t){return t?{...e,fileName:t}:e}function ir(e,t,n){return t.filter(t=>!A(e,t.mimeType)).map(e=>rr({code:`mime_not_allowed`,params:{mimeType:e.mimeType,channel:n}},e.name))}function ar(e,t){let n=[];e.length>t.maxFiles&&n.push({code:`too_many_files`,params:{maxFiles:t.maxFiles}});let r=0;for(let i of e){if(i.sizeBytes===void 0)continue;let e=Xn(i.mimeType,t);i.sizeBytes>e&&n.push(rr({code:`file_too_large`,params:{maxBytes:e}},i.name)),r+=i.sizeBytes}return r>t.maxTurnBytes&&n.push({code:`turn_too_large`,params:{maxTurnBytes:t.maxTurnBytes}}),n}function or(e,t,n){let r=[];return t.length>0&&!e.attachments&&r.push({code:`attachments_not_accepted`,params:{channel:`attachment`}}),n.length>0&&!e.voice&&r.push({code:`voice_not_accepted`,params:{channel:`voice`}}),r.length>0||t.length===0&&n.length===0?r:(e.attachments&&r.push(...ir(e.attachments,t,`attachment`)),e.voice&&r.push(...ir(e.voice,n,`voice`)),e.limits?[...r,...ar([...t,...n],e.limits)]:[...r,{code:`limits_unconfigured`}])}var sr={mime_not_allowed:`attachments.mime_not_allowed`,too_many_files:`attachments.too_many_files`,too_many_of_kind:`attachments.too_many_of_kind`,file_too_large:`attachments.file_too_large`,turn_too_large:`attachments.turn_too_large`,attachments_not_accepted:`attachments.not_accepted`,voice_not_accepted:`attachments.not_accepted`,limits_unconfigured:`attachments.limits_unconfigured`};function cr(e){let t={};for(let[n,r]of Object.entries(e.params??{}))r!==void 0&&(t[n]=r);return e.fileName!==void 0&&(t.fileName=e.fileName),{key:sr[e.code],params:t}}function lr(e,t){let n=cr(e);return P(n.key,n.params,t)}function ur(e){return new N(`input`,`attachments refused: ${e.map(e=>e.code).join(`, `)}`,{copy:e.map(cr)})}function dr(e){if(!qn.test(e))throw new N(`request`,`attachment data must be base64`);return $n(e)}function fr(e){let t={mimeType:e.mimeType,name:e.name};return Zn(e)||(t.sizeBytes=dr(e.data)),t}function pr(e,t,n){if(!hr(t,n))return;let r=Qn(e),i=or({attachments:De(e,`attachments`),voice:De(e,`voice`),limits:r},(t??[]).map(fr),(n??[]).map(fr));if(i.length>0)throw ur(i)}function mr(e,t){if(Zn(e))return e;let{mimeType:n,data:r}=e;if(!Jn.has(j(n)))return e;let i=nr(n,bt(r),t);return{...e,data:At(i)}}function hr(e,t){return(e?.length??0)>0||(t?.length??0)>0}function gr(e,t,n,r){return pr(e,t,n),{attachments:t?.length?t.map(e=>mr(e,r.attachment)):t,voice:n?.length?n.map(e=>mr(e,r.voice)):n}}var _r=`
2
-
3
- `;function vr(e){if(typeof e==`string`)return;if(typeof e!=`object`||!e||Array.isArray(e))return`must be a string or { private: string }`;let t=Object.keys(e);if(t.length!==1||t[0]!==`private`)return`must have exactly one key, private`;let n=e.private;if(typeof n!=`string`)return`must be a string`;if(n===``)return`must not be empty`}function yr(e,t){if(typeof e!=`string`){if(!Array.isArray(e))return`${t} must be a string or an array of parts`;if(e.length===0)return`${t} must not be an empty array`;for(let[n,r]of e.entries()){let e=vr(r);if(e)return`${t}[${n}]${typeof r==`object`&&r&&`private`in r?`.private`:``} ${e}`}}}function br(e,t){let n=yr(e,t);if(n)throw new N(`config`,n)}function xr(e,t,n){return br(e,t),typeof e==`string`?n(e):e.map(e=>typeof e==`string`?n(e):{private:n(e.private)})}function Sr(e){if(typeof e==`string`)return[{text:e,private:!0}];let t=e.some(e=>typeof e!=`string`);return e.map(e=>typeof e==`string`?{text:e,private:!t}:{text:e.private,private:!0})}function Cr(e){let t=[];for(let n of e)n.some(e=>e.text)&&(t.length>0&&t.push({text:_r,private:!0}),t.push(...n));return t}function wr(e){return e.map(e=>e.text).join(``)}function Tr(e){let t=[],n=``;for(let r of e)r.private?n+=r.text:(n.trim()&&t.push(n),n=``);return n.trim()&&t.push(n),{text:wr(e),private:t}}function Er(e,t){return Tr(Cr([e,...t.map(e=>e?[{text:e,private:!0}]:[])]))}var Dr=[`user`,`slots`,`repair`,`attachment`,`voice`,`history`,`system`];function Or(e,t){return e&&Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t.read(n)]))}var kr={client:`untrusted`,server:`assembled`};function Ar(e){return typeof e==`string`?e:JSON.stringify(e)}function jr(e,t){let n=[],r=!1;if(!e)return{context:e,events:n,blocked:r};let i={};for(let a of k){let o=e[a];if(o===void 0)continue;let s=t();i[a]=s.read(Ar(o));let c=s.found(),l=wt(`context`,c);l&&n.push({...l,trust:kr[a]}),r||=c.action===`block`}return{context:i,events:n,blocked:r}}var Mr=/^[A-Za-z0-9._-]+$/;function Nr(e){let t=e?.trim();return t&&Mr.test(t)?t:void 0}function Pr(e,t){if(!e)return e;let n=e.guidance?t.read(e.guidance):void 0;return{previousOutput:t.read(e.previousOutput),rejection:t.read(e.rejection),...n?{guidance:n}:{}}}function Fr(e,t){return e.map(e=>{let n=e.content===void 0?void 0:t.read(e.content),r=e.parts?.map(e=>e.type===`text`?{...e,text:t.read(e.text)}:e);return{role:e.role,...n===void 0?{}:{content:n},...r?{parts:r}:{},...e.tool_calls?{tool_calls:e.tool_calls}:{},...e.tool_call_id?{tool_call_id:e.tool_call_id}:{},...e.name?{name:e.name}:{},...e.metadata?{metadata:e.metadata}:{},...e.reasoning?{reasoning:e.reasoning}:{}}})}function Ir(e){return new N(`input`,`guardrails.detect blocked the request at ${e}`,{copy:{key:`detect.blocked`}})}function Lr(e,t){let{detect:n}=Ae(t.guardrails),r=Ke(Dr,e=>Et(e,n)),i=e.input??{},a=i.text===void 0?void 0:r.user.read(i.text),o=e.system===void 0?void 0:xr(e.system,`TurnRequest.system`,e=>r.system.read(e)),s=Or(i.slots,r.slots),c=jr(i.context,()=>Et(`context`,n)),l=Pr(i.repair,r.repair),u=i.history?Fr(i.history,r.history):void 0,{attachments:d,voice:f}=i.attachments?.length||i.voice?.length?gr(t,i.attachments,i.voice,r):i,p=[],m;for(let e of Dr){let t=r[e].found(),n=wt(e,t);n&&p.push(I(n)),t.action===`block`&&(m??=Ir(e))}return p.push(...c.events.map(I)),c.blocked&&(m??=Ir(`context`)),{request:{...e,system:o,projectId:Nr(e.projectId),input:{...i,text:a,slots:s,...c.context?{context:c.context}:{},repair:l,history:u,attachments:d,voice:f}},events:p,...m?{refusal:m}:{}}}function Rr(e,t){let{request:n,refusal:r}=Lr(e,t);if(r)throw r;return n}function zr(e){let t=Object.keys(e);return t.length===1?t[0]:void 0}function Br(e,t){return[...new Set([...t.filter(t=>A(e,t)),...e.filter(e=>A(t,e))])]}function Vr(e,t){let n=e.attachments?t?Br(e.attachments.accept,t.media.flatMap(e=>e.accept)):[...e.attachments.accept]:[],r=(t?.media??[]).flatMap(e=>e.maxPerInput===void 0?[]:[{accept:[...e.accept],max:e.maxPerInput}]);return{text:e.text!==!1,...n.length>0?{attachments:{accept:n}}:{},...e.maxFiles===void 0?{}:{maxFiles:e.maxFiles},...e.maxBytes===void 0?{}:{maxBytes:e.maxBytes},...e.maxTurnBytes===void 0?{}:{maxTurnBytes:e.maxTurnBytes},...e.limitsByMime===void 0?{}:{limitsByMime:{...e.limitsByMime}},...t?.maxInputs===void 0?{}:{maxInputs:t.maxInputs},...r.length>0?{perInput:r}:{}}}function Hr(e){let t=j(e[0]??``);return t===`application/pdf`?`PDF`:t.split(`/`)[0]??t}function Ur(e,t){let n=Yn(e),r=or({attachments:e.attachments?.accept,...n?{limits:{...n,maxFiles:2**53-1}}:{}},t.flat(),[]);if(n)for(let i of t){i.length>n.maxFiles&&r.push({code:`too_many_files`,params:{maxFiles:n.maxFiles}});for(let t of e.perInput??[])i.filter(e=>A(t.accept,e.mimeType)).length>t.max&&r.push({code:`too_many_of_kind`,params:{maxFiles:t.max,kind:Hr(t.accept)}})}let i=new Set;return r.filter(e=>{let t=JSON.stringify(e);return!i.has(t)&&(i.add(t),!0)})}function Wr(e,t){let n=e.get(t);return n!==void 0&&n.type!==`builtin`}function Gr(e,t){return!e||e.includes(`*`)?!0:t?e.includes(t):!1}function Kr(e,t){return t.filter(n=>{let r=e.get(n);return r?.type!==`builtin`||!(r.conflictsWith??[]).some(e=>t.includes(e))})}function K(e){return`tools`in e?e.tools.allow:[]}function qr(e){return e.type===`text`||e.type===`image`?e.tools:void 0}function Jr(e){return`tools`in e?e.tools.parallel:void 0}function Yr(e,t,n){return K(t).filter(r=>{let i=e.get(r);return!i||i.type===`builtin`?!1:t.type===`host`||Gr(i.paths,n.path)})}function Xr(e,t,n,r){let i=t.models[r];return i?(i.builtInTools??[]).filter(t=>{let r=e.get(t);return r?.type===`builtin`&&Gr(r.paths,n.path)}):[]}function Zr(e,t){let n=e.get(t);if(n&&n.type!==`builtin`)return{type:`function`,name:n.name,description:n.description,parameters:n.inputSchema}}function Qr(e,t){let n=[];for(let r of t){let t=Zr(e,r);t&&n.push(t)}return n}function $r(e,t,n){if(t.visible.includes(n))return;t.visible.push(n);let r=Zr(e,n);r&&!t.wire.some(e=>e.name===n)&&t.wire.push(r)}function ei(e,t,n){if(t.builtins.includes(n))return;let r=e.get(n);if(r?.type!==`builtin`)return;let i=r.conflictsWith??[];t.builtins=t.builtins.filter(t=>{if(i.includes(t))return!1;let r=e.get(t);return!(r?.type===`builtin`&&r.conflictsWith?.includes(n))}),t.builtins.push(n)}function ti(e,t,n){return t.type===`live`||t.type===`host`?[...n]:n.filter(t=>e.get(t)?.loadTier===`T0`)}function ni(e,t,n){return Kr(e,n.filter(n=>{let r=e.get(n);return r?.type===`builtin`&&(t.type===`live`||r.loadTier===`T0`)}))}function ri(e,t,n,r){let i=Yr(e,t,n),a=t.type===`host`||t.type===`decision`||t.type===`embedding`||r===void 0?[]:Xr(e,t,n,r),o=[...i,...a],s=ni(e,t,o),c=ti(e,t,o);return{builtins:s,gated:o,visible:c,executable:c.filter(t=>Wr(e,t)),path:n.path,sessionPermissions:n.sessionPermissions,wire:Qr(e,c)}}async function ii(e,t,n,r){let i=ri(e,t,n,r);return await oi(e,i,t,n),i}function ai(e){return{builtins:[...e.builtins],gated:[...e.gated],visible:[...e.visible],executable:[...e.executable],path:e.path,sessionPermissions:e.sessionPermissions?[...e.sessionPermissions]:void 0,wire:e.wire.map(e=>({...e,parameters:structuredClone(e.parameters)}))}}async function oi(e,t,n,r){let i=qr(n)?.t1Policy;if(!i)return;let a;try{a=await i({profile:n,input:r.input,path:r.path,sessionPermissions:r.sessionPermissions,gated:t.gated,host:r.host})}catch(e){let t=e instanceof Error?e.message:String(e);throw new N(`config`,`Profile '${n.id}' tools.t1Policy rejected: ${t}`,{cause:e})}if(!Array.isArray(a))throw new N(`config`,`Profile '${n.id}' tools.t1Policy must return ToolId[]`);for(let n of a){if(!t.gated.includes(n))continue;let r=e.get(n);r?.loadTier===`T2`&&(r.type===`builtin`?ei(e,t,n):$r(e,t,n))}t.executable=t.visible.filter(t=>Wr(e,t))}var si=new Set([`__proto__`,`constructor`,`prototype`]);function ci(e){if(!it(e))return;let{loaded:t}=e;if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t}function li(e,t,n,r){if(r.type===`live`||r.type===`host`)return{promoted:[]};let i=[];for(let a of n){if(typeof a!=`string`||si.has(a))return{promoted:[],failure:{code:`invalid_output`,kind:`bad_response`,message:`tools.t2Loader loaded ids must be plain strings`}};let n=di(e,a,r);if(`failure`in n)return{promoted:[],failure:n.failure};let{tool:o}=n;Gr(o.paths,t.path)&&t.gated.includes(a)&&i.push(a)}let a=[];for(let n of i)$r(e,t,n),a.push(n);return t.executable=t.visible.filter(t=>Wr(e,t)),{promoted:a}}function ui(e){return{failure:{code:`invalid_output`,kind:`bad_response`,message:e}}}function di(e,t,n){if(!K(n).includes(t))return ui(`tools.t2Loader attempted to promote tool '${t}' outside profile allow`);let r=e.get(t);return r?r.type===`builtin`?ui(`tools.t2Loader attempted to promote builtin '${t}' — only custom tools may be promoted`):r.loadTier===`T2`?{tool:r}:ui(`tools.t2Loader attempted to promote tool '${t}' with loadTier '${r.loadTier}' — only T2 tools may be promoted`):ui(`tools.t2Loader attempted to promote unknown tool '${t}'`)}function fi(e,t){return e.get(t)||{name:t,missing:!0}}function pi(e){let t=new Set;if(e.type===`host`||e.type===`decision`||e.type===`embedding`)return[];for(let n of Object.values(e.models))for(let e of n.builtInTools??[])t.add(e);return[...t]}function mi(e,t){return[...K(t),...pi(t)].map(t=>fi(e,t))}function q(e,t){if(Array.isArray(e)){for(let n of e)q(n,t);return}if(typeof e!=`object`||!e)return;let{properties:n,...r}=e;if(typeof n==`object`&&n)for(let[e,r]of Object.entries(n))t.add(e),q(r,t);for(let e of Object.values(r))q(e,t)}function hi(e,t){let n=mi(e,t);if(n.length===0)return;let r=new Set;for(let e of n)`inputSchema`in e&&q(e.inputSchema,r);return{names:n.map(({name:e})=>e),params:[...r]}}function gi(e){return!e||e.length===0?[]:e.slice(-4)}function _i(e,t){if(e.length===0)return``;let n=e.map(e=>`${e.role===`user`?`User`:`Assistant`}: ${e.content}`);return`${P(`repair.history_heading`,{count:e.length},t)}\n${n.join(`
4
- `)}\n\n`}function vi(e){let{profile:t,repair:n,history:r}=e,i=n.guidance||P(`repair.default_guidance`,{},t.labels),a=_i(gi(r),t.labels),o=`${P(`repair.prompt_header`,{},t.labels)}\n\n`;return o+=`${P(`repair.prompt_intro`,{},t.labels)}\n\n`,o+=`${P(`repair.section_previous_output`,{},t.labels)}\n\`\`\`\n${n.previousOutput.trim()}\n\`\`\`\n\n`,o+=`${P(`repair.section_validator_rejection`,{},t.labels)}\n${n.rejection.trim()}\n\n`,i.trim()&&(o+=`${P(`repair.section_repair_guidance`,{},t.labels)}\n${i.trim()}\n\n`),a&&(o+=a),o+=`${P(`repair.section_instructions`,{},t.labels)}\n`,o+=P(`repair.prompt_instructions`,{},t.labels),o}function yi(e,t){let n=[];return t&&n.push(`structured`),e.type===`image`&&n.push(`image`),e.type===`speech`&&n.push(`speech`),n}function bi(e,t){let n=yi(e,t);if(!(n.length<=1))throw new N(`config`,`Profile ${e.id} declares multiple output wire formats (${n.join(`, `)}). Only one of a structured JSON schema (outputs.structured), image, or speech may be active.`)}function xi(e,t){if(e.type!==`speech`){if(t.speech)throw new N(`request`,`Profile ${e.id} (${e.type}) takes no speech settings — only a speech profile speaks`)}else if(t.system)throw new N(`config`,`Profile ${e.id} (speech) takes no system prompt — the input text is the transcript`)}function Si(e,t){return e.type===`speech`?{...e.speech,...Ci(t.speech)}:void 0}function Ci(e){return Object.fromEntries(Object.entries(e??{}).filter(([,e])=>e!==void 0))}function wi(e){if(e.type!==`image`)return null;let t=e.image;return{type:`image`,mimeType:t.mimeType,aspectRatio:t.aspectRatio,resolution:t.resolution,quality:t.quality,background:t.background,n:t.n,seed:t.seed,outputCompression:t.outputCompression,includeText:t.includeText===!0}}function Ti(e){let t=Pe(e);if(!t)throw new N(`input`,`MIME '${e}' is not a supported media input type`);return t}function Ei(e){return e.map(e=>{let t=Ti(e.mimeType),n=j(e.mimeType),r=n===`image/jpg`?`image/jpeg`:n;return Zn(e)?{type:t,mimeType:r,uri:e.uri}:{type:t,mimeType:r,data:e.data}})}function Di(e,t){let{text:n,repair:r,history:i}=t.input??{};if(e.type===`speech`&&!n?.trim())throw new N(`request`,`Profile ${e.id} (speech) requires text input`);if(M(e)?.text===!1&&n)throw new N(`request`,`Profile ${e.id} does not accept text input`);let a=r?vi({profile:e,repair:r,history:i}):ki(e,t)??n;if(e.type===`speech`)return a?{type:`text`,text:a}:null;let o=[...Oi(t),...a?[tt(a)]:[]];return o.length>0?{type:`text`,text:o.join(`
5
-
6
- `)}:null}function Oi(e){let t=e.input?.context??{};return[...k].reverse().filter(e=>t[e]!==void 0).map(e=>Tt(e,Ar(t[e])))}function ki(e,t){if(t.continueFrom&&He.includes(e.type)){if(t.input?.text)throw new N(`request`,`Profile ${e.id}: a continueFrom turn takes no input.text — its user message is the continue instruction`);return P(`continue.instruction`,{},e.labels)}}function Ai(e){return e.type===`image`&&e.image.references?Ei(e.image.references):[]}function ji(e,t){let n=t.input?.attachments??[],r=t.input?.voice??[];return[...Ai(e),...Ei(n),...Ei(r)]}function Mi(e,t){let n=[],r=Di(e,t);return r&&n.push(r),n.push(...ji(e,t)),n}function Ni(e,t){let n=t.input?.slots;if(!n)return;let r=M(e)?.slots??{};for(let[t,i]of Object.entries(n)){let n=Object.hasOwn(r,t)?r[t]:void 0;if(!n)throw new N(`request`,`Profile ${e.id} has no slot '${t}'`);if(!n.includes(i))throw new N(`request`,`Profile ${e.id}: slot '${t}' takes ${n.join(`, `)}, not '${i}'`)}}function Pi(e,t){let n=t.input?.context;if(!n)return;let r=M(e)?.context;for(let[t,i]of Object.entries(n))if(i!==void 0){if(!k.includes(t)||!r?.from.some(e=>e===t))throw new N(`request`,`Profile ${e.id} takes no context from '${t}'`);if(Ar(i).length>r.maxChars)throw new N(`request`,`Profile ${e.id}: context from '${t}' is over inputs.context.maxChars (${String(r.maxChars)})`)}}var Fi=/\{([A-Za-z_][\w-]*)\}/g;function Ii(e,t,n,r){let i=M(e)?.slots;return i?t.replace(Fi,(t,a)=>{if(!Object.hasOwn(i,a))return t;let o=n&&Object.hasOwn(n,a)?n[a]:void 0;if(o===void 0)throw new N(`request`,`Profile ${e.id}: ${r} uses slot '${a}', and the request chose no value for it`);return o}):t}function Li(e,t){let{handle:n}=e.identity,r=e.type===`speech`?void 0:e.identity.systemByRole;return t&&r&&Object.hasOwn(r,t)?t:n}function Ri(e,t,n){if(e.type===`speech`)return[];let{systemByRole:r,system:i}=e.identity,a=r?.[t]||i||``;return a?Sr(xr(a,`Profile ${e.id} identity.system`,t=>Ii(e,t,n,`identity.system`))):[]}function zi(e,t){return Cr([Ri(e,Li(e,t.input?.role),t.input?.slots),t.system===void 0?[]:Sr(t.system)])}function Bi(e){return e.type!==`host`&&e.type!==`decision`&&e.type!==`embedding`}function Vi(e,t){if(Bi(e))return e;throw e.type===`host`?new N(`request`,`Profile ${e.id}: type 'host' never runs a model — ${t} is not supported; execute tools with invokeTool`):e.type===`embedding`?new N(`request`,`Profile ${e.id}: type 'embedding' runs through runEmbedding — ${t} is not supported`):new N(`request`,`Profile ${e.id}: type 'decision' runs through runDecision — ${t} is not supported`)}function Hi(e,t){if(t){if(!e.allowModelSelect)throw new N(`request`,`Profile ${e.id} does not allow model selection`);if(!e.models[t])throw new N(`request`,`Unknown model '${t}' for ${e.id}`);return t}return e.defaultModel}function Ui(e,t,n,r){let i=t.efforts;if(!i||Object.keys(i).length===0){if(r)throw new N(`request`,`Profile ${e.id} model '${n}' has no selectable efforts`);return}let a=Object.keys(i);if(r){if(!t.allowEffortSelect)throw new N(`request`,`Profile ${e.id} model '${n}' does not allow effort selection`);let a=i[r];if(!a)throw new N(`request`,`Unknown effort '${r}' for ${e.id} model '${n}'`);return a}return i[t.defaultEffort??a[0]]}function Wi(e){if(e.summaries===!0)return`auto`;if(e.summaries===!1)return`none`}function Gi(e,t){if(e.type===`live`)return null;let n=e.outputs?.structured;if(!n)return null;if(typeof n==`string`)return n;let r=t?.[n.by];if(r){let e=n.map[r];if(e)return e}return n.fallback}function Ki(e){return e.type===`live`||e.outputs?.streaming?.mode!==`buffered`}function qi(e,t){return e.type===`live`?`live`:`turn`}function Ji(e,t){if(!t.continueFrom)return;if(e.type===`live`)throw new N(`request`,`Profile ${e.id}: type 'live' uses live.sessionResumption, not turnBehaviour.resumption/continueFrom`);let n=ne(e)?.maxContinues;if(n===void 0)return;let r=t.continuation;if(r===void 0)throw new N(`request`,`Profile ${e.id}: continueFrom requires TurnRequest.continuation when turnBehaviour.resumption.maxContinues is set`);if(r<1)throw new N(`request`,`Profile ${e.id}: continuation must be >= 1`);if(r>n)throw new N(`request`,`Profile ${e.id}: continuation ${r} exceeds turnBehaviour.resumption.maxContinues (${n})`)}function Yi(e,t){return G(Ae(t),[`live_reply`])?{...e,transcription:{...e?.transcription,output:!0}}:e}function Xi(e){let{detect:t}=Ae(e.guardrails);return e.type!==`speech`&&Mt(t,`canary_leak`)?Lt():``}function Zi(e,t,n,r){if(!r)return;let i={};for(let[a,o]of Object.entries(r)){if(!n.builtInTools?.includes(a))throw new N(`request`,`Profile ${e.id}: builtInArgs names '${a}', which model '${t}' does not list in builtInTools`);i[a]=o}return i}function Qi(e,t,n){let r=Vi(e.profiles.get(t.profile),`resolveTurn`);Ni(r,t),Pi(r,t);let i=Rr(t,r),a=i.input??{};Ji(r,i);let o=n??Hi(r,i.model),s=ye(r,o),c=ri(e.tools,r,i,o),l=c.builtins,u=Gi(r,a.slots);bi(r,u),xi(r,i);let d=Zi(r,o,s,i.builtInArgs),f=qi(r,s);return{profile:r,generation:{model:o,apiId:s.apiId,transport:f,stream:Ki(r),thinking:Ui(r,s,o,i.effort),summaries:Wi(s),maxOutputTokens:s.maxOutputTokens,temperature:s.temperature,builtins:l,builtInArgs:d,sessionId:i.sessionId,tools:c,sessionPermissions:i.sessionPermissions,execution:i.execution,pageExecution:i.pageExecution,history:a.history,maxSteps:r.maxSteps??20,structured:u?{id:u,jsonSchema:e.schemas.get(u).jsonSchema}:null,image:wi(r),speech:Si(r,i),live:r.type===`live`?Yi(r.live,r.guardrails):void 0,input:Mi(r,i),canary:Xi(r),resolvedSystem:zi(r,i),host:i.host}}}function $i(e){return e.type===`image`?e.image:null}function ea(e,t){let n=Vi(t,`projectProfile`),{identity:r}=n,i=M(n)??null,a=n.type===`live`?null:n.outputs??null;return{id:n.id,type:n.type,handle:r.handle,models:n.models,defaultModel:n.defaultModel,allowModelSelect:n.allowModelSelect,maxSteps:n.maxSteps,tools:mi(e,n),inputs:i,outputs:a,image:$i(n),speech:n.type===`speech`?n.speech:null,live:n.type===`live`?n.live:null}}function ta(e,t){return ea(e.tools,e.profiles.get(t))}function na(e){return e==null}function J(e){return na(e)||typeof e!=`object`||Array.isArray(e)?null:e}function ra(e){let t=J(e);return!t||t.type!==void 0&&t.type!==`object`?null:t}function ia(e){let t=e.required;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function aa(e){let t=e.properties;return J(t)??{}}function oa(e,t){return e?`${e}.${t}`:t}function sa(e,t){t.push({path:e,error:`required field '${e}' is missing`})}async function ca(e,t,n,r,i){if(!n)return;let a=await n(t,r);a.isValid||i.push({path:e,error:a.error||a.finding||`Validation failed for '${e}'`})}async function la(e){let{path:t,propSchema:n,child:r,isRequired:i,fields:a,slots:o,failures:s}=e;if(na(r)){i&&sa(t,s);return}await ca(t,r,a?.[t],o,s);let c=ra(n),l=c?J(r):null;c&&l&&await ua(c,l,t,a,o,s)}async function ua(e,t,n,r,i,a){let o=aa(e),s=new Set(ia(e)),c=new Set([...Object.keys(o),...s]),l=J(t);for(let e of c)await la({path:oa(n,e),propSchema:o[e],child:l?.[e],isRequired:s.has(e),fields:r,slots:i,failures:a})}async function da(e,t,n,r){let i=ra(e);if(!i)throw new N(`config`,`structured validation requires a JSON Schema object root`);let a=[];if(!J(t)){for(let e of ia(i))sa(e,a);return a}return await ua(i,t,``,n,r,a),a}function fa(e,t){let n=e;for(let e of t.split(`.`)){let t=ra(n);if(!t)return!1;let r=aa(t);if(!Object.hasOwn(r,e)&&!ia(t).includes(e))return!1;n=r[e]}return!0}function pa(e){return e.map(e=>e.error).join(`; `)}function ma(e,t){let n=e;for(let e of t.split(`.`))n=J(n)?.[e];return n}function ha(e,t,n){let[r,...i]=t.split(`.`),a=J(e)??{};return r===void 0?e:{...a,[r]:i.length?ha(a[r],i.join(`.`),n):n}}async function ga(e,t,n){let r=[];for(let[i,a]of Object.entries(t??{})){let t=ma(e,i);if(Array.isArray(t))for(let[e,o]of t.entries()){let t=await a.check(o,n);t.isValid||r.push({path:i,index:e,item:o,reason:t.error||t.finding||`Validation failed for '${i}'`,onFail:a.onFail})}}return r}function _a(e,t){let n=e;for(let e of t.split(`.`)){let t=ra(n);if(!t)return;n=aa(t)[e]}let r=J(n);if(r?.type===`array`)return J(r.items)??void 0}var va=class extends Error{failure;constructor(e){super(e.message),this.failure=e}},ya=new Set([`text`,`image`,`speech`]),ba=g().regex(/\S/),xa=t({mimeType:g(),data:m(),name:g().optional()}),Sa=t({mimeType:g(),uri:g(),name:g().optional()}),Ca=t({voice:g().optional(),style:g().optional(),speed:h().positive().optional()});function wa(e){return t(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,d(t).optional()])))}var Ta=new Set([`text`,`attachments`,`voice`,`slots`,`speech`]);function Ea(e,t){if(!e.hostFields)return{sent:t};let n={...t},r={};for(let t of Object.keys(e.hostFields))n[t]!==void 0&&(r[t]=n[t]);let{text:i,attachments:a,voice:o,slots:s,speech:c}=t;return{sent:{text:i,...a?{attachments:a}:{},...o?{voice:o}:{},...s?{slots:s}:{},...c?{speech:c}:{}},hostInput:r}}function Da(e,n){let{inputs:r}=e,a={text:ba};r?.attachments&&(a.attachments=l(i([xa,Sa])).optional()),r?.voice&&(a.voice=l(xa).optional()),r?.slots&&(a.slots=wa(r.slots).optional()),e.type===`speech`&&(a.speech=Ca.optional());for(let e of n?.hostOnly??[]){if(!a[e])throw new N(`config`,`Tool '${n?.name}' keeps '${e}' for the host, which its profile does not take`);delete a[e]}for(let[e,t]of Object.entries(n?.fieldText??{})){let r=a[e];if(!r)throw new N(`config`,`Tool '${n?.name}' describes '${e}', which its profile does not take`);a[e]=r.describe(t)}for(let[e,t]of Object.entries(n?.hostFields??{})){if(Ta.has(e))throw new N(`config`,`Tool '${n?.name}' declares the host field '${e}', which is a field of every agent tool`);a[e]=t}return t(a)}var Oa=v({text:g().optional(),structured:n().optional(),removed:l(v({path:g(),reason:g(),item:n()})).optional(),parts:l(Te).optional(),sources:l(oe).optional()});function ka(e){return e.type===`speech`||(e.type===`text`||e.type===`image`)&&e.inputs.text!==!1}function Aa(e){return e.type===`builtin`?!1:e.permission!==`auto`||`auth`in e&&e.auth!==void 0&&(e.auth.onUnauthenticated??`gate`)===`gate`}function ja(e,t){if(!ya.has(e.type))return`it is a ${e.type} profile; an agent tool runs a text, image, or speech profile`;if(!ka(e))return`it does not take text`;for(let n of K(e)){let e=t(n);if(!e)return`its tool '${n}' is not registered; register it first`;if(Aa(e))return`its tool '${n}' can stop on a gate; give it permission 'auto' and no sign-in`}}function Ma(e,t,n){let r=`Agent tool "${e.name}"`,i=e.maxCallsPerTurn;if(i!==void 0&&!(Number.isInteger(i)&&i>0))throw new N(`config`,`${r}: maxCallsPerTurn must be a whole number above 0`);let a=t(e.profile);if(!a)throw new N(`config`,`${r}: profile '${e.profile}' must be registered before the tool`);let o=ja(a,n);if(o)throw new N(`config`,`${r} can't run '${e.profile}': ${o}`);return a}function Na(e){if(!e)return`delegated`;let t=`models`in e&&Object.values(e.models).some(e=>(e.builtInTools?.length??0)>0);return K(e).length===0&&!t?`local`:`delegated`}function Pa(e){let t=Ce(e),n=t.flatMap(e=>e.type===`text`?[e.text]:[]).join(``),r=ie(t,e=>e.type===`structured`),i=r?.structured,a=t.flatMap(e=>e.type===`media`?[{type:e.media.mimeType.startsWith(`audio/`)?`audio`:`image`,mimeType:e.media.mimeType,data:e.media.data}]:[]),o=t.flatMap(e=>e.type===`citation`?e.sources:[]);return{...i===void 0?{text:n}:{structured:i},...r?.removed?.length?{removed:r.removed}:{},...a.length>0?{parts:a}:{},...o.length>0?{sources:o}:{}}}function Fa(e,t,n){return{...e,type:`agent`,input:t,output:Oa,sources:e=>e.sources??[],...n}}var Ia=256,La=18e5,Ra=/^[\x21-\x7E]{1,256}$/;function za(e=Date.now){let t=new Map,n=new Map;return{get(n){let r=t.get(n);if(r&&(t.delete(n),!(e()-r.usedAt>La)))return t.set(n,{...r,usedAt:e()}),{id:r.id,protocolVersion:r.protocolVersion}},open(r,i){let a=n.get(r);if(a)return a;let o=i().then(n=>{t.delete(r),t.set(r,{...n,usedAt:e()});for(let e of t.keys()){if(t.size<=Ia)break;t.delete(e)}return n}).finally(()=>n.delete(r));return n.set(r,o),o},drop(e,n){t.get(e)?.id===n&&t.delete(e)},clear(){t.clear(),n.clear()}}}function Ba(e){return e!==null&&Ra.test(e)}async function Va(e,t){let n=JSON.stringify([e,Object.entries(t).map(([e,t])=>[e.toLowerCase(),t]).sort(([e],[t])=>e<t?-1:+(e>t))]),r=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(n));return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function Ha(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return n.push(`${t}: schema must be an object`),!1;let r=typeof e.type==`string`||Array.isArray(e.type),i=e.anyOf!==void 0||e.oneOf!==void 0;if(!r&&!i){if(t!==`$`)return!0;n.push(`${t}: missing type or combinator`)}return e.type===`array`&&e.items===void 0&&n.push(`${t}: array schema must define items`),!0}function Ua(e,t,n,r){let i=Array.isArray(t)?t:[];for(let t of i)typeof t==`string`&&!Object.hasOwn(e,t)&&r.push(`${n}: required key '${t}' missing from properties`);for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&Wa(i,`${n}.properties.${t}`,r)}function Wa(e,t,n){if(!Ha(e,t,n))return;let r=e.properties;r&&typeof r==`object`&&!Array.isArray(r)&&Ua(r,e.required,t,n),e.items&&typeof e.items==`object`&&!Array.isArray(e.items)&&Wa(e.items,`${t}.items`,n);for(let r of[`anyOf`,`oneOf`]){let i=e[r];Array.isArray(i)&&i.forEach((e,i)=>{e&&typeof e==`object`&&Wa(e,`${t}.${r}[${i}]`,n)})}}function Ga(e,t){let n=[];if(Wa(e,`$`,n),n.length>0)throw new N(`config`,`Invalid tool ${t} schema: ${n.join(`; `)}`)}function Ka(e,t=`output`){let n=r(e,{target:`draft-7`,io:t});return delete n.$schema,n.type||=`object`,n}function qa(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(qa);let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=qa(e[n]));return t}function Ja(e){let t=/^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(e)?.[0];if(!t||/[{}]/.test(t))throw new N(`config`,`Endpoint "${e}" must start with a fixed scheme and host; placeholders belong in the path or query`)}var Ya=class{value;constructor(e){this.value=e}};function Xa(e){return new Ya(e)}function Za(e){return(t,n)=>{let{page:r}=n;if(r&&`output`in r)return Xa(r.output);let{labels:i}=n.profile;throw r?.timedOut?Error(P(`tool.page_timed_out`,{},i)):Error(P(`tool.page_no_answer`,{tool:e},i))}}function Qa(e){let t=Ka(e.input,`input`);Ga(t,`input`);let n=Ka(e.output,`output`);Ga(n,`output`);let r={activity:{input:t},activityPast:{input:t,output:n},activityFailed:{input:t},request:{input:t}};for(let t of[`activity`,`activityPast`,`activityFailed`,`request`]){let n=e.labels?.[t],i=n?Le(n,r[t]):void 0;if(i)throw new N(`config`,`Tool "${e.name}" ${t} label: ${i}`)}return{inputSchema:t,outputSchema:n}}function $a(e,t){if(t&&(typeof t.service!=`string`||!t.service.trim()))throw new N(`config`,`Tool "${e}" signs in with slot "${t.slot}" but names no service`)}function eo(e,t,n=[]){if(t?.queryParam===void 0)return;let r=t.queryParam.trim()?t.type===`api_key`?t.headerName!==void 0||t.headerPrefix!==void 0?`is set with headerName or headerPrefix; the key goes in one place`:n.includes(t.queryParam)?`"${t.queryParam}" is also one of mapping.queryParams`:void 0:`is set on a '${t.type}' sign-in; only an API key goes in the URL`:`is blank`;if(r)throw new N(`config`,`Tool "${e}" auth.queryParam ${r}`)}function to(e,t){if(t!==void 0&&!(Number.isInteger(t.requests)&&t.requests>0&&Number.isFinite(t.windowMs)&&t.windowMs>0))throw new N(`config`,`Tool "${e}" limit needs a whole number of requests above 0 and a window above 0 ms`)}function no(e,t){if(!(t===void 0||Number.isFinite(t)&&t>0))throw new N(`config`,`Tool "${e}" timeoutMs needs a finite number of ms above 0`)}function ro(e){return Ja(e.endpoint),$a(e.name,e.auth),eo(e.name,e.auth,e.mapping?.queryParams),to(e.name,e.limit),no(e.name,e.timeoutMs),{...e,type:`http`,...Qa(e)}}function io(e){return $a(e.name,e.auth),eo(e.name,e.auth),{...e,type:`mcp`,...Qa(e)}}function ao(e){$a(e.name,e.auth),eo(e.name,e.auth);let t=e.answeredBy===`page`?Za(e.name):e.handler;if(typeof t!=`function`)throw new N(`config`,`Tool '${e.name}' needs a handler, or answeredBy: 'page'`);return{...e,handler:t,type:`function`,...Qa(e)}}function oo(e,t,n){if(e.type===`builtin`)return e;if(e.type===`agent`){let r=Ma(e,t,n),i=M(r),a=Da({type:r.type,...i?{inputs:i}:{}},e);return Fa(e,a,Qa({...e,input:a,output:Oa}))}return e.type===`http`?ro(e):e.type===`mcp`?io(e):ao(e)}function so(e=()=>void 0){let t=new Map,n=za(),r=e=>t.get(e),i=n=>{let i=oo(n,e,r);return t.set(i.name,i),i};return{register:i,registerMany:e=>e.map(e=>i(e)),get:r,require(e){let t=r(e);if(!t)throw new N(`config`,`Tool '${e}' is not registered`);return t},has:e=>t.has(e),list:()=>[...t.values()],findProfile:e,reset:()=>{t.clear(),n.clear()},mcpSessions:n}}function co(e,t,n,r){if(!n.provider?.trim()||!n.apiId?.trim())throw new N(`config`,P(`provider.binding_identity`))}function lo(e){yo(e.id,e.models),Vo(e.id,e.observability),ls(e.id,e.inputs);for(let[t,n]of Object.entries(e.models))xo(e.id,t,n);return{type:`embedding`,id:e.id,identity:{handle:e.identity.handle},models:e.models,defaultModel:bo(e.id,e),allowModelSelect:e.allowModelSelect,inputs:e.inputs,guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function uo(e,t,n,r){let i=r.safeParse(n);if(!i.success)throw new N(`config`,`Profile ${e} model '${t}': ${i.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`; `)}`)}function fo(e,t,n){if(uo(e,t,n,_e),co(e,t,n,`decision`),`retry`in n)throw new N(`config`,`Profile ${e} model '${t}': decision retry configuration is unsupported; POSTs are never retried`);if(n.timeoutMs!==void 0&&(!Number.isFinite(n.timeoutMs)||n.timeoutMs<=0))throw new N(`config`,`Profile ${e} model '${t}' timeoutMs must be > 0`)}function po(e){let t=e.models?zr(e.models):void 0;if(!t)throw new N(`config`,`Profile ${e.id}: type 'decision' must declare exactly one model`);fo(e.id,t,e.models[t])}function mo(e){if(e.inputs.state!==`json`)throw new N(`config`,`Profile ${e.id}: decision inputs.state must be 'json'`);let t=e.inputs.maxStateBytes;if(t!==void 0&&!(Number.isInteger(t)&&t>0))throw new N(`config`,`Profile ${e.id}: decision inputs.maxStateBytes must be a positive integer`);if(!e.decision.contract.trim())throw new N(`config`,`Profile ${e.id}: decision.contract must be non-empty`)}function ho(e){return po(e),mo(e),Vo(e.id,e.observability),{...e,identity:{handle:e.identity.handle}}}function go(e){return e===void 0?{}:{parallel:e}}function _o(e){return vo(e.id,e.tools),Vo(e.id,e.observability),{type:`host`,id:e.id,tools:{allow:e.tools.allow,...go(e.tools.parallel)},guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function vo(e,t){if(!Array.isArray(t.allow))throw new N(`config`,`Profile ${e}: type 'host' must set tools.allow`)}function yo(e,t){if(Object.keys(t).length===0)throw new N(`config`,`Profile ${e} must declare at least one model`)}function bo(e,t){let n=t.defaultModel??zr(t.models);if(!n)throw new N(`config`,`Profile ${e} must set defaultModel when more than one model is declared`);if(!t.models[n])throw new N(`config`,`Profile ${e} defaultModel '${n}' is not declared`);return n}function xo(e,t,n){So(e,t,n),uo(e,t,n,b),So(e,t,n)}function So(e,t,n){let r=n.efforts;if(!r||Object.keys(r).length===0){if(n.defaultEffort||n.allowEffortSelect)throw new N(`config`,`Profile ${e} model '${t}': defaultEffort and allowEffortSelect require efforts`);return}for(let[n,i]of Object.entries(r))if(!Me.includes(i))throw new N(`config`,`Profile ${e} model '${t}' effort '${n}': '${i}' is not a thinking level (${Me.join(`, `)})`);let i=Object.keys(r),a=n.defaultEffort??(i.length===1?i[0]:void 0);if(!a)throw new N(`config`,`Profile ${e} model '${t}' must set defaultEffort when more than one effort is declared`);if(!r[a])throw new N(`config`,`Profile ${e} model '${t}' defaultEffort '${a}' is not declared`);if(n.allowEffortSelect&&i.length<2)throw new N(`config`,`Profile ${e} model '${t}' allowEffortSelect requires at least two efforts`)}function Co(e){return{providerContinuation:e.providerContinuation?ze.parse(e.providerContinuation):{},models:e.models,defaultModel:bo(e.id,e),allowModelSelect:e.allowModelSelect,maxSteps:e.maxSteps}}function wo(e,t,n){if(n?.length){for(let r of n)if(!T(r))throw new N(`config`,`Profile ${e}: turnBehaviour.resumption.${t} may only include ContinueStopKind (length | stream_incomplete | provider_error); got '${r}'`)}}function To(e,t){t&&(wo(e,`allowContinue`,t.allowContinue),wo(e,`autoContinue`,t.autoContinue))}function Eo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Do(e,t){let n=[e];for(let e of t)n=n.flatMap(t=>Eo(t)?e===`*`?Object.values(t):[t[e]]:[]);return n}var Oo=Object.entries(le).filter(([,e])=>e.required===!0).map(([e,t])=>[e,t.profileTypes]).sort(([e],[t])=>e.split(`.`).length-t.split(`.`).length);function ko(e){if(!Eo(e))throw new N(`config`,`Profile definition must be an object`);let t=typeof e.id==`string`&&e.id.trim()?e.id:void 0;if(!t)throw new N(`config`,`Profile definition must set id`);if(!y.find(t=>t===e.type))throw new N(`config`,`Profile ${t}: type must be one of ${y.join(`, `)}`)}function Ao(e){let t=e.identity?.handle,n=[[`id`,e.id,64],[`identity.handle`,typeof t==`string`?t:``,32]];for(let[t,r,i]of n)if(!(Array.from(r).length<=i))throw new N(`config`,`Profile ${e.id.slice(0,64)}: ${t} must be at most ${i} characters`)}function jo(e){let{id:t,type:n}=e,r=e;for(let[e,i]of Oo){if(i&&!i.includes(n))continue;let a=xe(e),o=Do(r,a.slice(0,-1)),s=a[a.length-1];if(o.some(e=>{if(!Eo(e))return!1;let t=e[s];return t==null||t===``}))throw new N(`config`,`Profile ${t}: type '${n}' must set ${a.join(`.`)}`)}}function Mo(e){let{id:t,type:n}=e;if(n!==`live`&&ve(`inputs`).includes(n)&&e.inputs==null)throw new N(`config`,`Profile ${t}: type '${n}' must set inputs`)}function No(e){let[t]=Se(e);if(!t)return;let{offValue:n,reason:r}=t.scope,i=n===void 0?``:` (other than ${n})`;throw new N(`config`,`Profile ${e.id}: type '${e.type}' must not set ${t.path}${i} — ${r}`)}function Po(e,t){let n=t.turnBehaviour;To(e,n?.resumption)}function Fo(e,t){let n=t=>new N(`config`,`Profile ${e}: ${t}`),r=t?.maxRetries;if(r!==void 0&&(!Number.isInteger(r)||r<0))throw n(`outputs.validation.maxRetries must be a non-negative integer`)}function Io(e,t){let n=t=>new N(`config`,`Profile ${e}: ${t}`),r=Object.keys(t??{}).find(e=>!Lo.includes(e));if(r!==void 0)throw n(`guardrails.${r} is not a setting; it takes ${Lo.join(`, `)}`);zo(t?.blockedReply,n)}var Lo=[`quota`,`detect`,`blockedReply`,`network`,`taint`],Ro=[`onBlock`,`maxRetries`];function zo(e,t){if(e===void 0)return;let n=Object.keys(e).find(e=>!Ro.includes(e));if(n!==void 0)throw t(`guardrails.blockedReply.${n} is not a setting; it takes onBlock and maxRetries`);let{onBlock:r,maxRetries:i}=e;if(r!==void 0&&!Ee.includes(r))throw t(`guardrails.blockedReply.onBlock must be one of ${Ee.join(`, `)}`);if(i!==void 0&&(!Number.isInteger(i)||i<0))throw t(`guardrails.blockedReply.maxRetries must be a non-negative integer`)}function Bo(e){let t=e.guardrails?.detect,n=e.type===`host`?Ot(`guardrails.detect`,t,It):Ot(`guardrails.detect`,t);if(n!==void 0)throw new N(`config`,`Profile ${e.id}: ${n}`)}function Vo(e,t){try{let n=Bt(t);if(!Number.isFinite(n.retainForDays))throw new N(`config`,`Profile ${e}: observability.retainForDays must be a finite number`);if(n.rotateAfterMiB<=0||!Number.isFinite(n.rotateAfterMiB))throw new N(`config`,`Profile ${e}: observability.rotateAfterMiB must be a positive number`)}catch(t){if(t instanceof N&&t.message.startsWith(`Profile `))throw t;let n=t instanceof Error?t.message:String(t);throw new N(`config`,`Profile ${e}: ${n}`)}}function Ho(e){if(e.type===`host`||e.type===`decision`||e.type===`speech`||e.type===`embedding`)return;let{system:t,systemByRole:n}=e.identity;t!==void 0&&br(t,`Profile ${e.id} identity.system`);for(let[t,r]of Object.entries(n??{}))br(r,`Profile ${e.id} identity.systemByRole.${t}`)}function Uo(e){ko(e);for(let t of[`key`,`fallbackKey`,`protocol`,`provider`])if(t in e)throw new N(`config`,P(`provider.profile_configuration`,{profile:e.id,field:t}));if(No(e),Mo(e),jo(e),Ao(e),e.labels&&rt(e.labels,`Profile ${e.id}`),Ho(e),Bo(e),e.type===`host`)return _o(e);if(e.type===`decision`)return ho(e);if(e.type===`embedding`)return lo(e);yo(e.id,e.models),Po(e.id,e),Io(e.id,e.guardrails),e.type===`text`&&Fo(e.id,e.outputs?.validation),Vo(e.id,e.observability);for(let[t,n]of Object.entries(e.models))xo(e.id,t,n);let t=e.type===`speech`?{handle:e.identity.handle}:{handle:e.identity.handle,system:e.identity.system,systemByRole:e.identity.systemByRole},n=e.guardrails,r=e.observability,i=e.labels,a=Co(e),o;switch(e.type){case`text`:o={type:`text`,id:e.id,identity:t,...a,tools:e.tools,inputs:e.inputs,outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i};break;case`image`:o={type:`image`,id:e.id,identity:t,...a,image:e.image,tools:e.tools,inputs:e.inputs,outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i},Yo(o.id,o.inputs.attachments?.accept),Jo(o.id,o.image);break;case`speech`:o={type:`speech`,id:e.id,identity:t,...a,speech:e.speech,outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i};break;case`live`:o={type:`live`,id:e.id,identity:t,...a,live:e.live,inputs:e.inputs,tools:{allow:e.tools.allow,...go(e.tools.parallel)},turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i},Vt(o),Zo(o.id,o.live.contextCompression),Xo(o);break;default:throw new N(`config`,`Unknown profile type '${String(e)}'`)}return Ko(o),Wo(o),Go(o),o}function Wo(e){let{maxSteps:t}=e;if(!(t===void 0||Number.isInteger(t)&&t>0))throw new N(`config`,`Profile ${e.id}: maxSteps must be a whole number of 1 or more; leave it out for the default of 20`)}function Go(e){if(e.type===`text`&&e.turnBehaviour?.atStepLimit===`answer`&&e.maxSteps===1)throw new N(`config`,`Profile ${e.id}: turnBehaviour.atStepLimit 'answer' with maxSteps 1 leaves no step that can call a tool`)}function Ko(e){if(e.type===`live`)return;let t=e.outputs?.structured;if(!t||typeof t==`string`)return;let n=M(e)?.slots?.[t.by];if(!n)throw new N(`config`,`Profile ${e.id}: outputs.structured.by '${t.by}' is not a slot in inputs.slots`);let r=Object.keys(t.map).filter(e=>!n.includes(e));if(r.length)throw new N(`config`,`Profile ${e.id}: outputs.structured.map maps ${r.join(`, `)}, not a choice of slot '${t.by}'`)}var qo={n:{ok:e=>Number.isInteger(e)&&e>=1,rule:`a whole number of 1 or more`},seed:{ok:Number.isInteger,rule:`a whole number`},outputCompression:{ok:e=>Number.isInteger(e)&&e>=0&&e<=100,rule:`a whole number from 0 to 100`}};function Jo(e,t){for(let[n,{ok:r,rule:i}]of Object.entries(qo)){let a=t[n];if(a!==void 0&&!r(a))throw new N(`config`,`Profile ${e}: image.${n} must be ${i}`)}t.references?.forEach((t,n)=>{let r=`Profile ${e}: image.references[${n}]`;if(Pe(t.mimeType)!==`image`)throw new N(`config`,`${r} must be an image, not '${t.mimeType}'`);if(!(Zn(t)?t.uri:t.data))throw new N(`config`,`${r} needs its bytes or its uri`)})}function Yo(e,t){let n=t?.filter(e=>!A(je,e));if(n?.length)throw new N(`config`,`Profile ${e}: an image profile's attachments take images, video, and PDF only, not ${n.join(`, `)}`)}function Xo(e){let{greeting:t,resumed:n,sessionResumption:r}=e.live,i=`Profile ${e.id} live`;if(t!==void 0&&(typeof t!=`string`||!t.trim()))throw new N(`config`,`${i}.greeting must be a prompt; leave it out to wait`);if(!n)return;if(typeof n.prompt!=`string`||!n.prompt.trim())throw new N(`config`,`${i}.resumed.prompt must be a prompt`);let{afterMs:a}=n;if(a!==void 0&&!(Number.isFinite(a)&&a>=0))throw new N(`config`,`${i}.resumed.afterMs must be 0 or more milliseconds`);if(!r)throw new N(`config`,`${i}.resumed needs live.sessionResumption: without it no call resumes`)}function Zo(e,t){if(!t)return;let n=`Profile ${e} live.contextCompression`,r=t.triggerTokens,i=t.slidingWindow.targetTokens;if(Qo(`${n}.triggerTokens`,r),Qo(`${n}.slidingWindow.targetTokens`,i),r!==void 0&&i!==void 0&&i>=r)throw new N(`config`,`${n}: slidingWindow.targetTokens must be below triggerTokens`)}function Qo(e,t){if(!(t===void 0||Number.isInteger(t)&&t>0))throw new N(`config`,`${e} must be a whole number above 0`)}function $o(e,t,n,r){let i=`Profile ${t.id} model ${n} compaction`;if(es(i,r),ts(i,r),r.meter!=null&&r.meter!==`history`&&r.meter!==`input`)throw new N(`config`,`${i}: meter must be 'history' or 'input'`);if(r.profile===void 0){if(t.type!==`text`||t.inputs.text===!1)throw new N(`config`,`${i}: a profile that compacts itself must be a text profile that takes text`);return}let a=e.get(r.profile);if(!a)throw new N(`config`,`${i}: compaction profile '${r.profile}' must be registered before '${t.id}'`);if(a.type!==`text`||a.inputs.text===!1)throw new N(`config`,`${i}: compaction profile '${r.profile}' must be a text profile that takes text`)}function es(e,t){if(t.maxTokens<=0)throw new N(`config`,`${e}: maxTokens must be > 0`);if(t.compactAt<=0||t.compactAt>=1)throw new N(`config`,`${e}: compactAt must be in (0, 1)`)}function ts(e,t){if(t.previousExchanges<0)throw new N(`config`,`${e}: previousExchanges must be >= 0`);if(t.previousExchanges<1&&t.previousExchanges>=t.compactAt)throw new N(`config`,`${e}: previousExchanges as fraction (${t.previousExchanges}) must be < compactAt (${t.compactAt})`);if(t.previousExchanges>1&&!Number.isInteger(t.previousExchanges))throw new N(`config`,`${e}: previousExchanges >= 1 must be an integer`)}function ns(e,t){for(let n of K(t))if(e.get(n)?.type===`builtin`)throw new N(`config`,t.type===`host`?`Profile ${t.id} lists builtin '${n}' in tools.allow — type 'host' never runs a model`:`Profile ${t.id} lists builtin '${n}' in tools.allow — declare it on models.*.builtInTools instead`)}function rs(e,t){let n=qr(t)?.t2Loader;if(n){if(!K(t).includes(n))throw new N(`config`,`Profile ${t.id} tools.t2Loader '${n}' must also be listed in tools.allow`);if(e.get(n)?.type!==`function`)throw new N(`config`,`Profile ${t.id} tools.t2Loader '${n}' must be a registered type: 'function' tool`)}}function*is(e){for(let[t,n]of Object.entries(e.models))for(let e of n.builtInTools??[])yield{modelId:t,id:e}}function as(e,t){for(let{modelId:n,id:r}of is(t))if(e.get(r)?.type!==`builtin`)throw new N(`config`,`Profile ${t.id} model '${n}' lists '${r}' in builtInTools — not a registered builtin`)}function os(e){let t=e.type===`text`?e.outputs?.structured:void 0;return t?typeof t==`string`?[t]:[...new Set([...Object.values(t.map),t.fallback])]:[]}function ss(e,t){let n=os(t).map(n=>{let r=e.find(n);if(!r)throw new N(`config`,`Profile ${t.id}: outputs.structured names '${n}', which is not a registered schema; register it before the profile`);return r}),r=t.type===`text`?t.outputs?.validation:void 0,i=Object.keys(r?.fields??{}),a=Object.keys(r?.items??{});if(!i.length&&!a.length)return;if(!n.length)throw new N(`config`,`Profile ${t.id}: outputs.validation checks a structured reply, so it needs outputs.structured`);let o=a.filter(e=>!n.some(t=>_a(t.jsonSchema,e)));if(o.length)throw new N(`config`,`Profile ${t.id}: outputs.validation.items has ${o.join(`, `)}, which no structured schema reaches as a list with an items schema`);let s=i.filter(e=>!n.some(t=>fa(t.jsonSchema,e)));if(s.length)throw new N(`config`,`Profile ${t.id}: outputs.validation.fields has ${s.join(`, `)}, which no structured schema reaches through object properties`)}function cs(e){let t=M(e)?.context;if(!t)return;let n=k;if(t.from.length===0||t.from.some(e=>!n.includes(e)))throw new N(`config`,`Profile ${e.id}: inputs.context.from must list ${k.join(` or `)}`);if(!(Number.isInteger(t.maxChars)&&t.maxChars>0))throw new N(`config`,`Profile ${e.id}: inputs.context.maxChars must be a positive integer`)}function ls(e,t){if(!t)return;let{attachments:n,voice:r,maxFiles:i,maxBytes:a,maxTurnBytes:o,limitsByMime:s}=t,c={maxFiles:i,maxBytes:a,maxTurnBytes:o};if((n||r)&&Object.values(c).some(e=>e===void 0))throw new N(`config`,`Profile ${e} must set maxFiles, maxBytes, and maxTurnBytes`);for(let[e,t]of Object.entries(s??{}))c[`limitsByMime['${e}']`]=t;for(let[t,n]of Object.entries(c))if(n!==void 0&&!(Number.isInteger(n)&&n>0))throw new N(`config`,`Profile ${e}: inputs.${t} must be a positive integer`)}function us(e,t,n){let r=new Map,i=i=>{let a=Uo(i),o=n&&a.type!==`host`?{...a,models:Object.fromEntries(Object.entries(a.models).map(([e,t])=>[e,he(n.require(t.provider,t.apiId),t,a.type)]))}:a;if(ns(e,o),rs(e,o),o.type!==`host`&&o.type!==`decision`&&o.type!==`embedding`){as(e,o),ls(o.id,M(o)),cs(o),ss(t,o);for(let[e,t]of Object.entries(o.models))t.compaction&&$o(r,o,e,t.compaction)}r.set(o.id,o)};return{register:i,registerMany(e){for(let t of e)i(t)},get(e){let t=r.get(e);if(!t)throw new N(`config`,`Unknown profile '${e}'`);return t},find:e=>r.get(e),has:e=>r.has(e),list:()=>[...r.values()],clear:()=>r.clear()}}var ds=`https://generativelanguage.googleapis.com/v1beta/models`;function fs(e){let t=e?.trim()??``;if(t.startsWith(`AIza`))return`gemini`;if(t.startsWith(`sk-or-`))return`openrouter`}function ps(e){let t;try{t=new URL(e.baseUrl)}catch{throw new N(`config`,`Enter a valid localhost URL.`)}if(![`http:`,`https:`].includes(t.protocol)||![`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname)||t.username||t.password||t.search||t.hash)throw new N(`config`,`Use a localhost URL without credentials, query parameters or a fragment.`);return{baseUrl:t.href.replace(/\/$/,``),fetch:(e,n)=>new URL(e instanceof Request?e.url:String(e)).origin===t.origin?fetch(e,{...n,redirect:`error`,credentials:`omit`}):Promise.reject(new N(`blocked`,`Local requests must stay on the configured origin.`))}}var ms=v({data:l(v({id:g().min(1)}))});async function hs(e,t){let n=ps(e);if(!n?.fetch)throw new N(`config`,`Enter a local endpoint.`);let r=await n.fetch(`${n.baseUrl}/v1/models`,{signal:t,headers:{Accept:`application/json`}});if(!r.ok)throw new N(`network`,`Local model list returned HTTP ${r.status}.`);let i=ms.safeParse(await r.json());if(!i.success)throw new N(`request`,`The endpoint returned an invalid model list.`);return[...new Set(i.data.data.map(e=>e.id))]}var gs=`https://openrouter.ai/api/v1/models`,_s=`https://openrouter.ai/api/v1/embeddings/models`,vs=[{id:`gemini-embedding-2-preview`,label:`Gemini Embeddings 2 (preview)`},{id:`gemini-embedding-001`,label:`Gemini Embedding 001`}],ys=[{id:`liquid/lfm-2.5-embedding-350m:free`,label:`Liquid LFM 2.5 Embedding 350M (free)`},{id:`nvidia/nemotron-3-embed-1b:free`,label:`NVIDIA Nemotron 3 Embed 1B (free)`},{id:`nvidia/llama-nemotron-embed-vl-1b-v2:free`,label:`NVIDIA Llama Nemotron Embed VL 1B v2 (free)`}],bs={text:`text`,image:`image`,speech:`speech`,live:void 0,embedding:void 0},xs=v({data:l(v({id:g().min(1),name:g().optional(),architecture:v({output_modalities:l(g()).optional()}).optional()}))}),Ss=v({data:l(v({id:g().min(1),name:g().optional()}))}),Cs=v({models:l(v({name:g().min(1),displayName:g().optional(),supportedGenerationMethods:l(g()).optional()})).optional(),nextPageToken:g().optional()}),ws=5;async function Ts(e,t,n){let r=await fetch(t,{...n,redirect:`error`,credentials:`omit`});if(r.status===400||r.status===401||r.status===403)throw new N(`auth`,`${e} refused the key.`);if(!r.ok)throw new N(`network`,`${e} model list returned HTTP ${r.status}.`);return await r.json()}async function Es(e,t,n,r){let i=n?.trim();if(t===`embedding`&&!i)return[...e===`openrouter`?ys:vs];if(e===`openrouter`)return await Ds(t,i,r);if(!i)throw new N(`auth`,`Choose a key to list Gemini models.`);return await ks(t,i,r)}async function Ds(e,t,n){let r={signal:n,headers:{Accept:`application/json`,...t?{Authorization:[`Bearer`,t].join(` `)}:{}}};if(e===`embedding`){let e=Ss.safeParse(await Ts(`OpenRouter`,_s,r));if(!e.success)throw new N(`bad_response`,`OpenRouter returned an invalid embedding model list.`);return e.data.data.map(e=>({id:e.id,label:e.name??e.id}))}let i=bs[e];if(!i)return[];let a=xs.safeParse(await Ts(`OpenRouter`,`${gs}?output_modalities=${i}`,r));if(!a.success)throw new N(`bad_response`,`OpenRouter returned an invalid model list.`);return a.data.data.filter(e=>e.architecture?.output_modalities?.includes(i)??!0).map(e=>({id:e.id,label:e.name??e.id}))}var Os={live:`bidiGenerateContent`,embedding:`embedContent`};async function ks(e,t,n){let r=Os[e]??`generateContent`,i=[],a;for(let e=0;e<ws;e++){let e=new URL(ds);e.searchParams.set(`pageSize`,`1000`),a&&e.searchParams.set(`pageToken`,a);let o=Cs.safeParse(await Ts(`Google`,e.href,{signal:n,headers:{Accept:`application/json`,"x-goog-api-key":t}}));if(!o.success)throw new N(`bad_response`,`Google returned an invalid model list.`);for(let e of o.data.models??[]){if(!e.supportedGenerationMethods?.includes(r))continue;let t=e.name.replace(/^models\//,``);i.push({id:t,label:e.displayName??t})}if(a=o.data.nextPageToken,!a)break}return i}function As(e){return[...new Set([e.key,e.fallbackKey,...Object.values(e.models??{}).flatMap(e=>[e.keySlot,e.fallbackKeySlot])].filter(e=>!!e))]}function js(e,t){return Object.fromEntries(e.map(e=>[e,Object.hasOwn(t,e)?t[e]:void 0]))}var Ms=[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/wav`,`audio/mpeg`];function Ns(e){return e.join(`,`)}function Ps(e){let t=e?.attachments?.accept,n=e?.voice?.accept;return{text:e?.text!==!1,attachments:t?.length?{accept:t,acceptAttr:Ns(t)}:null,voice:n?.length?{accept:n}:null,maxFiles:e?.maxFiles,maxBytes:e?.maxBytes,maxTurnBytes:e?.maxTurnBytes,limitsByMime:e?.limitsByMime,slots:e?.slots,context:e?.context}}function Fs(e){return{text:e.text,attachments:e.attachments?{accept:e.attachments.accept}:void 0,voice:e.voice?{accept:e.voice.accept}:void 0,maxFiles:e.maxFiles,maxBytes:e.maxBytes,maxTurnBytes:e.maxTurnBytes,limitsByMime:e.limitsByMime,slots:e.slots,context:e.context}}function Is(e,t){let n=e=>(e??[]).map(({name:e,mimeType:t,sizeBytes:n})=>({name:e,mimeType:t,sizeBytes:n})),r=or({attachments:e.attachments?.accept,voice:e.voice?.accept,limits:Yn(Fs(e))},n(t.attachments),n(t.voice));return{ok:r.length===0,issues:r}}function Ls(e){let t=globalThis.MediaRecorder;if(t===void 0)return;let n=e=>t.isTypeSupported(e),r=e=>e.find(n);return e?.length?r(Ms.filter(t=>A(e,t)))??e.find(n):r(Ms)}var Rs=v({protocol:g(),provider:g(),apiId:g(),options:_(g(),u()).optional(),keySlot:g().optional(),fallbackKeySlot:g().optional(),efforts:_(g(),d(Me)).optional(),defaultEffort:g().optional(),allowEffortSelect:o().optional(),summaries:o().optional(),maxOutputTokens:h().optional(),temperature:h().optional(),builtInTools:l(g()).optional(),compaction:v({maxTokens:h(),compactAt:h(),previousExchanges:h(),profile:g().optional(),timing:d(w),meter:d(fe).optional()}).optional()}),zs=v({structured:i([g(),v({by:g(),map:_(g(),g()),fallback:g()}),p()]).optional(),streaming:v({mode:d(Oe).optional(),streamThoughts:o().optional()}).optional()}),Bs=v(Ke(dt,()=>d(lt))),Vs=v(Ke(jt,()=>Bs)),Hs=v({id:g(),label:g(),actions:Bs,names:l(g()),find:o()}),Us=v({hosts:l(g()),fromTools:o()}),Ws=v({quota:v({perDay:h()}).optional(),detect:Vs,patterns:a(d(jt),v({theorem:o(),names:l(g())})).optional(),host:l(Hs).optional(),allow:v({ungiven_images:Us,ungiven_links:Us}),blockedReply:v({onBlock:d(Ee),maxRetries:h()})}),Gs=i([o(),v({theorem:o(),host:o()})]),Ks=v({record:o(),writeTo:i([c(!1),g()]).optional(),sampleRate:h(),include:v({upstreamLog:o(),outboundWire:o(),evidenceRaw:o(),usage:o(),guardrailDecisions:o(),guardrailMatchPreview:o()}),scrub:v({sensitive:Gs,injection:Gs,canary:Gs}),resource:Ut,retainForDays:h(),rotateAfterMiB:h(),hasOnWriteError:o()}),qs=v({text:o(),attachments:v({accept:l(g()),acceptAttr:g()}).nullable(),voice:v({accept:l(g())}).nullable(),maxFiles:h().optional(),maxBytes:h().optional(),maxTurnBytes:h().optional(),limitsByMime:_(g(),h()).optional(),slots:_(g(),l(g())).optional(),context:v({from:l(d(k)),maxChars:h()}).optional()}),Js=v({allowContinue:l(d(pe)).optional(),autoContinue:l(d(pe)).optional(),maxContinues:h().optional()}),Ys=v({resumption:Js.optional()}),Xs=v({allow:l(g()),page:l(g()),t2Loader:g().optional(),parallel:o().optional()}),Zs={providerContinuation:v({history:d([`host`,`stateless`,`provider`]).optional()}).optional(),id:g(),models:_(g(),Rs),defaultModel:g(),allowModelSelect:o().optional(),maxSteps:h().optional(),labels:a(d(at),g()),guardrails:Ws.optional(),observability:Ks.optional()},Qs=i([g(),l(i([g(),t({private:g().min(1)})])).min(1).readonly()]),$s=v({handle:g(),system:Qs.optional(),systemByRole:_(g(),Qs).optional()}),Y=f(`type`,[v({...Zs,type:c(`text`),identity:$s,outputs:zs.optional(),inputs:qs,tools:Xs,turnBehaviour:v({resumption:Js.optional(),allowSteering:o().optional(),atStepLimit:d(Fe).optional()}).optional(),canStop:c(!0),allowSteering:o()}),v({...Zs,type:c(`image`),identity:$s,outputs:zs.optional(),image:v({aspectRatio:g().optional(),resolution:g().optional(),mimeType:g().optional(),quality:g().optional(),background:g().optional(),n:h().int().min(1).optional(),seed:h().int().optional(),outputCompression:h().int().min(0).max(100).optional(),references:l(i([v({mimeType:g(),data:g(),name:g().optional()}),v({mimeType:g(),uri:g(),name:g().optional()})])).optional(),includeText:o().optional()}),inputs:qs,tools:Xs,turnBehaviour:Ys.optional(),canStop:c(!0)}),v({...Zs,type:c(`speech`),identity:v({handle:g()}),outputs:zs.optional(),speech:v({voice:g().optional(),style:g().optional(),speed:h().optional(),format:d(be).optional()}),inputs:qs,turnBehaviour:Ys.optional(),canStop:c(!0)}),v({...Zs,type:c(`live`),identity:$s,inputs:qs.pick({slots:!0,context:!0}).optional(),live:v({ingress:v({audio:o().optional(),video:o().optional(),text:o().optional()}).optional(),voice:g().optional(),vad:v({activityHandling:d(O).optional(),startSensitivity:d(me).optional(),endSensitivity:d(ge).optional(),prefixPaddingMs:h().optional(),silenceDurationMs:h().optional()}).optional(),sessionResumption:o().optional(),contextCompression:v({triggerTokens:h().optional(),slidingWindow:v({targetTokens:h().optional()})}).optional(),transcription:v({input:o().optional(),output:o().optional()}).optional()}),tools:Xs.pick({allow:!0,page:!0}),turnBehaviour:v({allowSteering:o().optional()}).optional()})]);function ec(e){let t=Ae(e),{sources:n,host:r,...i}=t.detect;return{quota:t.quota,detect:i,...n?{patterns:Object.fromEntries(Object.entries(n).map(([e,{theorem:t,matchers:n}])=>[e,{theorem:t,names:n.map(({name:e})=>e)}]))}:{},...r?{host:r.map(({id:e,label:t,actions:n,matchers:r,find:i})=>({id:e,label:t,actions:n,names:r.map(({name:e})=>e),find:!!i}))}:{},allow:{ungiven_images:tc(t.allow.ungiven_images),ungiven_links:tc(t.allow.ungiven_links)},blockedReply:t.blockedReply}}function tc(e){return{hosts:[...e.hosts??[]],fromTools:e.fromTools??!0}}function nc(e){return e===void 0||e===!1||typeof e==`string`?e:`custom`}function rc(e){if(!e)return;let t=Bt(e);return{record:t.record,writeTo:nc(t.writeTo),sampleRate:t.sampleRate,include:t.include,scrub:t.scrub,resource:t.resource,retainForDays:t.retainForDays,rotateAfterMiB:t.rotateAfterMiB,hasOnWriteError:!!t.onWriteError}}function ic(e){let{greeting:t,resumed:n,...r}=e??{};return r}function ac(e,t){let n=e.tools.filter(e=>`type`in e&&e.type===`function`&&e.answeredBy===`page`).map(e=>e.name);if(t){let e=qr(t),r=Jr(t);return{allow:[...K(t)],page:n,...e?.t2Loader?{t2Loader:e.t2Loader}:{},...r===void 0?{}:{parallel:r}}}return{allow:e.tools.filter(e=>!(`type`in e&&e.type===`builtin`)).map(e=>e.name),page:n}}function oc({allow:e,page:t}){return{allow:e,page:t}}function sc(e,t){let n=Ps(e.inputs),r=t?.identity??{handle:e.handle},i=t?ec(t.guardrails):void 0,a=t?rc(t.observability):void 0,o=e.outputs??void 0,s={id:e.id,identity:r,models:e.models,defaultModel:e.defaultModel,allowModelSelect:e.allowModelSelect,maxSteps:e.maxSteps,providerContinuation:e.providerContinuation,outputs:o,guardrails:i,observability:a,labels:Ue(t?.labels)};switch(e.type){case`text`:return Y.parse({...s,type:`text`,inputs:n,tools:ac(e,t),turnBehaviour:t?.type===`text`?t.turnBehaviour:void 0,canStop:!0,allowSteering:!t||C(t)});case`image`:return Y.parse({...s,type:`image`,image:e.image??{},inputs:n,tools:ac(e,t),turnBehaviour:t?.type===`image`?t.turnBehaviour:void 0,canStop:!0});case`speech`:return Y.parse({...s,type:`speech`,speech:e.speech??{},inputs:n,turnBehaviour:t?.type===`speech`?t.turnBehaviour:void 0,canStop:!0});case`live`:return Y.parse({...s,type:`live`,live:ic(e.live),...e.inputs?{inputs:{slots:n.slots,context:n.context}}:{},tools:oc(ac(e,t))});default:return e.type}}function cc(e,t){let n=Vi(e,`interfaceFromProfile`);return sc(ea(t,n),n)}function lc(e){return s(t=>E.safeParse(e(t)).success)}var uc=[`running`,`gate`,`complete`,`error`,`cancel`],dc=s(e=>{let t=E.safeParse({type:`tool`,tool:e});if(!t.success||t.data.type!==`tool`||!(`phase`in t.data.tool))return!1;let{phase:n}=t.data.tool;return uc.some(e=>e===n)}),fc=_(g(),n()),pc=v({operationId:g().optional(),name:g(),callId:g(),arguments:fc,draft:g().optional(),reasoning:l(ae).optional(),stepId:g().optional(),edited:v({from:fc,to:fc}).optional(),activity:g().optional(),activityPast:g().optional(),outputDraft:g().optional(),state:dc.optional(),startedAt:h().optional(),endedAt:h().optional(),artifacts:l(n())}),mc=v({kind:d(Ie),native:g().optional()}),X={id:g()},hc=f(`kind`,[v({...X,kind:c(`user-text`),text:g()}),v({...X,kind:d([`user-attachment`,`user-voice`]),name:g(),mimeType:g(),sizeBytes:h(),data:g().optional()}),v({...X,kind:c(`thought`),text:g()}),v({...X,kind:c(`text`),text:g()}),v({...X,kind:c(`tool`),tool:pc}),v({...X,kind:c(`structured`),value:n(),draft:g().optional()}),v({...X,kind:c(`media`),mimeType:g(),data:g().optional(),url:g().optional(),previewUrl:g().optional()}),v({...X,kind:c(`grounding`),grounding:lc(e=>({type:`grounding`,grounding:e}))}),v({...X,kind:c(`citation`),sources:lc(e=>({type:`citation`,sources:e})),callId:g().optional()}),v({...X,kind:c(`evidence`),evidence:lc(e=>({type:`evidence`,evidence:e}))}),v({...X,kind:c(`guardrail`),guardrail:ee}),v({...X,kind:c(`error`),message:g()}),v({...X,kind:c(`turn-done`),stop:mc.optional(),tokens:lc(e=>({type:`tokens`,tokens:e})).optional(),interactionId:g().optional(),compaction:o().optional(),workedMs:h().optional(),endedAt:h().optional()})]),gc=v({type:g()});function _c(e,t){return Object.hasOwn(e,t)}function vc(e,t){return e.map(e=>{let n=[...t,...e.path],r=`${n.map(String).join(`.`)||`(root)`} ${e.code}`;return e.code!==`invalid_union`||e.errors.length===0?r:`${r} [${e.errors.map(e=>vc(e,n)).join(` | `)}]`}).join(`; `)}function yc(e){return vc(e.issues,[])}function bc(e,t){return new N(`bad_response`,`${e} failed its wire check: ${yc(t)}`)}function Z(e,t,n){let r=e.safeParse(t);if(!r.success)throw bc(n,r.error);return r.data}function xc(e){return{type:`malformed`,error:new N(`bad_response`,e,{copy:{key:`session.part_skipped`}})}}function Sc(e,t){let n=gc.safeParse(t);if(!n.success)return xc(`a line without a kind failed its wire check: ${yc(n.error)}`);let{type:r}=n.data;if(!_c(e,r))return{type:`unsupported`,received:r,raw:t};let i=e[r].safeParse(t);return i.success?i.data:xc(`a '${r}' line failed its wire check: ${yc(i.error)}`)}function Cc(e){try{return{value:JSON.parse(e)}}catch(e){if(e instanceof SyntaxError)return;throw e}}function wc(e,t){let n=Cc(t);return n?Sc(e,n.value):xc(`a line is not JSON`)}function Tc(e){let t=Cc(e);if(!t)throw new N(`bad_response`,`a line is not JSON`);return t.value}var Ec=v({name:g(),mimeType:g(),data:g()}),Dc=v({slots:_(g(),g()).optional(),context:n().optional(),text:g().optional(),attachments:l(Ec).optional(),voice:l(Ec).optional()}),Oc=v({gateKind:d(ke).optional(),sessionPermissions:l(g()).optional(),name:g().optional(),input:n().optional(),snapshot:Be.optional(),promoted:l(g()).optional(),model:g().optional(),effort:g().optional()}),kc=g().trim().min(1);v({input:Dc,conversation:g().min(1).optional(),model:g().optional(),effort:g().optional(),turnId:kc.optional(),abandon:l(se).min(1).optional(),replay:Oc.pick({sessionPermissions:!0}).optional(),transcript:l(hc).optional()});var Ac=[`approve`,`deny`],jc=i([t({unanswered:c(!0)}),t({output:n()}).refine(e=>`output`in e).transform(e=>({output:e.output}))]);v({gateId:g().min(1),operationId:g().min(1).max(256),decision:d(Ac),input:n().optional(),secret:g().optional(),page:jc.optional(),conversation:g().min(1).optional(),turnId:kc.optional(),replay:Oc.optional()}),v({turnId:kc,id:kc,inject:l(re).min(1)});var Mc=v({type:c(`conversation`),ref:g().min(1),posted:c(!0).optional()}),Nc={...S,conversation:Mc},Pc=v({transcript:l(hc),paused:v({events:l(E),blocks:l(hc)}).optional()});v({conversation:g().min(1)}),v({conversation:g().min(1),at:h().int().min(-1)});var Fc=v({conversation:g().min(1),view:Pc}),Ic=class extends Error{kind;publicMessage;internalMessage;copy;constructor(e,t,n,r){super(n??t??e),this.name=`TheoremStreamError`,this.kind=e,t&&(this.publicMessage=t),n&&(this.internalMessage=n),r&&(this.copy=r)}};function Lc(e){return e instanceof Ic}function Rc(e){return e?.trim()||void 0}var zc=v({error:g().optional(),errorKind:de.optional(),errorCopy:Re.optional(),errorInternal:g().optional()}),Bc=zc;function Vc(e,t){let n=Rc(e.error),r=Rc(e.errorInternal);return new Ic(e.errorKind??t,n,r&&r!==n?r:void 0,e.errorCopy)}function Hc(e){return!Lc(e)||e.copy===void 0?!1:(Array.isArray(e.copy)?e.copy:[e.copy]).some(e=>e.key===`session.conversation_unknown`)}function Uc(e,t){let n=wc(e,t);if(n.type===`error`)throw Vc(zc.parse(n),`internal`);return n}function Wc(e,t,n){let r=e.split(`
7
- `),i=r.pop()??``;for(let e of r)e.trim()&&n(Uc(t,e));return i}async function Gc(e,t,n,r){if(!e.body)throw new N(`bad_response`,`stream reply has no body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s=()=>{i.cancel()};r?.addEventListener(`abort`,s,{once:!0});try{for(;;){ue(r);let{done:e,value:s}=await i.read();if(e)break;o=Wc(o+a.decode(s,{stream:!0}),t,n)}let e=o.trim();e&&n(Uc(t,e))}finally{r?.removeEventListener(`abort`,s)}}async function Kc(e){let t=typeof e.headers==`function`?await e.headers():e.headers,n=new Headers(t);return n.set(`content-type`,`application/json`),n}async function qc(e,t){let n=await e.text(),r;try{r=JSON.parse(n),t?.(r)}catch{return Vc({errorInternal:`HTTP ${String(e.status)}`},D(e.status))}let i=zc.safeParse(r);return i.success?Vc({...i.data,errorInternal:i.data.errorInternal??`HTTP ${String(e.status)}`},D(e.status)):new N(`bad_response`,`HTTP ${String(e.status)} error body failed its wire check`)}async function Jc(e,t,n){let r=n.fetch??globalThis.fetch.bind(globalThis);try{return await r(e,{...t,headers:await Kc(n),credentials:n.credentials??`same-origin`})}catch(e){throw ce(e)?e:new N(`network`,we(e),{cause:e})}}async function Yc(e,t,n,r,i={}){await Gc(await Xc(e,t,i),n,r,i.signal)}async function Xc(e,t,n){let r=await Jc(e,{method:`POST`,body:JSON.stringify(t),signal:n.signal},n);if(!r.ok)throw await qc(r);return r}async function Zc(e,t,n={}){await Xc(e,t,n)}async function Q(e,t,n={}){let r=await Jc(e,{...t.body===void 0?{method:`GET`}:{method:`POST`,body:JSON.stringify(t.body)},signal:t.signal},n);if(!r.ok)throw await qc(r,t.failed);return Tc(await r.text())}async function Qc(e,t,n={}){let{signal:r,...i}=n;return Z(Pc,await Q(e,{body:t,signal:r},i),`the conversation`)}async function $c(e,t,n={}){let{signal:r,...i}=n;return Z(Fc,await Q(e,{body:t,signal:r},i),`the rewound conversation`)}function el(e){let t=e.length;for(;t>0&&e[t-1]===`/`;)--t;return e.slice(0,t)}var tl=v({interface:Y});function nl(e={}){let t=el(e.endpoint??`/api/theorem`);return{async describe(n){let r=await Jc(t,{method:`GET`,signal:n},e);if(!r.ok)throw await qc(r);return Z(tl,Tc(await r.text()),`the profile description`).interface},turn:({replay:n,...r},i,a)=>Yc(`${t}/turn`,r,Nc,i,{...e,signal:a}),invoke:({replay:n,...r},i,a)=>Yc(`${t}/invoke`,r,Nc,i,{...e,signal:a}),conversation:(n,r)=>Qc(`${t}/conversation`,n,{...e,signal:r}),rewind:(n,r)=>$c(`${t}/rewind`,n,{...e,signal:r}),pageResult:(n,r)=>Zc(`${t}/page-result`,n,{...e,signal:r}),steer:n=>Zc(`${t}/steer`,n,e)}}function rl(e,t){if(typeof e==`string`)return e;let n=Array.isArray(e)?e:Object.keys(e);return n.length?rl(n[0],t):t}function il(e){return e===void 0?{}:{field:e}}function al(e){if(typeof e==`string`)return/\x60([^\x60\s]+)\x60/.exec(e)?.[1];let t=Array.isArray(e)?e:Object.values(e);for(let e of t){let t=al(e);if(t!==void 0)return t}}function ol(e,t,n){return{type:`decision`,identity:{handle:e.identity.handle},contract:e.decision.contract,...e.inputs.maxStateBytes===void 0?{}:{maxStateBytes:e.inputs.maxStateBytes},questions:Object.entries(t).map(([e,t])=>({id:e,type:t.type,labels:t.type===`choice`?Object.keys(t.criteria):t.type===`score`?t.criteria.map((e,t)=>rl(e,String(t))):[],...t.type===`box`?il(t.image??al(t.instructions)):{}})),...n&&Object.keys(n).length>0?{images:n}:{},...e.observability?{observability:{record:Bt(e.observability).record}}:{}}}function sl(e,t){let n=Object.keys(t??{}).find(t=>e&&Object.hasOwn(e,t));if(n!==void 0)throw new N(`request`,`the image ${n} is the host's, so the page's needs another name`);let r={...e,...t};return Object.keys(r).length>0?r:void 0}var $=h().min(0).max(1),cl=_(g(),$).refine(e=>Math.abs(Object.values(e).reduce((e,t)=>e+t,0)-1)<=.001),ll=f(`type`,[v({type:c(`choice`),choice:g(),confidence:$,probabilities:cl}),v({type:c(`noul`),noul:$}),v({type:c(`box`),box:v({top:$,bottom:$,left:$,right:$}),confidence:$}),v({type:c(`score`),score:h().nonnegative(),confidence:$,legend:_(g(),g().min(1)),probabilities:cl})]),ul=v({result:v({model:g().min(1),answers:_(g(),ll),usage:v({inputTokens:h().int().nonnegative(),outputTokens:h().int().nonnegative(),costUsd:h().nonnegative().optional()}).optional()}),traces:l(Ht).optional()}),dl=new WeakMap;function fl(e,t){return t.length>0&&typeof e==`object`&&e&&dl.set(e,t),e}function pl(e){return typeof e==`object`&&!!e&&dl.get(e)||[]}var ml=v({traces:l(Ht)});async function hl(e,t,n,r,i){let a=[],o=e=>{let t=ml.safeParse(e);t.success&&(a=t.data.traces)};try{return i(await Q(e,{body:t,signal:n,failed:o},r))}catch(e){throw fl(e,a)}}function gl(e,t,n,r={}){return hl(e,t,n,r,_l)}function _l(e){return Z(ul,e,`the decision`)}var vl=v({interface:v({type:c(`decision`),identity:v({handle:g()}),contract:g(),maxStateBytes:h().optional(),questions:l(v({id:g(),type:d([`choice`,`noul`,`score`,`box`]),labels:l(g()),field:g().optional()})),images:_(g(),v({mimeType:d([`image/png`,`image/jpeg`]),data:g()})).optional(),observability:v({record:o()}).optional()})});function yl(e={}){let t=(e.endpoint??`/api/decision`).replace(/\/$/,``);return{async describe(n){return Z(vl,await Q(t,{signal:n},e),`the decision description`).interface},decide:(n,r,i)=>gl(`${t}/decide`,{state:n,...i?{assets:i}:{}},r,e)}}function bl(e,t,n={}){let r={name:t.name,description:t.description,category:t.category,access:t.access,paths:t.paths,loadTier:t.loadTier,permission:t.permission,...t.labels?{labels:t.labels}:{}};if(t.type===`agent`){e.register({...r,type:`agent`,profile:t.profile,...t.maxCallsPerTurn===void 0?{}:{maxCallsPerTurn:t.maxCallsPerTurn}});return}let i={...r,input:Ne(t.inputSchema),output:Ne(t.outputSchema)};if(t.type===`http`){e.register({...i,type:`http`,endpoint:t.endpoint,method:t.method,headers:t.headers,mapping:t.mapping,auth:t.auth});return}if(t.type===`mcp`){e.register({...i,type:`mcp`,serverUrl:t.serverUrl,mcpToolName:t.mcpToolName,headers:t.headers,auth:t.auth});return}if(t.answeredBy===`page`){e.register({...i,type:`function`,answeredBy:`page`});return}let a=t.stubResponse||!Object.hasOwn(n,t.name)?void 0:n[t.name],o=t.stubResponse??Wt(t.outputSchema);e.register({...i,type:`function`,handler:a?e=>{try{return Promise.resolve(a(e))}catch(e){return Promise.reject(e instanceof Error?e:Error(String(e)))}}:()=>Promise.resolve(o)})}function xl(e,t,n){e.registerMany(te);for(let r of t)bl(e,r,n)}function Sl(e,t,n,r,i){return xl(e.tools,n,i),r&&t.type!==`live`&&e.schemas.register(r.id,r.spec),e.profiles.register(t),t}function Cl(e){if(e.type===`error`&&e.errorInternal!==void 0){let{errorInternal:t,...n}=e;return{...n,error:t}}if(e.type===`session`&&e.session.kind===`ended`&&e.errorInternal!==void 0){let{errorInternal:t,...n}=e;return{...n,session:{...e.session,message:t}}}if(e.type===`tool`&&e.tool.phase===`error`&&e.tool.failure.error!==void 0){let{failure:t}=e.tool;return{...e,tool:{...e.tool,failure:{...t,error:t.message}}}}return e}function wl(e){if(e.type!==`error`&&e.type!==`session`&&e.type!==`tool`||e.errorInternal===void 0)return e;let{errorInternal:t,...n}=e;return n}function Tl(e){if(e.type!==`guardrail`||!e.guardrail?.errorInternal)return e;let{errorInternal:t,...n}=e.guardrail;return{...e,guardrail:n}}function El(e){if(e.type!==`evidence`||!e.evidence?.raw)return e;let{raw:t,...n}=e.evidence;return{...e,evidence:n}}function Dl(e,t){let n=t?.reader===`builder`?Cl(e):Tl(wl(e));return t?.includeEvidenceRaw||(n=El(n)),n=Kt(n,!1),n}function Ol(e,t){return e.map(e=>Dl(e,t))}function kl(e,t,n){let{error:r=``,errorKind:i,errorCopy:a}=Dl(x(Ve(e),t),n);return{error:r,errorKind:i,...a?{errorCopy:a}:{}}}var Al={reader:`builder`};function jl(e){return e.mode===`demo`?{reader:`visitor`}:Al}export{Da as $,Sc as A,Fr as At,js as B,zn as Bt,Lc as C,qr as Ct,Z as D,zr as Dt,Yc as E,Vr as Et,fs as F,lr as Ft,Ja as G,Jt as Gt,Uo as H,G as Ht,hs as I,ur as It,za as J,Kt as Jt,Ka as K,Gt as Kt,Es as L,dr as Lt,cc as M,Lr as Mt,Ls as N,Er as Nt,yc as O,Ir as Ot,Is as P,yr as Pt,ja as Q,ps as R,Hn as Rt,Bc as S,Jr as St,Zc as T,Ur as Tt,so as U,Ln as Ut,us as V,Bn as Vt,Ya as W,In as Wt,Va as X,Ba as Y,va as Z,nl as _,ai as _t,Ol as a,da as at,$c as b,ii as bt,yl as c,ma as ct,pl as d,ta as dt,Na as et,gl as f,Qi as ft,Ic as g,hi as gt,Nc as h,Mi as ht,Dl as i,ga as it,hc as j,Rr as jt,wc as k,jr as kt,sl as l,ha as lt,fl as m,Pi as mt,jl as n,Pa as nt,Sl as o,pa as ot,hl as p,Ii as pt,qa as q,I as qt,kl as r,Ea as rt,xl as s,_a as st,Al as t,Oa as tt,ol as u,Hi as ut,Qc as v,oi as vt,Hc as w,li as wt,Vc as x,K as xt,Q as y,ci as yt,As as z,Vn as zt};